Add gst_vaapidecode_ensure_display() helper for set-caps.

This commit is contained in:
gb 2010-05-05 15:36:25 +00:00 committed by Gwenole Beauchesne
parent 2a4f429007
commit 4a485200b9

View file

@ -160,11 +160,14 @@ error_commit_buffer:
}
static gboolean
gst_vaapidecode_create(GstVaapiDecode *decode)
gst_vaapidecode_ensure_display(GstVaapiDecode *decode)
{
GstVaapiVideoSink *sink;
GstVaapiDisplay *display;
if (decode->display)
return TRUE;
/* Look for a downstream vaapisink */
sink = gst_vaapi_video_sink_lookup(GST_ELEMENT(decode));
if (!sink)
@ -175,10 +178,18 @@ gst_vaapidecode_create(GstVaapiDecode *decode)
return FALSE;
decode->display = g_object_ref(display);
return TRUE;
}
static gboolean
gst_vaapidecode_create(GstVaapiDecode *decode)
{
if (!gst_vaapidecode_ensure_display(decode))
return FALSE;
if (decode->use_ffmpeg)
decode->decoder =
gst_vaapi_decoder_ffmpeg_new(display, decode->decoder_caps);
gst_vaapi_decoder_ffmpeg_new(decode->display, decode->decoder_caps);
return decode->decoder != NULL;
}