summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosep Torre Valles <josep@fluendo.com>2007-08-08 15:15:56 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-08-08 15:15:56 +0000
commit47b3e2452d6c4a6625bc32518579abbb279a74df (patch)
tree60d849ab819b367097b22c149e7e485816c7ea03
parent966bbca4bcdd2135d46ba17695abba0d4edfb75a (diff)
downloadgst-plugins-bad-47b3e2452d6c4a6625bc32518579abbb279a74df.tar.gz
gst-plugins-bad-47b3e2452d6c4a6625bc32518579abbb279a74df.tar.bz2
gst-plugins-bad-47b3e2452d6c4a6625bc32518579abbb279a74df.zip
Add connection speed property to libmms. Fixes #464678.
Original commit message from CVS: 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.
-rw-r--r--ChangeLog10
-rw-r--r--docs/plugins/gst-plugins-bad-plugins.args10
-rw-r--r--ext/libmms/gstmms.c36
-rw-r--r--ext/libmms/gstmms.h2
4 files changed, 53 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 69fd9325..200ce9af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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;
};