aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-multimedia/gstreamer/gstreamer1.0-omx
diff options
context:
space:
mode:
authorJan-Simon Möller <jsmoeller@linuxfoundation.org>2016-09-01 18:16:16 +0200
committerJan-Simon Möller <jsmoeller@linuxfoundation.org>2016-09-01 23:02:06 +0200
commitb55b46a7f29702db3c4bb0e5f53a66818f29909a (patch)
tree2b064bc0596c91f1e0ed3ee2ffd7cb927bf970c9 /common/recipes-multimedia/gstreamer/gstreamer1.0-omx
parent82611ccadef36ab0b8a6fd6fb1cf055e115f1ef5 (diff)
Changes to meta-renesas for building with YP 2.1.1 'krogoth'sandbox/jsmoeller/krogoth
Notable changes: - We drop old appends (libgcc_4.8.bbappend, qemu_%.bbappends, gtk+_2.24.%.bbappend) - All gstreamer1.0_1.2.3 related recipes are now in meta-reneas and have been heavily massaged to work with YP 2.1.1 . - systemd needs a patch due to the old kernel - linux-libc-headers needed a patch TODO: - Test and fix Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
Diffstat (limited to 'common/recipes-multimedia/gstreamer/gstreamer1.0-omx')
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omx-fixed-type-error-in-printf-call.patch30
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omxvideodec-don-t-disable-output-port-but-allocate-o.patch36
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0002-omxvideodec-populate-output-buffers-in-the-component.patch29
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-omxvideodec-update-the-cached-data-of-output-port-de.patch27
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0004-omxvideodec-change-supported-color-formats-list-crea.patch126
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0005-omxh264dec-allow-to-accept-H.264-stream-in-a-nal-uni.patch27
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0006-omxvideodec-set-OMX-buffer-flags-if-GST_BUFFER_FLAG_.patch29
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-omxvideodec-remove-the-data-packets-left-queued-in-t.patch63
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0008-omxwmvdec-support-VC-1-stream-decoding.patch97
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0009-omxwmvdec-support-VC-1-advanced-profile.patch56
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0010-omxvideodec-don-t-start-the-output-thread-before-set.patch74
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0011-omxvideodec-don-t-use-gst_buffer_map-when-copying-to.patch45
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0012-gstomx-Once-reinitialize-an-instance-and-then-retry-.patch36
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0013-gstomx-fix-a-missing-g_free.patch24
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0014-gstomx-Once-reinitialize-an-instance-and-then-retry-.patch39
-rw-r--r--common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0015-omxmpeg4videodec-conform-caps-template-to-the-defini.patch30
16 files changed, 768 insertions, 0 deletions
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omx-fixed-type-error-in-printf-call.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omx-fixed-type-error-in-printf-call.patch
new file mode 100644
index 0000000..a428ac9
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omx-fixed-type-error-in-printf-call.patch
@@ -0,0 +1,30 @@
+From f629e041e9f678fcd86ad764a15117dff63c271c Mon Sep 17 00:00:00 2001
+From: Carlos Rafael Giani <dv@pseudoterminal.org>
+Date: Sat, 27 Apr 2013 02:50:25 +0200
+Subject: [PATCH] omx: fixed type error in printf call
+
+%zu expects size_t
+
+Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=699008]
+
+Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
+---
+ omx/gstomx.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/omx/gstomx.c b/omx/gstomx.c
+index a2945ed..1eca7cc 100644
+--- a/omx/gstomx.c
++++ b/omx/gstomx.c
+@@ -1630,7 +1630,7 @@ gst_omx_port_allocate_buffers_unlocked (GstOMXPort * port,
+
+ GST_INFO_OBJECT (comp->parent,
+ "Allocating %d buffers of size %zu for %s port %u", n,
+- port->port_def.nBufferSize, comp->name, (guint) port->index);
++ (size_t) (port->port_def.nBufferSize), comp->name, (guint) port->index);
+
+ if (!port->buffers)
+ port->buffers = g_ptr_array_sized_new (n);
+--
+1.7.9.5
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omxvideodec-don-t-disable-output-port-but-allocate-o.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omxvideodec-don-t-disable-output-port-but-allocate-o.patch
new file mode 100644
index 0000000..b24dbeb
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omxvideodec-don-t-disable-output-port-but-allocate-o.patch
@@ -0,0 +1,36 @@
+From ca11a82ecfed260dfde19dfec5d9f27e0c5b4be5 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Wed, 5 Jun 2013 16:54:33 +0900
+Subject: [PATCH 01/14] omxvideodec: don't disable output port but allocate
+ output buffers when changing to idle
+
+According to the OpenMax specification, buffers for the component to
+use for all of the ports must be required to be allocated when
+changing to idle state. The input/output ports can't be disabled
+at this time.
+---
+ omx/gstomxvideodec.c | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
+index 976f58e..7f6a48e 100644
+--- a/omx/gstomxvideodec.c
++++ b/omx/gstomxvideodec.c
+@@ -2097,13 +2097,7 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
+ /* Need to allocate buffers to reach Idle state */
+ if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone)
+ return FALSE;
+-
+- /* And disable output port */
+- if (gst_omx_port_set_enabled (self->dec_out_port, FALSE) != OMX_ErrorNone)
+- return FALSE;
+-
+- if (gst_omx_port_wait_enabled (self->dec_out_port,
+- 1 * GST_SECOND) != OMX_ErrorNone)
++ if (gst_omx_port_allocate_buffers (self->dec_out_port) != OMX_ErrorNone)
+ return FALSE;
+
+ if (gst_omx_component_get_state (self->dec,
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0002-omxvideodec-populate-output-buffers-in-the-component.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0002-omxvideodec-populate-output-buffers-in-the-component.patch
new file mode 100644
index 0000000..4e1d59f
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0002-omxvideodec-populate-output-buffers-in-the-component.patch
@@ -0,0 +1,29 @@
+From fc7d4dec94367fcd9a3757667a10715897276c22 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Wed, 5 Jun 2013 17:28:47 +0900
+Subject: [PATCH 02/14] omxvideodec: populate output buffers in the component
+
+All of the output buffers must be populated in the component with
+FillThisBuffer() beforehand so that gst_omx_video_dec_loop() waits
+for output buffers to be obtained properly.
+---
+ omx/gstomxvideodec.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
+index 7f6a48e..73f677b 100644
+--- a/omx/gstomxvideodec.c
++++ b/omx/gstomxvideodec.c
+@@ -2111,6 +2111,9 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
+ if (gst_omx_component_get_state (self->dec,
+ GST_CLOCK_TIME_NONE) != OMX_StateExecuting)
+ return FALSE;
++
++ if (gst_omx_port_populate (self->dec_out_port) != OMX_ErrorNone)
++ return FALSE;
+ }
+
+ /* Unset flushing to allow ports to accept data again */
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-omxvideodec-update-the-cached-data-of-output-port-de.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-omxvideodec-update-the-cached-data-of-output-port-de.patch
new file mode 100644
index 0000000..f8dc325
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-omxvideodec-update-the-cached-data-of-output-port-de.patch
@@ -0,0 +1,27 @@
+From 881373684539709a23f842cdfd8cbc1dbef76673 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Wed, 5 Jun 2013 17:52:18 +0900
+Subject: [PATCH 03/14] omxvideodec: update the cached data of output port
+ definition after its changes
+
+This change reflects the change by negotiating caps with downstream.
+---
+ omx/gstomxvideodec.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
+index 73f677b..df6362b 100644
+--- a/omx/gstomxvideodec.c
++++ b/omx/gstomxvideodec.c
+@@ -1443,6 +1443,8 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
+
+ GST_VIDEO_DECODER_STREAM_UNLOCK (self);
+
++ gst_omx_port_update_port_definition (self->dec_out_port, NULL);
++
+ if (acq_return == GST_OMX_ACQUIRE_BUFFER_RECONFIGURE) {
+ err = gst_omx_video_dec_allocate_output_buffers (self);
+ if (err != OMX_ErrorNone)
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0004-omxvideodec-change-supported-color-formats-list-crea.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0004-omxvideodec-change-supported-color-formats-list-crea.patch
new file mode 100644
index 0000000..1f20871
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0004-omxvideodec-change-supported-color-formats-list-crea.patch
@@ -0,0 +1,126 @@
+From 92bf075e1ce4b2687acc84f56ffbfff17883069e Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 6 Jun 2013 11:31:27 +0900
+Subject: [PATCH 04/14] omxvideodec: change supported color formats list
+ creation
+
+To create supported color formats list for caps negotiation,
+this change tries to set each color format that is prepared in
+a list beforehand and determines which color formats are supported
+by the component. The more components can be dealt with by this
+support.
+
+NV12 color format is put at the top of the list declared as a constant
+so that the caps negotiation gives top priority to this color format.
+---
+ omx/gstomxvideodec.c | 84 +++++++++++++++++++++++-----------------------------
+ 1 file changed, 37 insertions(+), 47 deletions(-)
+
+diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
+index df6362b..62ee5c5 100644
+--- a/omx/gstomxvideodec.c
++++ b/omx/gstomxvideodec.c
+@@ -1793,63 +1793,53 @@ static GList *
+ gst_omx_video_dec_get_supported_colorformats (GstOMXVideoDec * self)
+ {
+ GstOMXPort *port = self->dec_out_port;
+- GstVideoCodecState *state = self->input_state;
+ OMX_VIDEO_PARAM_PORTFORMATTYPE param;
+ OMX_ERRORTYPE err;
+ GList *negotiation_map = NULL;
+- gint old_index;
++ gint i;
++ OMX_COLOR_FORMATTYPE format_org;
++ VideoNegotiationMap *m;
++ const VideoNegotiationMap format_list[] = {
++ {GST_VIDEO_FORMAT_NV12, OMX_COLOR_FormatYUV420SemiPlanar},
++ {GST_VIDEO_FORMAT_I420, OMX_COLOR_FormatYUV420Planar},
++ {GST_VIDEO_FORMAT_I420, OMX_COLOR_FormatYUV420PackedPlanar},
++ };
+
+ GST_OMX_INIT_STRUCT (&param);
+ param.nPortIndex = port->index;
+- param.nIndex = 0;
+- if (!state || state->info.fps_n == 0)
+- param.xFramerate = 0;
+- else
+- param.xFramerate = (state->info.fps_n << 16) / (state->info.fps_d);
+
+- old_index = -1;
+- do {
+- VideoNegotiationMap *m;
++ err = gst_omx_component_get_parameter (self->dec,
++ OMX_IndexParamVideoPortFormat, &param);
++ if (err != OMX_ErrorNone) {
++ GST_ERROR_OBJECT (self,
++ "Failed to getting video port format (err info: %s (0x%08x))",
++ gst_omx_error_to_string (err), err);
++ return NULL;
++ }
++ /* temporary save original format type */
++ format_org = param.eColorFormat;
+
+- err =
+- gst_omx_component_get_parameter (self->dec,
++ for (i = 0; i < sizeof (format_list) / sizeof (VideoNegotiationMap); i++) {
++ param.eColorFormat = format_list[i].type;
++ err = gst_omx_component_set_parameter (self->dec,
+ OMX_IndexParamVideoPortFormat, &param);
+-
+- /* FIXME: Workaround for Bellagio that simply always
+- * returns the same value regardless of nIndex and
+- * never returns OMX_ErrorNoMore
+- */
+- if (old_index == param.nIndex)
+- break;
+-
+- if (err == OMX_ErrorNone || err == OMX_ErrorNoMore) {
+- switch (param.eColorFormat) {
+- case OMX_COLOR_FormatYUV420Planar:
+- case OMX_COLOR_FormatYUV420PackedPlanar:
+- m = g_slice_new (VideoNegotiationMap);
+- m->format = GST_VIDEO_FORMAT_I420;
+- m->type = param.eColorFormat;
+- negotiation_map = g_list_append (negotiation_map, m);
+- GST_DEBUG_OBJECT (self, "Component supports I420 (%d) at index %d",
+- param.eColorFormat, param.nIndex);
+- break;
+- case OMX_COLOR_FormatYUV420SemiPlanar:
+- m = g_slice_new (VideoNegotiationMap);
+- m->format = GST_VIDEO_FORMAT_NV12;
+- m->type = param.eColorFormat;
+- negotiation_map = g_list_append (negotiation_map, m);
+- GST_DEBUG_OBJECT (self, "Component supports NV12 (%d) at index %d",
+- param.eColorFormat, param.nIndex);
+- break;
+- default:
+- GST_DEBUG_OBJECT (self,
+- "Component supports unsupported color format %d at index %d",
+- param.eColorFormat, param.nIndex);
+- break;
+- }
++ if (err == OMX_ErrorNone) {
++ m = g_slice_new (VideoNegotiationMap);
++ m->format = format_list[i].format;
++ m->type = format_list[i].type;
++ negotiation_map = g_list_append (negotiation_map, m);
++ GST_DEBUG_OBJECT (self, "Component supports (%d)", param.eColorFormat);
+ }
+- old_index = param.nIndex++;
+- } while (err == OMX_ErrorNone);
++ }
++
++ /* restore setting */
++ param.eColorFormat = format_org;
++ err = gst_omx_component_set_parameter (self->dec,
++ OMX_IndexParamVideoPortFormat, &param);
++ if (err != OMX_ErrorNone)
++ GST_ERROR_OBJECT (self,
++ "Failed to seetting video port format (err info: %s (0x%08x))",
++ gst_omx_error_to_string (err), err);
+
+ return negotiation_map;
+ }
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0005-omxh264dec-allow-to-accept-H.264-stream-in-a-nal-uni.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0005-omxh264dec-allow-to-accept-H.264-stream-in-a-nal-uni.patch
new file mode 100644
index 0000000..0ca832d
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0005-omxh264dec-allow-to-accept-H.264-stream-in-a-nal-uni.patch
@@ -0,0 +1,27 @@
+From 5c13ed4eeeb151b5bc648eb6f7262f65903470c4 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Fri, 7 Jun 2013 14:07:57 +0900
+Subject: [PATCH 05/14] omxh264dec: allow to accept H.264 stream in a nal unit
+
+This change allows to set caps to "alignment=nal" in order to
+receive H.264 stream that is split into a nal unit.
+---
+ omx/gstomxh264dec.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/omx/gstomxh264dec.c b/omx/gstomxh264dec.c
+index 2581889..3ed41fc 100644
+--- a/omx/gstomxh264dec.c
++++ b/omx/gstomxh264dec.c
+@@ -61,7 +61,7 @@ gst_omx_h264_dec_class_init (GstOMXH264DecClass * klass)
+
+ videodec_class->cdata.default_sink_template_caps = "video/x-h264, "
+ "parsed=(boolean) true, "
+- "alignment=(string) au, "
++ "alignment=(string) { au, nal }, "
+ "stream-format=(string) byte-stream, "
+ "width=(int) [1,MAX], " "height=(int) [1,MAX]";
+
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0006-omxvideodec-set-OMX-buffer-flags-if-GST_BUFFER_FLAG_.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0006-omxvideodec-set-OMX-buffer-flags-if-GST_BUFFER_FLAG_.patch
new file mode 100644
index 0000000..297ec78
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0006-omxvideodec-set-OMX-buffer-flags-if-GST_BUFFER_FLAG_.patch
@@ -0,0 +1,29 @@
+From 8c999df451f8e4307b71d83177f904d1c2ebd346 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Fri, 7 Jun 2013 15:59:21 +0900
+Subject: [PATCH 06/14] omxvideodec: set OMX buffer flags if
+ GST_BUFFER_FLAG_HEADER is detected
+
+OMX for R-CarM1A requires that the OMX_BUFFERFLAG_CODECCONFIG flag
+be set if the Nal unit type is SPS or PPS.
+---
+ omx/gstomxvideodec.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
+index 62ee5c5..1bdac85 100644
+--- a/omx/gstomxvideodec.c
++++ b/omx/gstomxvideodec.c
+@@ -2383,6 +2383,9 @@ gst_omx_video_dec_handle_frame (GstVideoDecoder * decoder,
+ if (offset == size)
+ buf->omx_buf->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
+
++ if (GST_BUFFER_FLAG_IS_SET (frame->input_buffer, GST_BUFFER_FLAG_HEADER))
++ buf->omx_buf->nFlags |= OMX_BUFFERFLAG_CODECCONFIG;
++
+ self->started = TRUE;
+ err = gst_omx_port_release_buffer (port, buf);
+ if (err != OMX_ErrorNone)
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-omxvideodec-remove-the-data-packets-left-queued-in-t.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-omxvideodec-remove-the-data-packets-left-queued-in-t.patch
new file mode 100644
index 0000000..15d2478
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-omxvideodec-remove-the-data-packets-left-queued-in-t.patch
@@ -0,0 +1,63 @@
+From 53072a001ad615377144a1e9ed38f4664496fc8c Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 13 Jun 2013 12:08:04 +0900
+Subject: [PATCH 07/14] omxvideodec: remove the data packets left queued in the
+ VideoDecoder class
+
+This change is required when the data packets split from a frame
+are queued in VideoDecoder class. The VideoDecoder class only takes account
+into frame to frame decoding, so subsequent packets aren't cleared
+from the queue in the VideoDecoder class.
+These should be removed before the test to determine if the remaining
+data in the queue is needed to be dropped.
+---
+ omx/gstomxvideodec.c | 33 +++++++++++++++++++++++++++++++++
+ 1 file changed, 33 insertions(+)
+
+diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
+index 1bdac85..e8c276b 100644
+--- a/omx/gstomxvideodec.c
++++ b/omx/gstomxvideodec.c
+@@ -949,6 +949,39 @@ _find_nearest_frame (GstOMXVideoDec * self, GstOMXBuffer * buf)
+ }
+
+ if (best_id) {
++ /* This processing is required when the data packets split from a frame
++ * are queued in VideoDecoder class. The VideoDecoder class takes account
++ * into frame to frame decoding, so the subsequent packets are left queued.
++ * These should be removed before the test to determine if the remaining
++ * data in the queue is needed to be dropped.
++ */
++ for (l = frames; l; l = l->next) {
++ GstVideoCodecFrame *tmp;
++ BufferIdentification *id;
++
++ tmp = l->data;
++ id = gst_video_codec_frame_get_user_data (tmp);
++
++ /* This happens for frames that were just added but
++ * which were not passed to the component yet. Ignore
++ * them here!
++ */
++ if (!id)
++ continue;
++
++ if (id->timestamp == best_timestamp && l != best_l) {
++ GstVideoCodecFrame *removal;
++
++ removal = gst_video_decoder_get_frame (GST_VIDEO_DECODER (self),
++ tmp->system_frame_number);
++ gst_video_decoder_release_frame (GST_VIDEO_DECODER (self), removal);
++ }
++ }
++
++ g_list_foreach (frames, (GFunc) gst_video_codec_frame_unref, NULL);
++ g_list_free (frames);
++ frames = gst_video_decoder_get_frames (GST_VIDEO_DECODER (self));
++
+ for (l = frames; l && l != best_l; l = l->next) {
+ GstVideoCodecFrame *tmp = l->data;
+ BufferIdentification *id = gst_video_codec_frame_get_user_data (tmp);
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0008-omxwmvdec-support-VC-1-stream-decoding.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0008-omxwmvdec-support-VC-1-stream-decoding.patch
new file mode 100644
index 0000000..f68c421
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0008-omxwmvdec-support-VC-1-stream-decoding.patch
@@ -0,0 +1,97 @@
+From b5605b7ce31c43bc29d15507389d980d09eb914a Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Mon, 17 Jun 2013 17:41:05 +0900
+Subject: [PATCH 08/14] omxwmvdec: support VC-1 stream decoding
+
+The input sequence header must be sent to the REL OMX component before
+pushing the frame data according to the spec.
+This patch sets codec_data to the the sequence header first,
+then the processing keeps being passed with doing nothing.
+
+Only the Simple/Main profiles are supported by this patch.
+Advanced profile isn't supported yet.
+---
+ omx/gstomxwmvdec.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 50 insertions(+)
+
+diff --git a/omx/gstomxwmvdec.c b/omx/gstomxwmvdec.c
+index 64460d9..0f8f2db 100644
+--- a/omx/gstomxwmvdec.c
++++ b/omx/gstomxwmvdec.c
+@@ -34,12 +34,16 @@ static gboolean gst_omx_wmv_dec_is_format_change (GstOMXVideoDec * dec,
+ GstOMXPort * port, GstVideoCodecState * state);
+ static gboolean gst_omx_wmv_dec_set_format (GstOMXVideoDec * dec,
+ GstOMXPort * port, GstVideoCodecState * state);
++static GstFlowReturn gst_omx_wmv_dec_prepare_frame (GstOMXVideoDec * self,
++ GstVideoCodecFrame * frame);
+
+ enum
+ {
+ PROP_0
+ };
+
++#define SEQ_PARAM_BUF_SIZE 24
++
+ /* class initialization */
+
+ #define DEBUG_INIT \
+@@ -58,6 +62,8 @@ gst_omx_wmv_dec_class_init (GstOMXWMVDecClass * klass)
+ videodec_class->is_format_change =
+ GST_DEBUG_FUNCPTR (gst_omx_wmv_dec_is_format_change);
+ videodec_class->set_format = GST_DEBUG_FUNCPTR (gst_omx_wmv_dec_set_format);
++ videodec_class->prepare_frame =
++ GST_DEBUG_FUNCPTR (gst_omx_wmv_dec_prepare_frame);
+
+ videodec_class->cdata.default_sink_template_caps = "video/x-wmv, "
+ "width=(int) [1,MAX], " "height=(int) [1,MAX]";
+@@ -96,3 +102,47 @@ gst_omx_wmv_dec_set_format (GstOMXVideoDec * dec, GstOMXPort * port,
+
+ return ret;
+ }
++
++static GstFlowReturn
++gst_omx_wmv_dec_prepare_frame (GstOMXVideoDec * self,
++ GstVideoCodecFrame * frame)
++{
++ if (self->codec_data) {
++ OMX_PARAM_PORTDEFINITIONTYPE port_def;
++ guint32 *SeqHdrBuf;
++ guint8 *u8ptr;
++ GstMapInfo info;
++
++ gst_omx_port_get_port_definition (self->dec_in_port, &port_def);
++
++ if (!gst_buffer_map (self->codec_data, &info, GST_MAP_READ)) {
++ GST_ERROR_OBJECT (self, "Failed to create a gstbuffer mapping");
++ return GST_FLOW_ERROR;
++ }
++
++ SeqHdrBuf = (guint32 *) g_malloc (SEQ_PARAM_BUF_SIZE);
++ if (SeqHdrBuf == NULL) {
++ GST_ERROR_OBJECT (self, "Failed to g_malloc");
++ return GST_FLOW_ERROR;
++ }
++
++ /* create sequence header */
++ SeqHdrBuf[0] = 0xc5000000;
++ SeqHdrBuf[1] = 0x00000004;
++ u8ptr = (guint8 *) & SeqHdrBuf[2];
++ u8ptr[0] = info.data[0];
++ u8ptr[1] = info.data[1];
++ u8ptr[2] = info.data[2];
++ u8ptr[3] = info.data[3];
++ SeqHdrBuf[3] = port_def.format.video.nFrameHeight;
++ SeqHdrBuf[4] = port_def.format.video.nFrameWidth;
++ SeqHdrBuf[5] = 0x0000000c;
++
++ gst_buffer_unmap (self->codec_data, &info);
++
++ gst_buffer_replace (&self->codec_data, NULL);
++ self->codec_data = gst_buffer_new_wrapped (SeqHdrBuf, SEQ_PARAM_BUF_SIZE);
++ }
++
++ return GST_FLOW_OK;
++}
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0009-omxwmvdec-support-VC-1-advanced-profile.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0009-omxwmvdec-support-VC-1-advanced-profile.patch
new file mode 100644
index 0000000..3d31b1c
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0009-omxwmvdec-support-VC-1-advanced-profile.patch
@@ -0,0 +1,56 @@
+From 5ad42791ad2d93bd694bf5faa466ccaffee7d23b Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Wed, 19 Jun 2013 16:03:02 +0900
+Subject: [PATCH 09/14] omxwmvdec: support VC-1 advanced profile
+
+If VC-1 advanced profile stream is demuxed, codec_data has a sequence
+header and a entry point header. At the beginning of playback,
+this patch pushes a buffer which is the concatenation of sequence header,
+entry point header and first frame data to decode the advanced profile
+stream.
+---
+ omx/gstomxwmvdec.c | 28 +++++++++++++++++++++++++++-
+ 1 file changed, 27 insertions(+), 1 deletion(-)
+
+diff --git a/omx/gstomxwmvdec.c b/omx/gstomxwmvdec.c
+index 0f8f2db..a3bd3c5 100644
+--- a/omx/gstomxwmvdec.c
++++ b/omx/gstomxwmvdec.c
+@@ -107,7 +107,33 @@ static GstFlowReturn
+ gst_omx_wmv_dec_prepare_frame (GstOMXVideoDec * self,
+ GstVideoCodecFrame * frame)
+ {
+- if (self->codec_data) {
++ GstCaps *caps;
++ gboolean is_ap = FALSE;
++ GstStructure *structure;
++ const gchar *fourcc;
++
++ if (self->codec_data == NULL)
++ return GST_FLOW_OK;
++
++ caps = gst_pad_get_current_caps (GST_VIDEO_DECODER_SINK_PAD (self));
++ structure = gst_caps_get_structure (caps, 0);
++ fourcc = gst_structure_get_string (structure, "format");
++ if (fourcc) {
++ if (strncmp (fourcc, "WVC1", strlen ("WVC1")) == 0) {
++ GST_INFO_OBJECT (self, "stream type is Advanced Profile");
++ is_ap = TRUE;
++ } else {
++ GST_INFO_OBJECT (self, "stream type is Simple/Main Profile");
++ is_ap = FALSE;
++ }
++ }
++ gst_caps_unref (caps);
++
++ if (is_ap) {
++ frame->input_buffer =
++ gst_buffer_append (self->codec_data, frame->input_buffer);
++ self->codec_data = NULL;
++ } else {
+ OMX_PARAM_PORTDEFINITIONTYPE port_def;
+ guint32 *SeqHdrBuf;
+ guint8 *u8ptr;
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0010-omxvideodec-don-t-start-the-output-thread-before-set.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0010-omxvideodec-don-t-start-the-output-thread-before-set.patch
new file mode 100644
index 0000000..d9bb319
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0010-omxvideodec-don-t-start-the-output-thread-before-set.patch
@@ -0,0 +1,74 @@
+From 51d51503f9a1bd52e32d08a81b1ab9b2c0996161 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Tue, 25 Jun 2013 19:23:28 +0900
+Subject: [PATCH 10/14] omxvideodec: don't start the output thread before
+ set_format has been done
+
+reset() method is invoked before set_format() has been invoked at
+the initialization. Thus the output thread is launched before output
+buffers haven't been populated into the component with FillThisBuffer() yet.
+This might cause a malfunction of decoding.
+To resolve the above issue, the output thread invocation in the
+reset() method is restricted before the processing necessary to
+activate the component with set_format_done flag.
+---
+ omx/gstomxvideodec.c | 8 ++++++--
+ omx/gstomxvideodec.h | 2 ++
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
+index e8c276b..2beaac6 100644
+--- a/omx/gstomxvideodec.c
++++ b/omx/gstomxvideodec.c
+@@ -735,6 +735,7 @@ gst_omx_video_dec_open (GstVideoDecoder * decoder)
+ klass->cdata.component_name, klass->cdata.component_role,
+ klass->cdata.hacks);
+ self->started = FALSE;
++ self->set_format_done = FALSE;
+
+ if (!self->dec)
+ return FALSE;
+@@ -819,6 +820,7 @@ gst_omx_video_dec_close (GstVideoDecoder * decoder)
+ self->dec = NULL;
+
+ self->started = FALSE;
++ self->set_format_done = FALSE;
+
+ GST_DEBUG_OBJECT (self, "Closed decoder");
+
+@@ -2158,6 +2160,7 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
+ self->downstream_flow_ret = GST_FLOW_OK;
+ gst_pad_start_task (GST_VIDEO_DECODER_SRC_PAD (self),
+ (GstTaskFunction) gst_omx_video_dec_loop, decoder, NULL);
++ self->set_format_done = TRUE;
+
+ return TRUE;
+ }
+@@ -2192,8 +2195,9 @@ gst_omx_video_dec_reset (GstVideoDecoder * decoder, gboolean hard)
+ self->last_upstream_ts = 0;
+ self->eos = FALSE;
+ self->downstream_flow_ret = GST_FLOW_OK;
+- gst_pad_start_task (GST_VIDEO_DECODER_SRC_PAD (self),
+- (GstTaskFunction) gst_omx_video_dec_loop, decoder, NULL);
++ if (self->set_format_done)
++ gst_pad_start_task (GST_VIDEO_DECODER_SRC_PAD (self),
++ (GstTaskFunction) gst_omx_video_dec_loop, decoder, NULL);
+
+ GST_DEBUG_OBJECT (self, "Reset decoder");
+
+diff --git a/omx/gstomxvideodec.h b/omx/gstomxvideodec.h
+index 8f0f98b..747bc36 100644
+--- a/omx/gstomxvideodec.h
++++ b/omx/gstomxvideodec.h
+@@ -62,6 +62,8 @@ struct _GstOMXVideoDec
+ * the first buffer */
+ gboolean started;
+
++ gboolean set_format_done;
++
+ GstClockTime last_upstream_ts;
+
+ /* Draining state */
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0011-omxvideodec-don-t-use-gst_buffer_map-when-copying-to.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0011-omxvideodec-don-t-use-gst_buffer_map-when-copying-to.patch
new file mode 100644
index 0000000..e593629
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0011-omxvideodec-don-t-use-gst_buffer_map-when-copying-to.patch
@@ -0,0 +1,45 @@
+From 23a56fb86827f4555e30fa587df32fb00f709877 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 27 Jun 2013 19:07:19 +0900
+Subject: [PATCH 11/14] omxvideodec: don't use gst_buffer_map when copying to
+ the output buffers
+
+When the preallocated buffers which are separated into multiple blocks
+are received from a sink plugin, gst_buffer_map() could return
+the different pointer from the buffers received from the sink plugin.
+Probably it is newly allocated because the buffers are mistakenly
+regarded as being discontiguous and tried to be collected into a
+region with copying.
+It is safety that the stride and the slice height are always taken
+account into when copying to the output buffers.
+---
+ omx/gstomxvideodec.c | 13 -------------
+ 1 file changed, 13 deletions(-)
+
+diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
+index 2beaac6..1c3a64c 100644
+--- a/omx/gstomxvideodec.c
++++ b/omx/gstomxvideodec.c
+@@ -1048,19 +1048,6 @@ gst_omx_video_dec_fill_buffer (GstOMXVideoDec * self,
+ goto done;
+ }
+
+- /* Same strides and everything */
+- if (gst_buffer_get_size (outbuf) == inbuf->omx_buf->nFilledLen) {
+- GstMapInfo map = GST_MAP_INFO_INIT;
+-
+- gst_buffer_map (outbuf, &map, GST_MAP_WRITE);
+- memcpy (map.data,
+- inbuf->omx_buf->pBuffer + inbuf->omx_buf->nOffset,
+- inbuf->omx_buf->nFilledLen);
+- gst_buffer_unmap (outbuf, &map);
+- ret = TRUE;
+- goto done;
+- }
+-
+ /* Different strides */
+
+ switch (vinfo->finfo->format) {
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0012-gstomx-Once-reinitialize-an-instance-and-then-retry-.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0012-gstomx-Once-reinitialize-an-instance-and-then-retry-.patch
new file mode 100644
index 0000000..743d849
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0012-gstomx-Once-reinitialize-an-instance-and-then-retry-.patch
@@ -0,0 +1,36 @@
+From 2319fa55b99d8bc0285f79f2cc322aa6ffdce41f Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 27 Jun 2013 21:50:31 +0900
+Subject: [PATCH 12/14] gstomx: Once reinitialize an instance and then retry
+ OMX_Init() if it fails
+
+Reinitializing an instance in case that OMX_Init() fails may
+be effective especially for some stateful OMXIL libraries since it
+resets the state.
+---
+ omx/gstomx.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/omx/gstomx.c b/omx/gstomx.c
+index f542954..be4c4dd 100644
+--- a/omx/gstomx.c
++++ b/omx/gstomx.c
+@@ -133,9 +133,15 @@ gst_omx_core_acquire (const gchar * filename)
+ core->user_count++;
+ if (core->user_count == 1) {
+ OMX_ERRORTYPE err;
++ int retry = 1;
+
++ reinit:
+ err = core->init ();
+ if (err != OMX_ErrorNone) {
++ if (retry-- > 0) {
++ core->deinit ();
++ goto reinit;
++ }
+ GST_ERROR ("Failed to initialize core '%s': 0x%08x", filename, err);
+ g_mutex_unlock (&core->lock);
+ goto error;
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0013-gstomx-fix-a-missing-g_free.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0013-gstomx-fix-a-missing-g_free.patch
new file mode 100644
index 0000000..fa91c71
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0013-gstomx-fix-a-missing-g_free.patch
@@ -0,0 +1,24 @@
+From 8ba852a436d22604897526cb3408e51626b7dd5f Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 27 Jun 2013 21:59:29 +0900
+Subject: [PATCH 13/14] gstomx: fix a missing g_free
+
+---
+ omx/gstomx.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/omx/gstomx.c b/omx/gstomx.c
+index be4c4dd..6738d98 100644
+--- a/omx/gstomx.c
++++ b/omx/gstomx.c
+@@ -651,6 +651,7 @@ gst_omx_component_new (GstObject * parent, const gchar * core_name,
+ "Failed to get component handle '%s' from core '%s': 0x%08x",
+ component_name, core_name, err);
+ gst_omx_core_release (core);
++ g_free (comp->name);
+ g_slice_free (GstOMXComponent, comp);
+ return NULL;
+ }
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0014-gstomx-Once-reinitialize-an-instance-and-then-retry-.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0014-gstomx-Once-reinitialize-an-instance-and-then-retry-.patch
new file mode 100644
index 0000000..f20d81d
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0014-gstomx-Once-reinitialize-an-instance-and-then-retry-.patch
@@ -0,0 +1,39 @@
+From 4a858bb6cf197653aa77f6a3d8b652a793419291 Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Thu, 27 Jun 2013 22:03:37 +0900
+Subject: [PATCH 14/14] gstomx: Once reinitialize an instance and then retry
+ OMX_Init() if OMX_GetHandle() fails
+
+Reinitializing an instance in case that OMX_GetHandle() fails may
+be effective especially for some stateful OMXIL libraries since it
+resets the state.
+---
+ omx/gstomx.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/omx/gstomx.c b/omx/gstomx.c
+index 6738d98..6b0a3d1 100644
+--- a/omx/gstomx.c
++++ b/omx/gstomx.c
+@@ -630,7 +630,9 @@ gst_omx_component_new (GstObject * parent, const gchar * core_name,
+ GstOMXCore *core;
+ GstOMXComponent *comp;
+ const gchar *dot;
++ gint retry = 1;
+
++reinit:
+ core = gst_omx_core_acquire (core_name);
+ if (!core)
+ return NULL;
+@@ -653,6 +655,8 @@ gst_omx_component_new (GstObject * parent, const gchar * core_name,
+ gst_omx_core_release (core);
+ g_free (comp->name);
+ g_slice_free (GstOMXComponent, comp);
++ if (retry-- > 0)
++ goto reinit;
+ return NULL;
+ }
+ GST_DEBUG_OBJECT (parent,
+--
+1.8.1.2
+
diff --git a/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0015-omxmpeg4videodec-conform-caps-template-to-the-defini.patch b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0015-omxmpeg4videodec-conform-caps-template-to-the-defini.patch
new file mode 100644
index 0000000..9dac021
--- /dev/null
+++ b/common/recipes-multimedia/gstreamer/gstreamer1.0-omx/0015-omxmpeg4videodec-conform-caps-template-to-the-defini.patch
@@ -0,0 +1,30 @@
+From d2e63c6780b323ae8dc03b0236e7e87c0a8832dc Mon Sep 17 00:00:00 2001
+From: Kazunori Kobayashi <kkobayas@igel.co.jp>
+Date: Mon, 1 Jul 2013 13:33:07 +0900
+Subject: [PATCH 15/15] omxmpeg4videodec: conform caps template to the
+ definition described in avidemux
+
+This is to avoid the caps negotiation failure between avidemux and
+omxmpeg4videodec.
+---
+ omx/gstomxmpeg4videodec.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/omx/gstomxmpeg4videodec.c b/omx/gstomxmpeg4videodec.c
+index d912d74..ade12fc 100644
+--- a/omx/gstomxmpeg4videodec.c
++++ b/omx/gstomxmpeg4videodec.c
+@@ -62,9 +62,7 @@ gst_omx_mpeg4_video_dec_class_init (GstOMXMPEG4VideoDecClass * klass)
+ GST_DEBUG_FUNCPTR (gst_omx_mpeg4_video_dec_set_format);
+
+ videodec_class->cdata.default_sink_template_caps = "video/mpeg, "
+- "mpegversion=(int) 4, "
+- "systemstream=(boolean) false, "
+- "parsed=(boolean) true, " "width=(int) [1,MAX], " "height=(int) [1,MAX]";
++ "mpegversion=(int) 4, " "width=(int) [1,MAX], " "height=(int) [1,MAX]";
+
+ gst_element_class_set_static_metadata (element_class,
+ "OpenMAX MPEG4 Video Decoder",
+--
+1.8.1.2
+