/* Properties */
GstCaps *caps;
+ gboolean force_sw_decoders;
};
struct _GstDecodebin3Class
enum
{
PROP_0,
- PROP_CAPS
+ PROP_CAPS,
+ PROP_FORCE_SW_DECODERS,
};
/* signals */
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",
GST_PAD_SINK,
GST_PAD_ALWAYS,
"The caps on which to stop decoding. (NULL = default)",
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 ! */
/**
* GstDecodebin3::select-stream
g_mutex_init (&dbin->input_lock);
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);
}
dbin->caps = g_value_dup_boxed (value);
GST_OBJECT_UNLOCK (dbin);
break;
+ case PROP_FORCE_SW_DECODERS:
+ dbin->force_sw_decoders = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
g_value_set_boxed (value, dbin->caps);
GST_OBJECT_UNLOCK (dbin);
break;
+ case PROP_FORCE_SW_DECODERS:
+ g_value_set_boolean (value, dbin->force_sw_decoders);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
dbin->decodable_factories = NULL;
for (tmp = dbin->factories; tmp; tmp = tmp->next) {
GstElementFactory *fact = (GstElementFactory *) tmp->data;
+
if (gst_element_factory_list_is_type (fact,
- GST_ELEMENT_FACTORY_TYPE_DECODER))
- dbin->decoder_factories = g_list_append (dbin->decoder_factories, fact);
- else
+ GST_ELEMENT_FACTORY_TYPE_DECODER)) {
+ 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);
+ }
+ } else {
dbin->decodable_factories =
g_list_append (dbin->decodable_factories, fact);
+ }
}
}
}
if (playbin->curr_group) {
GST_SOURCE_GROUP_LOCK (playbin->curr_group);
if (playbin->curr_group->uridecodebin) {
- g_object_set (playbin->curr_group->uridecodebin, "download",
- (g_value_get_flags (value) & GST_PLAY_FLAG_DOWNLOAD) != 0, NULL);
+ guint flags = g_value_get_flags (value);
+ g_object_set (playbin->curr_group->uridecodebin,
+ "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);
}
}
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 *ave_list = NULL;
gst_element_factory_list_is_type (factory,
GST_ELEMENT_FACTORY_TYPE_SINK)) {
dec_list = g_list_prepend (dec_list, gst_object_ref (factory));
- } else {
+ } else if (!(((flags & GST_PLAY_FLAG_FORCE_SW_DECODERS) != 0)
+ && gst_element_factory_list_is_type (factory,
+ GST_ELEMENT_FACTORY_TYPE_HARDWARE))) {
GSequenceIter *seq_iter;
seq_iter =
if (isaudiodeclist || isvideodeclist) {
GSequence **ave_list;
+ GstPlayFlags flags;
+
if (isaudiodeclist)
ave_list = &playbin->aelements;
else
ave_list = &playbin->velements;
+ flags = gst_play_bin_get_flags (playbin);
+
g_mutex_lock (&playbin->elements_lock);
/* sort factory_list based on the GstAVElement list priority */
- factory_list = create_decoders_list (factory_list, *ave_list);
+ factory_list = create_decoders_list (factory_list, *ave_list, flags);
g_mutex_unlock (&playbin->elements_lock);
}
"download", ((flags & GST_PLAY_FLAG_DOWNLOAD) != 0),
/* configure buffering of demuxed/parsed data */
"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 */
"buffer-duration", playbin->buffer_duration,
"buffer-size", playbin->buffer_size,
guint buffer_size; /* When buffering, buffer size (bytes) */
gboolean download;
gboolean use_buffering;
+ gboolean force_sw_decoders;
guint64 ring_buffer_max_size;
GList *play_items; /* List of GstPlayItem ordered by time of
#define DEFAULT_BUFFER_SIZE -1
#define DEFAULT_DOWNLOAD FALSE
#define DEFAULT_USE_BUFFERING FALSE
+#define DEFAULT_FORCE_SW_DECODERS FALSE
#define DEFAULT_RING_BUFFER_MAX_SIZE 0
enum
PROP_BUFFER_DURATION,
PROP_DOWNLOAD,
PROP_USE_BUFFERING,
+ PROP_FORCE_SW_DECODERS,
PROP_RING_BUFFER_MAX_SIZE,
PROP_CAPS
};
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
*
* The maximum size of the ring buffer in kilobytes. If set to 0, the ring
case PROP_USE_BUFFERING:
dec->use_buffering = g_value_get_boolean (value);
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:
dec->ring_buffer_max_size = g_value_get_uint64 (value);
break;
case PROP_USE_BUFFERING:
g_value_set_boolean (value, dec->use_buffering);
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:
g_value_set_uint64 (value, dec->ring_buffer_max_size);
break;