summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2006-12-11 13:59:33 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-12-11 13:59:33 +0000
commit0d3b023699640dc2866a2edba8c910ddf54c290e (patch)
tree50ff01f9d216a8235c3508dc323a7de032db1a10 /gst
parent2f992c783ef619eabc8baec272bf71c3397051d6 (diff)
gst/matroska/: Try harder to extract the framerate for video tracks correctly and save it directly instead of convert...
Original commit message from CVS: * gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream), (gst_matroska_demux_video_caps): * gst/matroska/matroska-ids.c: (gst_matroska_track_init_video_context): * gst/matroska/matroska-ids.h: Try harder to extract the framerate for video tracks correctly and save it directly instead of converting it back and forth a few times. Mostly makes a difference for very small framerates (<1). Fixes #380199.
Diffstat (limited to 'gst')
-rw-r--r--gst/matroska/matroska-demux.c26
-rw-r--r--gst/matroska/matroska-ids.c1
-rw-r--r--gst/matroska/matroska-ids.h5
3 files changed, 24 insertions, 8 deletions
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index c09afa40..3c54b213 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -660,7 +660,9 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux)
res = FALSE;
break;
}
- context->default_duration = GST_SECOND * (1. / num);
+ context->default_duration =
+ gst_gdouble_to_guint64 ((gdouble) GST_SECOND * (1.0 / num));
+ videocontext->default_fps = num;
break;
}
@@ -3615,14 +3617,26 @@ gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
videocontext->display_height * videocontext->pixel_width, NULL);
}
- if (context->default_duration > 0) {
- GValue fps_double = { 0 };
- GValue fps_fraction = { 0 };
+ if (videocontext->default_fps > 0.0) {
+ 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_guint64_to_gdouble (GST_SECOND / context->default_duration));
+ g_value_set_double (&fps_double, videocontext->default_fps);
+ 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 if (context->default_duration > 0) {
+ 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, (gdouble) GST_SECOND * 1.0 /
+ gst_guint64_to_gdouble (context->default_duration));
g_value_transform (&fps_double, &fps_fraction);
gst_structure_set_value (structure, "framerate", &fps_fraction);
diff --git a/gst/matroska/matroska-ids.c b/gst/matroska/matroska-ids.c
index db8261ab..ec71a568 100644
--- a/gst/matroska/matroska-ids.c
+++ b/gst/matroska/matroska-ids.c
@@ -56,6 +56,7 @@ gst_matroska_track_init_video_context (GstMatroskaTrackContext ** p_context)
video_context->eye_mode = 0;
video_context->asr_mode = 0;
video_context->fourcc = 0;
+ video_context->default_fps = 0.0;
return TRUE;
}
diff --git a/gst/matroska/matroska-ids.h b/gst/matroska/matroska-ids.h
index 5a5e5722..e570599d 100644
--- a/gst/matroska/matroska-ids.h
+++ b/gst/matroska/matroska-ids.h
@@ -292,8 +292,9 @@ typedef struct _GstMatroskaTrackContext {
typedef struct _GstMatroskaTrackVideoContext {
GstMatroskaTrackContext parent;
- guint pixel_width, pixel_height,
- display_width, display_height;
+ guint pixel_width, pixel_height;
+ guint display_width, display_height;
+ gdouble default_fps;
GstMatroskaEyeMode eye_mode;
GstMatroskaAspectRatioMode asr_mode;
guint32 fourcc;