vaapidecode: move gst_vaapidecode_negotiate() code

With it we can remove a function declaration, making the code a bit
more readable.

https://bugzilla.gnome.org/show_bug.cgi?id=764316
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-03-10 17:42:55 +01:00
parent aac0f50500
commit fe08f7ecdc

View file

@ -163,7 +163,6 @@ static gboolean gst_vaapidecode_update_sink_caps (GstVaapiDecode * decode,
GstCaps * caps);
static gboolean gst_vaapi_decode_input_state_replace (GstVaapiDecode * decode,
const GstVideoCodecState * new_state);
static gboolean gst_vaapidecode_negotiate (GstVaapiDecode * decode);
/* get invoked only if actural VASurface size (not the cropped values) changed */
static void
@ -408,6 +407,26 @@ set_display_res:
return TRUE;
}
static gboolean
gst_vaapidecode_negotiate (GstVaapiDecode * decode)
{
GstVideoDecoder *const vdec = GST_VIDEO_DECODER (decode);
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (vdec);
GST_DEBUG_OBJECT (decode, "Input codec state changed, doing renegotiation");
if (!gst_vaapi_plugin_base_set_caps (plugin, decode->sinkpad_caps, NULL))
return FALSE;
if (!gst_vaapidecode_update_src_caps (decode))
return FALSE;
if (!gst_video_decoder_negotiate (vdec))
return FALSE;
if (!gst_vaapi_plugin_base_set_caps (plugin, NULL, decode->srcpad_caps))
return FALSE;
return TRUE;
}
static GstFlowReturn
gst_vaapidecode_push_decoded_frame (GstVideoDecoder * vdec,
GstVideoCodecFrame * out_frame)
@ -535,26 +554,6 @@ error_commit_buffer:
}
}
static gboolean
gst_vaapidecode_negotiate (GstVaapiDecode * decode)
{
GstVideoDecoder *const vdec = GST_VIDEO_DECODER (decode);
GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (vdec);
GST_DEBUG_OBJECT (decode, "Input codec state changed, doing renegotiation");
if (!gst_vaapi_plugin_base_set_caps (plugin, decode->sinkpad_caps, NULL))
return FALSE;
if (!gst_vaapidecode_update_src_caps (decode))
return FALSE;
if (!gst_video_decoder_negotiate (vdec))
return FALSE;
if (!gst_vaapi_plugin_base_set_caps (plugin, NULL, decode->srcpad_caps))
return FALSE;
return TRUE;
}
static GstFlowReturn
gst_vaapidecode_push_all_decoded_frames (GstVaapiDecode * decode)
{