Add connection-speed property. Fixes #464690.

Original commit message from CVS:
Patch by: Josep Torre Valles <josep@fluendo.com>
* docs/plugins/gst-plugins-base-plugins.args:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_class_init),
(gst_uri_decode_bin_init), (gst_uri_decode_bin_set_property),
(gst_uri_decode_bin_get_property), (gen_source_element):
Add connection-speed property. Fixes #464690.
This commit is contained in:
Josep Torre Valles 2007-08-08 15:05:22 +00:00 committed by Wim Taymans
parent 9b8c837165
commit 382b710277
3 changed files with 46 additions and 1 deletions

View file

@ -1,3 +1,13 @@
2007-08-08 Wim Taymans <wim.taymans@gmail.com>
Patch by: Josep Torre Valles <josep@fluendo.com>
* docs/plugins/gst-plugins-base-plugins.args:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_class_init),
(gst_uri_decode_bin_init), (gst_uri_decode_bin_set_property),
(gst_uri_decode_bin_get_property), (gen_source_element):
Add connection-speed property. Fixes #464690.
2007-08-07 Wim Taymans <wim.taymans@gmail.com>
Patch by: Damien Lespiau <damien dot lespiau at gmail dot com>

View file

@ -1708,6 +1708,16 @@
<DEFAULT>NULL</DEFAULT>
</ARG>
<ARG>
<NAME>GstURIDecodeBin::connection-speed</NAME>
<TYPE>guint</TYPE>
<RANGE></RANGE>
<FLAGS>rw</FLAGS>
<NICK>Connection Speed</NICK>
<BLURB>Network connection speed in kbps (0 = unknown).</BLURB>
<DEFAULT>0</DEFAULT>
</ARG>
<ARG>
<NAME>GstQueue2::current-level-buffers</NAME>
<TYPE>guint</TYPE>

View file

@ -52,6 +52,7 @@ struct _GstURIDecodeBin
GstBin parent_instance;
gchar *uri;
guint connection_speed;
gboolean is_stream;
GstElement *source;
@ -85,11 +86,13 @@ GST_ELEMENT_DETAILS ("URI Decoder",
"Autoplug and decode an URI to raw media",
"Wim Taymans <wim@fluendo.com>");
#define DEFAULT_PROP_URI NULL
#define DEFAULT_PROP_URI NULL
#define DEFAULT_CONNECTION_SPEED 0
enum
{
PROP_0,
PROP_URI,
PROP_CONNECTION_SPEED,
PROP_LAST
};
@ -135,6 +138,11 @@ gst_uri_decode_bin_class_init (GstURIDecodeBinClass * klass)
g_param_spec_string ("uri", "URI", "URI to decode",
DEFAULT_PROP_URI, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_CONNECTION_SPEED,
g_param_spec_uint ("connection-speed", "Connection Speed",
"Network connection speed in kbps (0 = unknown)",
0, G_MAXUINT, DEFAULT_CONNECTION_SPEED, G_PARAM_READWRITE));
gstelement_class->query = GST_DEBUG_FUNCPTR (gst_uri_decode_bin_query);
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_uri_decode_bin_change_state);
@ -144,6 +152,7 @@ static void
gst_uri_decode_bin_init (GstURIDecodeBin * dec, GstURIDecodeBinClass * klass)
{
dec->uri = g_strdup (DEFAULT_PROP_URI);
dec->uri = DEFAULT_CONNECTION_SPEED;
}
static void
@ -168,6 +177,9 @@ gst_uri_decode_bin_set_property (GObject * object, guint prop_id,
g_free (dec->uri);
dec->uri = g_value_dup_string (value);
break;
case PROP_CONNECTION_SPEED:
dec->connection_speed = g_value_get_uint (value) * 1000;
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -184,6 +196,9 @@ gst_uri_decode_bin_get_property (GObject * object, guint prop_id,
case PROP_URI:
g_value_set_string (value, dec->uri);
break;
case PROP_CONNECTION_SPEED:
g_value_set_uint (value, dec->connection_speed / 1000);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -369,6 +384,16 @@ gen_source_element (GstURIDecodeBin * decoder)
"iradio-mode")) {
g_object_set (source, "iradio-mode", TRUE, NULL);
}
if (g_object_class_find_property (G_OBJECT_GET_CLASS (source),
"connection-speed")) {
GST_DEBUG_OBJECT (decoder,
"setting connection-speed=%d to source element",
decoder->connection_speed / 1000);
g_object_set (source, "connection-speed",
decoder->connection_speed / 1000, NULL);
}
return source;
/* ERRORS */