From: <bi...@ke...> - 2006-10-26 11:42:02
|
CVS Root: /cvs/gstreamer Module: gst-ffmpeg Changes by: bilboed Date: Thu Oct 26 2006 11:41:57 UTC Log message: * ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_getcaps), (gst_ffmpegenc_setcaps), (gst_ffmpegenc_register): MPEG4 standard does not accept framerates with a denominator greater than (1<<16 - 1) (according to the ffmpeg encoder...). We therefore scale down the framerate. Small indentation fixes using gst-indent. Modified files: . : ChangeLog ext/ffmpeg : gstffmpegenc.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-ffmpeg/ChangeLog.diff?r1=1.344&r2=1.345 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-ffmpeg/ext/ffmpeg/gstffmpegenc.c.diff?r1=1.95&r2=1.96 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-ffmpeg/ChangeLog,v retrieving revision 1.344 retrieving revision 1.345 diff -u -d -r1.344 -r1.345 --- ChangeLog 25 Oct 2006 17:20:25 -0000 1.344 +++ ChangeLog 26 Oct 2006 11:41:45 -0000 1.345 @@ -1,3 +1,12 @@ +2006-10-26 Edward Hervey <ed...@fl...> + + * ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_getcaps), + (gst_ffmpegenc_setcaps), (gst_ffmpegenc_register): + MPEG4 standard does not accept framerates with a denominator greater + than (1<<16 - 1) (according to the ffmpeg encoder...). + We therefore scale down the framerate. + Small indentation fixes using gst-indent. 2006-10-25 Wim Taymans <wi...@fl...> * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps), Index: gstffmpegenc.c RCS file: /cvs/gstreamer/gst-ffmpeg/ext/ffmpeg/gstffmpegenc.c,v retrieving revision 1.95 retrieving revision 1.96 diff -u -d -r1.95 -r1.96 --- gstffmpegenc.c 24 Oct 2006 09:27:16 -0000 1.95 +++ gstffmpegenc.c 26 Oct 2006 11:41:45 -0000 1.96 @@ -324,7 +324,7 @@ _shut_up_I_am_probing = TRUE; #endif for (pixfmt = 0; pixfmt < PIX_FMT_NB; pixfmt++) { - GstCaps * tmpcaps; + GstCaps *tmpcaps; ctx->pix_fmt = pixfmt; if (gst_ffmpeg_avcodec_open (ctx, oclass->in_plugin) >= 0 && @@ -334,10 +334,11 @@ caps = gst_caps_new_empty (); tmpcaps = gst_ffmpeg_codectype_to_caps (oclass->in_plugin->type, ctx); if (tmpcaps) - gst_caps_append (caps, tmpcaps); + gst_caps_append (caps, tmpcaps); else - GST_LOG_OBJECT (ffmpegenc, "Couldn't get caps for oclass->in_plugin->name:%s", - oclass->in_plugin->name); + GST_LOG_OBJECT (ffmpegenc, + "Couldn't get caps for oclass->in_plugin->name:%s", + oclass->in_plugin->name); gst_ffmpeg_avcodec_close (ctx); } if (ctx->priv_data) @@ -462,6 +463,18 @@ if (!ffmpegenc->context->time_base.den) { ffmpegenc->context->time_base.den = 25; ffmpegenc->context->time_base.num = 1; + } else if ((oclass->in_plugin->id == CODEC_ID_MPEG4) + && (ffmpegenc->context->time_base.den > 65535)) { + /* MPEG4 Standards do not support time_base denominator greater than + * (1<<16) - 1 . We therefore scale them down. + * Agreed, it will not be the exact framerate... but the difference + * shouldn't be that noticeable */ + ffmpegenc->context->time_base.num = + (gint) gst_util_uint64_scale_int (ffmpegenc->context->time_base.num, + 65535, ffmpegenc->context->time_base.den); + ffmpegenc->context->time_base.den = 65535; + GST_LOG_OBJECT (ffmpegenc, "MPEG4 : scaled down framerate to %d / %d", + ffmpegenc->context->time_base.den, ffmpegenc->context->time_base.num); } pix_fmt = ffmpegenc->context->pix_fmt; @@ -946,7 +959,9 @@ /* first make sure we've got a supported type */ srccaps = gst_ffmpeg_codecid_to_caps (in_plugin->id, NULL, TRUE); if (in_plugin->type == CODEC_TYPE_VIDEO) { - sinkcaps = gst_caps_from_string ("video/x-raw-rgb; video/x-raw-yuv; video/x-raw-gray"); + sinkcaps = + gst_caps_from_string + ("video/x-raw-rgb; video/x-raw-yuv; video/x-raw-gray"); } else { sinkcaps = gst_ffmpeg_codectype_to_caps (in_plugin->type, NULL); |