mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-01 20:12:28 +00:00
omxvideoenc/dec: factor out input buffer allocation
No semantic change so far. I'm going to add an alternate way to allocate input buffers. https://bugzilla.gnome.org/show_bug.cgi?id=787093
This commit is contained in:
parent
da07a647b8
commit
e55675b7ce
2 changed files with 26 additions and 10 deletions
|
@ -2133,6 +2133,15 @@ gst_omx_video_dec_disable (GstOMXVideoDec * self)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_omx_video_dec_allocate_in_buffers (GstOMXVideoDec * self)
|
||||
{
|
||||
if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_omx_video_dec_enable (GstOMXVideoDec * self)
|
||||
{
|
||||
|
@ -2143,7 +2152,7 @@ gst_omx_video_dec_enable (GstOMXVideoDec * self)
|
|||
if (self->disabled) {
|
||||
if (gst_omx_port_set_enabled (self->dec_in_port, TRUE) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone)
|
||||
if (!gst_omx_video_dec_allocate_in_buffers (self))
|
||||
return FALSE;
|
||||
|
||||
if ((klass->cdata.hacks & GST_OMX_HACK_NO_DISABLE_OUTPORT)) {
|
||||
|
@ -2180,7 +2189,7 @@ gst_omx_video_dec_enable (GstOMXVideoDec * self)
|
|||
return FALSE;
|
||||
|
||||
/* Need to allocate buffers to reach Idle state */
|
||||
if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone)
|
||||
if (!gst_omx_video_dec_allocate_in_buffers (self))
|
||||
return FALSE;
|
||||
} else {
|
||||
if (gst_omx_component_set_state (self->dec,
|
||||
|
@ -2188,7 +2197,7 @@ gst_omx_video_dec_enable (GstOMXVideoDec * self)
|
|||
return FALSE;
|
||||
|
||||
/* Need to allocate buffers to reach Idle state */
|
||||
if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone)
|
||||
if (!gst_omx_video_dec_allocate_in_buffers (self))
|
||||
return FALSE;
|
||||
if (gst_omx_port_allocate_buffers (self->dec_out_port) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
|
@ -2511,8 +2520,7 @@ gst_omx_video_dec_handle_frame (GstVideoDecoder * decoder,
|
|||
goto reconfigure_error;
|
||||
}
|
||||
|
||||
err = gst_omx_port_allocate_buffers (port);
|
||||
if (err != OMX_ErrorNone) {
|
||||
if (!gst_omx_video_dec_allocate_in_buffers (self)) {
|
||||
GST_VIDEO_DECODER_STREAM_LOCK (self);
|
||||
goto reconfigure_error;
|
||||
}
|
||||
|
|
|
@ -1120,6 +1120,15 @@ gst_omx_video_enc_configure_input_buffer (GstOMXVideoEnc * self,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_omx_video_enc_allocate_in_buffers (GstOMXVideoEnc * self)
|
||||
{
|
||||
if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_omx_video_enc_enable (GstOMXVideoEnc * self, GstBuffer * input)
|
||||
{
|
||||
|
@ -1134,7 +1143,7 @@ gst_omx_video_enc_enable (GstOMXVideoEnc * self, GstBuffer * input)
|
|||
if (self->disabled) {
|
||||
if (gst_omx_port_set_enabled (self->enc_in_port, TRUE) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone)
|
||||
if (!gst_omx_video_enc_allocate_in_buffers (self))
|
||||
return FALSE;
|
||||
|
||||
if ((klass->cdata.hacks & GST_OMX_HACK_NO_DISABLE_OUTPORT)) {
|
||||
|
@ -1168,7 +1177,7 @@ gst_omx_video_enc_enable (GstOMXVideoEnc * self, GstBuffer * input)
|
|||
return FALSE;
|
||||
|
||||
/* Need to allocate buffers to reach Idle state */
|
||||
if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone)
|
||||
if (!gst_omx_video_enc_allocate_in_buffers (self))
|
||||
return FALSE;
|
||||
} else {
|
||||
if (gst_omx_component_set_state (self->enc,
|
||||
|
@ -1176,7 +1185,7 @@ gst_omx_video_enc_enable (GstOMXVideoEnc * self, GstBuffer * input)
|
|||
return FALSE;
|
||||
|
||||
/* Need to allocate buffers to reach Idle state */
|
||||
if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone)
|
||||
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;
|
||||
|
@ -1664,8 +1673,7 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder,
|
|||
goto reconfigure_error;
|
||||
}
|
||||
|
||||
err = gst_omx_port_allocate_buffers (port);
|
||||
if (err != OMX_ErrorNone) {
|
||||
if (!gst_omx_video_enc_allocate_in_buffers (self)) {
|
||||
GST_VIDEO_ENCODER_STREAM_LOCK (self);
|
||||
goto reconfigure_error;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue