[gstreamer-bugs] [Bug 625129] typefinding: file incorrectly detected as audio/x-dts

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Mon Jan 24 16:50:47 PST 2011


https://bugzilla.gnome.org/show_bug.cgi?id=625129
  GStreamer | gst-plugins-base | git

Tim-Philipp Müller <t.i.m> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #178823|none                        |needs-work
             status|                            |

--- Comment #5 from Tim-Philipp Müller <t.i.m at zen.co.uk> 2011-01-25 00:50:39 UTC ---
(From update of attachment 178823)
>+  len = gst_type_find_get_length (tf);
>+  if (len < 4)
>+    return;
>+  data = gst_type_find_peek (tf, 0, 4);

Since there's supposed to be a 34-byte header, we may just as well check for
that (not that it matters).

>+  resolution = GST_READ_UINT16_BE (data);
>+  if (len == 32034) {
>+    /* could be DEGAS */
>+    if (resolution <= 2)

Isn't resolution a bitfield? (meaning shouldn't it be <= 3?)

>+      gst_type_find_suggest_simple (tf, GST_TYPE_FIND_POSSIBLE + 5,
>+          "image/x-degas", NULL);
>+  } else if (len == 32066) {
>+    /* could be DEGAS Elite */
>+    if (resolution <= 2)
>+      data = gst_type_find_peek (tf, len - 16, 8);
>+    for (n = 0; n < 4; n++) {
>+      if (GST_READ_UINT16_BE (data + n * 2) > 2)
>+        return;
>+      gst_type_find_suggest_simple (tf, GST_TYPE_FIND_POSSIBLE + 5,
>+          "image/x-degas", NULL);
>+    }

Not sure I understand the nesting here.

Shouldn't we bail out (return) if resolution is > 3? (see above re. bitfield)

Or, put differently: shouldn't the data= bit and the whole loop etc. all be in
a

  if (resolution <=3) {
    ...
  }

block?

Next, shouldn't the gst_type_find_suggest_simple() be outside the for loop?
Otherwise we suggest after the first value already, and not only if all 4
values are ok.


>+  } else if (len >= 66 && len < 32066) {
>+    /* could be compressed DEGAS Elite, but it's compressed and so we can't rely on size,
>+       it does have 4 16 bytes values near the end that are 0-2 though. */
>+    if ((resolution & 0x8000) && (resolution & 0x7fff) <= 2)
>+      data = gst_type_find_peek (tf, len - 16, 8);
>+    for (n = 0; n < 4; n++) {
>+      if (GST_READ_UINT16_BE (data + n * 2) > 2)
>+        return;
>+      gst_type_find_suggest_simple (tf, GST_TYPE_FIND_POSSIBLE + 5,
>+          "image/x-degas", NULL);
>+    }
>+  }

Same questions here re. nesting.

>+}
>+

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.



More information about the Gstreamer-bugs mailing list