]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gst-plugin-ducati.git/blobdiff - src/gstducatividdec.h
ducatimpeg4dec: xvid support
[glsdk/gst-plugin-ducati.git] / src / gstducatividdec.h
index 23a06a8a8ff4a7d056b350d9b60a34f758c60c55..7f83e90eea4145eb16f8227c53c221bd32b0c8de 100644 (file)
@@ -135,13 +135,46 @@ GType gst_ducati_viddec_get_type (void);
 /* helper methods for derived classes: */
 
 static inline void
-push_input (GstDucatiVidDec * self, guint8 *in, gint sz)
+push_input (GstDucatiVidDec * self, const guint8 *in, gint sz)
 {
   GST_DEBUG_OBJECT (self, "push: %d bytes)", sz);
   memcpy (self->input + self->in_size, in, sz);
   self->in_size += sz;
 }
 
+static inline int
+check_start_code (const guint8 *sc, gint scsize,
+    const guint8 *inbuf, gint insize)
+{
+  if (insize < scsize)
+    return FALSE;
+
+  while (scsize) {
+    if (*sc != *inbuf)
+      return FALSE;
+    scsize--;
+    sc++;
+    inbuf++;
+  }
+
+  return TRUE;
+}
+
+static inline int
+find_start_code (const guint8 *sc, gint scsize,
+    const guint8 *inbuf, gint insize)
+{
+  gint size = 0;
+  while (insize) {
+    if (check_start_code (sc, scsize, inbuf, insize))
+      break;
+    insize--;
+    size++;
+    inbuf++;
+  }
+  return size;
+}
+
 G_END_DECLS
 
 #endif /* __GST_DUCATIVIDDEC_H__ */