+2007-08-07 Wim Taymans <wim.taymans@gmail.com>
+
+ Patch by: Josep Torre Valles <josep@fluendo.com>
+
+ * gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init),
+ (gst_play_base_bin_init), (queue_threshold_reached),
+ (gen_source_element), (setup_substreams),
+ (gst_play_base_bin_set_property), (gst_play_base_bin_get_property),
+ (gst_play_base_bin_get_streaminfo_value_array):
+ * gst/playback/gstplaybasebin.h:
+ * gst/playback/gstplaybin.c: (gst_play_bin_class_init),
+ (gst_play_bin_set_property), (gst_play_bin_get_property),
+ (gst_play_bin_handle_redirect_message):
+ Move connection-speed property from playbin to playbasebin so that we
+ can also configure it in source elements that have the connection-speed
+ property. Fixes #464028.
+ Add some debug info here and there.
+
2007-08-06 Sebastian Dröge <slomo@circular-chaos.org>
* gst/audiotestsrc/gstaudiotestsrc.c: (gst_audio_test_src_query):
#define DEFAULT_QUEUE_SIZE (3 * GST_SECOND)
#define DEFAULT_QUEUE_MIN_THRESHOLD ((DEFAULT_QUEUE_SIZE * 30) / 100)
#define DEFAULT_QUEUE_THRESHOLD ((DEFAULT_QUEUE_SIZE * 95) / 100)
+#define DEFAULT_CONNECTION_SPEED 0
#define GROUP_LOCK(pbb) g_mutex_lock (pbb->group_lock)
#define GROUP_UNLOCK(pbb) g_mutex_unlock (pbb->group_lock)
ARG_VIDEO,
ARG_AUDIO,
ARG_TEXT,
- ARG_SUBTITLE_ENCODING
+ ARG_SUBTITLE_ENCODING,
+ ARG_CONNECTION_SPEED
};
static void gst_play_base_bin_class_init (GstPlayBaseBinClass * klass);
"If not set, the GST_SUBTITLE_ENCODING environment variable will "
"be checked for an encoding to use. If that is not set either, "
"ISO-8859-15 will be assumed.", NULL, G_PARAM_READWRITE));
+ /**
+ * GstPlayBin::connection-speed
+ *
+ * Network connection speed in kbps (0 = unknown)
+ *
+ * Since: 0.10.10 at gstplaybin.c, 0.10.15 moved to gstplaybasebin
+ **/
+ g_object_class_install_property (gobject_klass, ARG_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));
GST_DEBUG_CATEGORY_INIT (gst_play_base_bin_debug, "playbasebin", 0,
"playbasebin");
play_base_bin->queue_size = DEFAULT_QUEUE_SIZE;
play_base_bin->queue_threshold = DEFAULT_QUEUE_THRESHOLD;
play_base_bin->queue_min_threshold = DEFAULT_QUEUE_MIN_THRESHOLD;
+ play_base_bin->connection_speed = DEFAULT_CONNECTION_SPEED;
}
static void
queue_threshold_reached (GstElement * queue, GstPlayBaseBin * play_base_bin)
{
gpointer data;
+ GstPad *sinkpad;
GST_DEBUG_OBJECT (play_base_bin, "running signal received from queue %s",
GST_ELEMENT_NAME (queue));
play_base_bin->queue_min_threshold, NULL);
}
+ sinkpad = gst_element_get_pad (queue, "sink");
+
/* we remove the probe now because we don't need it anymore to give progress
* about the buffering. */
data = g_object_get_data (G_OBJECT (queue), "probe");
if (data) {
- GstPad *sinkpad;
-
- sinkpad = gst_element_get_pad (queue, "sink");
GST_DEBUG_OBJECT (play_base_bin,
"Removing buffer probe from pad %s:%s (%p)",
GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
g_object_set_data (G_OBJECT (queue), "probe", NULL);
gst_pad_remove_buffer_probe (sinkpad, GPOINTER_TO_INT (data));
-
- gst_object_unref (sinkpad);
+ } else {
+ GST_DEBUG_OBJECT (play_base_bin,
+ "No buffer probe to remove from %s:%s (%p)",
+ GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
}
+ gst_object_unref (sinkpad);
/* we post a 100% buffering message to notify the app that buffering is
* completed and playback can start/continue */
"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 (play_base_bin,
+ "setting connection-speed=%d to source element",
+ play_base_bin->connection_speed / 1000);
+ g_object_set (source, "connection-speed",
+ play_base_bin->connection_speed / 1000, NULL);
+ }
+
return source;
/* ERRORS */
gint n;
const GList *item;
+ GST_DEBUG_OBJECT (play_base_bin, "setting up substreams");
+
/* Remove the eat probes */
group = get_active_group (play_base_bin);
for (item = group->streaminfo; item; item = item->next) {
* we have output. Always keep it enabled. */
for (n = 0; n < NUM_TYPES; n++) {
if (play_base_bin->current[n] >= group->type[n].npads) {
+ GST_DEBUG_OBJECT (play_base_bin, "reset type %d to current 0", n);
play_base_bin->current[n] = 0;
}
}
/* now activate the right sources. Don't forget that during preroll,
* we set the first source to forwarding and ignored the rest. */
for (n = 0; n < NUM_TYPES; n++) {
+ GST_DEBUG_OBJECT (play_base_bin, "setting type %d to current %d", n,
+ play_base_bin->current[n]);
set_active_source (play_base_bin, n + 1, play_base_bin->current[n]);
}
}
case ARG_QUEUE_MIN_THRESHOLD:
play_base_bin->queue_min_threshold = g_value_get_uint64 (value);
break;
+ case ARG_CONNECTION_SPEED:
+ play_base_bin->connection_speed = g_value_get_uint (value) * 1000;
+ break;
case ARG_VIDEO:
GROUP_LOCK (play_base_bin);
set_active_source (play_base_bin,
case ARG_QUEUE_MIN_THRESHOLD:
g_value_set_uint64 (value, play_base_bin->queue_min_threshold);
break;
+ case ARG_CONNECTION_SPEED:
+ g_value_set_uint (value, play_base_bin->connection_speed / 1000);
+ break;
case ARG_STREAMINFO:
/* FIXME: hold some kind of lock here, use iterator */
g_value_set_pointer (value,
#define GST_IS_PLAY_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAY_BIN))
#define VOLUME_MAX_DOUBLE 10.0
-#define CONNECTION_SPEED_DEFAULT 0
typedef struct _GstPlayBin GstPlayBin;
typedef struct _GstPlayBinClass GstPlayBinClass;
/* font description */
gchar *font_desc;
- /* connection speed in bits/sec (0 = unknown) */
- guint connection_speed;
-
/* indication if the pipeline is live */
gboolean is_live;
};
ARG_VIS_PLUGIN,
ARG_VOLUME,
ARG_FRAME,
- ARG_FONT_DESC,
- ARG_CONNECTION_SPEED
+ ARG_FONT_DESC
};
/* signals */
"Subtitle font description",
"Pango font description of font "
"to be used for subtitle rendering", NULL, G_PARAM_WRITABLE));
- /**
- * GstPlayBin::connection-speed
- *
- * Network connection speed in kbps (0 = unknown)
- *
- * Since: 0.10.10
- **/
- g_object_class_install_property (gobject_klass, ARG_CONNECTION_SPEED,
- g_param_spec_uint ("connection-speed", "Connection Speed",
- "Network connection speed in kbps (0 = unknown)",
- 0, G_MAXUINT, CONNECTION_SPEED_DEFAULT, G_PARAM_READWRITE));
gobject_klass->dispose = GST_DEBUG_FUNCPTR (gst_play_bin_dispose);
"font-desc", g_value_get_string (value), NULL);
}
break;
- case ARG_CONNECTION_SPEED:
- play_bin->connection_speed = g_value_get_uint (value) * 1000;
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
gst_value_take_buffer (value, cur_frame);
break;
}
- case ARG_CONNECTION_SPEED:
- g_value_set_uint (value, play_bin->connection_speed / 1000);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
GList *l_good = NULL, *l_neutral = NULL, *l_bad = NULL;
GValue new_list = { 0, };
guint size, i;
+ GstPlayBaseBin *playbasebin = GST_PLAY_BASE_BIN (playbin);
+ guint connection_speed = playbasebin->connection_speed;
GST_DEBUG_OBJECT (playbin, "redirect message: %" GST_PTR_FORMAT, msg);
- GST_DEBUG_OBJECT (playbin, "connection speed: %u", playbin->connection_speed);
+ GST_DEBUG_OBJECT (playbin, "connection speed: %u", connection_speed);
- if (playbin->connection_speed == 0 || msg->structure == NULL)
+ if (connection_speed == 0 || msg->structure == NULL)
return msg;
locations_list = gst_structure_get_value (msg->structure, "locations");
if (!gst_structure_get_int (s, "minimum-bitrate", &bitrate) || bitrate <= 0) {
GST_DEBUG_OBJECT (playbin, "no bitrate: %" GST_PTR_FORMAT, s);
l_neutral = g_list_append (l_neutral, (gpointer) s);
- } else if (bitrate > playbin->connection_speed) {
+ } else if (bitrate > connection_speed) {
GST_DEBUG_OBJECT (playbin, "bitrate too high: %" GST_PTR_FORMAT, s);
l_bad = g_list_append (l_bad, (gpointer) s);
- } else if (bitrate <= playbin->connection_speed) {
+ } else if (bitrate <= connection_speed) {
GST_DEBUG_OBJECT (playbin, "bitrate OK: %" GST_PTR_FORMAT, s);
l_good = g_list_append (l_good, (gpointer) s);
}