UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
playback.h File Reference
#include "utils/macros.h"
Include dependency graph for playback.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

EXTERN_C void playback_register_keyboard_ctl (struct module *mod)
 
EXTERN_C int playback_set_device (char *device_string, size_t buf_len, const char *optarg)
 

Detailed Description

Author
Martin Pulec pulec.nosp@m.@ces.nosp@m.net.c.nosp@m.z Abstraction of import and file video capture.

Definition in file playback.h.

Function Documentation

◆ playback_register_keyboard_ctl()

EXTERN_C void playback_register_keyboard_ctl ( struct module * mod)
Parameters
modmoodule that will receive the playback messages

Definition at line 102 of file playback.c.

102 {
103 struct { int key; const char *msg; } kb[] = {{K_PGUP, "seek +600s"}, {K_PGDOWN, "seek -600s"}, {K_UP, "seek +60s"}, {K_DOWN, "seek -60s"}, {K_LEFT, "seek -10s"}, {K_RIGHT, "seek +10s"}, {' ', "pause"}, {'q', "quit"}};
104 for (size_t i = 0; i < sizeof kb / sizeof kb[0]; ++i) {
105 char description[200];
106 snprintf(description, sizeof description, "playback %s", kb[i].msg);
107 if (!keycontrol_register_key(mod, kb[i].key, kb[i].msg, description)) {
108 log_msg(LOG_LEVEL_ERROR, "Cannot register key %d control for playback!\n", kb[i].key);
109 }
110 }
111}
void log_msg(int level, const char *format,...)
Definition debug.cpp:130
#define LOG_LEVEL_ERROR
general errors
Definition debug.h:59
bool keycontrol_register_key(struct module *receiver_mod, int64_t key, const char *message, const char *description)
Registers callback message for given key.
#define K_LEFT
#define K_RIGHT
#define K_PGDOWN
#define K_DOWN
#define K_PGUP
#define K_UP
struct msghdr msg
const char * description
Definition cineform.cpp:126
const char * key
Definition cineform.cpp:125

References description, K_DOWN, K_LEFT, K_PGDOWN, K_PGUP, K_RIGHT, K_UP, key, keycontrol_register_key(), LOG_LEVEL_ERROR, log_msg(), and msg.

Referenced by initialize_import(), and vidcap_file_init().

Here is the call graph for this function:

◆ playback_set_device()

EXTERN_C int playback_set_device ( char * device_string,
size_t buf_len,
const char * optarg )

Definition at line 70 of file playback.c.

70 {
71 bool is_import = false;
72 if (strcmp(optarg, "help") == 0) {
74 return 0;
75 }
76 char *path = strdup(optarg);
77 if (strchr(path, ':')) {
78 *strchr(path, ':') = '\0';
79 }
80
81 struct stat sb;
82 if (stat(path, &sb) == -1) {
83 perror(MOD_NAME "stat");
84 log_msg(LOG_LEVEL_ERROR, MOD_NAME "Cannot access file or directory '%s'\n", path);
85 log_msg(LOG_LEVEL_INFO, MOD_NAME "Use '--playback help' to see usage.\n");
86 free(path);
87 return -1;
88 }
89
90 if (sb.st_mode & S_IFDIR || strstr(path, "video.info") != NULL) {
91 is_import = true;
92 }
93
94 snprintf(device_string, buf_len, "%s:%s:opportunistic_audio", is_import ? "import" : "file", optarg);
95 free(path);
96 return 1;
97}
#define LOG_LEVEL_INFO
normal reporting
Definition debug.h:62
#define MOD_NAME
Definition playback.c:54
static void playback_usage(void)
Definition playback.c:56

References LOG_LEVEL_ERROR, LOG_LEVEL_INFO, log_msg(), MOD_NAME, and playback_usage().

Referenced by parse_options_internal().

Here is the call graph for this function: