playbin2: set several properties in one go

g_object_set is a varargs function. Save 7 g_obvject_calls (and the overhead of
them) by using it accordingly.
This commit is contained in:
Stefan Kost 2011-03-04 14:39:45 +02:00
parent 09f15da2f8
commit cf9aaffcb9

View file

@ -3194,31 +3194,21 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target)
group->uridecodebin = gst_object_ref (uridecodebin); group->uridecodebin = gst_object_ref (uridecodebin);
} }
/* configure connection speed */
g_object_set (uridecodebin, "connection-speed",
playbin->connection_speed / 1000, NULL);
flags = gst_play_sink_get_flags (playbin->playsink); flags = gst_play_sink_get_flags (playbin->playsink);
/* configure download buffering */ g_object_set (uridecodebin,
if (flags & GST_PLAY_FLAG_DOWNLOAD) /* configure connection speed */
g_object_set (uridecodebin, "download", TRUE, NULL); "connection-speed", playbin->connection_speed / 1000,
else /* configure uri */
g_object_set (uridecodebin, "download", FALSE, NULL); "uri", group->uri,
/* configure download buffering */
/* configure uri */ "download", ((flags & GST_PLAY_FLAG_DOWNLOAD) != 0),
g_object_set (uridecodebin, "uri", group->uri, NULL); /* configure buffering of demuxed/parsed data */
/* configure buffering of demuxed/parsed data */ "use-buffering", ((flags & GST_PLAY_FLAG_BUFFERING) != 0),
if (flags & GST_PLAY_FLAG_BUFFERING) /* configure buffering parameters */
g_object_set (uridecodebin, "use-buffering", TRUE, NULL); "buffer-duration", playbin->buffer_duration,
else "buffer-size", playbin->buffer_size,
g_object_set (uridecodebin, "use-buffering", FALSE, NULL); "ring-buffer-max-size", playbin->ring_buffer_max_size, NULL);
/* configure buffering parameters */
g_object_set (uridecodebin, "buffer-duration", playbin->buffer_duration,
NULL);
g_object_set (uridecodebin, "buffer-size", playbin->buffer_size, NULL);
g_object_set (uridecodebin, "ring-buffer-max-size",
playbin->ring_buffer_max_size, NULL);
/* connect pads and other things */ /* connect pads and other things */
group->pad_added_id = g_signal_connect (uridecodebin, "pad-added", group->pad_added_id = g_signal_connect (uridecodebin, "pad-added",
@ -3268,11 +3258,11 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target)
group->suburidecodebin = gst_object_ref (suburidecodebin); group->suburidecodebin = gst_object_ref (suburidecodebin);
} }
/* configure connection speed */ g_object_set (suburidecodebin,
g_object_set (suburidecodebin, "connection-speed", /* configure connection speed */
playbin->connection_speed, NULL); "connection-speed", playbin->connection_speed,
/* configure uri */ /* configure uri */
g_object_set (suburidecodebin, "uri", group->suburi, NULL); "uri", group->suburi, NULL);
/* connect pads and other things */ /* connect pads and other things */
group->sub_pad_added_id = g_signal_connect (suburidecodebin, "pad-added", group->sub_pad_added_id = g_signal_connect (suburidecodebin, "pad-added",