From b84bf977b1a52b178c90b8113cbc68934b3acf5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 5 Nov 2009 18:19:58 +0000 Subject: [PATCH] asfdemux: prefer WM/TrackNumber over WM/Track, it's more reliable WM/Track has a 0 base but is often wrongly written as starting from 1, so not as reliable as WM/TrackNumber which always starts from 1. --- gst/asfdemux/gstasfdemux.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c index af813bd132..325533584e 100644 --- a/gst/asfdemux/gstasfdemux.c +++ b/gst/asfdemux/gstasfdemux.c @@ -2465,8 +2465,18 @@ gst_asf_demux_process_ext_content_desc (GstASFDemux * demux, guint8 * data, if (G_IS_VALUE (&tag_value)) { if (gst_tag_name) { - gst_tag_list_add_values (taglist, GST_TAG_MERGE_APPEND, - gst_tag_name, &tag_value, NULL); + GstTagMergeMode merge_mode = GST_TAG_MERGE_APPEND; + + /* WM/TrackNumber is more reliable than WM/Track, since the latter + * is supposed to have a 0 base but is often wrongly written to start + * from 1 as well, so prefer WM/TrackNumber when we have it: either + * replace the value added earlier from WM/Track or put it first in + * the list, so that it will get picked up by _get_uint() */ + if (strcmp (name_utf8, "WM/TrackNumber") == 0) + merge_mode = GST_TAG_MERGE_REPLACE; + + gst_tag_list_add_values (taglist, merge_mode, gst_tag_name, + &tag_value, NULL); g_value_unset (&tag_value); } else {