mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
examples: overlaycomposition: Add option for videosink element selection
It would be useful for testing overlaycomposition with specific videosink element.
This commit is contained in:
parent
7d8e7cd3eb
commit
4960f385cf
1 changed files with 21 additions and 2 deletions
|
@ -254,15 +254,34 @@ main (int argc, char **argv)
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
GstCaps *filter_caps;
|
GstCaps *filter_caps;
|
||||||
OverlayState overlay_state = { 0, };
|
OverlayState overlay_state = { 0, };
|
||||||
|
GOptionContext *option_ctx;
|
||||||
|
GError *error = NULL;
|
||||||
|
const gchar *video_sink = "autovidesink";
|
||||||
|
gboolean ret;
|
||||||
|
GOptionEntry options[] = {
|
||||||
|
{"videosink", 0, 0, G_OPTION_ARG_STRING, &video_sink,
|
||||||
|
"Video sink element to use (default is autovideosink)", NULL},
|
||||||
|
{NULL}
|
||||||
|
};
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
option_ctx = g_option_context_new ("- test overlaycomposition");
|
||||||
|
g_option_context_add_main_entries (option_ctx, options, NULL);
|
||||||
|
g_option_context_add_group (option_ctx, gst_init_get_option_group ());
|
||||||
|
ret = g_option_context_parse (option_ctx, &argc, &argv, &error);
|
||||||
|
g_option_context_free (option_ctx);
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
g_printerr ("option parsing failed: %s\n", error->message);
|
||||||
|
g_clear_error (&error);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
pipeline = gst_pipeline_new (NULL);
|
pipeline = gst_pipeline_new (NULL);
|
||||||
src = gst_element_factory_make ("videotestsrc", NULL);
|
src = gst_element_factory_make ("videotestsrc", NULL);
|
||||||
capsfilter = gst_element_factory_make ("capsfilter", NULL);
|
capsfilter = gst_element_factory_make ("capsfilter", NULL);
|
||||||
overlay = gst_element_factory_make ("overlaycomposition", NULL);
|
overlay = gst_element_factory_make ("overlaycomposition", NULL);
|
||||||
conv = gst_element_factory_make ("videoconvert", NULL);
|
conv = gst_element_factory_make ("videoconvert", NULL);
|
||||||
sink = gst_element_factory_make ("autovideosink", NULL);
|
sink = gst_element_factory_make (video_sink, NULL);
|
||||||
|
|
||||||
if (!pipeline || !src || !capsfilter || !overlay || !conv || !sink) {
|
if (!pipeline || !src || !capsfilter || !overlay || !conv || !sink) {
|
||||||
g_error ("Failed to create elements");
|
g_error ("Failed to create elements");
|
||||||
|
|
Loading…
Reference in a new issue