+++ /dev/null
-Index: modules/ffmpeg_in/ffmpeg_in.h
-===================================================================
---- modules/ffmpeg_in/ffmpeg_in.h (revision 4282)
-+++ modules/ffmpeg_in/ffmpeg_in.h (revision 4451)
-@@ -120,7 +120,7 @@
-
- /*for audio packed frames*/
- u32 frame_start;
-- char audio_buf[AVCODEC_MAX_AUDIO_FRAME_SIZE];
-+ char audio_buf[192000];
- Bool check_h264_isma;
-
- u32 base_ES_ID;
-Index: modules/ffmpeg_in/ffmpeg_demux.c
-===================================================================
---- modules/ffmpeg_in/ffmpeg_demux.c (revision 4282)
-+++ modules/ffmpeg_in/ffmpeg_demux.c (revision 4451)
-@@ -53,6 +53,18 @@
- #define AVERROR_NOFMT AVERROR(EINVAL)
- #endif /* AVERROR_NOFMT */
-
-+
-+#if (LIBAVFORMAT_VERSION_MAJOR >= 54) && (LIBAVFORMAT_VERSION_MINOR >= 20)
-+
-+#define av_find_stream_info(__c) avformat_find_stream_info(__c, NULL)
-+#ifndef FF_API_FORMAT_PARAMETERS
-+#define FF_API_FORMAT_PARAMETERS 1
-+#endif
-+
-+#endif
-+
-+
-+
- static u32 FFDemux_Run(void *par)
- {
- AVPacket pkt;
-Index: modules/ffmpeg_in/ffmpeg_decode.c
-===================================================================
---- modules/ffmpeg_in/ffmpeg_decode.c (revision 4282)
-+++ modules/ffmpeg_in/ffmpeg_decode.c (revision 4451)
-@@ -38,8 +38,14 @@
- #undef USE_AVCODEC2
- #endif
-
-+#if (LIBAVCODEC_VERSION_MAJOR >= 55)
-+#define USE_AVCTX3
-+#elif (LIBAVCODEC_VERSION_MAJOR >= 54) && (LIBAVCODEC_VERSION_MINOR >= 35)
-+#define USE_AVCTX3
-+#endif
-
-
-+
- /**
- * Allocates data for FFMPEG decoding
- * \param oldBuffer The oldBuffer (freed if not NULL)
-@@ -170,7 +176,12 @@
- frame = &ffd->base_frame;
- }
- if (!(*ctx)){
-+
-+#ifdef USE_AVCTX3
-+ *ctx = avcodec_alloc_context3(NULL);
-+#else
- *ctx = avcodec_alloc_context();
-+#endif
- }
-
- /*private FFMPEG DSI*/
-@@ -318,7 +329,11 @@
- (*ctx)->pix_fmt = ffd->raw_pix_fmt;
- if ((*ctx)->extradata && strstr((*ctx)->extradata, "BottomUp")) ffd->flipped = 1;
- } else {
-+#ifdef USE_AVCTX3
-+ if (avcodec_open2((*ctx), (*codec), NULL )<0) return GF_NON_COMPLIANT_BITSTREAM;
-+#else
- if (avcodec_open((*ctx), (*codec) )<0) return GF_NON_COMPLIANT_BITSTREAM;
-+#endif
- }
-
- /*setup audio streams*/
-@@ -612,10 +627,11 @@
- if (ffd->frame_start>inBufferLength) ffd->frame_start = 0;
-
- redecode:
-- gotpic = AVCODEC_MAX_AUDIO_FRAME_SIZE;
- #ifdef USE_AVCODEC2
-+ gotpic = 0;
- len = avcodec_decode_audio3(ctx, (short *)ffd->audio_buf, &gotpic, &pkt);
- #else
-+ gotpic = AVCODEC_MAX_AUDIO_FRAME_SIZE;
- len = avcodec_decode_audio2(ctx, (short *)ffd->audio_buf, &gotpic, inBuffer + ffd->frame_start, inBufferLength - ffd->frame_start);
- #endif
- if (len<0) { ffd->frame_start = 0; return GF_NON_COMPLIANT_BITSTREAM; }
-@@ -755,7 +771,13 @@
- here this means the DSI was broken, so no big deal*/
- avcodec_close(ctx);
- *codec = avcodec_find_decoder(CODEC_ID_H263);
-+
-+#ifdef USE_AVCTX3
-+ if (! (*codec) || (avcodec_open2(ctx, *codec, NULL)<0)) return GF_NON_COMPLIANT_BITSTREAM;
-+#else
- if (! (*codec) || (avcodec_open(ctx, *codec)<0)) return GF_NON_COMPLIANT_BITSTREAM;
-+#endif
-+
- #if USE_AVCODEC2
- if (avcodec_decode_video2(ctx, frame, &gotpic, &pkt) < 0) {
- #else
-@@ -765,7 +787,11 @@
- avcodec_close(ctx);
- *codec = avcodec_find_decoder(old_codec);
- assert(*codec);
-+#ifdef USE_AVCTX3
-+ avcodec_open2(ctx, *codec, NULL);
-+#else
- avcodec_open(ctx, *codec);
-+#endif
- return GF_NON_COMPLIANT_BITSTREAM;
- }
- }