UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
video_capture_params.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

Initialization Flags

Copyright (c) 2013-2023 CESNET, z. s. p. o All rights reserved.

Redistribution and use in source and binary forms, with or without modification, is permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of CESNET nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#define VIDCAP_FLAG_AUDIO_AESEBU   (1u<<2u)
 AES/EBU audio.
 
#define VIDCAP_FLAG_AUDIO_ANALOG   (1u<<3u)
 (balanced) analog audio
 
#define VIDCAP_FLAG_AUDIO_ANY   (VIDCAP_FLAG_AUDIO_EMBEDDED | VIDCAP_FLAG_AUDIO_AESEBU | VIDCAP_FLAG_AUDIO_ANALOG)
 
#define VIDCAP_FLAG_AUDIO_EMBEDDED   (1u<<1u)
 HD-SDI embedded audio.
 

Functions

Vidcap Parameters Handling Functions
void vidcap_params_add_flags (struct vidcap_params *params, unsigned int flags)
 
struct vidcap_params * vidcap_params_allocate (void)
 
struct vidcap_params * vidcap_params_allocate_next (struct vidcap_params *params)
 
struct vidcap_params * vidcap_params_copy (const struct vidcap_params *params)
 
void vidcap_params_free_struct (struct vidcap_params *params)
 
const char * vidcap_params_get_capture_filter (const struct vidcap_params *params)
 
const char * vidcap_params_get_driver (const struct vidcap_params *params)
 
unsigned int vidcap_params_get_flags (const struct vidcap_params *params)
 
const char * vidcap_params_get_fmt (const struct vidcap_params *params)
 
const char * vidcap_params_get_name (const struct vidcap_params *params)
 
struct vidcap_params * vidcap_params_get_next (const struct vidcap_params *params)
 
struct vidcap_params * vidcap_params_get_nth (struct vidcap_params *params, int index)
 
struct module * vidcap_params_get_parent (const struct vidcap_params *params)
 
void vidcap_params_set_capture_filter (struct vidcap_params *params, const char *req_capture_filter)
 
void vidcap_params_set_device (struct vidcap_params *params, const char *config)
 
void vidcap_params_set_driver (struct vidcap_params *params, const char *driver)
 
void vidcap_params_set_flags (struct vidcap_params *params, unsigned int flags)
 
void vidcap_params_set_parent (struct vidcap_params *params, struct module *mod)
 

Detailed Description

Author
Martin Pulec pulec.nosp@m.@ces.nosp@m.net.c.nosp@m.z

video_capture_params is basically intended as a linked list of video capture parameters. It is used for structured capturers like aggregate or switcher, which work as a master and initialize its slaves. The structure is used to hold individual devices' parameters (namely per-device capture filter).

Definition in file video_capture_params.h.

Macro Definition Documentation

◆ VIDCAP_FLAG_AUDIO_AESEBU

#define VIDCAP_FLAG_AUDIO_AESEBU   (1u<<2u)

◆ VIDCAP_FLAG_AUDIO_ANALOG

#define VIDCAP_FLAG_AUDIO_ANALOG   (1u<<3u)

◆ VIDCAP_FLAG_AUDIO_ANY

◆ VIDCAP_FLAG_AUDIO_EMBEDDED

Function Documentation

◆ vidcap_params_add_flags()

void vidcap_params_add_flags ( struct vidcap_params * params,
unsigned int flags )

Definition at line 208 of file video_capture_params.cpp.

209{
210 params->flags |= flags;
211}
const char unsigned int flags

References flags.

Referenced by parse_audio_capture().

◆ vidcap_params_allocate()

struct vidcap_params * vidcap_params_allocate ( void )

@brier Allocates blank vidcap_params structure.

Definition at line 117 of file video_capture_params.cpp.

118{
119 return (struct vidcap_params *) calloc(1, sizeof(struct vidcap_params));
120}

Referenced by test_video_capture(), vidcap_params_allocate_next(), and vidcap_screen_win_init().

◆ vidcap_params_allocate_next()

struct vidcap_params * vidcap_params_allocate_next ( struct vidcap_params * curr)

@brier Allocates blank vidcap_params structure.

Follows curr struct in the virtual list.

Parameters
currstructure to be appended after
Returns
pointer to newly created structure

Definition at line 129 of file video_capture_params.cpp.

130{
132 return curr->next;
133}
struct vidcap_params * next
struct vidcap_params * vidcap_params_allocate(void)

References vidcap_params::next, and vidcap_params_allocate().

Referenced by adjust_params(), and parse_options_internal().

Here is the call graph for this function:

◆ vidcap_params_copy()

struct vidcap_params * vidcap_params_copy ( const struct vidcap_params * params)

Creates deep copy of vidcap_params structure.

Definition at line 255 of file video_capture_params.cpp.

256{
257 if (!params)
258 return NULL;
259
260 struct vidcap_params *ret = (struct vidcap_params *) calloc(1, sizeof(struct vidcap_params));
261
262 if (params->driver)
263 ret->driver = strdup(params->driver);
264 if (params->fmt)
265 ret->fmt = strdup(params->fmt);
266 if (params->requested_capture_filter)
268 strdup(params->requested_capture_filter);
269 if (params->name)
270 ret->name = strdup(params->name);
271 if (params->flags)
272 ret->flags = params->flags;
273
274 ret->next = NULL; // there is high probability that the pointer will be invalid
275
276 return ret;
277}
char * driver
driver name
char * fmt
driver options
char * name
input name (capture alias in config file or complete config if not alias)
unsigned int flags
one of vidcap_flags

References vidcap_params::driver, vidcap_params::flags, vidcap_params::fmt, vidcap_params::name, vidcap_params::next, and vidcap_params::requested_capture_filter.

Referenced by parse(), and vidcap_screen_linux_init().

◆ vidcap_params_free_struct()

void vidcap_params_free_struct ( struct vidcap_params * buf)

Frees all members of the given structure as well as its members.

Parameters
[in]bufstructure to be feed

Definition at line 284 of file video_capture_params.cpp.

285{
286 if (!buf)
287 return;
288
289 free(buf->driver);
290 free(buf->fmt);
291 free(buf->requested_capture_filter);
292 free(buf->name);
293
294 free(buf);
295}

References vidcap_params::driver, vidcap_params::fmt, vidcap_params::name, and vidcap_params::requested_capture_filter.

Referenced by ug_options::~ug_options(), test_video_capture(), vidcap_screen_linux_init(), vidcap_screen_win_init(), and vidcap_swmix_done().

◆ vidcap_params_get_capture_filter()

const char * vidcap_params_get_capture_filter ( const struct vidcap_params * params)

Definition at line 198 of file video_capture_params.cpp.

199{
200 return params->requested_capture_filter;
201}

Referenced by initialize_video_capture(), and parse_options_internal().

◆ vidcap_params_get_driver()

const char * vidcap_params_get_driver ( const struct vidcap_params * params)
Returns
capture driver name (eg. decklink), not NULL if vidcap_params_set_device() called

Definition at line 216 of file video_capture_params.cpp.

217{
218 return params->driver;
219}

Referenced by adjust_params(), grab_worker(), initialize_video_capture(), main(), parse(), slave_worker(), vidcap_aggregate_init(), vidcap_gpustitch_init(), and vidcap_switcher_init().

◆ vidcap_params_get_flags()

◆ vidcap_params_get_fmt()

◆ vidcap_params_get_name()

const char * vidcap_params_get_name ( const struct vidcap_params * params)
Returns
<driver>[:<configuration>] as given on command-line
See also
vidcap_params_get_driver, vidcap_params_get_fmt

Definition at line 238 of file video_capture_params.cpp.

239{
240 return params->name;
241}

Referenced by init_slave_data(), and slave_worker().

◆ vidcap_params_get_next()

struct vidcap_params * vidcap_params_get_next ( const struct vidcap_params * curr)

@brier Returns next item in virtual vidcap_params list.

Definition at line 138 of file video_capture_params.cpp.

139{
140 return curr->next;
141}

References vidcap_params::next.

Referenced by ug_options::~ug_options(), initialize_video_capture(), parse(), vidcap_aggregate_init(), vidcap_gpustitch_init(), and vidcap_switcher_init().

◆ vidcap_params_get_nth()

struct vidcap_params * vidcap_params_get_nth ( struct vidcap_params * curr,
int index )

@brier Returns n-th item in vidcap_params list.

Definition at line 146 of file video_capture_params.cpp.

147{
148 struct vidcap_params *ret = curr;
149 for (int i = 0; i < index; i++) {
150 ret = ret->next;
151 if (ret == NULL) {
152 return NULL;
153 }
154 }
155 if (ret->driver == NULL) {
156 // this is just the stopper of the list...
157 return NULL;
158 }
159 return ret;
160}

References vidcap_params::driver, and vidcap_params::next.

Referenced by vidcap_switcher_grab().

◆ vidcap_params_get_parent()

struct module * vidcap_params_get_parent ( const struct vidcap_params * params)

◆ vidcap_params_set_capture_filter()

void vidcap_params_set_capture_filter ( struct vidcap_params * params,
const char * req_capture_filter )

Definition at line 192 of file video_capture_params.cpp.

194{
195 params->requested_capture_filter = strdup(req_capture_filter);
196}

Referenced by initialize_video_capture(), and parse_options_internal().

◆ vidcap_params_set_device()

void vidcap_params_set_device ( struct vidcap_params * params,
const char * config )

Fills the structure with device config string in format either driver[:params] or alias.

Definition at line 166 of file video_capture_params.cpp.

167{
168 free(params->name);
169 free(params->driver);
170 free(params->fmt);
171
172 params->name = strdup(config);
173
175 params->driver = strdup(config);
176 if (strchr(params->driver, ':')) {
177 char *delim = strchr(params->driver, ':');
178 *delim = '\0';
179 params->fmt = strdup(delim + 1);
180 } else {
181 params->fmt = strdup("");
182 }
183 }
184}
static bool vidcap_dispatch_alias(struct vidcap_params *params)

References vidcap_dispatch_alias().

Referenced by ug_options::ug_options(), adjust_params(), parse_options_internal(), test_video_capture(), and vidcap_screen_win_init().

Here is the call graph for this function:

◆ vidcap_params_set_driver()

void vidcap_params_set_driver ( struct vidcap_params * params,
const char * driver )

Definition at line 186 of file video_capture_params.cpp.

187{
188 free(params->driver);
189 params->driver = strdup(driver);
190}

References vidcap_params::driver.

Referenced by vidcap_screen_linux_init().

◆ vidcap_params_set_flags()

void vidcap_params_set_flags ( struct vidcap_params * params,
unsigned int flags )

Definition at line 203 of file video_capture_params.cpp.

204{
205 params->flags = flags;
206}

References flags.

Referenced by initialize_video_capture(), vidcap_aggregate_init(), and vidcap_switcher_init().

◆ vidcap_params_set_parent()

void vidcap_params_set_parent ( struct vidcap_params * params,
struct module * mod )

Definition at line 248 of file video_capture_params.cpp.

248 {
249 params->parent = mod;
250}

Referenced by initialize_video_capture(), and vidcap_screen_win_init().