summaryrefslogtreecommitdiffstats
path: root/gst/qtdemux/qtdemux.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-10-02 14:10:19 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2004-10-02 14:10:19 +0000
commitda9c8309164aeeb9782e0c4640b18fc39f4b09f7 (patch)
treea8f381621a3823828cb1e9124d2887ccfa28d84f /gst/qtdemux/qtdemux.c
parent6313a27c7187ec89542b5bb6d6b9cae67917a1f7 (diff)
downloadgst-plugins-bad-da9c8309164aeeb9782e0c4640b18fc39f4b09f7.tar.gz
gst-plugins-bad-da9c8309164aeeb9782e0c4640b18fc39f4b09f7.tar.bz2
gst-plugins-bad-da9c8309164aeeb9782e0c4640b18fc39f4b09f7.zip
gst-libs/gst/riff/riff-media.c: Add DIB fourcc (raw, palettized 8-bit RGB).
Original commit message from CVS: * gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps_with_data), (gst_riff_create_video_template_caps): Add DIB fourcc (raw, palettized 8-bit RGB). * gst-libs/gst/riff/riff-read.c: (gst_riff_read_strf_vids_with_data): Oops, fix strf_data reading bug. * gst/avi/gstavidemux.c: (gst_avi_demux_add_stream): Use a non-NULL tag. * gst/qtdemux/qtdemux.c: (qtdemux_parse_trak): Time for hacks. Sorry Dave. At least one quicktime movie (a trailer) that I've encountered contains multiple video tracks. One of those is the actual video track, the other are one-frame tracks (images). Unfortunately, the number of frames according to the trak header is 1 for each, so that doesn't help. So instead, I look at the duration and discard tracks with a duration shorter than 20% of the length of the stream. Better than nothing.
Diffstat (limited to 'gst/qtdemux/qtdemux.c')
-rw-r--r--gst/qtdemux/qtdemux.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index b6ee29be..e62fba0c 100644
--- a/gst/qtdemux/qtdemux.c
+++ b/gst/qtdemux/qtdemux.c
@@ -1876,6 +1876,9 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
tkhd = qtdemux_tree_get_child_by_type (trak, FOURCC_tkhd);
g_assert (tkhd);
+ GST_LOG ("track[tkhd] version/flags: 0x%08x",
+ QTDEMUX_GUINT32_GET (tkhd->data + 8));
+
/* track duration? */
mdia = qtdemux_tree_get_child_by_type (trak, FOURCC_mdia);
@@ -1885,7 +1888,21 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
g_assert (mdhd);
stream->timescale = QTDEMUX_GUINT32_GET (mdhd->data + 20);
- GST_INFO ("track timescale: %d", stream->timescale);
+ GST_LOG ("track timescale: %d", stream->timescale);
+ GST_LOG ("track duration: %d", QTDEMUX_GUINT32_GET (mdhd->data + 24));
+
+ /* HACK:
+ * some of those trailers, nowadays, have prologue images that are
+ * themselves vide tracks as well. I haven't really found a way to
+ * identify those yet, except for just looking at their duration. */
+ if ((guint64) QTDEMUX_GUINT32_GET (mdhd->data + 24) *
+ qtdemux->timescale * 10 / (stream->timescale * qtdemux->duration) < 2) {
+ GST_WARNING ("Track shorter than 20%% (%d/%d vs. %d/%d) of the stream "
+ "found, assuming preview image or something; skipping track",
+ QTDEMUX_GUINT32_GET (mdhd->data + 24), stream->timescale,
+ qtdemux->duration, qtdemux->timescale);
+ return;
+ }
hdlr = qtdemux_tree_get_child_by_type (mdia, FOURCC_hdlr);
g_assert (hdlr);