media-check: enable 'full' for files which reference are also 'full'
authorThiago Santos <thiagoss@osg.samsung.com>
Mon, 30 Nov 2015 14:54:05 +0000 (11:54 -0300)
committerThiago Santos <thiagoss@osg.samsung.com>
Fri, 4 Dec 2015 22:03:53 +0000 (19:03 -0300)
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
validate/gst/validate/media-descriptor.h
validate/tools/gst-validate-media-check.c

index 37e70e2..7313594 100644 (file)
@@ -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)
 {
index 48a58f2..30afebc 100644 (file)
@@ -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);
index d6a3ea1..66fa6be 100644 (file)
@@ -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;