ext/ffmpeg/gstffmpegenc.c: MPEG4 standard does not accept framerates with a denominator greater than (1<<16 - 1) (acc...

Original commit message from CVS:
* 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.
This commit is contained in:
Edward Hervey 2006-10-26 11:41:45 +00:00
parent 87106ca6c7
commit 0e07d784d2
2 changed files with 29 additions and 5 deletions

View file

@ -1,3 +1,12 @@
2006-10-26 Edward Hervey <edward@fluendo.com>
* 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 <wim@fluendo.com>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),

View file

@ -324,7 +324,7 @@ gst_ffmpegenc_getcaps (GstPad * pad)
_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 @@ gst_ffmpegenc_getcaps (GstPad * pad)
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 @@ gst_ffmpegenc_setcaps (GstPad * pad, GstCaps * caps)
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 @@ gst_ffmpegenc_register (GstPlugin * plugin)
/* 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);
}