summaryrefslogtreecommitdiffstats
path: root/gst/matroska
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@mad.scientist.com>2005-11-22 22:21:37 +0000
committerJan Schmidt <thaytan@mad.scientist.com>2005-11-22 22:21:37 +0000
commit11c39abc9a99d5fcb0070988ffe0d773d9780875 (patch)
treec92b2175e0a98b9de7e969cb851c9dc8f0db59fb /gst/matroska
parentdad9986cb4646c0090a9c8408c1a1d9e00869ae2 (diff)
More fractional framerate conversions
Original commit message from CVS: * ext/cairo/gsttextoverlay.c: (gst_text_overlay_init), (gst_text_overlay_setcaps), (gst_text_overlay_collected): * ext/cairo/gsttextoverlay.h: * ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link): * ext/gdk_pixbuf/gstgdkpixbuf.h: * ext/libpng/gstpngdec.c: (gst_pngdec_init), (gst_pngdec_caps_create_and_set): * ext/libpng/gstpngdec.h: * ext/libpng/gstpngenc.c: (gst_pngenc_setcaps): * gst/alpha/gstalphacolor.c: (gst_alpha_color_set_caps): * gst/avi/gstavimux.c: (gst_avimux_init), (gst_avimux_vidsinkconnect): * gst/flx/gstflxdec.c: (gst_flxdec_chain): * gst/goom/gstgoom.c: (gst_goom_init), (gst_goom_src_setcaps), (gst_goom_src_negotiate), (gst_goom_chain): * gst/goom/gstgoom.h: * gst/matroska/matroska-demux.c: (gst_matroska_demux_video_caps): * gst/matroska/matroska-mux.c: (gst_matroska_mux_video_pad_setcaps): * sys/osxvideo/osxvideosink.h: * sys/osxvideo/osxvideosink.m: More fractional framerate conversions
Diffstat (limited to 'gst/matroska')
-rw-r--r--gst/matroska/matroska-demux.c22
-rw-r--r--gst/matroska/matroska-mux.c12
2 files changed, 23 insertions, 11 deletions
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index 19cfab63..d7f46d47 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -3069,21 +3069,29 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
}
if (context->default_duration > 0) {
- gdouble framerate = (gdouble) GST_SECOND / context->default_duration;
-
- gst_structure_set (structure,
- "framerate", G_TYPE_DOUBLE, framerate, NULL);
+ GValue fps_double = { 0 };
+ GValue fps_fraction = { 0 };
+
+ g_value_init (&fps_double, G_TYPE_DOUBLE);
+ g_value_init (&fps_fraction, GST_TYPE_FRACTION);
+ g_value_set_double (&fps_double,
+ GST_SECOND / context->default_duration);
+ g_value_transform (&fps_double, &fps_fraction);
+
+ gst_structure_set_value (structure, "framerate", &fps_fraction);
+ g_value_unset (&fps_double);
+ g_value_unset (&fps_fraction);
} else {
/* sort of a hack to get most codecs to support,
* even if the default_duration is missing */
- gst_structure_set (structure, "framerate", G_TYPE_DOUBLE,
- (gdouble) 25.0, NULL);
+ gst_structure_set (structure, "framerate", GST_TYPE_FRACTION,
+ 25, 1, NULL);
}
} else {
gst_structure_set (structure,
"width", GST_TYPE_INT_RANGE, 16, 4096,
"height", GST_TYPE_INT_RANGE, 16, 4096,
- "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL);
+ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
}
}
}
diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c
index 32f8eb7d..10309357 100644
--- a/gst/matroska/matroska-mux.c
+++ b/gst/matroska/matroska-mux.c
@@ -56,7 +56,7 @@ static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
#define COMMON_VIDEO_CAPS \
"width = (int) [ 16, 4096 ], " \
"height = (int) [ 16, 4096 ], " \
- "framerate = (double) [ 0, MAX ]"
+ "framerate = (fraction) [ 0, MAX ]"
static GstStaticPadTemplate videosink_templ =
GST_STATIC_PAD_TEMPLATE ("video_%d",
@@ -424,7 +424,7 @@ gst_matroska_mux_video_pad_setcaps (GstPad * pad, GstCaps * caps)
GstMatroskaPad *collect_pad;
const gchar *mimetype;
gint width, height, pixel_width, pixel_height;
- gdouble framerate;
+ const GValue *framerate;
GstStructure *structure;
gboolean ret;
@@ -444,11 +444,15 @@ gst_matroska_mux_video_pad_setcaps (GstPad * pad, GstCaps * caps)
/* get general properties */
gst_structure_get_int (structure, "width", &width);
gst_structure_get_int (structure, "height", &height);
- gst_structure_get_double (structure, "framerate", &framerate);
+ framerate = gst_structure_get_value (structure, "framerate");
+ if (framerate == NULL || !GST_VALUE_HOLDS_FRACTION (framerate))
+ return FALSE;
videocontext->pixel_width = width;
videocontext->pixel_height = height;
- context->default_duration = GST_SECOND / framerate;
+ context->default_duration = gst_util_clock_time_scale (GST_SECOND,
+ gst_value_get_fraction_numerator (framerate),
+ gst_value_get_fraction_denominator (framerate));
ret = gst_structure_get_int (structure, "pixel_width", &pixel_width);
ret &= gst_structure_get_int (structure, "pixel_height", &pixel_height);