diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2011-05-16 02:21:20 +0100 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2011-05-16 02:21:20 +0100 |
commit | 9cc1ad12d7a936227d82f49a829713ca025a6bd6 (patch) | |
tree | 3928d0df4cfc3bbfe33c40570ffd5e979f45ef8a /src/combined/ffmpeg/ff_audio_decoder.c | |
parent | 713cbfc4fd926c1596bfa4f093fae308316004c2 (diff) | |
download | xine-lib-9cc1ad12d7a936227d82f49a829713ca025a6bd6.tar.gz xine-lib-9cc1ad12d7a936227d82f49a829713ca025a6bd6.tar.bz2 |
Fix up "pp" post-proc plugin and A/V decoding for ffmpeg 0.7.
Diffstat (limited to 'src/combined/ffmpeg/ff_audio_decoder.c')
-rw-r--r-- | src/combined/ffmpeg/ff_audio_decoder.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/combined/ffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c index 534a97afb..0367d0e50 100644 --- a/src/combined/ffmpeg/ff_audio_decoder.c +++ b/src/combined/ffmpeg/ff_audio_decoder.c @@ -45,6 +45,12 @@ #define AUDIOBUFSIZE (64 * 1024) +#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32) +# define AVAUDIO 3 +#else +# define AVAUDIO 2 +#endif + typedef struct { audio_decoder_class_t decoder_class; } ff_audio_class_t; @@ -254,6 +260,9 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) buf->decoder_info[2]); } else if (!(buf->decoder_flags & BUF_FLAG_SPECIAL)) { +#if AVAUDIO > 2 + AVPacket avpkt; +#endif if( !this->decoder_ok ) { if ( ! this->context || ! this->codec ) { @@ -285,11 +294,21 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) if (!this->output_open) { if (!this->audio_bits || !this->audio_sample_rate || !this->audio_channels) { decode_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; +#if AVAUDIO > 2 + av_init_packet (&avpkt); + avpkt.data = (uint8_t *)&this->buf[0]; + avpkt.size = this->size; + avpkt.flags = AV_PKT_FLAG_KEY; + avcodec_decode_audio3 (this->context, + (int16_t *)this->decode_buffer, + &decode_buffer_size, &avpkt); +#else avcodec_decode_audio2 (this->context, (int16_t *)this->decode_buffer, &decode_buffer_size, &this->buf[0], this->size); +#endif this->audio_bits = this->context->bits_per_sample; this->audio_sample_rate = this->context->sample_rate; this->audio_channels = this->context->channels; @@ -310,12 +329,21 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) offset = 0; while (this->size>0) { decode_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; +#if AVAUDIO > 2 + av_init_packet (&avpkt); + avpkt.data = (uint8_t *)&this->buf[offset]; + avpkt.size = this->size; + avpkt.flags = AV_PKT_FLAG_KEY; + bytes_consumed = avcodec_decode_audio3 (this->context, + (int16_t *)this->decode_buffer, + &decode_buffer_size, &avpkt); +#else bytes_consumed = avcodec_decode_audio2 (this->context, (int16_t *)this->decode_buffer, &decode_buffer_size, &this->buf[offset], this->size); - +#endif if (bytes_consumed<0) { xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "ffmpeg_audio_dec: error decompressing audio frame\n"); |