Revert "playbin3: handle GST_PLAY_FLAG_FORCE_SW_DECODERS"

This reverts commit f4bcf8290b.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/738>
This commit is contained in:
Edward Hervey 2020-07-07 10:52:40 +02:00
parent c9c93339fb
commit 1e596cb33f
3 changed files with 9 additions and 83 deletions

View file

@ -265,7 +265,6 @@ struct _GstDecodebin3
/* Properties */ /* Properties */
GstCaps *caps; GstCaps *caps;
gboolean force_sw_decoders;
}; };
struct _GstDecodebin3Class struct _GstDecodebin3Class
@ -372,8 +371,7 @@ typedef struct _PendingPad
enum enum
{ {
PROP_0, PROP_0,
PROP_CAPS, PROP_CAPS
PROP_FORCE_SW_DECODERS,
}; };
/* signals */ /* signals */
@ -425,8 +423,6 @@ G_DEFINE_TYPE (GstDecodebin3, gst_decodebin3, GST_TYPE_BIN);
static GstStaticCaps default_raw_caps = GST_STATIC_CAPS (DEFAULT_RAW_CAPS); static GstStaticCaps default_raw_caps = GST_STATIC_CAPS (DEFAULT_RAW_CAPS);
#define DEFAULT_FORCE_SW_DECODERS FALSE
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
@ -555,20 +551,6 @@ gst_decodebin3_class_init (GstDecodebin3Class * klass)
"The caps on which to stop decoding. (NULL = default)", "The caps on which to stop decoding. (NULL = default)",
GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); GST_TYPE_CAPS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstDecodeBin::force-sw-decoders:
*
* While auto-plugging, if set to %TRUE, those decoders within
* "Hardware" klass will be ignored. Otherwise they will be tried.
*
* Since: 1.18
*/
g_object_class_install_property (gobject_klass, PROP_FORCE_SW_DECODERS,
g_param_spec_boolean ("force-sw-decoders", "Software Decoders Only",
"Use only sofware decoders to process streams",
DEFAULT_FORCE_SW_DECODERS,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/* FIXME : ADD SIGNALS ! */ /* FIXME : ADD SIGNALS ! */
/** /**
* GstDecodebin3::select-stream * GstDecodebin3::select-stream
@ -649,7 +631,6 @@ gst_decodebin3_init (GstDecodebin3 * dbin)
g_mutex_init (&dbin->input_lock); g_mutex_init (&dbin->input_lock);
dbin->caps = gst_static_caps_get (&default_raw_caps); dbin->caps = gst_static_caps_get (&default_raw_caps);
dbin->force_sw_decoders = DEFAULT_FORCE_SW_DECODERS;
GST_OBJECT_FLAG_SET (dbin, GST_BIN_FLAG_STREAMS_AWARE); GST_OBJECT_FLAG_SET (dbin, GST_BIN_FLAG_STREAMS_AWARE);
} }
@ -701,9 +682,6 @@ gst_decodebin3_set_property (GObject * object, guint prop_id,
dbin->caps = g_value_dup_boxed (value); dbin->caps = g_value_dup_boxed (value);
GST_OBJECT_UNLOCK (dbin); GST_OBJECT_UNLOCK (dbin);
break; break;
case PROP_FORCE_SW_DECODERS:
dbin->force_sw_decoders = g_value_get_boolean (value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -723,9 +701,6 @@ gst_decodebin3_get_property (GObject * object, guint prop_id, GValue * value,
g_value_set_boxed (value, dbin->caps); g_value_set_boxed (value, dbin->caps);
GST_OBJECT_UNLOCK (dbin); GST_OBJECT_UNLOCK (dbin);
break; break;
case PROP_FORCE_SW_DECODERS:
g_value_set_boolean (value, dbin->force_sw_decoders);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -1067,19 +1042,12 @@ gst_decode_bin_update_factories_list (GstDecodebin3 * dbin)
dbin->decodable_factories = NULL; dbin->decodable_factories = NULL;
for (tmp = dbin->factories; tmp; tmp = tmp->next) { for (tmp = dbin->factories; tmp; tmp = tmp->next) {
GstElementFactory *fact = (GstElementFactory *) tmp->data; GstElementFactory *fact = (GstElementFactory *) tmp->data;
if (gst_element_factory_list_is_type (fact, if (gst_element_factory_list_is_type (fact,
GST_ELEMENT_FACTORY_TYPE_DECODER)) { GST_ELEMENT_FACTORY_TYPE_DECODER))
if (!(dbin->force_sw_decoders dbin->decoder_factories = g_list_append (dbin->decoder_factories, fact);
&& gst_element_factory_list_is_type (fact, else
GST_ELEMENT_FACTORY_TYPE_HARDWARE))) {
dbin->decoder_factories =
g_list_append (dbin->decoder_factories, fact);
}
} else {
dbin->decodable_factories = dbin->decodable_factories =
g_list_append (dbin->decodable_factories, fact); g_list_append (dbin->decodable_factories, fact);
}
} }
} }
} }

View file

@ -1776,11 +1776,8 @@ gst_play_bin3_set_property (GObject * object, guint prop_id,
if (playbin->curr_group) { if (playbin->curr_group) {
GST_SOURCE_GROUP_LOCK (playbin->curr_group); GST_SOURCE_GROUP_LOCK (playbin->curr_group);
if (playbin->curr_group->uridecodebin) { if (playbin->curr_group->uridecodebin) {
guint flags = g_value_get_flags (value); g_object_set (playbin->curr_group->uridecodebin, "download",
g_object_set (playbin->curr_group->uridecodebin, (g_value_get_flags (value) & GST_PLAY_FLAG_DOWNLOAD) != 0, NULL);
"download", (flags & GST_PLAY_FLAG_DOWNLOAD) != 0,
"force-sw-decoders",
(flags & GST_PLAY_FLAG_FORCE_SW_DECODERS) != 0, NULL);
} }
GST_SOURCE_GROUP_UNLOCK (playbin->curr_group); GST_SOURCE_GROUP_UNLOCK (playbin->curr_group);
} }
@ -3474,8 +3471,7 @@ avelement_iter_is_equal (GSequenceIter * iter, GstElementFactory * factory)
} }
static GList * static GList *
create_decoders_list (GList * factory_list, GSequence * avelements, create_decoders_list (GList * factory_list, GSequence * avelements)
GstPlayFlags flags)
{ {
GList *dec_list = NULL, *tmp; GList *dec_list = NULL, *tmp;
GList *ave_list = NULL; GList *ave_list = NULL;
@ -3494,9 +3490,7 @@ create_decoders_list (GList * factory_list, GSequence * avelements,
gst_element_factory_list_is_type (factory, gst_element_factory_list_is_type (factory,
GST_ELEMENT_FACTORY_TYPE_SINK)) { GST_ELEMENT_FACTORY_TYPE_SINK)) {
dec_list = g_list_prepend (dec_list, gst_object_ref (factory)); dec_list = g_list_prepend (dec_list, gst_object_ref (factory));
} else if (!(((flags & GST_PLAY_FLAG_FORCE_SW_DECODERS) != 0) } else {
&& gst_element_factory_list_is_type (factory,
GST_ELEMENT_FACTORY_TYPE_HARDWARE))) {
GSequenceIter *seq_iter; GSequenceIter *seq_iter;
seq_iter = seq_iter =
@ -3618,18 +3612,14 @@ autoplug_factories_cb (GstElement * decodebin, GstPad * pad,
if (isaudiodeclist || isvideodeclist) { if (isaudiodeclist || isvideodeclist) {
GSequence **ave_list; GSequence **ave_list;
GstPlayFlags flags;
if (isaudiodeclist) if (isaudiodeclist)
ave_list = &playbin->aelements; ave_list = &playbin->aelements;
else else
ave_list = &playbin->velements; ave_list = &playbin->velements;
flags = gst_play_bin_get_flags (playbin);
g_mutex_lock (&playbin->elements_lock); g_mutex_lock (&playbin->elements_lock);
/* sort factory_list based on the GstAVElement list priority */ /* sort factory_list based on the GstAVElement list priority */
factory_list = create_decoders_list (factory_list, *ave_list, flags); factory_list = create_decoders_list (factory_list, *ave_list);
g_mutex_unlock (&playbin->elements_lock); g_mutex_unlock (&playbin->elements_lock);
} }
@ -4531,8 +4521,6 @@ activate_group (GstPlayBin3 * playbin, GstSourceGroup * group)
"download", ((flags & GST_PLAY_FLAG_DOWNLOAD) != 0), "download", ((flags & GST_PLAY_FLAG_DOWNLOAD) != 0),
/* configure buffering of demuxed/parsed data */ /* configure buffering of demuxed/parsed data */
"use-buffering", ((flags & GST_PLAY_FLAG_BUFFERING) != 0), "use-buffering", ((flags & GST_PLAY_FLAG_BUFFERING) != 0),
/* configure usage of hardware elements */
"force-sw-decoders", ((flags & GST_PLAY_FLAG_FORCE_SW_DECODERS) != 0),
/* configure buffering parameters */ /* configure buffering parameters */
"buffer-duration", playbin->buffer_duration, "buffer-duration", playbin->buffer_duration,
"buffer-size", playbin->buffer_size, "buffer-size", playbin->buffer_size,

View file

@ -196,7 +196,6 @@ struct _GstURIDecodeBin3
guint buffer_size; /* When buffering, buffer size (bytes) */ guint buffer_size; /* When buffering, buffer size (bytes) */
gboolean download; gboolean download;
gboolean use_buffering; gboolean use_buffering;
gboolean force_sw_decoders;
guint64 ring_buffer_max_size; guint64 ring_buffer_max_size;
GList *play_items; /* List of GstPlayItem ordered by time of GList *play_items; /* List of GstPlayItem ordered by time of
@ -280,7 +279,6 @@ static GstStaticCaps raw_video_caps = GST_STATIC_CAPS ("video/x-raw(ANY)");
#define DEFAULT_BUFFER_SIZE -1 #define DEFAULT_BUFFER_SIZE -1
#define DEFAULT_DOWNLOAD FALSE #define DEFAULT_DOWNLOAD FALSE
#define DEFAULT_USE_BUFFERING FALSE #define DEFAULT_USE_BUFFERING FALSE
#define DEFAULT_FORCE_SW_DECODERS FALSE
#define DEFAULT_RING_BUFFER_MAX_SIZE 0 #define DEFAULT_RING_BUFFER_MAX_SIZE 0
enum enum
@ -296,7 +294,6 @@ enum
PROP_BUFFER_DURATION, PROP_BUFFER_DURATION,
PROP_DOWNLOAD, PROP_DOWNLOAD,
PROP_USE_BUFFERING, PROP_USE_BUFFERING,
PROP_FORCE_SW_DECODERS,
PROP_RING_BUFFER_MAX_SIZE, PROP_RING_BUFFER_MAX_SIZE,
PROP_CAPS PROP_CAPS
}; };
@ -441,21 +438,6 @@ gst_uri_decode_bin3_class_init (GstURIDecodeBin3Class * klass)
"Perform buffering on demuxed/parsed media", "Perform buffering on demuxed/parsed media",
DEFAULT_USE_BUFFERING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); DEFAULT_USE_BUFFERING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstURIDecodeBin3::force-sw-decoders:
*
* While auto-plugging, if set to %TRUE, those decoders within
* "Hardware" klass will by tried. Otherwise they will be ignored.
*
* Since: 1.18
*/
g_object_class_install_property (gobject_class, PROP_FORCE_SW_DECODERS,
g_param_spec_boolean ("force-sw-decoders", "Software Decoders Only",
"Use only sofware decoders to process streams",
DEFAULT_FORCE_SW_DECODERS,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/** /**
* GstURIDecodeBin3::ring-buffer-max-size * GstURIDecodeBin3::ring-buffer-max-size
* *
@ -882,12 +864,6 @@ gst_uri_decode_bin3_set_property (GObject * object, guint prop_id,
case PROP_USE_BUFFERING: case PROP_USE_BUFFERING:
dec->use_buffering = g_value_get_boolean (value); dec->use_buffering = g_value_get_boolean (value);
break; break;
case PROP_FORCE_SW_DECODERS:
if (dec->decodebin) {
g_object_set_property (G_OBJECT (dec->decodebin), "force-sw-decoders",
value);
}
break;
case PROP_RING_BUFFER_MAX_SIZE: case PROP_RING_BUFFER_MAX_SIZE:
dec->ring_buffer_max_size = g_value_get_uint64 (value); dec->ring_buffer_max_size = g_value_get_uint64 (value);
break; break;
@ -967,12 +943,6 @@ gst_uri_decode_bin3_get_property (GObject * object, guint prop_id,
case PROP_USE_BUFFERING: case PROP_USE_BUFFERING:
g_value_set_boolean (value, dec->use_buffering); g_value_set_boolean (value, dec->use_buffering);
break; break;
case PROP_FORCE_SW_DECODERS:
if (dec->decodebin) {
g_object_get_property (G_OBJECT (dec->decodebin), "force-sw-decoders",
value);
}
break;
case PROP_RING_BUFFER_MAX_SIZE: case PROP_RING_BUFFER_MAX_SIZE:
g_value_set_uint64 (value, dec->ring_buffer_max_size); g_value_set_uint64 (value, dec->ring_buffer_max_size);
break; break;