From: Eunhye Choi Date: Fri, 10 Apr 2020 11:41:00 +0000 (+0900) Subject: decodebin3: add property to select sw decoder X-Git-Tag: accepted/tizen/unified/20200415.121429~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=168674216e7eddacc8680dacb3a879d28571abdb;p=platform%2Fupstream%2Fgst-plugins-base.git decodebin3: add property to select sw decoder - separate the force-sw-decoders property for video and audio. Change-Id: Ia36ec554ed6454aa397b1b76439df0ca198c532b --- diff --git a/gst/playback/gstdecodebin3.c b/gst/playback/gstdecodebin3.c index 9ab45d0..c004407 100644 --- a/gst/playback/gstdecodebin3.c +++ b/gst/playback/gstdecodebin3.c @@ -265,7 +265,12 @@ struct _GstDecodebin3 /* Properties */ GstCaps *caps; +#ifdef TIZEN_FEATURE_FORCE_SW_DECODER + gboolean force_sw_decoders_for_video; + gboolean force_sw_decoders_for_audio; +#else gboolean force_sw_decoders; +#endif }; struct _GstDecodebin3Class @@ -373,7 +378,12 @@ enum { PROP_0, PROP_CAPS, +#ifdef TIZEN_FEATURE_FORCE_SW_DECODER + PROP_FORCE_SW_DECODERS_FOR_VIDEO, + PROP_FORCE_SW_DECODERS_FOR_AUDIO, +#else PROP_FORCE_SW_DECODERS, +#endif }; /* signals */ @@ -554,7 +564,18 @@ gst_decodebin3_class_init (GstDecodebin3Class * klass) g_param_spec_boxed ("caps", "Caps", "The caps on which to stop decoding. (NULL = default)", GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - +#ifdef TIZEN_FEATURE_FORCE_SW_DECODER + g_object_class_install_property (gobject_klass, PROP_FORCE_SW_DECODERS_FOR_VIDEO, + g_param_spec_boolean ("force-sw-decoders-for-video", "Video Software Decoders Only", + "Use only sofware decoders for video to process streams", + DEFAULT_FORCE_SW_DECODERS, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_klass, PROP_FORCE_SW_DECODERS_FOR_AUDIO, + g_param_spec_boolean ("force-sw-decoders-for-audio", "Audio Software Decoders Only", + "Use only sofware decoders for audio to process streams", + DEFAULT_FORCE_SW_DECODERS, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +#else /** * GstDecodeBin::force-sw-decoders: * @@ -568,7 +589,7 @@ gst_decodebin3_class_init (GstDecodebin3Class * klass) "Use only sofware decoders to process streams", DEFAULT_FORCE_SW_DECODERS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - +#endif /* FIXME : ADD SIGNALS ! */ /** * GstDecodebin3::select-stream @@ -646,7 +667,12 @@ gst_decodebin3_init (GstDecodebin3 * dbin) g_mutex_init (&dbin->input_lock); dbin->caps = gst_static_caps_get (&default_raw_caps); +#ifdef TIZEN_FEATURE_FORCE_SW_DECODER + dbin->force_sw_decoders_for_video = DEFAULT_FORCE_SW_DECODERS; + dbin->force_sw_decoders_for_audio = DEFAULT_FORCE_SW_DECODERS; +#else dbin->force_sw_decoders = DEFAULT_FORCE_SW_DECODERS; +#endif GST_OBJECT_FLAG_SET (dbin, GST_BIN_FLAG_STREAMS_AWARE); } @@ -698,9 +724,18 @@ gst_decodebin3_set_property (GObject * object, guint prop_id, dbin->caps = g_value_dup_boxed (value); GST_OBJECT_UNLOCK (dbin); break; +#ifdef TIZEN_FEATURE_FORCE_SW_DECODER + case PROP_FORCE_SW_DECODERS_FOR_VIDEO: + dbin->force_sw_decoders_for_video = g_value_get_boolean (value); + break; + case PROP_FORCE_SW_DECODERS_FOR_AUDIO: + dbin->force_sw_decoders_for_audio = g_value_get_boolean (value); + break; +#else case PROP_FORCE_SW_DECODERS: dbin->force_sw_decoders = g_value_get_boolean (value); break; +#endif default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -720,9 +755,18 @@ gst_decodebin3_get_property (GObject * object, guint prop_id, GValue * value, g_value_set_boxed (value, dbin->caps); GST_OBJECT_UNLOCK (dbin); break; +#ifdef TIZEN_FEATURE_FORCE_SW_DECODER + case PROP_FORCE_SW_DECODERS_FOR_VIDEO: + g_value_set_boolean (value, dbin->force_sw_decoders_for_video); + break; + case PROP_FORCE_SW_DECODERS_FOR_AUDIO: + g_value_set_boolean (value, dbin->force_sw_decoders_for_audio); + break; +#else case PROP_FORCE_SW_DECODERS: g_value_set_boolean (value, dbin->force_sw_decoders); break; +#endif default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1066,12 +1110,26 @@ gst_decode_bin_update_factories_list (GstDecodebin3 * dbin) if (gst_element_factory_list_is_type (fact, GST_ELEMENT_FACTORY_TYPE_DECODER)) { +#ifdef TIZEN_FEATURE_FORCE_SW_DECODER + if (!(dbin->force_sw_decoders_for_video && + gst_element_factory_list_is_type (fact, GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO) && + gst_element_factory_list_is_type (fact, GST_ELEMENT_FACTORY_TYPE_HARDWARE)) || + !(dbin->force_sw_decoders_for_audio && + gst_element_factory_list_is_type (fact, GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO) && + gst_element_factory_list_is_type (fact, GST_ELEMENT_FACTORY_TYPE_HARDWARE))) { + dbin->decoder_factories = + g_list_append (dbin->decoder_factories, fact); + } else { + GST_WARNING("%s is skipped", GST_OBJECT_NAME(fact)); + } +#else if (!(dbin->force_sw_decoders && gst_element_factory_list_is_type (fact, GST_ELEMENT_FACTORY_TYPE_HARDWARE))) { dbin->decoder_factories = g_list_append (dbin->decoder_factories, fact); } +#endif } else { dbin->decodable_factories = g_list_append (dbin->decodable_factories, fact); diff --git a/packaging/gst-plugins-base.spec b/packaging/gst-plugins-base.spec index 781f59b..7f8e31f 100644 --- a/packaging/gst-plugins-base.spec +++ b/packaging/gst-plugins-base.spec @@ -90,6 +90,7 @@ export CFLAGS="%{optflags} -fno-strict-aliasing\ -DTIZEN_FEATURE_VIDEO_MODIFICATION\ -DTIZEN_FEATURE_SUBPARSE_MODIFICATION\ -DTIZEN_FEATURE_VOLUME_MODIFICATION\ + -DTIZEN_FEATURE_FORCE_SW_DECODER\ %if "%{tizen_profile_name}" == "tv" -DTIZEN_PROFILE_TV\ -DTIZEN_FEATURE_TRUSTZONE\