v4l2-renegotiate: Change --enable-dmabuf into --io-mode=

This gives allow testing dmabuf importation but also exportation buy
letting user pick anything from the io-mode property on v4l2src.
This commit is contained in:
Nicolas Dufresne 2017-09-13 11:32:09 -04:00
parent cf3f195012
commit 3975e87136

View file

@ -29,7 +29,7 @@
/* Options */ /* Options */
static const gchar *device = "/dev/video0"; static const gchar *device = "/dev/video0";
static const gchar *videosink = "autovideosink"; static const gchar *videosink = "autovideosink";
static gboolean enable_dmabuf = FALSE; static const gchar *io_mode = "mmap";
static const gchar *def_resolutions[] = { static const gchar *def_resolutions[] = {
"320x240", "320x240",
"1280x720", "1280x720",
@ -44,8 +44,8 @@ static GOptionEntry entries[] = {
NULL}, NULL},
{"videosink", 's', 0, G_OPTION_ARG_STRING, &videosink, "Video Sink to use", {"videosink", 's', 0, G_OPTION_ARG_STRING, &videosink, "Video Sink to use",
NULL}, NULL},
{"enable-dmabuf", 'z', 0, G_OPTION_ARG_NONE, &enable_dmabuf, {"io-mode", 'z', 0, G_OPTION_ARG_STRING, &io_mode,
"Enable DMABuf", NULL}, "Configure the \"io-mode\" property on v4l2scr", NULL},
{"resolution", 'r', 0, G_OPTION_ARG_STRING_ARRAY, &resolutions, {"resolution", 'r', 0, G_OPTION_ARG_STRING_ARRAY, &resolutions,
"Add a resolution to the list", NULL}, "Add a resolution to the list", NULL},
{NULL} {NULL}
@ -133,8 +133,7 @@ main (gint argc, gchar ** argv)
loop = g_main_loop_new (NULL, FALSE); loop = g_main_loop_new (NULL, FALSE);
desc = g_strdup_printf ("v4l2src name=src device=\"%s\" io-mode=\"%s\" " desc = g_strdup_printf ("v4l2src name=src device=\"%s\" io-mode=\"%s\" "
"! capsfilter name=cf ! %s", device, enable_dmabuf ? "dmabuf" : "mmap", "! capsfilter name=cf ! %s", device, io_mode, videosink);
videosink);
pipeline = gst_parse_launch (desc, &error); pipeline = gst_parse_launch (desc, &error);
if (!pipeline) { if (!pipeline) {
g_print ("failed to create pipeline: %s", error->message); g_print ("failed to create pipeline: %s", error->message);