diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | docs/plugins/gst-plugins-bad-plugins.args | 10 | ||||
-rw-r--r-- | ext/libmms/gstmms.c | 36 | ||||
-rw-r--r-- | ext/libmms/gstmms.h | 2 |
4 files changed, 53 insertions, 5 deletions
@@ -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-bad-plugins.args: + * ext/libmms/gstmms.c: (gst_mms_class_init), (gst_mms_init), + (gst_mms_start), (gst_mms_set_property), (gst_mms_get_property): + * ext/libmms/gstmms.h: + Add connection speed property to libmms. Fixes #464678. + 2007-08-07 Wim Taymans <wim.taymans@gmail.com> * gst/real/gstrealvideodec.c: (gst_real_video_dec_chain), diff --git a/docs/plugins/gst-plugins-bad-plugins.args b/docs/plugins/gst-plugins-bad-plugins.args index 38625f08..f5dfcf31 100644 --- a/docs/plugins/gst-plugins-bad-plugins.args +++ b/docs/plugins/gst-plugins-bad-plugins.args @@ -1039,6 +1039,16 @@ </ARG> <ARG> +<NAME>GstMMS::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>GstFaac::bitrate</NAME> <TYPE>gint</TYPE> <RANGE>[8192,327680]</RANGE> diff --git a/ext/libmms/gstmms.c b/ext/libmms/gstmms.c index d80cac18..0951e590 100644 --- a/ext/libmms/gstmms.c +++ b/ext/libmms/gstmms.c @@ -27,10 +27,13 @@ #include <string.h> #include "gstmms.h" +#define DEFAULT_CONNECTION_SPEED 0 + enum { ARG_0, - ARG_LOCATION + ARG_LOCATION, + ARG_CONNECTION_SPEED }; @@ -113,6 +116,12 @@ gst_mms_class_init (GstMMSClass * klass) "Host URL to connect to. Accepted are mms://, mmsu://, mmst:// URL types", NULL, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_CONNECTION_SPEED, + g_param_spec_uint ("connection-speed", "Connection Speed", + "Network connection speed in kbps (0 = unknown)", + 0, G_MAXINT / 1000, DEFAULT_CONNECTION_SPEED, G_PARAM_READWRITE)); + /* Note: connection-speed is intentionaly limited to G_MAXINT as libmms use int for it */ + gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_mms_start); gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_mms_stop); @@ -136,6 +145,7 @@ gst_mms_init (GstMMS * mmssrc, GstMMSClass * g_class) mmssrc->uri_name = NULL; mmssrc->connection = NULL; mmssrc->connection_h = NULL; + mmssrc->connection_speed = DEFAULT_CONNECTION_SPEED; GST_BASE_SRC (mmssrc)->blocksize = 2048; } @@ -279,20 +289,30 @@ static gboolean gst_mms_start (GstBaseSrc * bsrc) { GstMMS *mms; + guint bandwidth_avail; mms = GST_MMS (bsrc); if (!mms->uri_name || *mms->uri_name == '\0') goto no_uri; + if (mms->connection_speed) + bandwidth_avail = mms->connection_speed; + else + bandwidth_avail = G_MAXINT; + /* FIXME: pass some sane arguments here */ - GST_DEBUG_OBJECT (mms, "Trying mms_connect (%s)", mms->uri_name); - mms->connection = mms_connect (NULL, NULL, mms->uri_name, 128 * 1024); + GST_DEBUG_OBJECT (mms, + "Trying mms_connect (%s) with bandwidth constraint of %d bps", + mms->uri_name, bandwidth_avail); + mms->connection = mms_connect (NULL, NULL, mms->uri_name, bandwidth_avail); if (mms->connection) goto success; - GST_DEBUG_OBJECT (mms, "Trying mmsh_connect (%s)", mms->uri_name); - mms->connection_h = mmsh_connect (NULL, NULL, mms->uri_name, 128 * 1024); + GST_DEBUG_OBJECT (mms, + "Trying mmsh_connect (%s) with bandwidth constraint of %d bps", + mms->uri_name, bandwidth_avail); + mms->connection_h = mmsh_connect (NULL, NULL, mms->uri_name, bandwidth_avail); if (!mms->connection_h) goto no_connect; @@ -353,6 +373,9 @@ gst_mms_set_property (GObject * object, guint prop_id, } mmssrc->uri_name = g_value_dup_string (value); break; + case ARG_CONNECTION_SPEED: + mmssrc->connection_speed = g_value_get_uint (value) * 1000; + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -374,6 +397,9 @@ gst_mms_get_property (GObject * object, guint prop_id, if (mmssrc->uri_name) g_value_set_string (value, mmssrc->uri_name); break; + case ARG_CONNECTION_SPEED: + g_value_set_uint (value, mmssrc->connection_speed / 1000); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff --git a/ext/libmms/gstmms.h b/ext/libmms/gstmms.h index 70aa7708..7e7143a4 100644 --- a/ext/libmms/gstmms.h +++ b/ext/libmms/gstmms.h @@ -32,6 +32,8 @@ struct _GstMMS GstPushSrc parent; gchar *uri_name; + guint connection_speed; + mms_t *connection; mmsh_t *connection_h; }; |