static gboolean activate_push (GstPad *pad, gboolean active) { gboolean result = TRUE; GstOmxBaseFilter *self; self = GST_OMX_BASE_FILTER (gst_pad_get_parent (pad)); if (active) { GST_DEBUG_OBJECT (self, "activate"); /* task may carry on */ g_atomic_int_set (&self->last_pad_push_return, GST_FLOW_OK); /* we do not start the task yet if the pad is not connected */ if (gst_pad_is_linked (pad)) { if (self->ready) { /** @todo link callback function also needed */ g_omx_port_resume (self->in_port); g_omx_port_resume (self->out_port); result = gst_pad_start_task (pad, output_loop, pad); } } } else { GST_DEBUG_OBJECT (self, "deactivate"); /* persuade task to bail out */ g_atomic_int_set (&self->last_pad_push_return, GST_FLOW_WRONG_STATE); if (self->ready) { /** @todo disable this until we properly reinitialize the buffers. */ #if 0 /* flush all buffers */ OMX_SendCommand (self->gomx->omx_handle, OMX_CommandFlush, OMX_ALL, NULL); #endif /* unlock loops */ g_omx_port_pause (self->in_port); g_omx_port_pause (self->out_port); } /* make sure streaming finishes */ result = gst_pad_stop_task (pad); } gst_object_unref (self); return result; }
static gboolean activate_push (GstPad *pad, gboolean active) { gboolean result = TRUE; GstOmxBaseFilter21 *self; int i; self = GST_OMX_BASE_FILTER21 (gst_pad_get_parent (pad)); if (active) { GST_DEBUG_OBJECT (self, "activate"); self->last_pad_push_return = GST_FLOW_OK; /* we do not start the task yet if the pad is not connected */ if (gst_pad_is_linked (pad)) { if (self->ready) { /** @todo link callback function also needed */ for (i = 0; i < NUM_INPUTS; i++) g_omx_port_resume (self->in_port[i]); g_omx_port_resume (self->out_port); //result = gst_pad_start_task (pad, output_loop, pad); } } } else { GST_DEBUG_OBJECT (self, "deactivate"); if (self->ready) { /* unlock loops */ for (i = 0; i < NUM_INPUTS; i++) g_omx_port_pause (self->in_port[i]); g_omx_port_pause (self->out_port); } /* make sure streaming finishes */ result = gst_pad_stop_task (pad); } gst_object_unref (self); return result; }
void g_omx_port_enable (GOmxPort *port) { GOmxCore *core; core = port->core; OMX_SendCommand (core->omx_handle, OMX_CommandPortEnable, port->port_index, NULL); port_allocate_buffers (port); if (core->omx_state != OMX_StateLoaded) port_start_buffers (port); g_omx_port_resume (port); g_sem_down (core->port_sem); }
static gboolean handle_event (GstBaseSink *gst_base, GstEvent *event) { GstOmxBaseSink *self; GOmxCore *gomx; GOmxPort *in_port; self = GST_OMX_BASE_SINK (gst_base); gomx = self->gomx; in_port = self->in_port; GST_LOG_OBJECT (self, "begin"); GST_DEBUG_OBJECT (self, "event: %s", GST_EVENT_TYPE_NAME (event)); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: /* Close the inpurt port. */ g_omx_core_set_done (gomx); break; case GST_EVENT_FLUSH_START: /* unlock loops */ g_omx_port_pause (in_port); /* flush all buffers */ OMX_SendCommand (gomx->omx_handle, OMX_CommandFlush, OMX_ALL, NULL); break; case GST_EVENT_FLUSH_STOP: g_sem_down (gomx->flush_sem); g_omx_port_resume (in_port); break; default: break; } GST_LOG_OBJECT (self, "end"); return TRUE; }
static gboolean activate_push (GstPad *pad, gboolean active) { gboolean result = TRUE; GstOmxBaseSink *self; self = GST_OMX_BASE_SINK (gst_pad_get_parent (pad)); if (active) { GST_DEBUG_OBJECT (self, "activate"); /* we do not start the task yet if the pad is not connected */ if (gst_pad_is_linked (pad)) { /** @todo link callback function also needed */ g_omx_port_resume (self->in_port); } } else { GST_DEBUG_OBJECT (self, "deactivate"); /** @todo disable this until we properly reinitialize the buffers. */ #if 0 /* flush all buffers */ OMX_SendCommand (self->gomx->omx_handle, OMX_CommandFlush, OMX_ALL, NULL); #endif /* unlock loops */ g_omx_port_pause (self->in_port); } gst_object_unref (self); if (result) result = self->base_activatepush (pad, active); return result; }