[packages/gpac] - ffmpeg2 fixes from upstream svn

baggins baggins at pld-linux.org
Wed Aug 28 21:39:00 CEST 2013


commit 3504b5e1cc8a8f79a2d29ebf00b5310cf2785fb2
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Wed Aug 28 21:38:35 2013 +0200

    - ffmpeg2 fixes from upstream svn

 gpac-ffmpeg2.patch | 193 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 gpac.spec          |   2 +-
 2 files changed, 187 insertions(+), 8 deletions(-)
---
diff --git a/gpac.spec b/gpac.spec
index eb0594b..8f48fc8 100644
--- a/gpac.spec
+++ b/gpac.spec
@@ -164,7 +164,7 @@ Wtyczka GPAC dla przeglądarek WWW zgodnych z Netscape.
 %patch6 -p1
 %patch7 -p1
 %patch8 -p1
-%patch9 -p1
+%patch9 -p0
 
 sed -i -e 's/wx-config/wx-gtk2-unicode-config/' configure
 chmod a+x configure
diff --git a/gpac-ffmpeg2.patch b/gpac-ffmpeg2.patch
index 248f0f7..c5ad0ae 100644
--- a/gpac-ffmpeg2.patch
+++ b/gpac-ffmpeg2.patch
@@ -1,15 +1,194 @@
-Index: gpac/modules/ffmpeg_in/ffmpeg_in.h
+Index: modules/ffmpeg_in/ffmpeg_in.h
 ===================================================================
---- gpac.orig/modules/ffmpeg_in/ffmpeg_in.h
-+++ gpac/modules/ffmpeg_in/ffmpeg_in.h
-@@ -96,6 +96,10 @@ void gf_av_vlog(void* avcl, int level, c
+--- 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_load.c
+===================================================================
+--- modules/ffmpeg_in/ffmpeg_load.c	(revision 4282)
++++ modules/ffmpeg_in/ffmpeg_load.c	(revision 4451)
+@@ -44,7 +44,7 @@
  #endif
  
  
-+#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
-+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
+-GF_EXPORT
++GPAC_MODULE_EXPORT
+ const u32 *QueryInterfaces()
+ {
+ 	static u32 si [] = {
+@@ -57,7 +57,7 @@
+ 	return si;
+ }
+ 
+-GF_EXPORT
++GPAC_MODULE_EXPORT
+ GF_BaseInterface *LoadInterface(u32 InterfaceType)
+ {
+ 	if (InterfaceType == GF_MEDIA_DECODER_INTERFACE) return FFDEC_Load();
+@@ -67,7 +67,7 @@
+ 	return NULL;
+ }
+ 
+-GF_EXPORT
++GPAC_MODULE_EXPORT
+ void ShutdownInterface(GF_BaseInterface *ifce)
+ {
+ 	switch (ifce->InterfaceType) {
+@@ -81,3 +81,6 @@
+ #endif
+ 	}
+ }
++
++
++GPAC_MODULE_STATIC_DELARATION( ffmpeg )
+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;
+@@ -76,7 +88,7 @@
+ 	seek_to = (s64) (AV_TIME_BASE*ffd->seek_time);
+ 	map_video_time = !ffd->seekable;
+ 
+-	video_init = (seek_to && ffd->video_ch) ? 0 : 1;
++	video_init = (seek_to && ffd->video_ch) ? GF_FALSE : GF_TRUE;
+ 	seek_audio = seek_video = 0;
+ 	if (ffd->seekable && (ffd->audio_st>=0)) seek_audio = (u64) (s64) (ffd->seek_time*ffd->audio_tscale.den);
+ 	if (ffd->seekable && (ffd->video_st>=0)) seek_video = (u64) (s64) (ffd->seek_time*ffd->video_tscale.den);
+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;
+ 			}
+ 		}
+@@ -979,7 +1005,7 @@
+ 	else if (StreamType==GF_STREAM_VISUAL) {
  
+ 		/*fixme - we should use some priority rather than declare ffmpeg can't handle svc*/
+-		if (esd->decoderConfig->objectTypeIndication == GPAC_OTI_VIDEO_AVC) {
++		if (esd->decoderConfig->objectTypeIndication == GPAC_OTI_VIDEO_AVC){
+ 			if (esd->decoderConfig->decoderSpecificInfo && esd->decoderConfig->decoderSpecificInfo->data) {
+ 				Bool is_svc = 0;
+ 				u32 i, count;
+@@ -1003,7 +1029,7 @@
+ 				gf_odf_avc_cfg_del(cfg);
+ 				return (is_svc || esd->decoderConfig->rvc_config || esd->decoderConfig->predefined_rvc_config) ? GF_CODEC_MAYBE_SUPPORTED : GF_CODEC_SUPPORTED;
+ 			}
+-			if (esd->decoderConfig->rvc_config || esd->decoderConfig->predefined_rvc_config) return GF_CODEC_MAYBE_SUPPORTED;
++			if (esd->decoderConfig->rvc_config || esd->decoderConfig->predefined_rvc_config || esd->has_ref_base) return GF_CODEC_MAYBE_SUPPORTED;
+ 			return GF_CODEC_SUPPORTED;
+ 		}
  
- /*FFMPEG decoder module */
+@@ -1011,7 +1037,8 @@
+ 		/*MPEG-4 v1 simple profile*/
+ 		case GPAC_OTI_VIDEO_MPEG4_PART2: codec_id = CODEC_ID_MPEG4; break;
+ 		/*H264 (not std OTI, just the way we use it internally)*/
+-		case GPAC_OTI_VIDEO_AVC: codec_id = CODEC_ID_H264; break;
++		case GPAC_OTI_VIDEO_AVC:
++			codec_id = CODEC_ID_H264; break;
+ 		/*MPEG1 video*/
+ 		case GPAC_OTI_VIDEO_MPEG1:
+ 		/*MPEG2 video*/
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/gpac.git/commitdiff/3504b5e1cc8a8f79a2d29ebf00b5310cf2785fb2



More information about the pld-cvs-commit mailing list