playbin2: add support for progressive download

Add a new playbin2 flag (initially disabled) to enable progressive download
buffering in uridecodebin.
This commit is contained in:
Wim Taymans 2009-07-10 20:04:33 +01:00 committed by Wim Taymans
parent f4d78328dd
commit 4403cf4efb
3 changed files with 33 additions and 8 deletions

View file

@ -59,6 +59,8 @@ register_gst_play_flags (GType * id)
"native-audio"},
{C_FLAGS (GST_PLAY_FLAG_NATIVE_VIDEO), "Only use native video formats",
"native-video"},
{C_FLAGS (GST_PLAY_FLAG_DOWNLOAD), "Attempt progressive download buffering",
"download"},
{0, NULL, NULL}
};
*id = g_flags_register_static ("GstPlayFlags", values);

View file

@ -53,6 +53,8 @@ GType gst_autoplug_select_result_get_type (void);
* configuration of audioconvert and audioresample.
* @GST_PLAY_FLAG_NATIVE_VIDEO: only allow native video formats, this omits
* configuration of ffmpegcolorspace and videoscale.
* @GST_PLAY_FLAG_DOWNLOAD: enable progressice download buffering for selected
* formats.
*
* Extra flags to configure the behaviour of the sinks.
*/
@ -63,7 +65,8 @@ typedef enum {
GST_PLAY_FLAG_VIS = (1 << 3),
GST_PLAY_FLAG_SOFT_VOLUME = (1 << 4),
GST_PLAY_FLAG_NATIVE_AUDIO = (1 << 5),
GST_PLAY_FLAG_NATIVE_VIDEO = (1 << 6)
GST_PLAY_FLAG_NATIVE_VIDEO = (1 << 6),
GST_PLAY_FLAG_DOWNLOAD = (1 << 7)
} GstPlayFlags;
#define GST_TYPE_PLAY_FLAGS (gst_play_flags_get_type())

View file

@ -1173,6 +1173,23 @@ gst_play_bin_set_suburi (GstPlayBin * playbin, const gchar * suburi)
GST_PLAY_BIN_UNLOCK (playbin);
}
static void
gst_play_bin_set_flags (GstPlayBin * playbin, GstPlayFlags flags)
{
gst_play_sink_set_flags (playbin->playsink, flags);
gst_play_sink_reconfigure (playbin->playsink);
}
static GstPlayFlags
gst_play_bin_get_flags (GstPlayBin * playbin)
{
GstPlayFlags flags;
flags = gst_play_sink_get_flags (playbin->playsink);
return flags;
}
/* get the currently playing group or if nothing is playing, the next
* group. Must be called with the PLAY_BIN_LOCK. */
static GstSourceGroup *
@ -1527,8 +1544,7 @@ gst_play_bin_set_property (GObject * object, guint prop_id,
gst_play_bin_set_suburi (playbin, g_value_get_string (value));
break;
case PROP_FLAGS:
gst_play_sink_set_flags (playbin->playsink, g_value_get_flags (value));
gst_play_sink_reconfigure (playbin->playsink);
gst_play_bin_set_flags (playbin, g_value_get_flags (value));
break;
case PROP_CURRENT_VIDEO:
gst_play_bin_set_current_video_stream (playbin, g_value_get_int (value));
@ -1644,7 +1660,7 @@ gst_play_bin_get_property (GObject * object, guint prop_id, GValue * value,
break;
}
case PROP_FLAGS:
g_value_set_flags (value, gst_play_sink_get_flags (playbin->playsink));
g_value_set_flags (value, gst_play_bin_get_flags (playbin));
break;
case PROP_N_VIDEO:
{
@ -2521,6 +2537,10 @@ 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)
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 */