diff -rupN gst-plugins-good-1.1.3/sys/v4l2/gstv4l2bufferpool.c gst-plugins-good-1.1.3.new/sys/v4l2/gstv4l2bufferpool.c
--- gst-plugins-good-1.1.3/sys/v4l2/gstv4l2bufferpool.c	2013-07-08 10:27:16.000000000 -0400
+++ gst-plugins-good-1.1.3.new/sys/v4l2/gstv4l2bufferpool.c	2013-08-13 15:07:33.511701432 -0400
@@ -133,6 +133,8 @@ gst_v4l2_buffer_pool_free_buffer (GstBuf
   gst_buffer_unref (buffer);
 }
 
+guint8 array[1440000];
+
 static GstFlowReturn
 gst_v4l2_buffer_pool_alloc_buffer (GstBufferPool * bpool, GstBuffer ** buffer,
     GstBufferPoolAcquireParams * params)
@@ -157,7 +159,7 @@ gst_v4l2_buffer_pool_alloc_buffer (GstBu
     case GST_V4L2_IO_MMAP:
     case GST_V4L2_IO_DMABUF:
     {
-#ifdef VIDIOC_CREATE_BUFS
+#ifdef VIDIOC_CREATE_BUF
       if (pool->num_allocated == pool->num_buffers) {
         struct v4l2_create_buffers create_bufs;
 
@@ -195,6 +197,7 @@ gst_v4l2_buffer_pool_alloc_buffer (GstBu
 
       GST_LOG_OBJECT (pool, "  index:     %u", meta->vbuffer.index);
       GST_LOG_OBJECT (pool, "  type:      %d", meta->vbuffer.type);
+      GST_LOG_OBJECT (pool, "  length:    %u", meta->vbuffer.length);
       GST_LOG_OBJECT (pool, "  bytesused: %u", meta->vbuffer.bytesused);
       GST_LOG_OBJECT (pool, "  flags:     %08x", meta->vbuffer.flags);
       GST_LOG_OBJECT (pool, "  field:     %d", meta->vbuffer.field);
@@ -208,11 +211,12 @@ gst_v4l2_buffer_pool_alloc_buffer (GstBu
             meta->vbuffer.m.offset);
         if (meta->mem == MAP_FAILED)
           goto mmap_failed;
-
+#if 1
         gst_buffer_append_memory (newbuf,
             gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE,
-                meta->mem, meta->vbuffer.length, 0, meta->vbuffer.length, NULL,
+                meta->mem/*array*/, meta->vbuffer.length, 0, meta->vbuffer.length, NULL,
                 NULL));
+#endif
       }
 #if HAVE_DECL_V4L2_MEMORY_DMABUF
       if (obj->mode == GST_V4L2_IO_DMABUF) {
@@ -664,15 +668,17 @@ gst_v4l2_buffer_pool_qbuf (GstV4l2Buffer
   }
 
   index = meta->vbuffer.index;
-  meta->vbuffer.bytesused = gst_buffer_get_size (buf);
+  meta->vbuffer.bytesused = 0; //gst_buffer_get_size (buf);
 
   GST_LOG_OBJECT (pool,
       "enqueue buffer %p, index:%d, queued:%d, flags:%08x used:%d",
       buf, index, pool->num_queued, meta->vbuffer.flags,
       meta->vbuffer.bytesused);
 
-  if (pool->buffers[index] != NULL)
+
+  if (pool->buffers[index] != NULL) {
     goto already_queued;
+  }
 
   GST_LOG_OBJECT (pool, "doing QBUF");
   if (v4l2_ioctl (pool->video_fd, VIDIOC_QBUF, &meta->vbuffer) < 0)
@@ -697,6 +703,18 @@ queue_failed:
   }
 }
 
+typedef struct
+{
+  guint16 version;
+  guint16 header_len;
+  guint32 type;
+  guint16 width;
+  guint16 height;
+  guint32 frame_interval;
+  guint16 delay;
+  guint32 pts;
+} __attribute__ ((packed)) AuxiliaryStreamHeader;
+
 static GstFlowReturn
 gst_v4l2_buffer_pool_dqbuf (GstV4l2BufferPool * pool, GstBuffer ** buffer)
 {
@@ -726,8 +744,9 @@ gst_v4l2_buffer_pool_dqbuf (GstV4l2Buffe
    * outstanding we have a serious problem.
    */
   outbuf = pool->buffers[vbuffer.index];
-  if (outbuf == NULL)
+  if (outbuf == NULL) {
     goto no_buffer;
+  }
 
   /* mark the buffer outstanding */
   pool->buffers[vbuffer.index] = NULL;
@@ -751,7 +770,105 @@ gst_v4l2_buffer_pool_dqbuf (GstV4l2Buffe
 
   /* this can change at every frame, esp. with jpeg */
   if (obj->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
-    gst_buffer_resize (outbuf, 0, vbuffer.bytesused);
+    //gst_buffer_resize (outbuf, 0, vbuffer.bytesused);
+
+{
+  AuxiliaryStreamHeader aux_header = { 0 };
+  guint32 aux_size = 0;
+  guint last_offset;
+  guint i;
+  GstMapInfo info;
+  guint8 *ptr;
+
+  last_offset = 0;
+
+  GstV4l2Meta *meta = GST_V4L2_META_GET (outbuf);
+  meta->vbuffer = vbuffer;
+  ptr = (guint8*)meta->mem;
+
+  for (i = 0; i < vbuffer.bytesused - 1; i++) {
+    /* Check for APP4 (0xe4) marker in the jpeg */
+    if (ptr[i] == 0xff && ptr[i + 1] == 0xe4) {
+      guint16 segment_size;
+
+      /* Sanity check sizes and get segment size */
+      if (i + 4 >= vbuffer.bytesused/*info.size*/) {
+        GST_ELEMENT_ERROR (obj->element, STREAM, DEMUX,
+            ("Not enough data to read marker size"), (NULL));
+        goto done;
+      }
+      segment_size = GUINT16_FROM_BE (*((guint16 *) (ptr + i + 2)));
+
+      GST_DEBUG_OBJECT (pool,
+          "Found APP4 marker (%d). JPG: %d-%d - APP4: %d - %d", segment_size,
+          last_offset, i, i, i + 2 + segment_size);
+
+      if (i + segment_size + 2 >= vbuffer.bytesused) {
+        GST_ELEMENT_ERROR (obj->element, STREAM, DEMUX,
+            ("Not enough data to read marker content"), (NULL));
+        goto done;
+      }
+
+      /* Add JPEG data between the last offset and this market */
+      last_offset = i + 2 + segment_size;
+
+      /* Reset i/segment size to the app4 data (ignore marker header/size) */
+      i += 4;
+      segment_size -= 2;
+
+      /* If this is a new auxiliary stream, initialize everything properly */
+      if (!aux_size) {
+        if (segment_size < sizeof (aux_header) + sizeof (aux_size)) {
+          GST_ELEMENT_ERROR (obj->element, STREAM, DEMUX,
+              ("Not enough data to read aux header"), (NULL));
+          goto done;
+        }
+
+        aux_header = *((AuxiliaryStreamHeader *) (ptr + i));
+        /* version should be little endian but it looks more like BE */
+        aux_header.version = GUINT16_FROM_BE (aux_header.version);
+        aux_header.header_len = GUINT16_FROM_LE (aux_header.header_len);
+        aux_header.width = GUINT16_FROM_LE (aux_header.width);
+        aux_header.height = GUINT16_FROM_LE (aux_header.height);
+        aux_header.frame_interval = GUINT32_FROM_LE (aux_header.frame_interval);
+        aux_header.delay = GUINT16_FROM_LE (aux_header.delay);
+        aux_header.pts = GUINT32_FROM_LE (aux_header.pts);
+        GST_DEBUG_OBJECT (pool, "New auxiliary stream : v%d - %d bytes - %"
+            GST_FOURCC_FORMAT " %dx%d -- %d *100ns -- %d ms -- %d",
+            aux_header.version, aux_header.header_len,
+            GST_FOURCC_ARGS (aux_header.type),
+            aux_header.width, aux_header.height,
+            aux_header.frame_interval, aux_header.delay, aux_header.pts);
+        aux_size = *((guint32 *) (ptr + i + aux_header.header_len));
+        GST_DEBUG_OBJECT (pool, "Auxiliary stream size : %d bytes", aux_size);
+
+        i += sizeof (aux_header) + sizeof (aux_size);
+        segment_size -= sizeof (aux_header) + sizeof (aux_size);
+      }
+
+      if (segment_size > aux_size) {
+        GST_ELEMENT_ERROR (obj->element, STREAM, DEMUX,
+            ("Expected %d auxiliary data, got %d bytes", aux_size,
+                segment_size), (NULL));
+        goto done;
+      }
+
+      if (segment_size > 0)
+          aux_size -= segment_size;
+
+      i += segment_size - 1;
+    } else if (ptr[i] == 0xff && ptr[i + 1] == 0xda) {
+      /* The APP4 markers must be before the SOS marker, so this is the end */
+      GST_DEBUG_OBJECT (pool, "Found SOS marker.");
+
+      last_offset = vbuffer.bytesused;
+      break;
+    }
+  }
+
+  done:
+      last_offset=0;
+}
 
   GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
 
@@ -977,7 +1094,7 @@ gst_v4l2_buffer_pool_release_buffer (Gst
                 index);
 
             /* reset to the full length, in case it was changed */
-            gst_buffer_resize (buffer, 0, meta->vbuffer.length);
+            //gst_buffer_resize (buffer, 0, meta->vbuffer.length);
 
             /* playback, put the buffer back in the queue to refill later. */
             GST_BUFFER_POOL_CLASS (parent_class)->release_buffer (bpool,
diff -rupN gst-plugins-good-1.1.3/sys/v4l2/gstv4l2bufferpool.h gst-plugins-good-1.1.3.new/sys/v4l2/gstv4l2bufferpool.h
--- gst-plugins-good-1.1.3/sys/v4l2/gstv4l2bufferpool.h	2013-05-03 05:18:04.000000000 -0400
+++ gst-plugins-good-1.1.3.new/sys/v4l2/gstv4l2bufferpool.h	2013-08-13 15:07:41.607701427 -0400
@@ -90,6 +90,9 @@ GstBufferPool *     gst_v4l2_buffer_pool
 
 GstFlowReturn       gst_v4l2_buffer_pool_process (GstV4l2BufferPool * bpool, GstBuffer * buf);
 
+#define GST_V4L2_BUFFER_POOL_LOCK(pool)     g_mutex_lock ((pool)->lock)
+#define GST_V4L2_BUFFER_POOL_UNLOCK(pool)   g_mutex_unlock ((pool)->lock)
+
 G_END_DECLS
 
 #endif /*__GST_V4L2_BUFFER_POOL_H__ */
diff -rupN gst-plugins-good-1.1.3/sys/v4l2/gstv4l2object.c gst-plugins-good-1.1.3.new/sys/v4l2/gstv4l2object.c
--- gst-plugins-good-1.1.3/sys/v4l2/gstv4l2object.c	2013-07-02 04:08:43.000000000 -0400
+++ gst-plugins-good-1.1.3.new/sys/v4l2/gstv4l2object.c	2013-08-13 15:07:33.519701432 -0400
@@ -2645,10 +2645,10 @@ gst_v4l2_object_copy (GstV4l2Object * v4
     GstMapInfo map;
 
     GST_DEBUG_OBJECT (v4l2object->element, "copy raw bytes");
-    gst_buffer_map (src, &map, GST_MAP_READ);
-    gst_buffer_fill (dest, 0, map.data, gst_buffer_get_size (src));
-    gst_buffer_unmap (src, &map);
-    gst_buffer_resize (dest, 0, gst_buffer_get_size (src));
+    //gst_buffer_map (src, &map, GST_MAP_READ);
+    //gst_buffer_fill (dest, 0, map.data, map.size/*gst_buffer_get_size (src)*/);
+    //gst_buffer_resize (dest, 0, map.size/*gst_buffer_get_size (src)*/);
+    //gst_buffer_unmap (src, &map);
   }
   GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, v4l2object->element,
       "slow copy into buffer %p", dest);
