summaryrefslogtreecommitdiffstats
path: root/gst
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
commit89e2912bada430273a6219919366cadad87eb210 (patch)
tree0ef15417af8c17ec76aa064cc911906e18f4925c /gst
parentb4700acee012d0cc27ca55d8d03bbc06c8629880 (diff)
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')
-rw-r--r--gst/avi/gstavidemux.c7
-rw-r--r--gst/qtdemux/qtdemux.c19
2 files changed, 24 insertions, 2 deletions
diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c
index dd06e141..bfe1c706 100644
--- a/gst/avi/gstavidemux.c
+++ b/gst/avi/gstavidemux.c
@@ -832,10 +832,15 @@ gst_avi_demux_add_stream (GstAviDemux * avi)
{
char *codec_name = NULL;
GstTagList *list = gst_tag_list_new ();
+ guint32 tag;
padname = g_strdup_printf ("video_%02d", avi->num_v_streams);
templ = gst_element_class_get_pad_template (klass, "video_%02d");
- caps = gst_riff_create_video_caps_with_data (strf.vids->compression,
+ if (strf.vids->compression)
+ tag = strf.vids->compression;
+ else
+ tag = strh->fcc_handler;
+ caps = gst_riff_create_video_caps_with_data (tag,
strh, strf.vids, extradata, initdata, &codec_name);
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC,
codec_name, NULL);
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);