playbin2: add flag to enable decodebin buffering

Add a flag that enables buffering in decodebin.
This commit is contained in:
Wim Taymans 2009-10-23 14:34:42 -04:00 committed by Wim Taymans
parent f998858192
commit 660fc111d1
3 changed files with 19 additions and 2 deletions

View file

@ -61,6 +61,8 @@ register_gst_play_flags (GType * id)
"native-video"},
{C_FLAGS (GST_PLAY_FLAG_DOWNLOAD), "Attempt progressive download buffering",
"download"},
{C_FLAGS (GST_PLAY_FLAG_BUFFERING), "Buffer demuxed/parsed data",
"buffering"},
{0, NULL, NULL}
};
*id = g_flags_register_static ("GstPlayFlags", values);

View file

@ -55,6 +55,7 @@ GType gst_autoplug_select_result_get_type (void);
* configuration of ffmpegcolorspace and videoscale.
* @GST_PLAY_FLAG_DOWNLOAD: enable progressice download buffering for selected
* formats.
* @GST_PLAY_FLAG_BUFFERING: enable buffering of the demuxed or parsed data.
*
* Extra flags to configure the behaviour of the sinks.
*/
@ -66,7 +67,8 @@ typedef enum {
GST_PLAY_FLAG_SOFT_VOLUME = (1 << 4),
GST_PLAY_FLAG_NATIVE_AUDIO = (1 << 5),
GST_PLAY_FLAG_NATIVE_VIDEO = (1 << 6),
GST_PLAY_FLAG_DOWNLOAD = (1 << 7)
GST_PLAY_FLAG_DOWNLOAD = (1 << 7),
GST_PLAY_FLAG_BUFFERING = (1 << 8)
} GstPlayFlags;
#define GST_TYPE_PLAY_FLAGS (gst_play_flags_get_type())

View file

@ -2600,6 +2600,7 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target)
{
GstElement *uridecodebin;
GstElement *suburidecodebin = NULL;
GstPlayFlags flags;
g_return_val_if_fail (group->valid, FALSE);
g_return_val_if_fail (!group->active, FALSE);
@ -2624,14 +2625,26 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group, GstState target)
/* configure connection speed */
g_object_set (uridecodebin, "connection-speed",
playbin->connection_speed / 1000, NULL);
if (gst_play_sink_get_flags (playbin->playsink) & GST_PLAY_FLAG_DOWNLOAD)
flags = gst_play_sink_get_flags (playbin->playsink);
/* configure download buffering */
if (flags & GST_PLAY_FLAG_DOWNLOAD)
g_object_set (uridecodebin, "download", TRUE, NULL);
else
g_object_set (uridecodebin, "download", FALSE, NULL);
/* configure subtitle encoding */
g_object_set (uridecodebin, "subtitle-encoding", playbin->encoding, NULL);
/* configure uri */
g_object_set (uridecodebin, "uri", group->uri, NULL);
/* configure buffering of demuxed/parsed data */
if (flags & GST_PLAY_FLAG_BUFFERING)
g_object_set (uridecodebin, "use-buffering", TRUE, NULL);
else
g_object_set (uridecodebin, "use-buffering", FALSE, NULL);
/* configure buffering parameters */
g_object_set (uridecodebin, "buffer-duration", playbin->buffer_duration,
NULL);
g_object_set (uridecodebin, "buffer-size", playbin->buffer_size, NULL);