diff --git a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp --- a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp +++ b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp @@ -38,11 +38,7 @@ #include -#if LIBAVFORMAT_BUILD < 4629 -#define FFMPEG_CODEC(s) (&s->codec) -#else #define FFMPEG_CODEC(s) (s->codec) -#endif #ifndef HAVE_FFMPEG_AVFORMAT_OPEN_INPUT // this works because the parameters/options are not used @@ -85,13 +81,7 @@ K3b::Msf length; - // for decoding. ffmpeg requires 16-byte alignment. -#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4 ::AVFrame* frame; -#else - char outputBuffer[AVCODEC_MAX_AUDIO_FRAME_SIZE + 15]; - char* alignedOutputBuffer; -#endif char* outputBufferPos; int outputBufferSize; ::AVPacket packet; @@ -108,29 +98,14 @@ d = new Private; d->formatContext = 0; d->codec = 0; -#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4 -# if LIBAVCODEC_BUILD < AV_VERSION_INT(55,28,1) - d->frame = avcodec_alloc_frame(); -# else - d->frame = av_frame_alloc(); -# endif -#else - int offset = 0x10 - (reinterpret_cast(&d->outputBuffer) & 0xf); - d->alignedOutputBuffer = &d->outputBuffer[offset]; -#endif + d->frame = ::av_frame_alloc(); } K3bFFMpegFile::~K3bFFMpegFile() { close(); -#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4 -# if LIBAVCODEC_BUILD < AV_VERSION_INT(55,28,1) - av_free(d->frame); -# else - av_frame_free(&d->frame); -# endif -#endif + ::av_frame_free(&d->frame); delete d; } @@ -241,12 +216,6 @@ QString K3bFFMpegFile::typeComment() const { -#if LIBAVCODEC_BUILD < AV_VERSION_INT(54,25,0) - #define AV_CODEC_ID_WMAV1 CODEC_ID_WMAV1 - #define AV_CODEC_ID_WMAV2 CODEC_ID_WMAV2 - #define AV_CODEC_ID_MP3 CODEC_ID_MP3 - #define AV_CODEC_ID_AAC CODEC_ID_AAC -#endif switch( type() ) { case AV_CODEC_ID_WMAV1: return i18n("Windows Media v1"); @@ -343,50 +312,21 @@ return 0; } -#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4 int gotFrame = 0; int len = ::avcodec_decode_audio4( -#else - d->outputBufferPos = d->alignedOutputBuffer; - d->outputBufferSize = AVCODEC_MAX_AUDIO_FRAME_SIZE; -# ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3 - int len = ::avcodec_decode_audio3( -# else -# ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO2 - int len = ::avcodec_decode_audio2( -# else - int len = ::avcodec_decode_audio( -# endif -# endif -#endif - FFMPEG_CODEC(d->formatContext->streams[0]), -#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4 d->frame, &gotFrame, - &d->packet ); -#else - (short*)d->alignedOutputBuffer, - &d->outputBufferSize, -# ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3 - &d->packet ); -# else - d->packetData, d->packetSize ); -# endif -#endif + &d->packet + ); if( d->packetSize <= 0 || len < 0 ) -#if LIBAVCODEC_VERSION_MAJOR >= 56 ::av_packet_unref( &d->packet ); -#else - ::av_free_packet( &d->packet ); -#endif if( len < 0 ) { qDebug() << "(K3bFFMpegFile) decoding failed for " << m_filename; return -1; } -#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4 if (gotFrame) { int nb_s = d->frame->nb_samples; int nb_ch = 2; // copy only two channels even if there're more @@ -420,7 +360,6 @@ } } } -#endif d->packetSize -= len; d->packetData += len; } @@ -438,11 +377,7 @@ quint64 timestamp = (quint64)(seconds * (double)AV_TIME_BASE); // FIXME: do we really need the start_time and why? -#if LIBAVFORMAT_BUILD >= 4619 return ( ::av_seek_frame( d->formatContext, -1, timestamp + d->formatContext->start_time, 0 ) >= 0 ); -#else - return ( ::av_seek_frame( d->formatContext, -1, timestamp + d->formatContext->start_time ) >= 0 ); -#endif }