mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
test: vaapicontext: use playbin to test files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/342>
This commit is contained in:
parent
672b2dd991
commit
283fceac0b
1 changed files with 12 additions and 11 deletions
|
@ -35,12 +35,12 @@
|
||||||
|
|
||||||
static gboolean g_multisink;
|
static gboolean g_multisink;
|
||||||
static gchar *g_filepath;
|
static gchar *g_filepath;
|
||||||
|
static GstElement *g_vaapisink;
|
||||||
|
|
||||||
static GOptionEntry g_options[] = {
|
static GOptionEntry g_options[] = {
|
||||||
{"multi", 'm', 0, G_OPTION_ARG_NONE, &g_multisink, "test multiple vaapisink",
|
{"multi", 'm', 0, G_OPTION_ARG_NONE, &g_multisink, "test multiple vaapisink",
|
||||||
NULL},
|
NULL},
|
||||||
{"file", 'f', 0, G_OPTION_ARG_STRING, &g_filepath,
|
{"file", 'f', 0, G_OPTION_ARG_STRING, &g_filepath, "file path to play", NULL},
|
||||||
"file path to play (only mp4/h264)", NULL},
|
|
||||||
{NULL,}
|
{NULL,}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -258,10 +258,13 @@ create_rotate_button (AppData * app, const gchar * name)
|
||||||
GstElement *sink;
|
GstElement *sink;
|
||||||
|
|
||||||
sink = gst_bin_get_by_name (GST_BIN (app->pipeline), name);
|
sink = gst_bin_get_by_name (GST_BIN (app->pipeline), name);
|
||||||
|
if (!sink && !g_strcmp0 (name, "sink1"))
|
||||||
|
sink = g_vaapisink;
|
||||||
g_assert (sink);
|
g_assert (sink);
|
||||||
|
|
||||||
rotate = gtk_button_new_with_label ("Rotate");
|
rotate = gtk_button_new_with_label ("Rotate");
|
||||||
g_signal_connect (rotate, "clicked", G_CALLBACK (button_rotate_cb), sink);
|
g_signal_connect (rotate, "clicked", G_CALLBACK (button_rotate_cb), sink);
|
||||||
|
if (sink != g_vaapisink)
|
||||||
gst_object_unref (sink);
|
gst_object_unref (sink);
|
||||||
|
|
||||||
return rotate;
|
return rotate;
|
||||||
|
@ -344,8 +347,8 @@ main (gint argc, gchar ** argv)
|
||||||
app.pipeline = gst_parse_launch ("videotestsrc ! vaapih264enc ! "
|
app.pipeline = gst_parse_launch ("videotestsrc ! vaapih264enc ! "
|
||||||
"vaapidecodebin ! vaapisink name=sink1", &error);
|
"vaapidecodebin ! vaapisink name=sink1", &error);
|
||||||
} else {
|
} else {
|
||||||
app.pipeline = gst_parse_launch ("filesrc name=src ! qtdemux ! h264parse ! "
|
app.pipeline = gst_element_factory_make ("playbin", NULL);
|
||||||
"vaapidecodebin ! vaapisink name=sink1", &error);
|
g_assert (app.pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@ -355,12 +358,10 @@ main (gint argc, gchar ** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_multisink && g_filepath) {
|
if (!g_multisink && g_filepath) {
|
||||||
GstElement *src;
|
g_vaapisink = gst_element_factory_make ("vaapisink", "sink1");
|
||||||
|
g_assert (g_vaapisink);
|
||||||
src = gst_bin_get_by_name (GST_BIN (app.pipeline), "src");
|
g_object_set (app.pipeline, "uri", g_filepath, "video-sink", g_vaapisink,
|
||||||
g_assert (src);
|
NULL);
|
||||||
g_object_set (src, "location", g_filepath, NULL);
|
|
||||||
gst_object_unref (src);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build_ui (&app);
|
build_ui (&app);
|
||||||
|
|
Loading…
Reference in a new issue