From ae52807efdb7b3aa45528c5befa1374620092ff5 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Mon, 30 Nov 2015 11:54:05 -0300 Subject: [PATCH] media-check: enable 'full' for files which reference are also 'full' If the reference file has frames information, enable it automatically so that the comparison file also has frames to be used. https://bugzilla.gnome.org/show_bug.cgi?id=758855 --- validate/gst/validate/media-descriptor.c | 16 +++++++++++++++ validate/gst/validate/media-descriptor.h | 1 + validate/tools/gst-validate-media-check.c | 25 +++++++++++++++-------- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/validate/gst/validate/media-descriptor.c b/validate/gst/validate/media-descriptor.c index 37e70e2891..731359460f 100644 --- a/validate/gst/validate/media-descriptor.c +++ b/validate/gst/validate/media-descriptor.c @@ -547,6 +547,22 @@ done: return ret; } +gboolean +gst_media_descriptor_has_frame_info (GstMediaDescriptor * self) +{ + GList *tmpstream; + + for (tmpstream = self->filenode->streams; + tmpstream; tmpstream = tmpstream->next) { + StreamNode *streamnode = (StreamNode *) tmpstream->data; + + if (g_list_length (streamnode->frames)) + return TRUE; + } + + return FALSE; +} + GstClockTime gst_media_descriptor_get_duration (GstMediaDescriptor * self) { diff --git a/validate/gst/validate/media-descriptor.h b/validate/gst/validate/media-descriptor.h index 48a58f2b2b..30afebc5e5 100644 --- a/validate/gst/validate/media-descriptor.h +++ b/validate/gst/validate/media-descriptor.h @@ -151,6 +151,7 @@ gboolean gst_media_descriptors_compare (GstMediaDescriptor *ref, gboolean gst_media_descriptor_detects_frames (GstMediaDescriptor * self); gboolean gst_media_descriptor_get_buffers (GstMediaDescriptor * self, GstPad * pad, GCompareFunc compare_func, GList ** bufs); +gboolean gst_media_descriptor_has_frame_info (GstMediaDescriptor * self); GstClockTime gst_media_descriptor_get_duration (GstMediaDescriptor * self); gboolean gst_media_descriptor_get_seekable (GstMediaDescriptor * self); GList * gst_media_descriptor_get_pads (GstMediaDescriptor * self); diff --git a/validate/tools/gst-validate-media-check.c b/validate/tools/gst-validate-media-check.c index d6a3ea11fe..66fa6be56c 100644 --- a/validate/tools/gst-validate-media-check.c +++ b/validate/tools/gst-validate-media-check.c @@ -97,6 +97,21 @@ main (int argc, gchar ** argv) g_option_context_free (ctx); runner = gst_validate_runner_new (); + + if (expected_file) { + reference = gst_media_descriptor_parser_new (runner, expected_file, NULL); + + if (reference == NULL) { + g_print ("Could not parse file: %s\n", expected_file); + ret = 1; + goto out; + } + + if (!full && gst_media_descriptor_has_frame_info ((GstMediaDescriptor *) + reference)) + full = TRUE; /* Reference has frame info, activate to do comparison */ + } + writer = gst_media_descriptor_writer_new_discover (runner, argv[1], full, TRUE, NULL); @@ -113,15 +128,7 @@ main (int argc, gchar ** argv) } } - if (expected_file) { - reference = gst_media_descriptor_parser_new (runner, expected_file, NULL); - - if (reference == NULL) { - g_print ("Could not parse file: %s\n", expected_file); - ret = 1; - goto out; - } - + if (reference) { if (!gst_media_descriptors_compare (GST_MEDIA_DESCRIPTOR (reference), GST_MEDIA_DESCRIPTOR (writer))) { ret = 1;