static void omx_setup (GstOmxBaseFilter2 *omx_base) { GstOmxBaseVfpc2 *self; GOmxCore *gomx; GOmxPort *port; int i; self = GST_OMX_BASE_VFPC2 (omx_base); gomx = (GOmxCore *) omx_base->gomx; GST_INFO_OBJECT (omx_base, "begin"); if (self->omx_setup) { self->omx_setup (omx_base); } /* 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); for (i=0; i<NUM_OUTPUTS; i++) { /* enable output port */ port = omx_base->out_port[i]; OMX_SendCommand (g_omx_core_get_handle (port->core), OMX_CommandPortEnable, port->port_index, NULL); g_sem_down (port->core->port_sem); } /* indicate that port is now configured */ self->port_configured = TRUE; GST_INFO_OBJECT (omx_base, "end"); }
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, ¶m); 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, ¶m); /* 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, ¶m); 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, ¶m); } /* the component should do this instead */ { G_OMX_PORT_GET_DEFINITION (omx_base->out_port, ¶m); /* 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, ¶m); } /* 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"); }