[Bug 752850] matroskademux: Does not send user-supplied metadata tags from streamable files

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Tue Jul 28 10:30:18 PDT 2015


https://bugzilla.gnome.org/show_bug.cgi?id=752850

--- Comment #3 from Glen Diener <grd at loganmill.net> ---
A little more info: when streamable=true, track tags injected before
gst_matroska_mux_start are written out by the muxer, but they are not reported
by matroska-demux.  To illustrate:

$ gst-launch-1.0 -c videotestsrc ! taginject tags=comment=hello ! matroskamux
streamable=true ! filesink location=x.mkv
C-c

....The 'comment' tag (suitably renamed 'COMMENTS') is clearly in the mkv file:

$  mkvinfo x.mkv
+ EBML head
|+ Doc type: matroska
|+ Doc type version: 2
|+ Doc type read version: 2
+ Segment, size unknown
|+ Tags
| + Tag
|  + Targets
|   + TrackUID: 1380911230444452577
|  + Simple
|   + Name: COMMENTS
|   + String: hello
|+ Segment information
| + Segment UID: 0x5d 0x2e 0xc6 0xc5 0xb6 0x53 0x66 0x35 0x20 0x8f 0xb6 0x30
0x19 0xad 0x0c 0x4b
| + Timecode scale: 1000000
| + Muxing application: GStreamer matroskamux version 1.5.2.1
| + Writing application: GStreamer Matroska muxer
| + Date: Tue Jul 28 00:43:27 2015 UTC
|+ Segment tracks
| + A track
|  + Track number: 1 (track ID for mkvmerge & mkvextract: 0)
|  + Track type: video
|  + Track UID: 1380911230444452577
|  + Default duration: 33.333ms (30.000 frames/fields per second for a video
track)
|  + Name: Video
|  + Video track
|   + Pixel width: 320
|   + Pixel height: 240
|   + Colour space: length 4, data: 0x49 0x34 0x32 0x30
|  + Codec ID: V_UNCOMPRESSED
|+ Cluster


....however, this Tag appears in the .mkv before the track it belongs to...its
like a forward reference.  The matroska-demux reads the tag, but simply throws
it away (with a FIXME log), because it does not (yet) have the corresponding
track:

$ export GST_DEBUG=matroska-demux:3

gst-launch-1.0 -t filesrc location=x.mkv ! matroskademux ! fakesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
0:00:00.030284747 22173      0x145f0a0 FIXME     matroskareadcommon
matroska-read-common.c:2395:gst_matroska_read_common_parse_metadata_id_tag:<matroskademux0:sink>
Found track-specific tag(s), but track 1380911230444452577 is not known (yet?)
FOUND TAG      : found by element "fakesink0".
container format: Matroska
FOUND TAG      : found by element "fakesink0".
     video codec: Uncompressed planar YUV 4:4:4
Pipeline is PREROLLED ...
 ...

....there is no COMMENTS tag reported. Seems that matroska-demux needs code to
cache the track taglist in matroska-read-common, then merge it into the taglist
when the track is later parsed.  Not a bug, just code thats not implemented
(yet).

Agove is a patch that attempts to address the issue.  It adds a field to 
matroska-read-common.h:GstMatroskaReadCommon called
"cached_track_taglists".  This GstStructure that acts as a hashtable mapping
track_id->taglist.  If/when gst_matroska_read_common_parse_metadata_id_tag(...)
finds tags for an unknown track, it adds those tags to cached_track_taglists
(merging them if the unknown track has been seen before).  Later, if/when the
stream is found in the mkv, matroska-demux.c:gst_matroska_demux_add_stream()
will throw the cached tags back into the mix.

Disclaimer: while I think the logic in the patch is ok, and it tests well for
me, this is the first time I've written any GObject code, so I'm sure it can be
done better. In particular, the GstStructure that maps track_id->taglist
converts everything to Strings and maps String->String.  This is simply because
I didn't find a way to use have GstStructure map the actual datatypes
(guint64->GstTagList).

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list