diff --git a/ChangeLog b/ChangeLog index 2de1d9e2f8..f0362d15f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-09-19 Wim Taymans + + * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_to_pixfmt): + Better framerate setting. + 2005-09-16 Thomas Vander Stichele * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_sink_event): diff --git a/common b/common index 39250a956e..eac450a673 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 39250a956e1dfc010fe9f9d93ca1e2c3a343cdca +Subproject commit eac450a673cd1d3a606fe75399d0cd1fcb1d0d7b diff --git a/ext/ffmpeg/gstffmpegcodecmap.c b/ext/ffmpeg/gstffmpegcodecmap.c index a6379fd1bd..fd7b26fdd4 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.c +++ b/ext/ffmpeg/gstffmpegcodecmap.c @@ -1111,8 +1111,21 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps, gst_structure_get_int (structure, "bpp", &context->bits_per_sample); if (gst_structure_get_double (structure, "framerate", &fps)) { - context->time_base.den = fps * DEFAULT_FRAME_RATE_BASE; - context->time_base.num = DEFAULT_FRAME_RATE_BASE; + GValue dfps = { 0 }; + GValue framerate = { 0 }; + + /* convert double to fraction for the framerate */ + g_value_init (&dfps, G_TYPE_DOUBLE); + g_value_init (&framerate, GST_TYPE_FRACTION); + g_value_set_double (&dfps, fps); + g_value_transform (&dfps, &framerate); + + /* somehow these seem mixed up.. */ + context->time_base.den = gst_value_get_fraction_numerator (&framerate); + context->time_base.num = gst_value_get_fraction_denominator (&framerate); + + GST_DEBUG ("setting framerate %d/%d = %lf", + context->time_base.den, context->time_base.num, fps); } if (!raw)