omx: Add hack for Qualcomm's OMX implementation to manually reset nOffset in EmptyBuf...
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 26 Sep 2011 11:04:18 +0000 (13:04 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 26 Sep 2011 11:05:23 +0000 (13:05 +0200)
omx/gstomx.c
omx/gstomx.h

index b2a55c6..76b347a 100644 (file)
@@ -332,6 +332,12 @@ EmptyBufferDone (OMX_HANDLETYPE hComponent, OMX_PTR pAppData,
   GST_DEBUG_OBJECT (comp->parent, "Port %u emptied buffer %p",
       port->index, buf);
   buf->used = FALSE;
+
+  if (comp->hacks & GST_OMX_HACK_NO_NOFFSET_RESET) {
+    g_assert (buf->omx_buf->nFilledLen == 0);
+    buf->omx_buf->nOffset = 0;
+  }
+
   g_queue_push_tail (port->pending_buffers, buf);
   g_cond_broadcast (port->port_cond);
   g_mutex_unlock (port->port_lock);
@@ -1888,6 +1894,8 @@ gst_omx_parse_hacks (gchar ** hacks)
       hacks_flags |= GST_OMX_HACK_VIDEO_FRAMERATE_INTEGER;
     else if (g_str_equal (*hacks, "syncframe-flag-not-used"))
       hacks_flags |= GST_OMX_HACK_SYNCFRAME_FLAG_NOT_USED;
+    else if (g_str_equal (*hacks, "no-noffset-reset"))
+      hacks_flags |= GST_OMX_HACK_NO_NOFFSET_RESET;
     else
       GST_WARNING ("Unknown hack: %s", *hacks);
     hacks++;
index 1f2d207..af797fc 100644 (file)
@@ -55,6 +55,11 @@ G_BEGIN_DECLS
  * Happens with the Bellagio ffmpegdist video encoder.
  */
 #define GST_OMX_HACK_SYNCFRAME_FLAG_NOT_USED                          G_GUINT64_CONSTANT (0x0000000000000008)
+/* If the nOffset field of buffers is not reset in EmptyBufferDone.
+ * Happens with Qualcomm's OpenMAX implementation.
+ */
+#define GST_OMX_HACK_NO_NOFFSET_RESET                                 G_GUINT64_CONSTANT (0x0000000000000010)
+
 
 typedef struct _GstOMXCore GstOMXCore;
 typedef struct _GstOMXPort GstOMXPort;