Remove audio_caps_text in the tutorials
authorSebastian Dröge <sebastian@centricular.com>
Sun, 3 Dec 2017 10:57:25 +0000 (12:57 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Sun, 3 Dec 2017 10:57:25 +0000 (12:57 +0200)
The caps are created from a GstAudioInfo, not from a string.

https://bugzilla.gnome.org/show_bug.cgi?id=791157

markdown/tutorials/basic/short-cutting-the-pipeline.md
markdown/tutorials/playback/short-cutting-the-pipeline.md

index b15fdf3..b3e7cf8 100644 (file)
@@ -263,7 +263,6 @@ int main(int argc, char *argv[]) {
   g_object_set (data.app_sink, "emit-signals", TRUE, "caps", audio_caps, NULL);
   g_signal_connect (data.app_sink, "new-sample", G_CALLBACK (new_sample), &data);
   gst_caps_unref (audio_caps);
-  g_free (audio_caps_text);
 
   /* Link all elements that can be automatically linked because they have "Always" pads */
   gst_bin_add_many (GST_BIN (data.pipeline), data.app_source, data.tee, data.audio_queue, data.audio_convert1, data.audio_resample,
@@ -352,8 +351,8 @@ Regarding the configuration of the `appsrc` and `appsink` elements:
 
 ``` c
 /* Configure appsrc */
-audio_caps_text = g_strdup_printf (AUDIO_CAPS, SAMPLE_RATE);
-audio_caps = gst_caps_from_string (audio_caps_text);
+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 (data.app_source, "caps", audio_caps, NULL);
 g_signal_connect (data.app_source, "need-data", G_CALLBACK (start_feed), &data);
 g_signal_connect (data.app_source, "enough-data", G_CALLBACK (stop_feed), &data);
@@ -376,7 +375,6 @@ almost full, respectively. We will use these signals to start and stop
 g_object_set (data.app_sink, "emit-signals", TRUE, "caps", audio_caps, NULL);
 g_signal_connect (data.app_sink, "new-sample", G_CALLBACK (new_sample), &data);
 gst_caps_unref (audio_caps);
-g_free (audio_caps_text);
 ```
 
 Regarding the `appsink` configuration, we connect to the
index be7e41e..00f6803 100644 (file)
@@ -137,7 +137,6 @@ static void source_setup (GstElement *pipeline, GstElement *source, CustomData *
   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[]) {
@@ -214,7 +213,6 @@ static void source_setup (GstElement *pipeline, GstElement *source, CustomData *
   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);
 }
 ```
 
@@ -242,4 +240,4 @@ This tutorial applies the concepts shown in
     URI `appsrc://`
   - How to configure the `appsrc` using the `source-setup` signal
 
-It has been a pleasure having you here, and see you soon!
\ No newline at end of file
+It has been a pleasure having you here, and see you soon!