Port playback tutorials to 1.0
authorSebastian Dröge <sebastian@centricular.com>
Thu, 31 Oct 2013 09:13:31 +0000 (10:13 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 31 Oct 2013 09:25:59 +0000 (10:25 +0100)
gst-sdk/tutorials/playback-tutorial-1.c
gst-sdk/tutorials/playback-tutorial-2.c
gst-sdk/tutorials/playback-tutorial-3.c
gst-sdk/tutorials/playback-tutorial-4.c
gst-sdk/tutorials/playback-tutorial-5.c
gst-sdk/tutorials/playback-tutorial-6.c
gst-sdk/tutorials/playback-tutorial-7.c

index e457de6..ddd399f 100644 (file)
@@ -1,8 +1,9 @@
+#include <stdio.h>\r
 #include <gst/gst.h>\r
   \r
 /* Structure to contain all our information, so we can pass it around */\r
 typedef struct _CustomData {\r
-  GstElement *playbin2;  /* Our one and only element */\r
+  GstElement *playbin;  /* Our one and only element */\r
   \r
   gint n_video;          /* Number of embedded video streams */\r
   gint n_audio;          /* Number of embedded audio streams */\r
@@ -15,7 +16,7 @@ typedef struct _CustomData {
   GMainLoop *main_loop;  /* GLib's Main Loop */\r
 } CustomData;\r
   \r
-/* playbin2 flags */\r
+/* playbin flags */\r
 typedef enum {\r
   GST_PLAY_FLAG_VIDEO         = (1 << 0), /* We want video output */\r
   GST_PLAY_FLAG_AUDIO         = (1 << 1), /* We want audio output */\r
@@ -37,31 +38,31 @@ int main(int argc, char *argv[]) {
   gst_init (&argc, &argv);\r
    \r
   /* Create the elements */\r
-  data.playbin2 = gst_element_factory_make ("playbin2", "playbin2");\r
+  data.playbin = gst_element_factory_make ("playbin", "playbin");\r
   \r
-  if (!data.playbin2) {\r
+  if (!data.playbin) {\r
     g_printerr ("Not all elements could be created.\n");\r
     return -1;\r
   }\r
   \r
   /* Set the URI to play */\r
-  g_object_set (data.playbin2, "uri", "http://docs.gstreamer.com/media/sintel_cropped_multilingual.webm", NULL);\r
+  g_object_set (data.playbin, "uri", "http://docs.gstreamer.com/media/sintel_cropped_multilingual.webm", NULL);\r
   \r
   /* Set flags to show Audio and Video but ignore Subtitles */\r
-  g_object_get (data.playbin2, "flags", &flags, NULL);\r
+  g_object_get (data.playbin, "flags", &flags, NULL);\r
   flags |= GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_AUDIO;\r
   flags &= ~GST_PLAY_FLAG_TEXT;\r
-  g_object_set (data.playbin2, "flags", flags, NULL);\r
+  g_object_set (data.playbin, "flags", flags, NULL);\r
   \r
-  /* Set connection speed. This will affect some internal decisions of playbin2 */\r
-  g_object_set (data.playbin2, "connection-speed", 56, NULL);\r
+  /* Set connection speed. This will affect some internal decisions of playbin */\r
+  g_object_set (data.playbin, "connection-speed", 56, NULL);\r
   \r
   /* Add a bus watch, so we get notified when a message arrives */\r
-  bus = gst_element_get_bus (data.playbin2);\r
+  bus = gst_element_get_bus (data.playbin);\r
   gst_bus_add_watch (bus, (GstBusFunc)handle_message, &data);\r
   \r
   /* Add a keyboard watch so we get notified of keystrokes */\r
-#ifdef _WIN32\r
+#ifdef G_OS_WIN32\r
   io_stdin = g_io_channel_win32_new_fd (fileno (stdin));\r
 #else\r
   io_stdin = g_io_channel_unix_new (fileno (stdin));\r
@@ -69,10 +70,10 @@ int main(int argc, char *argv[]) {
   g_io_add_watch (io_stdin, G_IO_IN, (GIOFunc)handle_keyboard, &data);\r
   \r
   /* Start playing */\r
-  ret = gst_element_set_state (data.playbin2, GST_STATE_PLAYING);\r
+  ret = gst_element_set_state (data.playbin, GST_STATE_PLAYING);\r
   if (ret == GST_STATE_CHANGE_FAILURE) {\r
     g_printerr ("Unable to set the pipeline to the playing state.\n");\r
-    gst_object_unref (data.playbin2);\r
+    gst_object_unref (data.playbin);\r
     return -1;\r
   }\r
   \r
@@ -84,8 +85,8 @@ int main(int argc, char *argv[]) {
   g_main_loop_unref (data.main_loop);\r
   g_io_channel_unref (io_stdin);\r
   gst_object_unref (bus);\r
-  gst_element_set_state (data.playbin2, GST_STATE_NULL);\r
-  gst_object_unref (data.playbin2);\r
+  gst_element_set_state (data.playbin, GST_STATE_NULL);\r
+  gst_object_unref (data.playbin);\r
   return 0;\r
 }\r
   \r
@@ -97,9 +98,9 @@ static void analyze_streams (CustomData *data) {
   guint rate;\r
   \r
   /* Read some properties */\r
-  g_object_get (data->playbin2, "n-video", &data->n_video, NULL);\r
-  g_object_get (data->playbin2, "n-audio", &data->n_audio, NULL);\r
-  g_object_get (data->playbin2, "n-text", &data->n_text, NULL);\r
+  g_object_get (data->playbin, "n-video", &data->n_video, NULL);\r
+  g_object_get (data->playbin, "n-audio", &data->n_audio, NULL);\r
+  g_object_get (data->playbin, "n-text", &data->n_text, NULL);\r
   \r
   g_print ("%d video stream(s), %d audio stream(s), %d text stream(s)\n",\r
     data->n_video, data->n_audio, data->n_text);\r
@@ -108,13 +109,13 @@ static void analyze_streams (CustomData *data) {
   for (i = 0; i < data->n_video; i++) {\r
     tags = NULL;\r
     /* Retrieve the stream's video tags */\r
-    g_signal_emit_by_name (data->playbin2, "get-video-tags", i, &tags);\r
+    g_signal_emit_by_name (data->playbin, "get-video-tags", i, &tags);\r
     if (tags) {\r
       g_print ("video stream %d:\n", i);\r
       gst_tag_list_get_string (tags, GST_TAG_VIDEO_CODEC, &str);\r
       g_print ("  codec: %s\n", str ? str : "unknown");\r
       g_free (str);\r
-      gst_tag_list_free (tags);\r
+      gst_tag_list_unref (tags);\r
     }\r
   }\r
   \r
@@ -122,7 +123,7 @@ static void analyze_streams (CustomData *data) {
   for (i = 0; i < data->n_audio; i++) {\r
     tags = NULL;\r
     /* Retrieve the stream's audio tags */\r
-    g_signal_emit_by_name (data->playbin2, "get-audio-tags", i, &tags);\r
+    g_signal_emit_by_name (data->playbin, "get-audio-tags", i, &tags);\r
     if (tags) {\r
       g_print ("audio stream %d:\n", i);\r
       if (gst_tag_list_get_string (tags, GST_TAG_AUDIO_CODEC, &str)) {\r
@@ -136,7 +137,7 @@ static void analyze_streams (CustomData *data) {
       if (gst_tag_list_get_uint (tags, GST_TAG_BITRATE, &rate)) {\r
         g_print ("  bitrate: %d\n", rate);\r
       }\r
-      gst_tag_list_free (tags);\r
+      gst_tag_list_unref (tags);\r
     }\r
   }\r
   \r
@@ -144,20 +145,20 @@ static void analyze_streams (CustomData *data) {
   for (i = 0; i < data->n_text; i++) {\r
     tags = NULL;\r
     /* Retrieve the stream's subtitle tags */\r
-    g_signal_emit_by_name (data->playbin2, "get-text-tags", i, &tags);\r
+    g_signal_emit_by_name (data->playbin, "get-text-tags", i, &tags);\r
     if (tags) {\r
       g_print ("subtitle stream %d:\n", i);\r
       if (gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &str)) {\r
         g_print ("  language: %s\n", str);\r
         g_free (str);\r
       }\r
-      gst_tag_list_free (tags);\r
+      gst_tag_list_unref (tags);\r
     }\r
   }\r
   \r
-  g_object_get (data->playbin2, "current-video", &data->current_video, NULL);\r
-  g_object_get (data->playbin2, "current-audio", &data->current_audio, NULL);\r
-  g_object_get (data->playbin2, "current-text", &data->current_text, NULL);\r
+  g_object_get (data->playbin, "current-video", &data->current_video, NULL);\r
+  g_object_get (data->playbin, "current-audio", &data->current_audio, NULL);\r
+  g_object_get (data->playbin, "current-text", &data->current_text, NULL);\r
   \r
   g_print ("\n");\r
   g_print ("Currently playing video stream %d, audio stream %d and text stream %d\n",\r
@@ -186,7 +187,7 @@ static gboolean handle_message (GstBus *bus, GstMessage *msg, CustomData *data)
     case GST_MESSAGE_STATE_CHANGED: {\r
       GstState old_state, new_state, pending_state;\r
       gst_message_parse_state_changed (msg, &old_state, &new_state, &pending_state);\r
-      if (GST_MESSAGE_SRC (msg) == GST_OBJECT (data->playbin2)) {\r
+      if (GST_MESSAGE_SRC (msg) == GST_OBJECT (data->playbin)) {\r
         if (new_state == GST_STATE_PLAYING) {\r
           /* Once we are in the playing state, analyze the streams */\r
           analyze_streams (data);\r
@@ -206,13 +207,13 @@ static gboolean handle_keyboard (GIOChannel *source, GIOCondition cond, CustomDa
   gchar *str = NULL;\r
   \r
   if (g_io_channel_read_line (source, &str, NULL, NULL, NULL) == G_IO_STATUS_NORMAL) {\r
-    int index = atoi (str);\r
+    int index = g_ascii_strtoull (str, NULL, 0);\r
     if (index < 0 || index >= data->n_audio) {\r
       g_printerr ("Index out of bounds\n");\r
     } else {\r
       /* If the input was a valid audio stream index, set the current audio stream */\r
       g_print ("Setting current audio stream to %d\n", index);\r
-      g_object_set (data->playbin2, "current-audio", index, NULL);\r
+      g_object_set (data->playbin, "current-audio", index, NULL);\r
     }\r
   }\r
   g_free (str);\r
index bd11fbb..19f55f7 100644 (file)
@@ -1,8 +1,9 @@
+#include <stdio.h>\r
 #include <gst/gst.h>\r
   \r
 /* Structure to contain all our information, so we can pass it around */\r
 typedef struct _CustomData {\r
-  GstElement *playbin2;  /* Our one and only element */\r
+  GstElement *playbin;  /* Our one and only element */\r
   \r
   gint n_video;          /* Number of embedded video streams */\r
   gint n_audio;          /* Number of embedded audio streams */\r
@@ -15,7 +16,7 @@ typedef struct _CustomData {
   GMainLoop *main_loop;  /* GLib's Main Loop */\r
 } CustomData;\r
   \r
-/* playbin2 flags */\r
+/* playbin flags */\r
 typedef enum {\r
   GST_PLAY_FLAG_VIDEO         = (1 << 0), /* We want video output */\r
   GST_PLAY_FLAG_AUDIO         = (1 << 1), /* We want audio output */\r
@@ -37,31 +38,31 @@ int main(int argc, char *argv[]) {
   gst_init (&argc, &argv);\r
    \r
   /* Create the elements */\r
-  data.playbin2 = gst_element_factory_make ("playbin2", "playbin2");\r
+  data.playbin = gst_element_factory_make ("playbin", "playbin");\r
   \r
-  if (!data.playbin2) {\r
+  if (!data.playbin) {\r
     g_printerr ("Not all elements could be created.\n");\r
     return -1;\r
   }\r
   \r
   /* Set the URI to play */\r
-  g_object_set (data.playbin2, "uri", "http://docs.gstreamer.com/media/sintel_trailer-480p.ogv", NULL);\r
+  g_object_set (data.playbin, "uri", "http://docs.gstreamer.com/media/sintel_trailer-480p.ogv", NULL);\r
   \r
   /* Set the subtitle URI to play and some font description */\r
-  g_object_set (data.playbin2, "suburi", "http://docs.gstreamer.com/media/sintel_trailer_gr.srt", NULL);\r
-  g_object_set (data.playbin2, "subtitle-font-desc", "Sans, 18", NULL);\r
+  g_object_set (data.playbin, "suburi", "http://docs.gstreamer.com/media/sintel_trailer_gr.srt", NULL);\r
+  g_object_set (data.playbin, "subtitle-font-desc", "Sans, 18", NULL);\r
   \r
   /* Set flags to show Audio, Video and Subtitles */\r
-  g_object_get (data.playbin2, "flags", &flags, NULL);\r
+  g_object_get (data.playbin, "flags", &flags, NULL);\r
   flags |= GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_AUDIO | GST_PLAY_FLAG_TEXT;\r
-  g_object_set (data.playbin2, "flags", flags, NULL);\r
+  g_object_set (data.playbin, "flags", flags, NULL);\r
   \r
   /* Add a bus watch, so we get notified when a message arrives */\r
-  bus = gst_element_get_bus (data.playbin2);\r
+  bus = gst_element_get_bus (data.playbin);\r
   gst_bus_add_watch (bus, (GstBusFunc)handle_message, &data);\r
   \r
   /* Add a keyboard watch so we get notified of keystrokes */\r
-#ifdef _WIN32\r
+#ifdef G_OS_WIN32\r
   io_stdin = g_io_channel_win32_new_fd (fileno (stdin));\r
 #else\r
   io_stdin = g_io_channel_unix_new (fileno (stdin));\r
@@ -69,10 +70,10 @@ int main(int argc, char *argv[]) {
   g_io_add_watch (io_stdin, G_IO_IN, (GIOFunc)handle_keyboard, &data);\r
   \r
   /* Start playing */\r
-  ret = gst_element_set_state (data.playbin2, GST_STATE_PLAYING);\r
+  ret = gst_element_set_state (data.playbin, GST_STATE_PLAYING);\r
   if (ret == GST_STATE_CHANGE_FAILURE) {\r
     g_printerr ("Unable to set the pipeline to the playing state.\n");\r
-    gst_object_unref (data.playbin2);\r
+    gst_object_unref (data.playbin);\r
     return -1;\r
   }\r
   \r
@@ -84,8 +85,8 @@ int main(int argc, char *argv[]) {
   g_main_loop_unref (data.main_loop);\r
   g_io_channel_unref (io_stdin);\r
   gst_object_unref (bus);\r
-  gst_element_set_state (data.playbin2, GST_STATE_NULL);\r
-  gst_object_unref (data.playbin2);\r
+  gst_element_set_state (data.playbin, GST_STATE_NULL);\r
+  gst_object_unref (data.playbin);\r
   return 0;\r
 }\r
   \r
@@ -97,9 +98,9 @@ static void analyze_streams (CustomData *data) {
   guint rate;\r
   \r
   /* Read some properties */\r
-  g_object_get (data->playbin2, "n-video", &data->n_video, NULL);\r
-  g_object_get (data->playbin2, "n-audio", &data->n_audio, NULL);\r
-  g_object_get (data->playbin2, "n-text", &data->n_text, NULL);\r
+  g_object_get (data->playbin, "n-video", &data->n_video, NULL);\r
+  g_object_get (data->playbin, "n-audio", &data->n_audio, NULL);\r
+  g_object_get (data->playbin, "n-text", &data->n_text, NULL);\r
   \r
   g_print ("%d video stream(s), %d audio stream(s), %d text stream(s)\n",\r
     data->n_video, data->n_audio, data->n_text);\r
@@ -108,7 +109,7 @@ static void analyze_streams (CustomData *data) {
   for (i = 0; i < data->n_video; i++) {\r
     tags = NULL;\r
     /* Retrieve the stream's video tags */\r
-    g_signal_emit_by_name (data->playbin2, "get-video-tags", i, &tags);\r
+    g_signal_emit_by_name (data->playbin, "get-video-tags", i, &tags);\r
     if (tags) {\r
       g_print ("video stream %d:\n", i);\r
       gst_tag_list_get_string (tags, GST_TAG_VIDEO_CODEC, &str);\r
@@ -122,7 +123,7 @@ static void analyze_streams (CustomData *data) {
   for (i = 0; i < data->n_audio; i++) {\r
     tags = NULL;\r
     /* Retrieve the stream's audio tags */\r
-    g_signal_emit_by_name (data->playbin2, "get-audio-tags", i, &tags);\r
+    g_signal_emit_by_name (data->playbin, "get-audio-tags", i, &tags);\r
     if (tags) {\r
       g_print ("audio stream %d:\n", i);\r
       if (gst_tag_list_get_string (tags, GST_TAG_AUDIO_CODEC, &str)) {\r
@@ -145,7 +146,7 @@ static void analyze_streams (CustomData *data) {
     tags = NULL;\r
     /* Retrieve the stream's subtitle tags */\r
     g_print ("subtitle stream %d:\n", i);\r
-    g_signal_emit_by_name (data->playbin2, "get-text-tags", i, &tags);\r
+    g_signal_emit_by_name (data->playbin, "get-text-tags", i, &tags);\r
     if (tags) {\r
       if (gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &str)) {\r
         g_print ("  language: %s\n", str);\r
@@ -157,9 +158,9 @@ static void analyze_streams (CustomData *data) {
     }\r
   }\r
   \r
-  g_object_get (data->playbin2, "current-video", &data->current_video, NULL);\r
-  g_object_get (data->playbin2, "current-audio", &data->current_audio, NULL);\r
-  g_object_get (data->playbin2, "current-text", &data->current_text, NULL);\r
+  g_object_get (data->playbin, "current-video", &data->current_video, NULL);\r
+  g_object_get (data->playbin, "current-audio", &data->current_audio, NULL);\r
+  g_object_get (data->playbin, "current-text", &data->current_text, NULL);\r
   \r
   g_print ("\n");\r
   g_print ("Currently playing video stream %d, audio stream %d and subtitle stream %d\n",\r
@@ -188,7 +189,7 @@ static gboolean handle_message (GstBus *bus, GstMessage *msg, CustomData *data)
     case GST_MESSAGE_STATE_CHANGED: {\r
       GstState old_state, new_state, pending_state;\r
       gst_message_parse_state_changed (msg, &old_state, &new_state, &pending_state);\r
-      if (GST_MESSAGE_SRC (msg) == GST_OBJECT (data->playbin2)) {\r
+      if (GST_MESSAGE_SRC (msg) == GST_OBJECT (data->playbin)) {\r
         if (new_state == GST_STATE_PLAYING) {\r
           /* Once we are in the playing state, analyze the streams */\r
           analyze_streams (data);\r
@@ -208,13 +209,13 @@ static gboolean handle_keyboard (GIOChannel *source, GIOCondition cond, CustomDa
   gchar *str = NULL;\r
   \r
   if (g_io_channel_read_line (source, &str, NULL, NULL, NULL) == G_IO_STATUS_NORMAL) {\r
-    int index = atoi (str);\r
+    int index = g_ascii_strtoull (str, NULL, 0);\r
     if (index < 0 || index >= data->n_text) {\r
       g_printerr ("Index out of bounds\n");\r
     } else {\r
       /* If the input was a valid subtitle stream index, set the current subtitle stream */\r
       g_print ("Setting current subtitle stream to %d\n", index);\r
-      g_object_set (data->playbin2, "current-text", index, NULL);\r
+      g_object_set (data->playbin, "current-text", index, NULL);\r
     }\r
   }\r
   g_free (str);\r
index de6d40f..4f8b809 100644 (file)
@@ -1,9 +1,9 @@
 #include <gst/gst.h>
+#include <gst/audio/audio.h>
 #include <string.h>
   
 #define CHUNK_SIZE 1024   /* Amount of bytes we are sending in each buffer */
 #define SAMPLE_RATE 44100 /* Samples per second we are sending */
-#define AUDIO_CAPS "audio/x-raw-int,channels=1,rate=%d,signed=(boolean)true,width=16,depth=16,endianness=BYTE_ORDER"
   
 /* Structure to contain all our information, so we can pass it to callbacks */
 typedef struct _CustomData {
@@ -26,6 +26,7 @@ static gboolean push_data (CustomData *data) {
   GstBuffer *buffer;
   GstFlowReturn ret;
   int i;
+  GstMapInfo map;
   gint16 *raw;
   gint num_samples = CHUNK_SIZE / 2; /* Because each sample is 16 bits */
   gfloat freq;
@@ -38,7 +39,8 @@ static gboolean push_data (CustomData *data) {
   GST_BUFFER_DURATION (buffer) = gst_util_uint64_scale (CHUNK_SIZE, GST_SECOND, SAMPLE_RATE);
   
   /* Generate some psychodelic waveforms */
-  raw = (gint16 *)GST_BUFFER_DATA (buffer);
+  gst_buffer_map (buffer, &map, GST_MAP_WRITE);
+  raw = (gint16 *)map.data;
   data->c += data->d;
   data->d -= data->c / 1000;
   freq = 1100 + 1000 * data->d;
@@ -47,6 +49,7 @@ static gboolean push_data (CustomData *data) {
     data->b -= data->a / freq;
     raw[i] = (gint16)(500 * data->a);
   }
+  gst_buffer_unmap (buffer, &map);
   data->num_samples += num_samples;
   
   /* Push the buffer into the appsrc */
@@ -97,23 +100,22 @@ static void error_cb (GstBus *bus, GstMessage *msg, CustomData *data) {
   g_main_loop_quit (data->main_loop);
 }
   
-/* This function is called when playbin2 has created the appsrc element, so we have
+/* This function is called when playbin has created the appsrc element, so we have
  * a chance to configure it. */
 static void source_setup (GstElement *pipeline, GstElement *source, CustomData *data) {
-  gchar *audio_caps_text;
+  GstAudioInfo info;
   GstCaps *audio_caps;
   
   g_print ("Source has been created. Configuring.\n");
   data->app_source = source;
   
   /* Configure appsrc */
-  audio_caps_text = g_strdup_printf (AUDIO_CAPS, SAMPLE_RATE);
-  audio_caps = gst_caps_from_string (audio_caps_text);
-  g_object_set (source, "caps", audio_caps, NULL);
+  gst_audio_info_set_format (&info, GST_AUDIO_FORMAT_S16, SAMPLE_RATE, 1, NULL);
+  audio_caps = gst_audio_info_to_caps (&info);
+  g_object_set (source, "caps", audio_caps, "format", GST_FORMAT_TIME, NULL);
   g_signal_connect (source, "need-data", G_CALLBACK (start_feed), data);
   g_signal_connect (source, "enough-data", G_CALLBACK (stop_feed), data);
   gst_caps_unref (audio_caps);
-  g_free (audio_caps_text);
 }
   
 int main(int argc, char *argv[]) {
@@ -128,8 +130,8 @@ int main(int argc, char *argv[]) {
   /* Initialize GStreamer */
   gst_init (&argc, &argv);
   
-  /* Create the playbin2 element */
-  data.pipeline = gst_parse_launch ("playbin2 uri=appsrc://", NULL);
+  /* Create the playbin element */
+  data.pipeline = gst_parse_launch ("playbin uri=appsrc://", NULL);
   g_signal_connect (data.pipeline, "source-setup", G_CALLBACK (source_setup), &data);
   
   /* Instruct the bus to emit signals for each received message, and connect to the interesting signals */
index a5829d6..403d17d 100644 (file)
@@ -1,9 +1,9 @@
 #include <gst/gst.h>
 #include <string.h>
   
-#define GRAPH_LENGTH 80
+#define GRAPH_LENGTH 78
   
-/* playbin2 flags */
+/* playbin flags */
 typedef enum {
   GST_PLAY_FLAG_DOWNLOAD      = (1 << 7) /* Enable progressive download (on selected formats) */
 } GstPlayFlags;
@@ -19,6 +19,7 @@ static void got_location (GstObject *gstobject, GstObject *prop_object, GParamSp
   gchar *location;
   g_object_get (G_OBJECT (prop_object), "temp-location", &location, NULL);
   g_print ("Temporary file: %s\n", location);
+  g_free (location);
   /* Uncomment this line to keep the temporary file after the program exits */
   /* g_object_set (G_OBJECT (prop_object), "temp-remove", FALSE, NULL); */
 }
@@ -76,7 +77,6 @@ static gboolean refresh_ui (CustomData *data) {
   if (result) {
     gint n_ranges, range, i;
     gchar graph[GRAPH_LENGTH + 1];
-    GstFormat format = GST_FORMAT_TIME;
     gint64 position = 0, duration = 0;
     
     memset (graph, ' ', GRAPH_LENGTH);
@@ -86,14 +86,14 @@ static gboolean refresh_ui (CustomData *data) {
     for (range = 0; range < n_ranges; range++) {
       gint64 start, stop;
       gst_query_parse_nth_buffering_range (query, range, &start, &stop);
-      start = start * GRAPH_LENGTH / 100;
-      stop = stop * GRAPH_LENGTH / 100;
+      start = start * GRAPH_LENGTH / (stop - start);
+      stop = stop * GRAPH_LENGTH / (stop - start);
       for (i = (gint)start; i < stop; i++)
         graph [i] = '-';
     }
-    if (gst_element_query_position (data->pipeline, &format, &position) &&
+    if (gst_element_query_position (data->pipeline, GST_FORMAT_TIME, &position) &&
         GST_CLOCK_TIME_IS_VALID (position) &&
-        gst_element_query_duration (data->pipeline, &format, &duration) &&
+        gst_element_query_duration (data->pipeline, GST_FORMAT_TIME, &duration) &&
         GST_CLOCK_TIME_IS_VALID (duration)) {
       i = (gint)(GRAPH_LENGTH * (double)position / (double)(duration + 1));
       graph [i] = data->buffering_level < 100 ? 'X' : '>';
@@ -127,7 +127,7 @@ int main(int argc, char *argv[]) {
   data.buffering_level = 100;
   
   /* Build the pipeline */
-  pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);
+  pipeline = gst_parse_launch ("playbin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);
   bus = gst_element_get_bus (pipeline);
   
   /* Set the download flag */
@@ -169,4 +169,4 @@ int main(int argc, char *argv[]) {
 
   g_print ("\n");
   return 0;
-}
\ No newline at end of file
+}
index a09f6ab..acc534e 100644 (file)
@@ -1,6 +1,7 @@
 #include <string.h>
+#include <stdio.h>
 #include <gst/gst.h>
-#include <gst/interfaces/colorbalance.h>
+#include <gst/video/colorbalance.h>
   
 typedef struct _CustomData {
   GstElement *pipeline;
@@ -113,10 +114,10 @@ int main(int argc, char *argv[]) {
     " 'Q' to quit\n");
   
   /* Build the pipeline */
-  data.pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);
+  data.pipeline = gst_parse_launch ("playbin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);
   
   /* Add a keyboard watch so we get notified of keystrokes */
-#ifdef _WIN32
+#ifdef G_OS_WIN32
   io_stdin = g_io_channel_win32_new_fd (fileno (stdin));
 #else
   io_stdin = g_io_channel_unix_new (fileno (stdin));
index 31a3a42..cf33e16 100644 (file)
@@ -30,7 +30,7 @@ int main(int argc, char *argv[]) {
   gst_init (&argc, &argv);
   
   /* Get a list of all visualization plugins */
-  list = gst_registry_feature_filter (gst_registry_get_default (), filter_vis_features, FALSE, NULL);
+  list = gst_registry_feature_filter (gst_registry_get (), filter_vis_features, FALSE, NULL);
   
   /* Print their names */
   g_print("Available visualization plugins:\n");
@@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
     return -1;
   
   /* Build the pipeline */
-  pipeline = gst_parse_launch ("playbin2 uri=http://radio.hbr1.com:19800/ambient.ogg", NULL);
+  pipeline = gst_parse_launch ("playbin uri=http://radio.hbr1.com:19800/ambient.ogg", NULL);
   
   /* Set the visualization flag */
   g_object_get (pipeline, "flags", &flags, NULL);
index 2ccd069..edfa89f 100644 (file)
@@ -10,7 +10,7 @@ int main(int argc, char *argv[]) {
   gst_init (&argc, &argv);\r
   \r
   /* Build the pipeline */\r
-  pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);\r
+  pipeline = gst_parse_launch ("playbin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);\r
   \r
   /* Create the elements inside the sink bin */\r
   equalizer = gst_element_factory_make ("equalizer-3bands", "equalizer");\r
@@ -52,4 +52,4 @@ int main(int argc, char *argv[]) {
   gst_element_set_state (pipeline, GST_STATE_NULL);\r
   gst_object_unref (pipeline);\r
   return 0;\r
-}
\ No newline at end of file
+}\r