ffmpeg-2 -- AVCODEC_MAX_AUDIO_FRAME_SIZE

deprecated:
http://git.videolan.org/?p=ffmpeg.git;a=commit;h=0eea212943544d40f99b05571aa7159d78667154

broken with libavcodec 54
This commit is contained in:
eroen 2013-11-21 11:35:53 +01:00
parent ea18d2b740
commit bf065f3e89

View File

@ -43,6 +43,12 @@
#define AVMEDIA_TYPE_AUDIO 1 #define AVMEDIA_TYPE_AUDIO 1
#endif #endif
#if LIBAVCODEC_VERSION_MAJOR < 54
#define MAX_AUDIO_FRAME_SIZE AVCODEC_MAX_AUDIO_FRAME_SIZE
#else
#define MAX_AUDIO_FRAME_SIZE 192000
#endif
typedef struct _TSMFFFmpegDecoder typedef struct _TSMFFFmpegDecoder
{ {
ITSMFDecoder iface; ITSMFDecoder iface;
@ -351,7 +357,7 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const BYTE* data, UI
#endif #endif
if (mdecoder->decoded_size_max == 0) if (mdecoder->decoded_size_max == 0)
mdecoder->decoded_size_max = AVCODEC_MAX_AUDIO_FRAME_SIZE + 16; mdecoder->decoded_size_max = MAX_AUDIO_FRAME_SIZE + 16;
mdecoder->decoded_data = malloc(mdecoder->decoded_size_max); mdecoder->decoded_data = malloc(mdecoder->decoded_size_max);
ZeroMemory(mdecoder->decoded_data, mdecoder->decoded_size_max); ZeroMemory(mdecoder->decoded_data, mdecoder->decoded_size_max);
/* align the memory for SSE2 needs */ /* align the memory for SSE2 needs */
@ -363,7 +369,7 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const BYTE* data, UI
while (src_size > 0) while (src_size > 0)
{ {
/* Ensure enough space for decoding */ /* Ensure enough space for decoding */
if (mdecoder->decoded_size_max - mdecoder->decoded_size < AVCODEC_MAX_AUDIO_FRAME_SIZE) if (mdecoder->decoded_size_max - mdecoder->decoded_size < MAX_AUDIO_FRAME_SIZE)
{ {
mdecoder->decoded_size_max = mdecoder->decoded_size_max * 2 + 16; mdecoder->decoded_size_max = mdecoder->decoded_size_max * 2 + 16;
mdecoder->decoded_data = realloc(mdecoder->decoded_data, mdecoder->decoded_size_max); mdecoder->decoded_data = realloc(mdecoder->decoded_data, mdecoder->decoded_size_max);