mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
Use gst_element_request_pad_simple...
Instead of the deprecated gst_element_get_request_pad.
This commit is contained in:
parent
192fe04d8a
commit
37e70829dc
7 changed files with 17 additions and 17 deletions
examples
markdown
additional/design
application-development/basics
tutorials/basic
|
@ -23,7 +23,7 @@ some_function (GstElement * tee)
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
|
||||||
pad = gst_element_get_request_pad (tee, "src%d");
|
pad = gst_element_request_pad_simple (tee, "src%d");
|
||||||
name = gst_pad_get_name (pad);
|
name = gst_pad_get_name (pad);
|
||||||
g_print ("A new pad %s was created\n", name);
|
g_print ("A new pad %s was created\n", name);
|
||||||
g_free (name);
|
g_free (name);
|
||||||
|
|
|
@ -55,11 +55,11 @@ main (int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Manually link the Tee, which has "Request" pads */
|
/* Manually link the Tee, which has "Request" pads */
|
||||||
tee_audio_pad = gst_element_get_request_pad (tee, "src_%u");
|
tee_audio_pad = gst_element_request_pad_simple (tee, "src_%u");
|
||||||
g_print ("Obtained request pad %s for audio branch.\n",
|
g_print ("Obtained request pad %s for audio branch.\n",
|
||||||
gst_pad_get_name (tee_audio_pad));
|
gst_pad_get_name (tee_audio_pad));
|
||||||
queue_audio_pad = gst_element_get_static_pad (audio_queue, "sink");
|
queue_audio_pad = gst_element_get_static_pad (audio_queue, "sink");
|
||||||
tee_video_pad = gst_element_get_request_pad (tee, "src_%u");
|
tee_video_pad = gst_element_request_pad_simple (tee, "src_%u");
|
||||||
g_print ("Obtained request pad %s for video branch.\n",
|
g_print ("Obtained request pad %s for video branch.\n",
|
||||||
gst_pad_get_name (tee_video_pad));
|
gst_pad_get_name (tee_video_pad));
|
||||||
queue_video_pad = gst_element_get_static_pad (video_queue, "sink");
|
queue_video_pad = gst_element_get_static_pad (video_queue, "sink");
|
||||||
|
|
|
@ -218,15 +218,15 @@ main (int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Manually link the Tee, which has "Request" pads */
|
/* Manually link the Tee, which has "Request" pads */
|
||||||
tee_audio_pad = gst_element_get_request_pad (data.tee, "src_%u");
|
tee_audio_pad = gst_element_request_pad_simple (data.tee, "src_%u");
|
||||||
g_print ("Obtained request pad %s for audio branch.\n",
|
g_print ("Obtained request pad %s for audio branch.\n",
|
||||||
gst_pad_get_name (tee_audio_pad));
|
gst_pad_get_name (tee_audio_pad));
|
||||||
queue_audio_pad = gst_element_get_static_pad (data.audio_queue, "sink");
|
queue_audio_pad = gst_element_get_static_pad (data.audio_queue, "sink");
|
||||||
tee_video_pad = gst_element_get_request_pad (data.tee, "src_%u");
|
tee_video_pad = gst_element_request_pad_simple (data.tee, "src_%u");
|
||||||
g_print ("Obtained request pad %s for video branch.\n",
|
g_print ("Obtained request pad %s for video branch.\n",
|
||||||
gst_pad_get_name (tee_video_pad));
|
gst_pad_get_name (tee_video_pad));
|
||||||
queue_video_pad = gst_element_get_static_pad (data.video_queue, "sink");
|
queue_video_pad = gst_element_get_static_pad (data.video_queue, "sink");
|
||||||
tee_app_pad = gst_element_get_request_pad (data.tee, "src_%u");
|
tee_app_pad = gst_element_request_pad_simple (data.tee, "src_%u");
|
||||||
g_print ("Obtained request pad %s for app branch.\n",
|
g_print ("Obtained request pad %s for app branch.\n",
|
||||||
gst_pad_get_name (tee_app_pad));
|
gst_pad_get_name (tee_app_pad));
|
||||||
queue_app_pad = gst_element_get_static_pad (data.app_queue, "sink");
|
queue_app_pad = gst_element_get_static_pad (data.app_queue, "sink");
|
||||||
|
|
|
@ -67,7 +67,7 @@ g_object_set (encbin, "profile", "N900/H264 HQ", NULL);
|
||||||
gst_element_link (encbin, filesink);
|
gst_element_link (encbin, filesink);
|
||||||
|
|
||||||
vsrcpad = gst_element_get_src_pad (source, "src1");
|
vsrcpad = gst_element_get_src_pad (source, "src1");
|
||||||
vsinkpad = gst_element_get_request_pad (encbin, "video\_%u");
|
vsinkpad = gst_element_request_pad_simple (encbin, "video\_%u");
|
||||||
gst_pad_link (vsrcpad, vsinkpad);
|
gst_pad_link (vsrcpad, vsinkpad);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ from a “tee” element:
|
||||||
|
|
||||||
{{ snippets.c#some_function }}
|
{{ snippets.c#some_function }}
|
||||||
|
|
||||||
The `gst_element_get_request_pad ()` method can be used to get a pad
|
The `gst_element_request_pad_simple ()` method can be used to get a pad
|
||||||
from the element based on the name of the pad template. It is also
|
from the element based on the name of the pad template. It is also
|
||||||
possible to request a pad that is compatible with another pad template.
|
possible to request a pad that is compatible with another pad template.
|
||||||
This is very useful if you want to link an element to a multiplexer
|
This is very useful if you want to link an element to a multiplexer
|
||||||
|
|
|
@ -140,10 +140,10 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Manually link the Tee, which has "Request" pads */
|
/* Manually link the Tee, which has "Request" pads */
|
||||||
tee_audio_pad = gst_element_get_request_pad (tee, "src_%u");
|
tee_audio_pad = gst_element_request_pad_simple (tee, "src_%u");
|
||||||
g_print ("Obtained request pad %s for audio branch.\n", gst_pad_get_name (tee_audio_pad));
|
g_print ("Obtained request pad %s for audio branch.\n", gst_pad_get_name (tee_audio_pad));
|
||||||
queue_audio_pad = gst_element_get_static_pad (audio_queue, "sink");
|
queue_audio_pad = gst_element_get_static_pad (audio_queue, "sink");
|
||||||
tee_video_pad = gst_element_get_request_pad (tee, "src_%u");
|
tee_video_pad = gst_element_request_pad_simple (tee, "src_%u");
|
||||||
g_print ("Obtained request pad %s for video branch.\n", gst_pad_get_name (tee_video_pad));
|
g_print ("Obtained request pad %s for video branch.\n", gst_pad_get_name (tee_video_pad));
|
||||||
queue_video_pad = gst_element_get_static_pad (video_queue, "sink");
|
queue_video_pad = gst_element_get_static_pad (video_queue, "sink");
|
||||||
if (gst_pad_link (tee_audio_pad, queue_audio_pad) != GST_PAD_LINK_OK ||
|
if (gst_pad_link (tee_audio_pad, queue_audio_pad) != GST_PAD_LINK_OK ||
|
||||||
|
@ -260,10 +260,10 @@ comment says).
|
||||||
|
|
||||||
``` c
|
``` c
|
||||||
/* Manually link the Tee, which has "Request" pads */
|
/* Manually link the Tee, which has "Request" pads */
|
||||||
tee_audio_pad = gst_element_get_request_pad (tee, "src_%u");
|
tee_audio_pad = gst_element_request_pad_simple (tee, "src_%u");
|
||||||
g_print ("Obtained request pad %s for audio branch.\n", gst_pad_get_name (tee_audio_pad));
|
g_print ("Obtained request pad %s for audio branch.\n", gst_pad_get_name (tee_audio_pad));
|
||||||
queue_audio_pad = gst_element_get_static_pad (audio_queue, "sink");
|
queue_audio_pad = gst_element_get_static_pad (audio_queue, "sink");
|
||||||
tee_video_pad = gst_element_get_request_pad (tee, "src_%u");
|
tee_video_pad = gst_element_request_pad_simple (tee, "src_%u");
|
||||||
g_print ("Obtained request pad %s for video branch.\n", gst_pad_get_name (tee_video_pad));
|
g_print ("Obtained request pad %s for video branch.\n", gst_pad_get_name (tee_video_pad));
|
||||||
queue_video_pad = gst_element_get_static_pad (video_queue, "sink");
|
queue_video_pad = gst_element_get_static_pad (video_queue, "sink");
|
||||||
if (gst_pad_link (tee_audio_pad, queue_audio_pad) != GST_PAD_LINK_OK ||
|
if (gst_pad_link (tee_audio_pad, queue_audio_pad) != GST_PAD_LINK_OK ||
|
||||||
|
@ -283,7 +283,7 @@ provided.
|
||||||
In the documentation for the `tee` element we see that it has two pad
|
In the documentation for the `tee` element we see that it has two pad
|
||||||
templates named “sink” (for its sink Pads) and “src_%u” (for the Request
|
templates named “sink” (for its sink Pads) and “src_%u” (for the Request
|
||||||
Pads). We request two Pads from the tee (for the
|
Pads). We request two Pads from the tee (for the
|
||||||
audio and video branches) with `gst_element_get_request_pad()`.
|
audio and video branches) with `gst_element_request_pad_simple()`.
|
||||||
|
|
||||||
We then obtain the Pads from the downstream elements to which these
|
We then obtain the Pads from the downstream elements to which these
|
||||||
Request Pads need to be linked. These are normal Always Pads, so we
|
Request Pads need to be linked. These are normal Always Pads, so we
|
||||||
|
@ -319,7 +319,7 @@ it still needs to be unreferenced (freed) with `gst_object_unref()`.
|
||||||
`queue` elements.
|
`queue` elements.
|
||||||
|
|
||||||
- What is a Request Pad and how to link elements with request pads,
|
- What is a Request Pad and how to link elements with request pads,
|
||||||
with `gst_element_get_request_pad()`, `gst_pad_link()` and
|
with `gst_element_request_pad_simple()`, `gst_pad_link()` and
|
||||||
`gst_element_release_request_pad()`.
|
`gst_element_release_request_pad()`.
|
||||||
|
|
||||||
- How to have the same stream available in different branches by using
|
- How to have the same stream available in different branches by using
|
||||||
|
|
|
@ -286,13 +286,13 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Manually link the Tee, which has "Request" pads */
|
/* Manually link the Tee, which has "Request" pads */
|
||||||
tee_audio_pad = gst_element_get_request_pad (data.tee, "src_%u");
|
tee_audio_pad = gst_element_request_pad_simple (data.tee, "src_%u");
|
||||||
g_print ("Obtained request pad %s for audio branch.\n", gst_pad_get_name (tee_audio_pad));
|
g_print ("Obtained request pad %s for audio branch.\n", gst_pad_get_name (tee_audio_pad));
|
||||||
queue_audio_pad = gst_element_get_static_pad (data.audio_queue, "sink");
|
queue_audio_pad = gst_element_get_static_pad (data.audio_queue, "sink");
|
||||||
tee_video_pad = gst_element_get_request_pad (data.tee, "src_%u");
|
tee_video_pad = gst_element_request_pad_simple (data.tee, "src_%u");
|
||||||
g_print ("Obtained request pad %s for video branch.\n", gst_pad_get_name (tee_video_pad));
|
g_print ("Obtained request pad %s for video branch.\n", gst_pad_get_name (tee_video_pad));
|
||||||
queue_video_pad = gst_element_get_static_pad (data.video_queue, "sink");
|
queue_video_pad = gst_element_get_static_pad (data.video_queue, "sink");
|
||||||
tee_app_pad = gst_element_get_request_pad (data.tee, "src_%u");
|
tee_app_pad = gst_element_request_pad_simple (data.tee, "src_%u");
|
||||||
g_print ("Obtained request pad %s for app branch.\n", gst_pad_get_name (tee_app_pad));
|
g_print ("Obtained request pad %s for app branch.\n", gst_pad_get_name (tee_app_pad));
|
||||||
queue_app_pad = gst_element_get_static_pad (data.app_queue, "sink");
|
queue_app_pad = gst_element_get_static_pad (data.app_queue, "sink");
|
||||||
if (gst_pad_link (tee_audio_pad, queue_audio_pad) != GST_PAD_LINK_OK ||
|
if (gst_pad_link (tee_audio_pad, queue_audio_pad) != GST_PAD_LINK_OK ||
|
||||||
|
|
Loading…
Reference in a new issue