[tracker-miners/wip/carlosg/test: 50/50] tracker-extract: ignore subtrack titles for videos
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/test: 50/50] tracker-extract: ignore subtrack titles for videos
- Date: Fri, 4 Mar 2022 18:01:07 +0000 (UTC)
commit d261cb1cb2cb964b89d87b213acb4bb8ffb70fe4
Author: Ignacy KuchciĆski <ignacykuchcinski gmail com>
Date: Tue Feb 22 10:13:45 2022 +0100
tracker-extract: ignore subtrack titles for videos
config-miners.h.meson.in | 3 +++
meson.build | 1 +
src/tracker-extract/tracker-extract-gstreamer.c | 21 +++++++++++++++++++--
tests/functional-tests/meson.build | 3 +++
.../video/mkv-basic.expected.json | 12 ++++++++++++
.../test-extraction-data/video/mkv-basic.mkv | Bin 0 -> 3623204 bytes
6 files changed, 38 insertions(+), 2 deletions(-)
---
diff --git a/config-miners.h.meson.in b/config-miners.h.meson.in
index 863b50631..402d432b9 100644
--- a/config-miners.h.meson.in
+++ b/config-miners.h.meson.in
@@ -32,6 +32,9 @@
/* Define if we have GStreamer */
#mesondefine HAVE_GSTREAMER
+/* Define if we have Gstreamer version 1.20.0 or up */
+#mesondefine HAVE_GSTREAMER_1_20
+
/* Define if we have HAL */
#mesondefine HAVE_HAL
diff --git a/meson.build b/meson.build
index 9432f19db..1270e2512 100644
--- a/meson.build
+++ b/meson.build
@@ -368,6 +368,7 @@ conf.set('GIO_SUPPORTS_CREATION_TIME', glib.version().version_compare('>=2.70.0'
conf.set('HAVE_ENCA', charset_library_name == 'enca')
conf.set('HAVE_EXEMPI', exempi.found())
conf.set('HAVE_GSTREAMER', generic_media_handler_name == 'gstreamer')
+conf.set('HAVE_GSTREAMER_1_20', gstreamer.version() >= '1.20.0')
conf.set('GSTREAMER_BACKEND_DISCOVERER', gstreamer_backend_name == 'Discoverer')
conf.set('GSTREAMER_BACKEND_GUPNP_DLNA', gstreamer_backend_name == 'GUPnP-DLNA')
conf.set('HAVE_HAL', battery_detection_library_name == 'hal')
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index f5bd24d3e..f64413f72 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -1244,7 +1244,12 @@ discoverer_init_and_run (MetadataExtractor *extractor,
extractor->duration = gst_discoverer_info_get_duration (info) / GST_SECOND;
/* Retrieve global tags */
+#if defined(HAVE_GSTREAMER_1_20)
+ GstDiscovererStreamInfo *sinfo = gst_discoverer_info_get_stream_info (info);
+ discoverer_tags = gst_discoverer_container_info_get_tags ((GstDiscovererContainerInfo *)sinfo);
+#else
discoverer_tags = gst_discoverer_info_get_tags (info);
+#endif
if (discoverer_tags) {
gst_tag_list_insert (extractor->tagcache,
@@ -1256,7 +1261,6 @@ discoverer_init_and_run (MetadataExtractor *extractor,
extractor->streams = gst_discoverer_info_get_stream_list (info);
for (l = extractor->streams; l; l = g_list_next (l)) {
GstDiscovererStreamInfo *stream = l->data;
- const GstTagList *stream_tags;
if (G_TYPE_CHECK_INSTANCE_TYPE (stream, GST_TYPE_DISCOVERER_AUDIO_INFO)) {
GstDiscovererAudioInfo *audio = (GstDiscovererAudioInfo*)stream;
@@ -1285,17 +1289,30 @@ discoverer_init_and_run (MetadataExtractor *extractor,
} else {
/* Unknown type - do nothing */
}
+ }
- stream_tags = gst_discoverer_stream_info_get_tags (stream);
+ for (l = extractor->streams; l; l = g_list_next (l)) {
+ GstDiscovererStreamInfo *stream = l->data;
+ GstTagList *stream_tags;
+
+ stream_tags = gst_tag_list_copy (gst_discoverer_stream_info_get_tags (stream));
+ if (extractor->has_video &&
+ gst_tag_list_get_tag_size (extractor->tagcache, "title") > 0)
+ gst_tag_list_remove_tag (stream_tags, "title");
if (stream_tags) {
gst_tag_list_insert (extractor->tagcache,
stream_tags,
GST_TAG_MERGE_APPEND);
}
+
+ gst_tag_list_unref (stream_tags);
}
gst_discoverer_info_unref (info);
+#if defined(HAVE_GSTREAMER_1_20)
+ gst_discoverer_stream_info_unref (sinfo);
+#endif
return TRUE;
}
diff --git a/tests/functional-tests/meson.build b/tests/functional-tests/meson.build
index 9ed3be7b5..ccd69a1bc 100644
--- a/tests/functional-tests/meson.build
+++ b/tests/functional-tests/meson.build
@@ -143,6 +143,9 @@ detect_h264_codec = join_paths(meson.current_source_dir(), 'detect-h264-codec.sh
detect_h264_codec_result = run_command(detect_h264_codec)
if detect_h264_codec_result.returncode() == 0
+ if gstreamer.version() >= '1.20.0'
+ extractor_tests += 'video/mkv-basic'
+ endif
extractor_tests += [
'video/mov-basic',
'video/mp4-basic',
diff --git a/tests/functional-tests/test-extraction-data/video/mkv-basic.expected.json
b/tests/functional-tests/test-extraction-data/video/mkv-basic.expected.json
new file mode 100644
index 000000000..aeb718471
--- /dev/null
+++ b/tests/functional-tests/test-extraction-data/video/mkv-basic.expected.json
@@ -0,0 +1,12 @@
+{
+ "test": {
+ "Filename": "mkv-basic.mkv",
+ "Comment": "Just one standard mkv"
+ },
+ "metadata": {
+ "@type": "nmm:Video",
+ "nie:title": "MYTITLE",
+ "nfo:height": "1080",
+ "nfo:width": "1920"
+ }
+}
diff --git a/tests/functional-tests/test-extraction-data/video/mkv-basic.mkv
b/tests/functional-tests/test-extraction-data/video/mkv-basic.mkv
new file mode 100644
index 000000000..ba2d754db
Binary files /dev/null and b/tests/functional-tests/test-extraction-data/video/mkv-basic.mkv differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]