tests: examples: Stop duplicating keyboard interaction handler code

Extract the code from QSV and use it for D3D11 and NVCODEC examples

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2468>
This commit is contained in:
Seungha Yang 2022-05-23 00:36:50 +09:00
parent 962dc37d4f
commit aa835f5e64
12 changed files with 83 additions and 615 deletions

View file

@ -1,172 +0,0 @@
/* GStreamer command line playback testing utility - keyboard handling helpers
*
* Copyright (C) 2013 Tim-Philipp Müller <tim centricular net>
* Copyright (C) 2013 Centricular Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "d3d11videosink-kb.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <io.h>
#include <gst/gst.h>
/* This is all not thread-safe, but doesn't have to be really */
static GstD3D11VideoSinkKbFunc kb_callback;
static gpointer kb_callback_data;
typedef struct
{
GThread *thread;
HANDLE event_handle;
HANDLE console_handle;
gboolean closing;
GMutex lock;
} Win32KeyHandler;
static Win32KeyHandler *win32_handler = NULL;
static gboolean
gst_d3d11_video_sink_source_cb (Win32KeyHandler * handler)
{
HANDLE h_input = handler->console_handle;
INPUT_RECORD buffer;
DWORD n;
if (PeekConsoleInput (h_input, &buffer, 1, &n) && n == 1) {
ReadConsoleInput (h_input, &buffer, 1, &n);
if (buffer.EventType == KEY_EVENT && buffer.Event.KeyEvent.bKeyDown) {
if (buffer.Event.KeyEvent.wVirtualKeyCode == VK_SPACE) {
kb_callback (' ', kb_callback_data);
} else {
kb_callback (buffer.Event.KeyEvent.uChar.AsciiChar, kb_callback_data);
}
}
}
return G_SOURCE_REMOVE;
}
static gpointer
gst_d3d11_video_sink_kb_thread (gpointer user_data)
{
Win32KeyHandler *handler = (Win32KeyHandler *) user_data;
HANDLE handles[2];
handles[0] = handler->event_handle;
handles[1] = handler->console_handle;
if (!kb_callback)
return NULL;
while (TRUE) {
DWORD ret = WaitForMultipleObjects (2, handles, FALSE, INFINITE);
if (ret == WAIT_FAILED) {
GST_WARNING ("WaitForMultipleObject Failed");
return NULL;
}
g_mutex_lock (&handler->lock);
if (handler->closing) {
g_mutex_unlock (&handler->lock);
return NULL;
}
g_mutex_unlock (&handler->lock);
g_idle_add ((GSourceFunc) gst_d3d11_video_sink_source_cb, handler);
}
return NULL;
}
gboolean
gst_d3d11_video_sink_kb_set_key_handler (GstD3D11VideoSinkKbFunc kb_func,
gpointer user_data)
{
gint fd = _fileno (stdin);
if (!_isatty (fd)) {
GST_INFO ("stdin is not connected to a terminal");
return FALSE;
}
if (win32_handler) {
g_mutex_lock (&win32_handler->lock);
win32_handler->closing = TRUE;
g_mutex_unlock (&win32_handler->lock);
SetEvent (win32_handler->event_handle);
g_thread_join (win32_handler->thread);
CloseHandle (win32_handler->event_handle);
g_mutex_clear (&win32_handler->lock);
g_free (win32_handler);
win32_handler = NULL;
}
if (kb_func) {
SECURITY_ATTRIBUTES sec_attrs;
sec_attrs.nLength = sizeof (SECURITY_ATTRIBUTES);
sec_attrs.lpSecurityDescriptor = NULL;
sec_attrs.bInheritHandle = FALSE;
win32_handler = g_new0 (Win32KeyHandler, 1);
/* create cancellable event handle */
win32_handler->event_handle = CreateEvent (&sec_attrs, TRUE, FALSE, NULL);
if (!win32_handler->event_handle) {
g_warning ("Couldn't create event handle\n");
g_free (win32_handler);
win32_handler = NULL;
return FALSE;
}
win32_handler->console_handle = GetStdHandle (STD_INPUT_HANDLE);
if (!win32_handler->console_handle) {
g_warning ("Couldn't get console handle\n");
CloseHandle (win32_handler->event_handle);
g_free (win32_handler);
win32_handler = NULL;
return FALSE;
}
g_mutex_init (&win32_handler->lock);
win32_handler->thread =
g_thread_new ("gst-play-kb", gst_d3d11_video_sink_kb_thread,
win32_handler);
}
kb_callback = kb_func;
kb_callback_data = user_data;
return TRUE;
}

View file

@ -1,30 +0,0 @@
/* GStreamer command line playback testing utility - keyboard handling helpers
*
* Copyright (C) 2013 Tim-Philipp Müller <tim centricular net>
* Copyright (C) 2013 Centricular Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_D3D11_VIDEO_SINK_KB_H__
#define __GST_D3D11_VIDEO_SINK_KB_H__
#include <glib.h>
typedef void (*GstD3D11VideoSinkKbFunc) (gchar kb_input, gpointer user_data);
gboolean gst_d3d11_video_sink_kb_set_key_handler (GstD3D11VideoSinkKbFunc kb_func, gpointer user_data);
#endif /* __GST_D3D11_VIDEO_SINK_KB_H__ */

View file

@ -27,7 +27,7 @@
#include <windows.h>
#include <string.h>
#include "d3d11videosink-kb.h"
#include "../key-handler.h"
static GMainLoop *loop = NULL;
static gboolean visible = FALSE;
@ -61,13 +61,12 @@ window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
static void
keyboard_cb (gchar key_input, CallbackData * data)
keyboard_cb (gchar input, gboolean is_ascii, CallbackData * data)
{
gchar key;
if (!is_ascii)
return;
key = g_ascii_tolower (key_input);
switch (key) {
switch (input) {
case 'q':
case 'Q':
gst_element_send_event (data->pipeline, gst_event_new_eos ());
@ -141,9 +140,9 @@ bus_msg (GstBus * bus, GstMessage * msg, CallbackData * data)
if (gst_navigation_event_parse_key_event (ev, &key)) {
if (strcmp (key, "space") == 0 || strcmp (key, "Space") == 0) {
keyboard_cb (' ', data);
keyboard_cb (' ', TRUE, data);
} else {
keyboard_cb (key[0], data);
keyboard_cb (key[0], TRUE, data);
}
}
}
@ -300,8 +299,7 @@ main (gint argc, gchar ** argv)
gst_bus_add_watch (GST_ELEMENT_BUS (pipeline), (GstBusFunc) bus_msg,
&cb_data);
gst_d3d11_video_sink_kb_set_key_handler ((GstD3D11VideoSinkKbFunc)
keyboard_cb, &cb_data);
set_key_handler ((KeyInputCallback) keyboard_cb, &cb_data);
if (start_fullscreen)
g_object_set (sink, "fullscreen", TRUE, NULL);
@ -339,6 +337,8 @@ main (gint argc, gchar ** argv)
gst_bus_remove_watch (GST_ELEMENT_BUS (pipeline));
terminate:
unset_key_handler ();
if (hwnd)
DestroyWindow (hwnd);

View file

@ -1,6 +1,6 @@
if host_system == 'windows'
executable('d3d11videosink',
['d3d11videosink.c', 'd3d11videosink-kb.c'],
['d3d11videosink.c', '../key-handler.c'],
c_args : gst_plugins_bad_args,
include_directories : [configinc, libsinc],
dependencies: [gst_dep, gstbase_dep, gstvideo_dep],

View file

@ -1,5 +1,5 @@
executable('nvcodec',
['nvcodec.c', 'nvcodec-kb.c'],
['nvcodec.c', '../key-handler.c'],
include_directories : [configinc],
dependencies: [gst_dep, gstbase_dep, gstvideo_dep],
c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'],

View file

@ -1,297 +0,0 @@
/* GStreamer command line playback testing utility - keyboard handling helpers
*
* Copyright (C) 2013 Tim-Philipp Müller <tim centricular net>
* Copyright (C) 2013 Centricular Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "nvcodec.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef G_OS_UNIX
#include <unistd.h>
#include <termios.h>
#endif
#ifdef G_OS_WIN32
#include <windows.h>
#include <io.h>
#endif
#include <gst/gst.h>
/* This is all not thread-safe, but doesn't have to be really */
static GstNvCodecPlayKbFunc kb_callback;
static gpointer kb_callback_data;
#ifdef G_OS_UNIX
static struct termios term_settings;
static gboolean term_settings_saved = FALSE;
static gulong io_watch_id;
static gboolean
gst_nvcodec_kb_io_cb (GIOChannel * ioc, GIOCondition cond, gpointer user_data)
{
GIOStatus status;
if (cond & G_IO_IN) {
gchar buf[16] = { 0, };
gsize read;
status = g_io_channel_read_chars (ioc, buf, sizeof (buf) - 1, &read, NULL);
if (status == G_IO_STATUS_ERROR)
return G_SOURCE_REMOVE;
if (status == G_IO_STATUS_NORMAL) {
if (kb_callback)
kb_callback (buf, kb_callback_data);
}
}
return G_SOURCE_CONTINUE;
}
gboolean
gst_nvcodec_kb_set_key_handler (GstNvCodecPlayKbFunc kb_func,
gpointer user_data)
{
GIOChannel *ioc;
if (!isatty (STDIN_FILENO)) {
GST_INFO ("stdin is not connected to a terminal");
return FALSE;
}
if (io_watch_id > 0) {
g_source_remove (io_watch_id);
io_watch_id = 0;
}
if (kb_func == NULL && term_settings_saved) {
/* restore terminal settings */
if (tcsetattr (STDIN_FILENO, TCSAFLUSH, &term_settings) == 0)
term_settings_saved = FALSE;
else
g_warning ("could not restore terminal attributes");
setvbuf (stdin, NULL, _IOLBF, 0);
}
if (kb_func != NULL) {
struct termios new_settings;
if (!term_settings_saved) {
if (tcgetattr (STDIN_FILENO, &term_settings) != 0) {
g_warning ("could not save terminal attributes");
return FALSE;
}
term_settings_saved = TRUE;
/* Echo off, canonical mode off, extended input processing off */
new_settings = term_settings;
new_settings.c_lflag &= ~(ECHO | ICANON | IEXTEN);
new_settings.c_cc[VMIN] = 0;
new_settings.c_cc[VTIME] = 0;
if (tcsetattr (STDIN_FILENO, TCSAFLUSH, &new_settings) != 0) {
g_warning ("Could not set terminal state");
return FALSE;
}
setvbuf (stdin, NULL, _IONBF, 0);
}
}
ioc = g_io_channel_unix_new (STDIN_FILENO);
io_watch_id = g_io_add_watch_full (ioc, G_PRIORITY_DEFAULT, G_IO_IN,
(GIOFunc) gst_nvcodec_kb_io_cb, user_data, NULL);
g_io_channel_unref (ioc);
kb_callback = kb_func;
kb_callback_data = user_data;
return TRUE;
}
#elif defined(G_OS_WIN32)
typedef struct
{
GThread *thread;
HANDLE event_handle;
HANDLE console_handle;
gboolean closing;
GMutex lock;
} Win32KeyHandler;
static Win32KeyHandler *win32_handler = NULL;
static gboolean
gst_nvcodec_kb_source_cb (Win32KeyHandler * handler)
{
HANDLE h_input = handler->console_handle;
INPUT_RECORD buffer;
DWORD n;
if (PeekConsoleInput (h_input, &buffer, 1, &n) && n == 1) {
ReadConsoleInput (h_input, &buffer, 1, &n);
if (buffer.EventType == KEY_EVENT && buffer.Event.KeyEvent.bKeyDown) {
gchar key_val[2] = { 0 };
switch (buffer.Event.KeyEvent.wVirtualKeyCode) {
case VK_RIGHT:
kb_callback (GST_NVCODEC_KB_ARROW_RIGHT, kb_callback_data);
break;
case VK_LEFT:
kb_callback (GST_NVCODEC_KB_ARROW_LEFT, kb_callback_data);
break;
case VK_UP:
kb_callback (GST_NVCODEC_KB_ARROW_UP, kb_callback_data);
break;
case VK_DOWN:
kb_callback (GST_NVCODEC_KB_ARROW_DOWN, kb_callback_data);
break;
default:
key_val[0] = buffer.Event.KeyEvent.uChar.AsciiChar;
kb_callback (key_val, kb_callback_data);
break;
}
}
}
return G_SOURCE_REMOVE;
}
static gpointer
gst_nvcodec_kb_win32_thread (gpointer user_data)
{
Win32KeyHandler *handler = (Win32KeyHandler *) user_data;
HANDLE handles[2];
handles[0] = handler->event_handle;
handles[1] = handler->console_handle;
if (!kb_callback)
return NULL;
while (TRUE) {
DWORD ret = WaitForMultipleObjects (2, handles, FALSE, INFINITE);
if (ret == WAIT_FAILED) {
GST_WARNING ("WaitForMultipleObject Failed");
return NULL;
}
g_mutex_lock (&handler->lock);
if (handler->closing) {
g_mutex_unlock (&handler->lock);
return NULL;
}
g_mutex_unlock (&handler->lock);
g_idle_add ((GSourceFunc) gst_nvcodec_kb_source_cb, handler);
}
return NULL;
}
gboolean
gst_nvcodec_kb_set_key_handler (GstNvCodecPlayKbFunc kb_func,
gpointer user_data)
{
gint fd = _fileno (stdin);
if (!_isatty (fd)) {
GST_INFO ("stdin is not connected to a terminal");
return FALSE;
}
if (win32_handler) {
g_mutex_lock (&win32_handler->lock);
win32_handler->closing = TRUE;
g_mutex_unlock (&win32_handler->lock);
SetEvent (win32_handler->event_handle);
g_thread_join (win32_handler->thread);
CloseHandle (win32_handler->event_handle);
g_mutex_clear (&win32_handler->lock);
g_free (win32_handler);
win32_handler = NULL;
}
if (kb_func) {
SECURITY_ATTRIBUTES sec_attrs;
sec_attrs.nLength = sizeof (SECURITY_ATTRIBUTES);
sec_attrs.lpSecurityDescriptor = NULL;
sec_attrs.bInheritHandle = FALSE;
win32_handler = g_new0 (Win32KeyHandler, 1);
/* create cancellable event handle */
win32_handler->event_handle = CreateEvent (&sec_attrs, TRUE, FALSE, NULL);
if (!win32_handler->event_handle) {
GST_WARNING ("Couldn't create event handle");
g_free (win32_handler);
win32_handler = NULL;
return FALSE;
}
win32_handler->console_handle = GetStdHandle (STD_INPUT_HANDLE);
if (!win32_handler->console_handle) {
GST_WARNING ("Couldn't get console handle");
CloseHandle (win32_handler->event_handle);
g_free (win32_handler);
win32_handler = NULL;
return FALSE;
}
g_mutex_init (&win32_handler->lock);
win32_handler->thread =
g_thread_new ("gst-play-kb", gst_nvcodec_kb_win32_thread,
win32_handler);
}
kb_callback = kb_func;
kb_callback_data = user_data;
return TRUE;
}
#else
gboolean
gst_nvcodec_kb_set_key_handler (GstNvCodecPlayKbFunc key_func,
gpointer user_data)
{
GST_FIXME ("Keyboard handling for this OS needs to be implemented");
return FALSE;
}
#endif /* !G_OS_UNIX */

View file

@ -25,7 +25,7 @@
#include <gst/video/video.h>
#include <stdlib.h>
#include "nvcodec.h"
#include "../key-handler.h"
#define DEFAULT_VIDEO_SINK "autovideosink"
@ -45,12 +45,6 @@ typedef struct
gint prev_height;
} TestCallbackData;
static void
restore_terminal (void)
{
gst_nvcodec_kb_set_key_handler (NULL, NULL);
}
static void
print_keyboard_help (void)
{
@ -61,10 +55,10 @@ print_keyboard_help (void)
const gchar *key_help;
} key_controls[] = {
{
"q or ESC", "Quit"}, {
"q", "Quit"}, {
"right arrow", "Increase Width"}, {
"left arrow", "Decrease Width"}, {
"up arrow", "Increase Height"}, {
"up arrow", "Increase Height"} , {
"down arrow", "Decrease Height"}, {
">", "Increase encoding bitrate by 100 kbit/sec"}, {
"<", "Decrease encoding bitrate by 100 kbit/sec"}, {
@ -92,55 +86,54 @@ print_keyboard_help (void)
}
static void
keyboard_cb (const gchar * key_input, gpointer user_data)
keyboard_cb (gchar input, gboolean is_ascii, gpointer user_data)
{
TestCallbackData *data = (TestCallbackData *) user_data;
gchar key = '\0';
/* only want to switch/case on single char, not first char of string */
if (key_input[0] != '\0' && key_input[1] == '\0')
key = g_ascii_tolower (key_input[0]);
switch (key) {
case 'k':
print_keyboard_help ();
break;
case 'q':
case 'Q':
gst_element_send_event (data->pipeline, gst_event_new_eos ());
g_main_loop_quit (loop);
break;
case 27: /* ESC */
if (key_input[1] == '\0') {
if (is_ascii) {
switch (input) {
case 'k':
print_keyboard_help ();
break;
case 'q':
case 'Q':
gst_element_send_event (data->pipeline, gst_event_new_eos ());
g_main_loop_quit (loop);
}
break;
case '>':
bitrate += 100;
bitrate = MIN (bitrate, 2048000);
g_print ("Increase encoding bitrate to %d\n", bitrate);
g_object_set (G_OBJECT (data->nvenc), "bitrate", bitrate, NULL);
break;
case '<':
bitrate -= 100;
bitrate = MAX (bitrate, 100);
g_print ("Decrease encoding bitrate to %d\n", bitrate);
g_object_set (G_OBJECT (data->nvenc), "bitrate", bitrate, NULL);
break;
default:{
if (strcmp (key_input, GST_NVCODEC_KB_ARROW_RIGHT) == 0) {
g_print ("Increase width to %d\n", ++width);
} else if (strcmp (key_input, GST_NVCODEC_KB_ARROW_LEFT) == 0) {
g_print ("Decrease width to %d\n", --width);
} else if (strcmp (key_input, GST_NVCODEC_KB_ARROW_UP) == 0) {
g_print ("Increase height to %d\n", ++height);
} else if (strcmp (key_input, GST_NVCODEC_KB_ARROW_DOWN) == 0) {
g_print ("Decrease height to %d\n", --height);
}
break;
break;
case '>':
bitrate += 100;
bitrate = MIN (bitrate, 2048000);
g_print ("Increase encoding bitrate to %d\n", bitrate);
g_object_set (G_OBJECT (data->nvenc), "bitrate", bitrate, NULL);
break;
case '<':
bitrate -= 100;
bitrate = MAX (bitrate, 100);
g_print ("Decrease encoding bitrate to %d\n", bitrate);
g_object_set (G_OBJECT (data->nvenc), "bitrate", bitrate, NULL);
break;
default:
break;
}
return;
}
switch (input) {
case KB_ARROW_RIGHT:
g_print ("Increase width to %d\n", ++width);
break;
case KB_ARROW_LEFT:
g_print ("Decrease width to %d\n", --width);
break;
case KB_ARROW_UP:
g_print ("Increase height to %d\n", ++height);
break;
case KB_ARROW_DOWN:
g_print ("Decrease height to %d\n", --height);
break;
default:
break;
}
}
@ -199,22 +192,32 @@ bus_msg (GstBus * bus, GstMessage * msg, gpointer user_data)
GstNavigationEventType e_type = gst_navigation_event_get_type (ev);
if (e_type == GST_NAVIGATION_EVENT_KEY_PRESS) {
const gchar *key;
gchar val = 0;
if (gst_navigation_event_parse_key_event (ev, &key)) {
gboolean ascii = TRUE;
GST_INFO ("Key press: %s", key);
if (strcmp (key, "Left") == 0)
key = GST_NVCODEC_KB_ARROW_LEFT;
else if (strcmp (key, "Right") == 0)
key = GST_NVCODEC_KB_ARROW_RIGHT;
else if (strcmp (key, "Up") == 0)
key = GST_NVCODEC_KB_ARROW_UP;
else if (strcmp (key, "Down") == 0)
key = GST_NVCODEC_KB_ARROW_DOWN;
else if (strlen (key) > 1)
break;
val = key[0];
keyboard_cb (key, user_data);
if (g_strcmp0 (key, "Left") == 0) {
val = KB_ARROW_LEFT;
ascii = FALSE;
} else if (g_strcmp0 (key, "Right") == 0) {
val = KB_ARROW_RIGHT;
ascii = FALSE;
} else if (g_strcmp0 (key, "Up") == 0) {
val = KB_ARROW_UP;
ascii = FALSE;
} else if (g_strcmp0 (key, "Down") == 0) {
val = KB_ARROW_DOWN;
ascii = FALSE;
} else if (strlen (key) > 1) {
break;
}
keyboard_cb (val, ascii, user_data);
}
}
}
@ -455,10 +458,9 @@ main (gint argc, gchar ** argv)
gst_bus_add_watch (GST_ELEMENT_BUS (pipeline), bus_msg, &data);
if (gst_nvcodec_kb_set_key_handler (keyboard_cb, &data)) {
g_print ("Press 'k' to see a list of keyboard shortcuts.\n");
atexit (restore_terminal);
}
set_key_handler (keyboard_cb, &data);
g_print ("Press 'k' to see a list of keyboard shortcuts.\n");
atexit (unset_key_handler);
/* run the pipeline */
sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);

View file

@ -1,35 +0,0 @@
/* GStreamer command line playback testing utility - keyboard handling helpers
*
* Copyright (C) 2013 Tim-Philipp Müller <tim centricular net>
* Copyright (C) 2013 Centricular Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_NV_CODEC_KB_H__
#define __GST_NV_CODEC_KB_H__
#include <glib.h>
#define GST_NVCODEC_KB_ARROW_UP "\033[A"
#define GST_NVCODEC_KB_ARROW_DOWN "\033[B"
#define GST_NVCODEC_KB_ARROW_RIGHT "\033[C"
#define GST_NVCODEC_KB_ARROW_LEFT "\033[D"
typedef void (*GstNvCodecPlayKbFunc) (const gchar * kb_input, gpointer user_data);
gboolean gst_nvcodec_kb_set_key_handler (GstNvCodecPlayKbFunc kb_func, gpointer user_data);
#endif /* __GST_NV_CODEC_EXAMPLE_KB_H__ */

View file

@ -3,7 +3,7 @@ if host_system not in ['windows', 'linux']
endif
executable('qsvenc-dynamic-reconfigure',
['qsvenc-dynamic-reconfigure.c', 'key-handler.c'],
['qsvenc-dynamic-reconfigure.c', '../key-handler.c'],
include_directories : [configinc],
dependencies: [gst_dep, gstbase_dep, gstvideo_dep],
c_args : gst_plugins_bad_args,

View file

@ -24,7 +24,7 @@
#include <gst/gst.h>
#include <gst/video/video.h>
#include <stdlib.h>
#include "key-handler.h"
#include "../key-handler.h"
typedef enum
{