From: <fe...@ke...> - 2008-12-08 21:08:20
|
CVS Root: /cvs/gstreamer Module: gst-openmax Changes by: felipec Date: Mon Dec 08 2008 21:08:18 UTC Log message: jpegenc: Add quality property. Modified files: omx : gstomx_jpegenc.c gstomx_jpegenc.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-openmax/omx/gstomx_jpegenc.c.diff?r1=1.3&r2=1.4 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-openmax/omx/gstomx_jpegenc.h.diff?r1=1.1&r2=1.2 ====Begin Diffs==== Index: gstomx_jpegenc.c =================================================================== RCS file: /cvs/gstreamer/gst-openmax/omx/gstomx_jpegenc.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- gstomx_jpegenc.c 20 Nov 2008 16:33:15 -0000 1.3 +++ gstomx_jpegenc.c 8 Dec 2008 21:08:03 -0000 1.4 @@ -27,6 +27,14 @@ #include <stdlib.h> #include <stdbool.h> +enum +{ + ARG_0, + ARG_QUALITY +}; + +#define DEFAULT_QUALITY 90 #define OMX_COMPONENT_NAME "OMX.st.image_encoder.jpeg" static GstOmxBaseFilterClass *parent_class = NULL; @@ -123,6 +131,48 @@ } static void +set_property (GObject *obj, + guint prop_id, + const GValue *value, + GParamSpec *pspec) + GstOmxJpegEnc *self; + self = GST_OMX_JPEGENC (obj); + switch (prop_id) + { + case ARG_QUALITY: + self->quality = g_value_get_uint (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); + } +} +static void +get_property (GObject *obj, + GValue *value, + g_value_set_uint (value, self->quality); type_class_init (gpointer g_class, gpointer class_data) { @@ -131,6 +181,17 @@ gobject_class = G_OBJECT_CLASS (g_class); parent_class = g_type_class_ref (GST_OMX_BASE_FILTER_TYPE); + /* Properties stuff */ + gobject_class->set_property = set_property; + gobject_class->get_property = get_property; + g_object_class_install_property (gobject_class, ARG_QUALITY, + g_param_spec_uint ("quality", "Quality of image", + "Set the quality from 0 to 100", + 0, 100, DEFAULT_QUALITY, G_PARAM_READWRITE)); @@ -335,6 +396,22 @@ free (param); } + OMX_IMAGE_PARAM_QFACTORTYPE *param; + param = calloc (1, sizeof (OMX_IMAGE_PARAM_QFACTORTYPE)); + param->nSize = sizeof (OMX_IMAGE_PARAM_QFACTORTYPE); + param->nVersion.s.nVersionMajor = 1; + param->nVersion.s.nVersionMinor = 1; + param->nQFactor = self->quality; + param->nPortIndex = 1; + OMX_SetConfig (gomx->omx_handle, OMX_IndexParamQFactor, param); + free (param); GST_INFO_OBJECT (omx_base, "end"); @@ -354,6 +431,8 @@ omx_base->gomx->settings_changed_cb = settings_changed_cb; gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); + self->quality = DEFAULT_QUALITY; GType Index: gstomx_jpegenc.h RCS file: /cvs/gstreamer/gst-openmax/omx/gstomx_jpegenc.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gstomx_jpegenc.h 20 Nov 2008 16:16:55 -0000 1.1 +++ gstomx_jpegenc.h 8 Dec 2008 21:08:04 -0000 1.2 @@ -39,6 +39,8 @@ struct GstOmxJpegEnc GstOmxBaseFilter omx_base; + guint quality; }; struct GstOmxJpegEncClass |