You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
267 lines
8.9 KiB
267 lines
8.9 KiB
#!/bin/sh
|
|
# Generated by Alien's SlackBuild Toolkit: http://slackware.com/~alien/AST
|
|
# Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015 Eric Hameleers, Eindhoven, Netherlands
|
|
# Copyright 2015-2017 Thorn Inurcide
|
|
# Copyright 2015-2017 tde-slackbuilds project on GitHub
|
|
# All rights reserved.
|
|
#
|
|
# Permission to use, copy, modify, and distribute this software for
|
|
# any purpose with or without fee is hereby granted, provided that
|
|
# the above copyright notice and this permission notice appear in all
|
|
# copies.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
|
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
# IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
|
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
# SUCH DAMAGE.
|
|
|
|
PRGNAM=akode
|
|
VERSION=$TDEVERSION
|
|
BUILD=${BUILD:-1}
|
|
TAG=${TAG:-_tde}
|
|
|
|
source ../../get-source.sh
|
|
getsource_fn
|
|
|
|
untar_fn
|
|
|
|
[[ $TDEVERSION == 14.0.12 ]] && {
|
|
## all versons ffmpeg support, ported from upstream commits
|
|
patch -p0 << EOF
|
|
--- akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp
|
|
+++ akode/plugins/ffmpeg_decoder/ffmpeg_decoder.cpp
|
|
@@ -40 +40 @@
|
|
-#if LIBAVCODEC_VERSION_MAJOR < 58
|
|
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 33, 100)
|
|
@@ -72,4 +71,0 @@
|
|
-/*
|
|
-void FFMPEGDecoderPlugin::initializeFFMPEG() {
|
|
- av_register_all();
|
|
-}*/
|
|
@@ -84 +80,2 @@
|
|
- eof(false), error(false), initialized(false), retries(0) {};
|
|
+ eof(false), error(false), initialized(false), retries(0),
|
|
+ packet(NULL), audioStream_ctx(NULL), videoStream_ctx(NULL) {};
|
|
@@ -92,0 +90,2 @@
|
|
+ AVCodecContext *audioStream_ctx;
|
|
+ AVCodecContext *videoStream_ctx;
|
|
@@ -94 +93,4 @@
|
|
- AVPacket packet;
|
|
+ AVPacket *packet;
|
|
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 12, 100)
|
|
+ AVPacket _packet;
|
|
+#endif
|
|
@@ -115,0 +118,3 @@
|
|
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58,9,100)
|
|
+ av_register_all();
|
|
+#endif
|
|
@@ -209,3 +214,3 @@
|
|
- // Set config
|
|
- if (!setAudioConfiguration(&d->config, d->ic->streams[d->audioStream]->codec))
|
|
- {
|
|
+ d->codec = (AVCodec *)avcodec_find_decoder(d->ic->streams[d->audioStream]->CODECPAR->codec_id);
|
|
+ if (!d->codec) {
|
|
+ std::cerr << "akode: FFMPEG: Codec not found\n";
|
|
@@ -216,3 +221,8 @@
|
|
- d->codec = avcodec_find_decoder(d->ic->streams[d->audioStream]->CODECPAR->codec_id);
|
|
- if (!d->codec) {
|
|
- std::cerr << "akode: FFMPEG: Codec not found\n";
|
|
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100)
|
|
+ // allocate a codec context
|
|
+ d->audioStream_ctx = avcodec_alloc_context3(d->codec);
|
|
+ if (d->audioStream_ctx) {
|
|
+ avcodec_parameters_to_context(d->audioStream_ctx, d->ic->streams[d->audioStream]->codecpar);
|
|
+ }
|
|
+ else {
|
|
+ std::cerr << "akode: failed to allocate an audio codec context\n";
|
|
@@ -222 +232,17 @@
|
|
- avcodec_open2( d->ic->streams[d->audioStream]->codec, d->codec, NULL );
|
|
+#else
|
|
+ d->audioStream_ctx = d->ic->streams[d->audioStream]->codec;
|
|
+#endif
|
|
+
|
|
+ // Set config
|
|
+ if (!setAudioConfiguration(&d->config, d->audioStream_ctx))
|
|
+ {
|
|
+ closeFile();
|
|
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100)
|
|
+ avcodec_free_context(&d->audioStream_ctx);
|
|
+#else
|
|
+ d->audioStream_ctx = NULL;
|
|
+#endif
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ avcodec_open2( d->audioStream_ctx, d->codec, NULL );
|
|
@@ -242 +268 @@
|
|
- av_free_packet(&d->packet);
|
|
+ av_free_packet(&d->_packet);
|
|
@@ -244 +270 @@
|
|
- av_packet_unref( &d->packet );
|
|
+ av_packet_unref( d->packet );
|
|
@@ -245,0 +272 @@
|
|
+ d->packet = NULL;
|
|
@@ -250 +277,6 @@
|
|
- avcodec_close( d->ic->streams[d->audioStream]->codec );
|
|
+ avcodec_close( d->audioStream_ctx );
|
|
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100)
|
|
+ avcodec_free_context(&d->audioStream_ctx);
|
|
+#else
|
|
+ d->audioStream_ctx = NULL;
|
|
+#endif
|
|
@@ -254,0 +287 @@
|
|
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(59, 0, 100)
|
|
@@ -255,0 +289 @@
|
|
+#endif
|
|
@@ -266,2 +300,7 @@
|
|
- av_init_packet(&d->packet);
|
|
- if ( av_read_frame(d->ic, &d->packet) < 0 ) {
|
|
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
|
|
+ d->packet = av_packet_alloc();
|
|
+#else
|
|
+ av_init_packet(&d->_packet);
|
|
+ d->packet = &d->_packet;
|
|
+#endif
|
|
+ if ( av_read_frame(d->ic, d->packet) < 0 ) {
|
|
@@ -269 +308 @@
|
|
- av_free_packet(&d->packet);
|
|
+ av_free_packet(&d->_packet);
|
|
@@ -271 +310 @@
|
|
- av_packet_unref( &d->packet );
|
|
+ av_packet_unref( d->packet );
|
|
@@ -272,0 +312 @@
|
|
+ d->packet = NULL;
|
|
@@ -277,3 +317,3 @@
|
|
- if (d->packet.stream_index == d->audioStream) {
|
|
- d->packetSize = d->packet.size;
|
|
- d->packetData = d->packet.data;
|
|
+ if (d->packet->stream_index == d->audioStream) {
|
|
+ d->packetSize = d->packet->size;
|
|
+ d->packetData = d->packet->data;
|
|
@@ -283 +323 @@
|
|
- av_free_packet(&d->packet);
|
|
+ av_free_packet(&d->_packet);
|
|
@@ -285 +325 @@
|
|
- av_packet_unref(&d->packet);
|
|
+ av_packet_unref(d->packet);
|
|
@@ -286,0 +327 @@
|
|
+ d->packet = NULL;
|
|
@@ -327 +368 @@
|
|
- assert(d->packet.stream_index == d->audioStream);
|
|
+ assert(d->packet->stream_index == d->audioStream);
|
|
@@ -339 +380,23 @@
|
|
- int len = avcodec_decode_audio4( d->ic->streams[d->audioStream]->codec,
|
|
+
|
|
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 106, 100)
|
|
+ int len = avcodec_receive_frame(d->audioStream_ctx, decodeFrame);
|
|
+ if (len == 0) {
|
|
+ decoded = 1;
|
|
+ }
|
|
+ else if (len == AVERROR(EAGAIN)) {
|
|
+ len = 0;
|
|
+ }
|
|
+
|
|
+ if (len == 0) {
|
|
+ len = avcodec_send_packet(d->audioStream_ctx, d->packet);
|
|
+ if (len == AVERROR(EAGAIN)) {
|
|
+ len = 0;
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ len = d->packet->size;
|
|
+ d->packetSize = d->packet->size;
|
|
+ }
|
|
+ }
|
|
+#else
|
|
+ int len = avcodec_decode_audio4( d->audioStream_ctx,
|
|
@@ -341 +404 @@
|
|
- &d->packet );
|
|
+ d->packet );
|
|
@@ -343 +406 @@
|
|
- d->packetSize = d->packet.size;
|
|
+ d->packetSize = d->packet->size;
|
|
@@ -346,0 +410,2 @@
|
|
+#endif
|
|
+
|
|
@@ -349 +414 @@
|
|
- d->buffer_size = decodeFrame->nb_samples * d->ic->streams[d->audioStream]->codec->channels * av_get_bytes_per_sample(d->ic->streams[d->audioStream]->codec->sample_fmt);
|
|
+ d->buffer_size = decodeFrame->nb_samples * d->ic->streams[d->audioStream]->CODECPAR->channels * av_get_bytes_per_sample(d->ic->streams[d->audioStream]->codec->sample_fmt);
|
|
@@ -351 +416 @@
|
|
- d->buffer_size = decodeFrame->nb_samples * decodeFrame->channels * av_get_bytes_per_sample(d->ic->streams[d->audioStream]->codec->sample_fmt);
|
|
+ d->buffer_size = decodeFrame->nb_samples * decodeFrame->channels * av_get_bytes_per_sample(d->audioStream_ctx->sample_fmt);
|
|
@@ -397 +462 @@
|
|
- av_free_packet(&d->packet);
|
|
+ av_free_packet(&d->_packet);
|
|
@@ -399 +464 @@
|
|
- av_packet_unref( &d->packet );
|
|
+ av_packet_unref( d->packet );
|
|
@@ -400,0 +466 @@
|
|
+ d->packet = NULL;
|
|
EOF
|
|
}
|
|
|
|
chown_fn
|
|
|
|
cd_builddir_fn
|
|
|
|
## see README for cmake options
|
|
cmake ${G_NINJA:-} \
|
|
-DCMAKE_C_FLAGS="$SLKRCFLAGS" \
|
|
-DCMAKE_CXX_FLAGS="$SLKRCFLAGS" \
|
|
-DCMAKE_C_COMPILER=$COMPILER \
|
|
-DCMAKE_CXX_COMPILER=$COMPILER_CXX \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_INSTALL_PREFIX=$INSTALL_TDE \
|
|
-DLIB_SUFFIX=$LIBDIRSUFFIX \
|
|
-DWITH_GCC_VISIBILITY=${GCC_VIS:-} \
|
|
-DWITH_LIBLTDL="ON" \
|
|
-DWITH_ALSA_SINK="ON" \
|
|
-DWITH_JACK_SINK="OFF" \
|
|
-DWITH_PULSE_SINK="ON" \
|
|
-DWITH_OSS_SINK="OFF" \
|
|
-DWITH_SUN_SINK="OFF" \
|
|
-DWITH_FFMPEG_DECODER="ON" \
|
|
-DWITH_MPC_DECODER="ON" \
|
|
-DWITH_MPEG_DECODER="ON" \
|
|
-DWITH_SRC_RESAMPLER="ON" \
|
|
-DWITH_XIPH_DECODER="ON" \
|
|
-Wno-dev \
|
|
..
|
|
|
|
make_fn
|
|
|
|
strip_fn
|
|
|
|
mkdir_install_fn
|
|
|
|
echo "
|
|
# HOW TO EDIT THIS FILE:
|
|
# The 'handy ruler' below makes it easier to edit a package description. Line
|
|
# up the first '|' above the ':' following the base package name, and the '|'
|
|
# on the right side marks the last column you can put a character in. You must
|
|
# make exactly 11 lines for the formatting to be correct. It's also
|
|
# customary to leave one space after the ':'.
|
|
|-----handy-ruler------------------------------------------------------|
|
|
$PRGNAM: akode - player and plugins for aRts music formats
|
|
$PRGNAM:
|
|
$PRGNAM: - Ogg Vorbis
|
|
$PRGNAM: - Musepack (MPC)
|
|
$PRGNAM: - FLAC
|
|
$PRGNAM: - Speex
|
|
$PRGNAM: - Libmad (MPEG-1 and MPEG-2)
|
|
$PRGNAM: - Libsamplerate
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
" > $PKG/install/slack-desc
|
|
|
|
makepkg_fn
|