Commit 4403cf4e authored by Wim Taymans's avatar Wim Taymans Committed by Wim Taymans
Browse files

playbin2: add support for progressive download

Add a new playbin2 flag (initially disabled) to enable progressive download
buffering in uridecodebin.
parent f4d78328
......@@ -28,7 +28,7 @@ register_gst_autoplug_select_result (GType * id)
static const GEnumValue values[] = {
{C_ENUM (GST_AUTOPLUG_SELECT_TRY), "GST_AUTOPLUG_SELECT_TRY", "try"},
{C_ENUM (GST_AUTOPLUG_SELECT_EXPOSE), "GST_AUTOPLUG_SELECT_EXPOSE",
"expose"},
"expose"},
{C_ENUM (GST_AUTOPLUG_SELECT_SKIP), "GST_AUTOPLUG_SELECT_SKIP", "skip"},
{0, NULL, NULL}
};
......@@ -53,12 +53,14 @@ register_gst_play_flags (GType * id)
{C_FLAGS (GST_PLAY_FLAG_AUDIO), "Render the audio stream", "audio"},
{C_FLAGS (GST_PLAY_FLAG_TEXT), "Render subtitles", "text"},
{C_FLAGS (GST_PLAY_FLAG_VIS),
"Render visualisation when no video is present", "vis"},
"Render visualisation when no video is present", "vis"},
{C_FLAGS (GST_PLAY_FLAG_SOFT_VOLUME), "Use software volume", "soft-volume"},
{C_FLAGS (GST_PLAY_FLAG_NATIVE_AUDIO), "Only use native audio formats",
"native-audio"},
"native-audio"},
{C_FLAGS (GST_PLAY_FLAG_NATIVE_VIDEO), "Only use native video formats",
"native-video"},
"native-video"},
{C_FLAGS (GST_PLAY_FLAG_DOWNLOAD), "Attempt progressive download buffering",
"download"},
{0, NULL, NULL}
};
*id = g_flags_register_static ("GstPlayFlags", values);
......
......@@ -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())
......
......@@ -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 */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment