From: Lionel Landwerlin Date: Fri, 13 Jun 2014 20:45:04 +0000 (+0100) Subject: vaapidecode: make decoder work with playbin X-Git-Tag: 0.5.9~36 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fgstreamer-vaapi.git;a=commitdiff_plain;h=334a0ca8bd20181bcb66ce910c36a54886f99d56 vaapidecode: make decoder work with playbin When playbin/decodebin builds the pipeline, it puts decoders and sinks into different bins and forwards the queries from bins to bins. So in the initials steps the pipeline is built iteratively by playbin and looks like this : [filesrc] [filesrc] -> [typefind] [filesrc] -> [typefind] -> [demuxer] [filesrc] -> [typefind] -> [demuxer] -> [decoder] At this point the decoder is asked for its SRC caps and it will make a choice based on what gst_pad_peer_query_caps() returns. The problem is that the caps returns at that point includes caps features like ANY, essentially because playbin can plug in additional elements like videoscale, videoconv or deinterlace. This patch adds a another call to gst_vaapi_find_preferred_caps_feature() when the decoder decides its allocation, to make sure we asks the downstream elements when the entire pipeline has been built. https://bugzilla.gnome.org/show_bug.cgi?id=731645 --- diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 0ec280d..1d97c62 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -514,6 +514,7 @@ gst_vaapidecode_decide_allocation(GstVideoDecoder *vdec, GstQuery *query) gboolean has_video_meta = FALSE; GstVideoCodecState *state; #if GST_CHECK_VERSION(1,1,0) && USE_GLX + gboolean has_texture_upload_meta = FALSE; GstCapsFeatures *features, *features2; #endif @@ -534,10 +535,22 @@ gst_vaapidecode_decide_allocation(GstVideoDecoder *vdec, GstQuery *query) features = gst_caps_get_features(state->caps, 0); features2 = gst_caps_features_new(GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, NULL); + has_texture_upload_meta = + gst_vaapi_find_preferred_caps_feature(GST_VIDEO_DECODER_SRC_PAD(vdec), + GST_VIDEO_FORMAT_ENCODED) == + GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META; + /* Update src caps if feature is not handled downstream */ if (!decode->has_texture_upload_meta && gst_caps_features_is_equal(features, features2)) gst_vaapidecode_update_src_caps (decode, state); + else if (has_texture_upload_meta && + !gst_caps_features_is_equal(features, features2)) { + gst_video_info_set_format(&state->info, GST_VIDEO_FORMAT_RGBA, + state->info.width, + state->info.height); + gst_vaapidecode_update_src_caps(decode, state); + } gst_caps_features_free(features2); #endif