mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
omxvideoenc: factor out gst_omx_video_enc_set_to_idle()
No semantic change. We'll have to use this when the input pool is activated so we can allocate buffers. https://bugzilla.gnome.org/show_bug.cgi?id=796918
This commit is contained in:
parent
7d3b0cd1e8
commit
092788a968
1 changed files with 38 additions and 30 deletions
|
@ -2001,6 +2001,43 @@ gst_omx_video_enc_pick_input_allocation_mode (GstOMXVideoEnc * self,
|
||||||
return GST_OMX_BUFFER_ALLOCATION_ALLOCATE_BUFFER;
|
return GST_OMX_BUFFER_ALLOCATION_ALLOCATE_BUFFER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_omx_video_enc_set_to_idle (GstOMXVideoEnc * self)
|
||||||
|
{
|
||||||
|
GstOMXVideoEncClass *klass = GST_OMX_VIDEO_ENC_GET_CLASS (self);
|
||||||
|
gboolean no_disable_outport;
|
||||||
|
|
||||||
|
no_disable_outport = klass->cdata.hacks & GST_OMX_HACK_NO_DISABLE_OUTPORT;
|
||||||
|
|
||||||
|
if (!no_disable_outport) {
|
||||||
|
/* Disable output port */
|
||||||
|
if (gst_omx_port_set_enabled (self->enc_out_port, FALSE) != OMX_ErrorNone)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (gst_omx_port_wait_enabled (self->enc_out_port,
|
||||||
|
1 * GST_SECOND) != OMX_ErrorNone)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gst_omx_component_set_state (self->enc, OMX_StateIdle) != OMX_ErrorNone)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* Need to allocate buffers to reach Idle state */
|
||||||
|
if (!gst_omx_video_enc_allocate_in_buffers (self))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (no_disable_outport) {
|
||||||
|
if (gst_omx_port_allocate_buffers (self->enc_out_port) != OMX_ErrorNone)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gst_omx_component_get_state (self->enc,
|
||||||
|
GST_CLOCK_TIME_NONE) != OMX_StateIdle)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_omx_video_enc_enable (GstOMXVideoEnc * self, GstBuffer * input)
|
gst_omx_video_enc_enable (GstOMXVideoEnc * self, GstBuffer * input)
|
||||||
{
|
{
|
||||||
|
@ -2060,36 +2097,7 @@ gst_omx_video_enc_enable (GstOMXVideoEnc * self, GstBuffer * input)
|
||||||
if (gst_omx_port_mark_reconfigured (self->enc_in_port) != OMX_ErrorNone)
|
if (gst_omx_port_mark_reconfigured (self->enc_in_port) != OMX_ErrorNone)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
if (!(klass->cdata.hacks & GST_OMX_HACK_NO_DISABLE_OUTPORT)) {
|
if (!gst_omx_video_enc_set_to_idle (self))
|
||||||
/* Disable output port */
|
|
||||||
if (gst_omx_port_set_enabled (self->enc_out_port, FALSE) != OMX_ErrorNone)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (gst_omx_port_wait_enabled (self->enc_out_port,
|
|
||||||
1 * GST_SECOND) != OMX_ErrorNone)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (gst_omx_component_set_state (self->enc,
|
|
||||||
OMX_StateIdle) != OMX_ErrorNone)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Need to allocate buffers to reach Idle state */
|
|
||||||
if (!gst_omx_video_enc_allocate_in_buffers (self))
|
|
||||||
return FALSE;
|
|
||||||
} else {
|
|
||||||
if (gst_omx_component_set_state (self->enc,
|
|
||||||
OMX_StateIdle) != OMX_ErrorNone)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Need to allocate buffers to reach Idle state */
|
|
||||||
if (!gst_omx_video_enc_allocate_in_buffers (self))
|
|
||||||
return FALSE;
|
|
||||||
if (gst_omx_port_allocate_buffers (self->enc_out_port) != OMX_ErrorNone)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gst_omx_component_get_state (self->enc,
|
|
||||||
GST_CLOCK_TIME_NONE) != OMX_StateIdle)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (gst_omx_component_set_state (self->enc,
|
if (gst_omx_component_set_state (self->enc,
|
||||||
|
|
Loading…
Reference in a new issue