static void
set_property (GObject *obj,
              guint prop_id,
              const GValue *value,
              GParamSpec *pspec)
{
    GstOmxBaseFilter2 *self;

    self = GST_OMX_BASE_FILTER2 (obj);

    switch (prop_id)
    {
        case ARG_COMPONENT_ROLE:
            g_free (self->omx_role);
            self->omx_role = g_value_dup_string (value);
            break;
        case ARG_COMPONENT_NAME:
            g_free (self->omx_component);
            self->omx_component = g_value_dup_string (value);
            break;
        case ARG_LIBRARY_NAME:
            g_free (self->omx_library);
            self->omx_library = g_value_dup_string (value);
            break;
        case ARG_USE_TIMESTAMPS:
            self->gomx->use_timestamps = g_value_get_boolean (value);
            break;
        case ARG_GEN_TIMESTAMPS:
            self->gomx->gen_timestamps = g_value_get_boolean (value);
            break;
        case ARG_NUM_INPUT_BUFFERS:
            {
                OMX_PARAM_PORTDEFINITIONTYPE param;
                OMX_U32 nBufferCountActual = g_value_get_uint (value);
                G_OMX_PORT_GET_DEFINITION (self->in_port, &param);
                g_return_if_fail (nBufferCountActual >= param.nBufferCountMin);
                param.nBufferCountActual = nBufferCountActual;
                G_OMX_PORT_SET_DEFINITION (self->in_port, &param);
            }
            break;
        case ARG_NUM_OUTPUT_BUFFERS:
            {
                OMX_PARAM_PORTDEFINITIONTYPE param;
                OMX_U32 nBufferCountActual = g_value_get_uint (value);
				int i;
				for (i = 0; i < NUM_OUTPUTS; i++) {
					G_OMX_PORT_GET_DEFINITION (self->out_port[i], &param);
					g_return_if_fail (nBufferCountActual >= param.nBufferCountMin);
					param.nBufferCountActual = nBufferCountActual;
					G_OMX_PORT_SET_DEFINITION (self->out_port[i], &param);
				}
            }
            break;
        default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
            break;
    }
}
static void
setup_input_buffer (GstOmxBaseFilter21 *self, GstBuffer *buf, int sink_num)
{
	int j;
	gint i = sink_num;
	if (GST_IS_OMXBUFFERTRANSPORT (buf))
	{
		OMX_PARAM_PORTDEFINITIONTYPE param;
		GOmxPort *port, *in_port;
		/* retrieve incoming buffer port information */
		port = GST_GET_OMXPORT (buf);
		/* Check if output port has set always_copy */
		if (port->always_copy != TRUE) {
				/* configure input buffer size to match with upstream buffer */
				G_OMX_PORT_GET_DEFINITION (self->in_port[i], &param);
				param.nBufferSize =  GST_BUFFER_SIZE (buf);
				param.nBufferCountActual = port->num_buffers;
				G_OMX_PORT_SET_DEFINITION (self->in_port[i], &param);

				/* allocate resource to save the incoming buffer port pBuffer pointer in
				* OmxBufferInfo structure.
				*/
			
				in_port =  self->in_port[i];
				in_port->share_buffer_info = malloc (sizeof(OmxBufferInfo));
				if(in_port->share_buffer_info == NULL){
					GST_ERROR_OBJECT (self, "omx: failed to malloc share_buffer_info");
				}
				in_port->share_buffer_info->pBuffer = malloc (sizeof(int) * port->num_buffers);
				if(in_port->share_buffer_info->pBuffer == NULL){
					GST_ERROR_OBJECT (self, "omx: failed to malloc share_buffer_info->pBuffer");
				}
				for (j=0; j < port->num_buffers; j++) {
					in_port->share_buffer_info->pBuffer[j] = port->buffers[j]->pBuffer;
				}
				/* disable omx_allocate alloc flag, so that we can fall back to shared method */
				self->in_port[i]->omx_allocate = FALSE;
				self->in_port[i]->always_copy = FALSE;
			return;
		}
	}
	/* ask openmax to allocate input buffer */
	self->in_port[i]->omx_allocate = TRUE;
	self->in_port[i]->always_copy = TRUE;
	GST_INFO_OBJECT (self, "omx: setup input buffer - end");
}
static void
set_property (GObject *obj,
              guint prop_id,
              const GValue *value,
              GParamSpec *pspec)
{
    GstOmxBaseSrc *self;

    self = GST_OMX_BASE_SRC (obj);

    switch (prop_id)
    {
    case ARG_COMPONENT_ROLE:
        g_free (self->omx_role);
        self->omx_role = g_value_dup_string (value);
        break;
    case ARG_COMPONENT_NAME:
        g_free (self->omx_component);
        self->omx_component = g_value_dup_string (value);
        break;
    case ARG_LIBRARY_NAME:
        g_free (self->omx_library);
        self->omx_library = g_value_dup_string (value);
        break;
    case ARG_NUM_OUTPUT_BUFFERS:
    {
        OMX_PARAM_PORTDEFINITIONTYPE param;
        OMX_U32 nBufferCountActual = g_value_get_uint (value);

        G_OMX_PORT_GET_DEFINITION (self->out_port, &param);

        g_return_if_fail (nBufferCountActual >= param.nBufferCountMin);
        param.nBufferCountActual = nBufferCountActual;

        G_OMX_PORT_SET_DEFINITION (self->out_port, &param);
    }
    break;
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
        break;
    }
}
static void
omx_setup (GstOmxBaseFilter *omx_base)
{
    GstOmxJpegEnc *self;
    GOmxCore *gomx;

    self = GST_OMX_JPEGENC (omx_base);
    gomx = (GOmxCore *) omx_base->gomx;

    GST_INFO_OBJECT (omx_base, "begin");

    {
        OMX_PARAM_PORTDEFINITIONTYPE param;

        /* Output port configuration. */
        G_OMX_PORT_GET_DEFINITION (omx_base->out_port, &param);

        param.format.image.eCompressionFormat = OMX_IMAGE_CodingJPEG;

        G_OMX_PORT_SET_DEFINITION (omx_base->out_port, &param);

        /* some workarounds required for TI components. */
        {
            guint32 fourcc;
            gint width, height;

            /* the component should do this instead */
            {
                G_OMX_PORT_GET_DEFINITION (omx_base->in_port, &param);

                width = param.format.image.nFrameWidth;
                height = param.format.image.nFrameHeight;
                fourcc = g_omx_colorformat_to_fourcc (
                        param.format.image.eColorFormat);

                /* this is against the standard; nBufferSize is read-only. */
                param.nBufferSize = gst_video_format_get_size (
                        gst_video_format_from_fourcc (fourcc),
                        GST_ROUND_UP_16 (width), GST_ROUND_UP_16 (height));

                G_OMX_PORT_SET_DEFINITION (omx_base->in_port, &param);
            }

            /* the component should do this instead */
            {
                G_OMX_PORT_GET_DEFINITION (omx_base->out_port, &param);

                param.nBufferSize = width * height;

                param.format.image.nFrameWidth = width;
                param.format.image.nFrameHeight = height;

                G_OMX_PORT_SET_DEFINITION (omx_base->out_port, &param);
            }
        }
    }

    {
        OMX_IMAGE_PARAM_QFACTORTYPE param;

        G_OMX_PORT_GET_PARAM (omx_base->out_port, OMX_IndexParamQFactor, &param);

        param.nQFactor = self->quality;

        G_OMX_PORT_SET_PARAM (omx_base->out_port, OMX_IndexParamQFactor, &param);
    }

    GST_INFO_OBJECT (omx_base, "end");
}
static gboolean
sink_setcaps (GstPad *pad,
              GstCaps *caps)
{
    GstStructure *structure;
    GstOmxBaseFilter *omx_base;
    GstOmxJpegEnc *self;
    GOmxCore *gomx;
    OMX_COLOR_FORMATTYPE color_format = OMX_COLOR_FormatYUV420PackedPlanar;
    gint width = 0;
    gint height = 0;

    omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad));
    self = GST_OMX_JPEGENC (omx_base);
    gomx = (GOmxCore *) omx_base->gomx;

    GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps);

    g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE);

    structure = gst_caps_get_structure (caps, 0);

    gst_structure_get_int (structure, "width", &width);
    gst_structure_get_int (structure, "height", &height);

    if (!gst_structure_get_fraction (structure, "framerate",
                                     &self->framerate_num,
                                     &self->framerate_denom))
    {
        self->framerate_num = 0;
        self->framerate_denom = 1;
        omx_base->duration = gst_util_uint64_scale_int(GST_SECOND,0,1);
        GST_DEBUG_OBJECT (self, "Nominal frame duration =%"GST_TIME_FORMAT,
                            GST_TIME_ARGS (omx_base->duration));
    }

    if (strcmp (gst_structure_get_name (structure), "video/x-raw-yuv") == 0)
    {
        guint32 fourcc;

        if (gst_structure_get_fourcc (structure, "format", &fourcc))
        {
            color_format = g_omx_fourcc_to_colorformat (fourcc);
        }
    }

    {
        OMX_PARAM_PORTDEFINITIONTYPE param;

        /* Input port configuration. */
        G_OMX_PORT_GET_DEFINITION (omx_base->in_port, &param);

        param.format.image.nFrameWidth = width;
        param.format.image.nFrameHeight = height;
        param.format.image.eColorFormat = color_format;

        G_OMX_PORT_SET_DEFINITION (omx_base->in_port, &param);
    }

    return gst_pad_set_caps (pad, caps);
}
static void
omx_setup (GstOmxBaseFilter21 *omx_base)
{
	int i;
	GOmxCore *gomx;
	OMX_ERRORTYPE eError = OMX_ErrorNone;
	OMX_PARAM_BUFFER_MEMORYTYPE memTypeCfg;
	OMX_PARAM_PORTDEFINITIONTYPE paramPort;
	OMX_CONFIG_VSWMOSAIC_CREATEMOSAICLAYOUT  sMosaic;
	OMX_CONFIG_VSWMOSAIC_SETBACKGROUNDCOLOR  sMosaicBg;
	OMX_PARAM_VSWMOSAIC_MOSAIC_PERIODICITY	 sMosaicFPS;
    GstOmxBaseFilter21 *self;
    gomx = (GOmxCore *) omx_base->gomx;
    self = GST_OMX_BASE_FILTER21(omx_base);
	
    GST_LOG_OBJECT (self, "begin");
    /* set the output cap */
    gst_pad_set_caps (self->srcpad, create_src_caps (omx_base));
    /* Setting Memory type at input port to Raw Memory */
    GST_LOG_OBJECT (self, "Setting input port to Raw memory");

    _G_OMX_INIT_PARAM (&memTypeCfg);
	memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT;

	for ( i = 0; i < NUM_INPUTS; i++) {
		memTypeCfg.nPortIndex = omx_base->in_port[i]->port_index;
		eError = OMX_SetParameter (gomx->omx_handle, OMX_TI_IndexParamBuffMemType, &memTypeCfg);
		if (eError != OMX_ErrorNone)
		{
				return;
		}
	}
	
	/* Setting Memory type at output port to Raw Memory */
    GST_LOG_OBJECT (self, "Setting output port to Raw memory");
    
    memTypeCfg.nPortIndex = omx_base->out_port->port_index;
	memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT;
	eError = OMX_SetParameter (gomx->omx_handle, OMX_TI_IndexParamBuffMemType, &memTypeCfg);

	if (eError != OMX_ErrorNone)
	{
		return;
	}

	GST_LOG_OBJECT (self, "Setting port definition (input)");


	for ( i = 0; i < NUM_INPUTS; i++) {
		/* set input height/width and color format */
		G_OMX_PORT_GET_DEFINITION (omx_base->in_port[i], &paramPort);
		paramPort.format.video.nFrameWidth  = self->in_width[i]; 
		paramPort.format.video.nFrameHeight = self->in_height[i];
		/* swmosaic is connceted to scalar, whose stride is different than width*/
		paramPort.format.video.nStride = self->in_stride[i];
		paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
		paramPort.format.video.eColorFormat = OMX_COLOR_FormatYCbYCr;
		paramPort.nBufferSize = (paramPort.format.video.nStride * paramPort.format.video.nFrameHeight);

		paramPort.nBufferAlignment = 0;
		paramPort.bBuffersContiguous = 0;
	
		G_OMX_PORT_SET_DEFINITION (omx_base->in_port[i], &paramPort);
		g_omx_port_setup (omx_base->in_port[i], &paramPort);
	}
	
	G_OMX_PORT_GET_DEFINITION (omx_base->out_port, &paramPort);
	paramPort.format.video.nFrameWidth  = self->out_width;
	paramPort.format.video.nFrameHeight = self->out_height;
	paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
	paramPort.format.video.eColorFormat = OMX_COLOR_FormatYCbYCr;
	paramPort.nBufferAlignment = 0;
	paramPort.bBuffersContiguous = 0;
	paramPort.nBufferCountActual = 4;
	paramPort.format.video.nStride = self->out_stride;
	paramPort.nBufferSize = paramPort.format.video.nStride * paramPort.format.video.nFrameHeight;
	
	G_OMX_PORT_SET_DEFINITION (omx_base->out_port, &paramPort);
	g_omx_port_setup (omx_base->out_port, &paramPort);
	
	_G_OMX_INIT_PARAM (&sMosaic);
	sMosaic.nPortIndex  = OMX_VSWMOSAIC_OUTPUT_PORT_START_INDEX;
  
	sMosaic.nOpWidth    = self->out_width;  /* Width in pixels  */
	sMosaic.nOpHeight   = self->out_height; /* Height in pixels */
	sMosaic.nOpPitch    = self->out_stride; /* Pitch in bytes   */

	sMosaic.nNumWindows = 2;
	sMosaic.sMosaicWinFmt[0].dataFormat = OMX_COLOR_FormatYCbYCr;
	sMosaic.sMosaicWinFmt[0].nPortIndex = 0;
	sMosaic.sMosaicWinFmt[0].pitch[0]   =  self->in_stride[0];
	sMosaic.sMosaicWinFmt[0].winStartX  = self->x[0];
	sMosaic.sMosaicWinFmt[0].winStartY  = self->y[0];
	sMosaic.sMosaicWinFmt[0].winWidth   = self->in_width[0];
	sMosaic.sMosaicWinFmt[0].winHeight  = self->in_height[0];
	
	sMosaic.sMosaicWinFmt[1].dataFormat = OMX_COLOR_FormatYCbYCr;
	sMosaic.sMosaicWinFmt[1].nPortIndex = 1;
	sMosaic.sMosaicWinFmt[1].pitch[0]   = self->in_stride[1];
	sMosaic.sMosaicWinFmt[1].winStartX  = self->x[1];
	sMosaic.sMosaicWinFmt[1].winStartY  = self->y[1];
	sMosaic.sMosaicWinFmt[1].winWidth   = self->in_width[1];
	sMosaic.sMosaicWinFmt[1].winHeight  = self->in_height[1];
	
	eError = OMX_SetConfig (gomx->omx_handle, 
							OMX_TI_IndexConfigVSWMOSAICCreateMosaicLayout, 
							&sMosaic);
	if (eError != OMX_ErrorNone)
	{
			printf("Error during Layout settings\n");
	}
	_G_OMX_INIT_PARAM(&sMosaicBg);
	sMosaicBg.nPortIndex  = OMX_VSWMOSAIC_OUTPUT_PORT_START_INDEX;
	sMosaicBg.uColor = BG_COLOR;
	eError = OMX_SetConfig (gomx->omx_handle, 
							OMX_TI_IndexConfigVSWMOSAICSetBackgroundColor, 
							&sMosaicBg);
	if (eError != OMX_ErrorNone)
	{
			printf("Error during background\n");
	}
	
// FPS settings didn't work actually 
#if 1
	_G_OMX_INIT_PARAM(&sMosaicFPS);
	sMosaicFPS.nPortIndex  = OMX_VSWMOSAIC_OUTPUT_PORT_START_INDEX;
	sMosaicFPS.nFps		   = 60;				
	eError = OMX_SetConfig (gomx->omx_handle, 
							OMX_TI_IndexParamVSWMOSAICMosaicPeriodicity, 
							&sMosaicFPS);
	if (eError != OMX_ErrorNone)
	{
			printf("Error during FPS settings : %s\n",g_omx_error_to_str (eError));
	}
#endif
}
static void
setup_input_buffer (GstOmxBaseFilter2 *self, GstBuffer *buf)
{
    if (GST_IS_OMXBUFFERTRANSPORT (buf))
    {
        OMX_PARAM_PORTDEFINITIONTYPE param;
        GOmxPort *port, *in_port;
        gint i, shift = 0;

        /* retrieve incoming buffer port information */
        port = GST_GET_OMXPORT (buf);

        /* configure input buffer size to match with upstream buffer */
        G_OMX_PORT_GET_DEFINITION (self->in_port, &param);

		printf("this input  params: %dx%d,%d %d %d\n", param.format.video.nFrameWidth, 
			param.format.video.nFrameHeight, 
			param.format.video.nStride,
			param.nBufferSize, param.nBufferCountActual);
		if (GST_GET_OMXBUFFER(buf)) {
			printf("incoming buffer: nFilledLen: %d, nOffset: %d nFlags: %x\n", 
					GST_GET_OMXBUFFER(buf)->nFilledLen, 
					GST_GET_OMXBUFFER(buf)->nOffset, 
					GST_GET_OMXBUFFER(buf)->nFlags);
		}
        param.nBufferSize =  GST_BUFFER_SIZE (buf);
		if (self->input_fields_separately) param.nBufferCountActual = port->num_buffers * 2;
        else param.nBufferCountActual = port->num_buffers;
        G_OMX_PORT_SET_DEFINITION (self->in_port, &param);

        /* allocate resource to save the incoming buffer port pBuffer pointer in
         * OmxBufferInfo structure.
         */
        in_port = self->in_port;
        in_port->share_buffer_info = malloc (sizeof(OmxBufferInfo));
		if (self->input_fields_separately) {
			int t1, t2;
			t1 = GST_GET_OMXBUFFER(buf)->nOffset / param.format.video.nStride;
			t2 = t1 + t1 + ((param.format.video.nFrameHeight + 7) & 0xFFFFFFF8);
			t1 = t2 * param.format.video.nStride;
			self->second_field_offset = ( GST_GET_OMXBUFFER(buf)->nFilledLen + GST_GET_OMXBUFFER(buf)->nOffset ) / 3;
			if (self->second_field_offset != t1) {
				printf("Second field offset does not look right... correcting it from %d to %d\n", 
					self->second_field_offset, t1);
				self->second_field_offset = t1;
			}
			in_port->share_buffer_info->pBuffer = malloc (sizeof(int) * port->num_buffers * 2);
			for (i=0; i < port->num_buffers; i++) {
				in_port->share_buffer_info->pBuffer[i<<1] = port->buffers[i]->pBuffer;
				in_port->share_buffer_info->pBuffer[(i<<1)+1] = port->buffers[i]->pBuffer + 
					self->second_field_offset;
			}
		} else {
			in_port->share_buffer_info->pBuffer = malloc (sizeof(int) * port->num_buffers);
			for (i=0; i < port->num_buffers; i++) {
				in_port->share_buffer_info->pBuffer[i] = port->buffers[i]->pBuffer;
			}
		}

        /* disable omx_allocate alloc flag, so that we can fall back to shared method */
        self->in_port->omx_allocate = FALSE;
        self->in_port->always_copy = FALSE;
    }
    else
    {
        /* ask openmax to allocate input buffer */
        self->in_port->omx_allocate = TRUE;
        self->in_port->always_copy = TRUE;
		self->input_fields_separately = FALSE;
    }
}
static void
omx_setup (GstOmxBaseFilter *omx_base)
{
    GstOmxBaseVideoEnc *self;
    GOmxCore *gomx;

    self = GST_OMX_BASE_VIDEOENC (omx_base);
    gomx = (GOmxCore *) omx_base->gomx;

    GST_INFO_OBJECT (omx_base, "begin");

    {
        OMX_PARAM_PORTDEFINITIONTYPE param;

        /* Output port configuration. */
        G_OMX_PORT_GET_DEFINITION (omx_base->out_port, &param);

        param.format.video.eCompressionFormat = self->compression_format;

        /** @todo this should be set with a property */
        param.format.video.nBitrate = self->bitrate;

        G_OMX_PORT_SET_DEFINITION (omx_base->out_port, &param);

        /* some workarounds required for TI components. */
        {
            guint32 fourcc;
            gint width, height;
            gulong framerate;

            /* the component should do this instead */
            {
                G_OMX_PORT_GET_DEFINITION (omx_base->in_port, &param);

                width = param.format.video.nFrameWidth;
                height = param.format.video.nFrameHeight;
                framerate = param.format.video.xFramerate;
                
                /* this is against the standard; nBufferSize is read-only. */
                fourcc = GST_MAKE_FOURCC ('N', 'V', '1', '2');
                param.nBufferSize = gst_video_format_get_size_strided (
                        gst_video_format_from_fourcc (fourcc),

                        width, height, param.format.video.nStride);
                G_OMX_PORT_SET_DEFINITION (omx_base->in_port, &param);
            }

            /* the component should do this instead */
            {
                G_OMX_PORT_GET_DEFINITION (omx_base->out_port, &param);

                /* this is against the standard; nBufferSize is read-only. */
                param.nBufferSize = width * height;

                param.format.video.nFrameWidth = width;
                param.format.video.nFrameHeight = height;
                param.format.video.xFramerate = framerate;

                G_OMX_PORT_SET_DEFINITION (omx_base->out_port, &param);
            }

            /* the component should do this instead */
            {
                GOmxPort *port;

                /* enable input port */
                port = omx_base->in_port;
                OMX_SendCommand (g_omx_core_get_handle (port->core), OMX_CommandPortEnable, 
                    port->port_index, NULL);
                g_sem_down (port->core->port_sem);

                /* enable output port */
                port = omx_base->out_port;
                OMX_SendCommand (g_omx_core_get_handle (port->core), OMX_CommandPortEnable, 
                    port->port_index, NULL);
                g_sem_down (port->core->port_sem);

            }
        }
    }

    if (self->omx_setup)
        self->omx_setup (GST_OMX_BASE_FILTER (self));

    GST_INFO_OBJECT (omx_base, "end");
}
static gboolean
sink_setcaps (GstPad *pad,
              GstCaps *caps)
{
    GstOmxBaseVideoEnc *self;
    GstOmxBaseFilter *omx_base;
    GstQuery *query;
    GstVideoFormat format;
    gint width, height, rowstride;
    const GValue *framerate = NULL;

    self = GST_OMX_BASE_VIDEOENC (GST_PAD_PARENT (pad));
    omx_base = GST_OMX_BASE_FILTER (self);

    GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps);

    g_return_val_if_fail (caps, FALSE);
    g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);

    framerate = gst_structure_get_value (
            gst_caps_get_structure (caps, 0), "framerate");

    if (framerate)
    {
        omx_base->duration = gst_util_uint64_scale_int(GST_SECOND,
                gst_value_get_fraction_denominator (framerate),
                gst_value_get_fraction_numerator (framerate));
        GST_DEBUG_OBJECT (self, "Nominal frame duration =%"GST_TIME_FORMAT,
                            GST_TIME_ARGS (omx_base->duration));
    }

    if (gst_video_format_parse_caps_strided (caps,
            &format, &width, &height, &rowstride))
    {
        /* Output port configuration: */
        OMX_PARAM_PORTDEFINITIONTYPE param;

        G_OMX_PORT_GET_DEFINITION (omx_base->in_port, &param);

        param.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar ;
        param.format.video.nFrameWidth  = width;
        param.format.video.nFrameHeight = height;
        if (!rowstride)
            rowstride = (width + 15) & 0xFFFFFFF0;
        param.format.video.nStride      = self->rowstride = rowstride;

        if (framerate)
        {
            self->framerate_num = gst_value_get_fraction_numerator (framerate);
            self->framerate_denom = gst_value_get_fraction_denominator (framerate);

            /* convert to Q.16 */
            param.format.video.xFramerate =
                (gst_value_get_fraction_numerator (framerate) << 16) /
                gst_value_get_fraction_denominator (framerate);
        }

        G_OMX_PORT_SET_DEFINITION (omx_base->out_port, &param);
    }


    return TRUE;
}