From 081a13bbea0b372a8ec9f725f9b97916c74a6a79 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Sun, 5 Apr 2009 16:37:28 +0200 Subject: [PATCH] Fix ffmpeg API breakage avcodec_audio_decode() has been removed in favor of avcodec_decode_audio2(); output buffer size must be passed to the function. --- src/plugins/ssc-ffmpeg.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/plugins/ssc-ffmpeg.c b/src/plugins/ssc-ffmpeg.c index a8b01b14..99abbc7c 100644 --- a/src/plugins/ssc-ffmpeg.c +++ b/src/plugins/ssc-ffmpeg.c @@ -310,7 +310,7 @@ int ssc_ffmpeg_close(void *vp) { } -int _ssc_ffmpeg_read_frame(void *vp, char *buffer, int len) { +int _ssc_ffmpeg_read_frame(void *vp, char *buffer, int buflen) { SSCHANDLE *handle = (SSCHANDLE *)vp; int data_size; int len1; @@ -329,11 +329,12 @@ int _ssc_ffmpeg_read_frame(void *vp, char *buffer, int len) { if(!handle->file_bytes_read) return 0; - - len1 = avcodec_decode_audio(handle->pCodecCtx,(short*)buffer, - &out_size, - (uint8_t*)handle->file_buffer_ptr, - handle->file_bytes_read); + + out_size = buflen; + len1 = avcodec_decode_audio2(handle->pCodecCtx,(short*)buffer, + &out_size, + (uint8_t*)handle->file_buffer_ptr, + handle->file_bytes_read); if(len1 < 0) /* FIXME: Decode Error */ return 0; @@ -355,11 +356,12 @@ int _ssc_ffmpeg_read_frame(void *vp, char *buffer, int len) { while(1) { while(handle->packet_size > 0) { - len1=avcodec_decode_audio(handle->pCodecCtx, - (int16_t*)buffer, - &data_size, - handle->packet_data, - handle->packet_size); + data_size = buflen; + len1=avcodec_decode_audio2(handle->pCodecCtx, + (int16_t*)buffer, + &data_size, + handle->packet_data, + handle->packet_size); if(len1 < 0) { /* skip frame */