Playback tutorial 1: Playbin usage
Property
We have set all these properties one by one, but we could have all of them with a single call to g_object_set():
1 | g_object_set (data.playbin, "uri", "https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_cropped_multilingual.webm", "flags", flags, "connection-speed", 56, NULL); |
This is why g_object_set() requires a NULL as the last parameter.
tag
playbin defines 3 action signals to retrieve metadata: get-video-tags, get-audio-tagsand get-text-tags.
get-audio-tags-> GstTagList -> Constants-> GST_TAG_IMAGE 可以参考ATC例子
How to retrieve a particular tag from the list with gst_tag_list_get_string()or gst_tag_list_get_uint()
Playback tutorial 3: Short-cutting the pipeline
How to configure the appsrc using the source-setup signal
1 | /* This function is called when playbin has created the appsrc element, so we have |
Playback tutorial 4: Progressive streaming
deep-notify
1 | g_signal_connect (pipeline, "deep-notify::temp-location", G_CALLBACK (got_location), NULL); |
deep-notify signals are emitted by GstObject elements (like playbin) when the properties of any of their children elements change. In this case we want to know when the temp-location property changes, indicating that the queue2 has decided where to store the downloaded data.
“temp-location”其实是queue2的属性。
1 | static void got_location (GstObject *gstobject, GstObject *prop_object, GParamSpec *prop, gpointer data) { |
The temp-location property is read from the element that triggered the signal (the queue2) and printed on screen.
When the pipeline state changes from PAUSED to READY, this file is removed. As the comment reads, you can keep it by setting the temp-remove property of the queue2 to FALSE.
定时器
In main we also install a timer which we use to refresh the UI every second.
1 | /* Register a function that GLib will call every second */ |