static void type_instance_init (GTypeInstance *instance, gpointer g_class) { GstOmxBaseFilter2 *omx_base; GstOmxBaseVfpc2 *self; char srcname[10]; int i; omx_base = GST_OMX_BASE_FILTER2 (instance); self = GST_OMX_BASE_VFPC2 (instance); omx_base->omx_setup = omx_setup; self->g_class = g_class; gst_pad_set_setcaps_function (omx_base->sinkpad, GST_DEBUG_FUNCPTR (sink_setcaps)); for (i=0; i<NUM_OUTPUTS; i++) gst_pad_set_setcaps_function (omx_base->srcpad[i], GST_DEBUG_FUNCPTR (src_setcaps)); /* free the existing core and ports */ g_omx_core_free (omx_base->gomx); g_omx_port_free (omx_base->in_port); /* create new core and ports */ omx_base->gomx = g_omx_core_new (omx_base, self->g_class); omx_base->in_port = g_omx_core_get_port (omx_base->gomx, "in", OMX_VFPC_INPUT_PORT_START_INDEX); omx_base->in_port->omx_allocate = TRUE; omx_base->in_port->share_buffer = FALSE; omx_base->in_port->always_copy = FALSE; omx_base->in_port->port_index = OMX_VFPC_INPUT_PORT_START_INDEX; for (i=0; i<NUM_OUTPUTS; i++) { g_omx_port_free (omx_base->out_port[i]); sprintf(srcname, "out_%02x", i); omx_base->out_port[i] = g_omx_core_get_port (omx_base->gomx, srcname, OMX_VFPC_OUTPUT_PORT_START_INDEX + i); omx_base->out_port[i]->port_index = OMX_VFPC_OUTPUT_PORT_START_INDEX + i; omx_base->out_port[i]->omx_allocate = TRUE; omx_base->out_port[i]->share_buffer = FALSE; omx_base->out_port[i]->always_copy = FALSE; } }
void g_omx_core_finish (GOmxCore *core) { change_state (core, OMX_StateIdle); wait_for_state (core, OMX_StateIdle); change_state (core, OMX_StateLoaded); { guint index; guint i; for (index = 0; index < core->ports->len; index++) { GOmxPort *port; port = g_omx_core_get_port (core, index); for (i = 0; i < port->num_buffers; i++) { OMX_BUFFERHEADERTYPE *omx_buffer; omx_buffer = port->buffers[i]; g_free (omx_buffer->pBuffer); OMX_FreeBuffer (core->omx_handle, index, omx_buffer); } } } wait_for_state (core, OMX_StateLoaded); { gint index; for (index = 0; index < core->ports->len; index++) { GOmxPort *port; port = g_omx_core_get_port (core, index); g_omx_port_free (port); } g_ptr_array_clear (core->ports); } }