mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
matroskademux: Preserve forward referenced track tags
https://bugzilla.gnome.org/show_bug.cgi?id=752850
This commit is contained in:
parent
5f9e5bf385
commit
cd57697a2c
3 changed files with 32 additions and 2 deletions
|
@ -397,6 +397,7 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux, GstEbmlRead * ebml)
|
||||||
GstPadTemplate *templ = NULL;
|
GstPadTemplate *templ = NULL;
|
||||||
GstStreamFlags stream_flags;
|
GstStreamFlags stream_flags;
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
|
GstTagList *cached_taglist;
|
||||||
gchar *padname = NULL;
|
gchar *padname = NULL;
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
guint32 id, riff_fourcc = 0;
|
guint32 id, riff_fourcc = 0;
|
||||||
|
@ -1128,6 +1129,13 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux, GstEbmlRead * ebml)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check for a cached track taglist */
|
||||||
|
cached_taglist =
|
||||||
|
(GstTagList *) g_hash_table_lookup (demux->common.cached_track_taglists,
|
||||||
|
GUINT_TO_POINTER (context->uid));
|
||||||
|
if (cached_taglist)
|
||||||
|
gst_tag_list_insert (context->tags, cached_taglist, GST_TAG_MERGE_APPEND);
|
||||||
|
|
||||||
/* now create the GStreamer connectivity */
|
/* now create the GStreamer connectivity */
|
||||||
switch (context->type) {
|
switch (context->type) {
|
||||||
case GST_MATROSKA_TRACK_TYPE_VIDEO:{
|
case GST_MATROSKA_TRACK_TYPE_VIDEO:{
|
||||||
|
|
|
@ -2392,9 +2392,21 @@ gst_matroska_read_common_parse_metadata_id_tag (GstMatroskaReadCommon * common,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
GST_FIXME_OBJECT (common->sinkpad,
|
/* Cache the track taglist: possibly belongs to a track that will be parsed
|
||||||
|
later in gst_matroska_demux.c:gst_matroska_demux_add_stream (...) */
|
||||||
|
gpointer track_uid = GUINT_TO_POINTER (tgt);
|
||||||
|
GstTagList *cached_taglist =
|
||||||
|
g_hash_table_lookup (common->cached_track_taglists, track_uid);
|
||||||
|
if (cached_taglist)
|
||||||
|
gst_tag_list_insert (cached_taglist, taglist, GST_TAG_MERGE_REPLACE);
|
||||||
|
else {
|
||||||
|
gst_tag_list_ref (taglist);
|
||||||
|
g_hash_table_insert (common->cached_track_taglists, track_uid,
|
||||||
|
taglist);
|
||||||
|
}
|
||||||
|
GST_DEBUG_OBJECT (common->sinkpad,
|
||||||
"Found track-specific tag(s), but track %" G_GUINT64_FORMAT
|
"Found track-specific tag(s), but track %" G_GUINT64_FORMAT
|
||||||
" is not known (yet?)", tgt);
|
" is not known yet, caching", tgt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -2844,6 +2856,9 @@ gst_matroska_read_common_init (GstMatroskaReadCommon * ctx)
|
||||||
ctx->index = NULL;
|
ctx->index = NULL;
|
||||||
ctx->global_tags = NULL;
|
ctx->global_tags = NULL;
|
||||||
ctx->adapter = gst_adapter_new ();
|
ctx->adapter = gst_adapter_new ();
|
||||||
|
ctx->cached_track_taglists =
|
||||||
|
g_hash_table_new_full (NULL, NULL, NULL,
|
||||||
|
(GDestroyNotify) gst_tag_list_unref);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2860,6 +2875,9 @@ gst_matroska_read_common_finalize (GstMatroskaReadCommon * ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (ctx->adapter);
|
g_object_unref (ctx->adapter);
|
||||||
|
g_hash_table_remove_all (ctx->cached_track_taglists);
|
||||||
|
g_hash_table_unref (ctx->cached_track_taglists);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -102,6 +102,10 @@ typedef struct _GstMatroskaReadCommon {
|
||||||
|
|
||||||
/* push based mode usual suspects */
|
/* push based mode usual suspects */
|
||||||
GstAdapter *adapter;
|
GstAdapter *adapter;
|
||||||
|
|
||||||
|
/* cache for track tags that forward-reference their tracks */
|
||||||
|
GHashTable *cached_track_taglists ;
|
||||||
|
|
||||||
} GstMatroskaReadCommon;
|
} GstMatroskaReadCommon;
|
||||||
|
|
||||||
GstFlowReturn gst_matroska_decode_content_encodings (GArray * encodings);
|
GstFlowReturn gst_matroska_decode_content_encodings (GArray * encodings);
|
||||||
|
|
Loading…
Reference in a new issue