mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 05:16:13 +00:00
Merge remote-tracking branch 'keema/master'
Conflicts: gst-sdk/tutorials/basic-tutorial-12.c
This commit is contained in:
commit
003fa6a129
1 changed files with 5 additions and 16 deletions
|
@ -7,11 +7,6 @@ typedef struct _CustomData {
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
} CustomData;
|
} CustomData;
|
||||||
|
|
||||||
/* playbin2 flags */
|
|
||||||
typedef enum {
|
|
||||||
GST_PLAY_FLAG_BUFFERING = (1 << 8) /* We want to allow buffering */
|
|
||||||
} GstPlayFlags;
|
|
||||||
|
|
||||||
static void cb_message (GstBus *bus, GstMessage *msg, CustomData *data) {
|
static void cb_message (GstBus *bus, GstMessage *msg, CustomData *data) {
|
||||||
|
|
||||||
switch (GST_MESSAGE_TYPE (msg)) {
|
switch (GST_MESSAGE_TYPE (msg)) {
|
||||||
|
@ -33,11 +28,6 @@ static void cb_message (GstBus *bus, GstMessage *msg, CustomData *data) {
|
||||||
gst_element_set_state (data->pipeline, GST_STATE_READY);
|
gst_element_set_state (data->pipeline, GST_STATE_READY);
|
||||||
g_main_loop_quit (data->loop);
|
g_main_loop_quit (data->loop);
|
||||||
break;
|
break;
|
||||||
case GST_MESSAGE_CLOCK_LOST:
|
|
||||||
/* Get a new clock */
|
|
||||||
gst_element_set_state (data->pipeline, GST_STATE_PAUSED);
|
|
||||||
gst_element_set_state (data->pipeline, GST_STATE_PLAYING);
|
|
||||||
break;
|
|
||||||
case GST_MESSAGE_BUFFERING: {
|
case GST_MESSAGE_BUFFERING: {
|
||||||
gint percent = 0;
|
gint percent = 0;
|
||||||
|
|
||||||
|
@ -53,6 +43,11 @@ static void cb_message (GstBus *bus, GstMessage *msg, CustomData *data) {
|
||||||
gst_element_set_state (data->pipeline, GST_STATE_PLAYING);
|
gst_element_set_state (data->pipeline, GST_STATE_PLAYING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GST_MESSAGE_CLOCK_LOST:
|
||||||
|
/* Get a new clock */
|
||||||
|
gst_element_set_state (data->pipeline, GST_STATE_PAUSED);
|
||||||
|
gst_element_set_state (data->pipeline, GST_STATE_PLAYING);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
/* Unhandled message */
|
/* Unhandled message */
|
||||||
break;
|
break;
|
||||||
|
@ -65,7 +60,6 @@ int main(int argc, char *argv[]) {
|
||||||
GstStateChangeReturn ret;
|
GstStateChangeReturn ret;
|
||||||
GMainLoop *main_loop;
|
GMainLoop *main_loop;
|
||||||
CustomData data;
|
CustomData data;
|
||||||
guint flags;
|
|
||||||
|
|
||||||
/* Initialize GStreamer */
|
/* Initialize GStreamer */
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
@ -77,11 +71,6 @@ int main(int argc, char *argv[]) {
|
||||||
pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);
|
pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);
|
||||||
bus = gst_element_get_bus (pipeline);
|
bus = gst_element_get_bus (pipeline);
|
||||||
|
|
||||||
/* Set the buffering flag */
|
|
||||||
g_object_get (pipeline, "flags", &flags, NULL);
|
|
||||||
flags |= GST_PLAY_FLAG_BUFFERING;
|
|
||||||
g_object_set (pipeline, "flags", flags, NULL);
|
|
||||||
|
|
||||||
/* Start playing */
|
/* Start playing */
|
||||||
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
if (ret == GST_STATE_CHANGE_FAILURE) {
|
if (ret == GST_STATE_CHANGE_FAILURE) {
|
||||||
|
|
Loading…
Reference in a new issue