Commit 0e07d784 authored by Edward Hervey's avatar Edward Hervey 🤘

ext/ffmpeg/gstffmpegenc.c: MPEG4 standard does not accept framerates with a...

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.
parent 87106ca6
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),
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment