typefindfunctions: Fix otio typefinder to actually detect otio files
authorSebastian Dröge <sebastian@centricular.com>
Mon, 6 Apr 2020 12:20:39 +0000 (15:20 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 6 Apr 2020 12:23:27 +0000 (15:23 +0300)
The string "\"OTIO_SCHEMA\":" is 14 characters and not 15. Checking for
15 characters would also check for the final '\0', which does not exist
in any otio file as the string is the key of a JSON map.

gst/typefind/gsttypefindfunctions.c

index 3ed5857..0d6ebb6 100644 (file)
@@ -755,11 +755,11 @@ otio_type_find (GstTypeFind * tf, gpointer unused)
   if (!tmp)
     return;
 
-  data = (const gchar *) gst_type_find_peek (tf, tmp - data, 15);
+  data = (const gchar *) gst_type_find_peek (tf, tmp - data, 14);
   if (!data)
     return;
 
-  if (memcmp (data, "\"OTIO_SCHEMA\":", 15) == 0) {
+  if (memcmp (data, "\"OTIO_SCHEMA\":", 14) == 0) {
     gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, OTIO_CAPS);
   }
 }