aboutsummaryrefslogtreecommitdiffstats
path: root/meta-steppeeagle/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-gstomxvideoenc-implement-scaling-configuration-suppo.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-steppeeagle/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-gstomxvideoenc-implement-scaling-configuration-suppo.patch')
-rw-r--r--meta-steppeeagle/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-gstomxvideoenc-implement-scaling-configuration-suppo.patch155
1 files changed, 155 insertions, 0 deletions
diff --git a/meta-steppeeagle/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-gstomxvideoenc-implement-scaling-configuration-suppo.patch b/meta-steppeeagle/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-gstomxvideoenc-implement-scaling-configuration-suppo.patch
new file mode 100644
index 00000000..6db5e742
--- /dev/null
+++ b/meta-steppeeagle/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-gstomxvideoenc-implement-scaling-configuration-suppo.patch
@@ -0,0 +1,155 @@
+From 9d1fc5ceb72222037b959c1a2c3fe05c50de676a Mon Sep 17 00:00:00 2001
+From: Leo Liu <leo.liu@amd.com>
+Date: Thu, 14 Nov 2013 18:47:24 -0500
+Subject: [PATCH 07/11] gstomxvideoenc: implement scaling configuration
+ support
+
+Signed-off-by: Leo Liu <leo.liu@amd.com>
+---
+ omx/gstomxvideoenc.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++-
+ omx/gstomxvideoenc.h | 3 +++
+ 2 files changed, 75 insertions(+), 1 deletion(-)
+
+diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
+index 8f6cab3..ee41fa0 100644
+--- a/omx/gstomxvideoenc.c
++++ b/omx/gstomxvideoenc.c
+@@ -96,7 +96,9 @@ enum
+ PROP_TARGET_BITRATE,
+ PROP_QUANT_I_FRAMES,
+ PROP_QUANT_P_FRAMES,
+- PROP_QUANT_B_FRAMES
++ PROP_QUANT_B_FRAMES,
++ PROP_SCALING_WIDTH,
++ PROP_SCALING_HEIGHT
+ };
+
+ /* FIXME: Better defaults */
+@@ -105,6 +107,8 @@ enum
+ #define GST_OMX_VIDEO_ENC_QUANT_I_FRAMES_DEFAULT (0xffffffff)
+ #define GST_OMX_VIDEO_ENC_QUANT_P_FRAMES_DEFAULT (0xffffffff)
+ #define GST_OMX_VIDEO_ENC_QUANT_B_FRAMES_DEFAULT (0xffffffff)
++#define GST_OMX_VIDEO_ENC_SCALING_WIDTH_DEFAULT (0xffffffff)
++#define GST_OMX_VIDEO_ENC_SCALING_HEIGHT_DEFAULT (0xffffffff)
+
+ /* class initialization */
+
+@@ -163,6 +167,20 @@ gst_omx_video_enc_class_init (GstOMXVideoEncClass * klass)
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+ GST_PARAM_MUTABLE_READY));
+
++ g_object_class_install_property (gobject_class, PROP_SCALING_WIDTH,
++ g_param_spec_uint ("scaling-width", "Scaling Width",
++ "Scaling Width parameter (0xffffffff=component default)",
++ 0, G_MAXUINT, GST_OMX_VIDEO_ENC_SCALING_WIDTH_DEFAULT,
++ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
++ GST_PARAM_MUTABLE_READY));
++
++ g_object_class_install_property (gobject_class, PROP_SCALING_HEIGHT,
++ g_param_spec_uint ("scaling-height", "Scaling Height",
++ "Scaling Height parameter (0xffffffff=component default)",
++ 0, G_MAXUINT, GST_OMX_VIDEO_ENC_SCALING_HEIGHT_DEFAULT,
++ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
++ GST_PARAM_MUTABLE_READY));
++
+ element_class->change_state =
+ GST_DEBUG_FUNCPTR (gst_omx_video_enc_change_state);
+
+@@ -197,6 +215,8 @@ gst_omx_video_enc_init (GstOMXVideoEnc * self)
+ self->quant_i_frames = GST_OMX_VIDEO_ENC_QUANT_I_FRAMES_DEFAULT;
+ self->quant_p_frames = GST_OMX_VIDEO_ENC_QUANT_P_FRAMES_DEFAULT;
+ self->quant_b_frames = GST_OMX_VIDEO_ENC_QUANT_B_FRAMES_DEFAULT;
++ self->scaling_width = GST_OMX_VIDEO_ENC_SCALING_WIDTH_DEFAULT;
++ self->scaling_height = GST_OMX_VIDEO_ENC_SCALING_HEIGHT_DEFAULT;
+
+ g_mutex_init (&self->drain_lock);
+ g_cond_init (&self->drain_cond);
+@@ -345,6 +365,45 @@ gst_omx_video_enc_open (GstVideoEncoder * encoder)
+
+ }
+ }
++
++ if (self->scaling_width != 0xffffffff ||
++ self->scaling_height != 0xffffffff) {
++ OMX_CONFIG_SCALEFACTORTYPE scale_factor;
++ GST_OMX_INIT_STRUCT (&scale_factor);
++ scale_factor.nPortIndex = self->enc_out_port->index;
++
++ err = gst_omx_component_get_config (self->enc,
++ OMX_IndexConfigCommonScale, &scale_factor);
++
++ if (err == OMX_ErrorNone) {
++
++ if (self->scaling_width != 0xffffffff)
++ scale_factor.xWidth = self->scaling_width;
++ if (self->scaling_height != 0xffffffff)
++ scale_factor.xHeight = self->scaling_height;
++
++ err =
++ gst_omx_component_set_config (self->enc,
++ OMX_IndexConfigCommonScale, &scale_factor);
++ if (err == OMX_ErrorUnsupportedIndex) {
++ GST_WARNING_OBJECT (self,
++ "Setting scale configuration not supported by the component");
++ } else if (err == OMX_ErrorUnsupportedSetting) {
++ GST_WARNING_OBJECT (self,
++ "Setting scale configuration %u %u not supported by the component",
++ self->scaling_width, self->scaling_height);
++ } else if (err != OMX_ErrorNone) {
++ GST_ERROR_OBJECT (self,
++ "Failed to set scale configuration: %s (0x%08x)",
++ gst_omx_error_to_string (err), err);
++ return FALSE;
++ }
++ } else {
++ GST_ERROR_OBJECT (self,
++ "Failed to set scale configuration: %s (0x%08x)",
++ gst_omx_error_to_string (err), err);
++ }
++ }
+ }
+
+ return TRUE;
+@@ -443,6 +502,12 @@ gst_omx_video_enc_set_property (GObject * object, guint prop_id,
+ case PROP_QUANT_B_FRAMES:
+ self->quant_b_frames = g_value_get_uint (value);
+ break;
++ case PROP_SCALING_WIDTH:
++ self->scaling_width = g_value_get_uint (value);
++ break;
++ case PROP_SCALING_HEIGHT:
++ self->scaling_height = g_value_get_uint (value);
++ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+@@ -471,6 +536,12 @@ gst_omx_video_enc_get_property (GObject * object, guint prop_id, GValue * value,
+ case PROP_QUANT_B_FRAMES:
+ g_value_set_uint (value, self->quant_b_frames);
+ break;
++ case PROP_SCALING_WIDTH:
++ g_value_set_uint (value, self->scaling_width);
++ break;
++ case PROP_SCALING_HEIGHT:
++ g_value_set_uint (value, self->scaling_height);
++ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+diff --git a/omx/gstomxvideoenc.h b/omx/gstomxvideoenc.h
+index e266537..86e9c8f 100644
+--- a/omx/gstomxvideoenc.h
++++ b/omx/gstomxvideoenc.h
+@@ -77,6 +77,9 @@ struct _GstOMXVideoEnc
+ guint32 quant_p_frames;
+ guint32 quant_b_frames;
+
++ guint32 scaling_width;
++ guint32 scaling_height;
++
+ GstFlowReturn downstream_flow_ret;
+ };
+
+--
+1.7.9.5
+