summaryrefslogtreecommitdiffstats
path: root/gst/qtdemux
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2006-10-31 10:31:18 +0000
committerWim Taymans <wim.taymans@gmail.com>2006-10-31 10:31:18 +0000
commit4bef7791d973deef3e6339ea6a8b421326d6b084 (patch)
treef70e6f22e9e9161e340ac3ff4bcba2d7cb0d1019 /gst/qtdemux
parentbd2497729e65a160c2453af996d2802e399132e9 (diff)
downloadgst-plugins-bad-4bef7791d973deef3e6339ea6a8b421326d6b084.tar.gz
gst-plugins-bad-4bef7791d973deef3e6339ea6a8b421326d6b084.tar.bz2
gst-plugins-bad-4bef7791d973deef3e6339ea6a8b421326d6b084.zip
gst/qtdemux/qtdemux.c: Handle unbounded length streams a bit better. Fixes #367696.
Original commit message from CVS: * gst/qtdemux/qtdemux.c: (gst_qtdemux_get_duration), (gst_qtdemux_handle_src_query), (qtdemux_parse_tree), (qtdemux_parse_trak): Handle unbounded length streams a bit better. Fixes #367696.
Diffstat (limited to 'gst/qtdemux')
-rw-r--r--gst/qtdemux/qtdemux.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index a67932a5..61497619 100644
--- a/gst/qtdemux/qtdemux.c
+++ b/gst/qtdemux/qtdemux.c
@@ -558,6 +558,22 @@ gst_qtdemux_get_src_query_types (GstPad * pad)
}
static gboolean
+gst_qtdemux_get_duration (GstQTDemux * qtdemux, gint64 * duration)
+{
+ gboolean res = TRUE;
+
+ *duration = GST_CLOCK_TIME_NONE;
+
+ if (qtdemux->duration != 0) {
+ if (qtdemux->duration != G_MAXINT32 && qtdemux->timescale != 0) {
+ *duration = gst_util_uint64_scale_int (qtdemux->duration,
+ GST_SECOND, qtdemux->timescale);
+ }
+ }
+ return res;
+}
+
+static gboolean
gst_qtdemux_handle_src_query (GstPad * pad, GstQuery * query)
{
gboolean res = FALSE;
@@ -572,15 +588,13 @@ gst_qtdemux_handle_src_query (GstPad * pad, GstQuery * query)
}
break;
case GST_QUERY_DURATION:
- if (qtdemux->duration != 0 && qtdemux->timescale != 0) {
- gint64 duration;
+ {
+ gint64 duration;
- duration = gst_util_uint64_scale_int (qtdemux->duration,
- GST_SECOND, qtdemux->timescale);
+ res = gst_qtdemux_get_duration (qtdemux, &duration);
- gst_query_set_duration (query, GST_FORMAT_TIME, duration);
- res = TRUE;
- }
+ gst_query_set_duration (query, GST_FORMAT_TIME, duration);
+ }
break;
default:
res = FALSE;
@@ -3145,12 +3159,10 @@ qtdemux_parse_tree (GstQTDemux * qtdemux)
GST_INFO_OBJECT (qtdemux, "timescale: %d", qtdemux->timescale);
GST_INFO_OBJECT (qtdemux, "duration: %d", qtdemux->duration);
- if (qtdemux->timescale != 0 && qtdemux->duration != 0) {
+ if (TRUE) {
gint64 duration;
- duration = gst_util_uint64_scale_int (qtdemux->duration,
- GST_SECOND, qtdemux->timescale);
-
+ gst_qtdemux_get_duration (qtdemux, &duration);
gst_segment_set_duration (&qtdemux->segment, GST_FORMAT_TIME, duration);
}
@@ -3242,7 +3254,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
GST_LOG ("track timescale: %d", stream->timescale);
GST_LOG ("track duration: %d", stream->duration);
- {
+ if (qtdemux->duration != G_MAXINT32 && stream->duration != G_MAXINT32) {
guint64 tdur1, tdur2;
/* don't overflow */