UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
deltacast.cpp
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2011-2023 CESNET, z.s.p.o.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, is permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * 3. Neither the name of CESNET nor the names of its contributors may be
21 * used to endorse or promote products derived from this software without
22 * specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
26 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
28 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#include "config.h"
39#include "config_unix.h"
40#include "config_win32.h"
41
42#include <algorithm>
43#include <fcntl.h>
44#include <semaphore.h>
45#include <stdio.h>
46#include <stdlib.h>
47#include <string.h>
48#ifndef _WIN32
49#include <sys/ioctl.h>
50#include <sys/poll.h>
51#endif
52#include <sys/stat.h>
53#include <sys/time.h>
54#include <unistd.h>
55
56#include "audio/types.h"
57#include "audio/utils.h"
58#include "debug.h"
59#include "deltacast_common.hpp"
60#include "host.h"
61#include "lib_common.h"
62#include "tv.h"
63#include "video.h"
64#include "video_capture.h"
66
67using namespace std;
68
71 struct tile *tile;
73 HANDLE SlotHandle;
74
76
77 struct timeval t, t0;
78 int frames;
79
81 VHD_AUDIOCHANNEL *pAudioChn;
82 VHD_AUDIOINFO AudioInfo;
84 unsigned int grab_audio:1;
85 unsigned int autodetect_format:1;
86
87 unsigned int initialize_flags;
89};
90
91static void usage(void);
92
93static void usage(void)
94{
95 printf("\t-t deltacast[:device=<index>][:mode=<mode>][:codec=<codec>]\n");
96
98
99 printf("\nAvailable modes:\n");
100 for (int i = 0; i < deltacast_frame_modes_count; ++i)
101 {
102 printf("\t%d: %s", deltacast_frame_modes[i].mode,
104 if (deltacast_frame_modes[i].iface != VHD_INTERFACE_AUTO)
105 printf("\t\t(no autodetection)");
106 printf("\n");
107 }
108
109 printf("\nAvailable codecs:\n");
110 printf("\tUYVY\n");
111 printf("\tv210\n");
112 printf("\traw\n");
113
114 printf("\nDefault board is 0. If mode is omitted, it will be autodetected "
115 "(except of UHD modes). Default codec is UYVY.\n");
116}
117
118static void vidcap_deltacast_probe(device_info **available_cards, int *count, void (**deleter)(void *))
119{
120 *deleter = free;
121
122 ULONG Result,DllVersion,NbBoards;
123 Result = VHD_GetApiInfo(&DllVersion,&NbBoards);
124 if (Result == VHDERR_NOERROR) {
125 *available_cards = (struct device_info *) calloc(NbBoards, sizeof(struct device_info));
126 *count = NbBoards;
127 for (ULONG i = 0; i < NbBoards; ++i) {
128 auto& card = (*available_cards)[i];
129 snprintf(card.dev, sizeof(card.dev), ":device=%" PRIu_ULONG, i);
130 snprintf(card.name, sizeof(card.name), "DELTACAST SDI board %" PRIu_ULONG, i);
131 snprintf(card.extra, sizeof(card.extra), "\"embeddedAudioAvailable\":\"t\"");
132 }
133 }
134}
135
138
139#define DELTA_TRY_CMD(cmd, msg) \
140 do {\
141 Result = cmd;\
142 if (Result != VHDERR_NOERROR) {\
143 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] " msg " Result = 0x%08" PRIX_ULONG "\n", Result);\
144 throw delta_init_exception();\
145 }\
146 } while(0)
147
154{
155 ULONG Result;
156 ULONG Packing;
157 ULONG Status = 0;
158 int i;
159 ULONG Interface = 0;
160
161 /* Wait for channel locked */
162 Result = VHD_GetBoardProperty(s->BoardHandle, VHD_CORE_BP_RX0_STATUS, &Status);
163
164 if (Result != VHDERR_NOERROR) {
165 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] ERROR : Cannot get channel status. Result = 0x%08" PRIX_ULONG "\n",Result);
166 throw delta_init_exception();
167 }
168
169 // no signal was detected on the wire
170 if(Status & VHD_CORE_RXSTS_UNLOCKED) {
171 return false;
172 }
173
174 /* Auto-detect clock system */
175 Result = VHD_GetBoardProperty(s->BoardHandle,VHD_SDI_BP_RX0_CLOCK_DIV,&s->ClockSystem);
176
177 if(Result != VHDERR_NOERROR) {
178 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] ERROR : Cannot detect incoming clock system from RX0. Result = 0x%08" PRIX_ULONG "\n",Result);
179 throw delta_init_exception();
180 } else {
181 printf("\nIncoming clock system : %s\n",(s->ClockSystem==VHD_CLOCKDIV_1)?"European":"American");
182 }
183
184 /* Select the detected clock system */
185 VHD_SetBoardProperty(s->BoardHandle,VHD_SDI_BP_CLOCK_SYSTEM,s->ClockSystem);
186
187 /* Create a logical stream to receive from RX0 connector */
188 if(!s->autodetect_format && s->frame->color_spec == RAW)
189 Result = VHD_OpenStreamHandle(s->BoardHandle,VHD_ST_RX0,VHD_SDI_STPROC_RAW,NULL,&s->StreamHandle,NULL);
191 Result = VHD_OpenStreamHandle(s->BoardHandle,VHD_ST_RX0,VHD_SDI_STPROC_JOINED,NULL,&s->StreamHandle,NULL);
192 } else {
193 Result = VHD_OpenStreamHandle(s->BoardHandle,VHD_ST_RX0,VHD_SDI_STPROC_DISJOINED_VIDEO,NULL,&s->StreamHandle,NULL);
194 }
195
196
197 if (Result != VHDERR_NOERROR)
198 {
199 log_msg(LOG_LEVEL_ERROR, "ERROR : Cannot open RX0 stream on DELTA-hd/sdi/codec board handle. Result = 0x%08" PRIX_ULONG "\n",Result);
200 throw delta_init_exception();
201 }
202
203 if(s->autodetect_format) {
204 /* Get auto-detected video standard */
205 Result = VHD_GetStreamProperty(s->StreamHandle,VHD_SDI_SP_VIDEO_STANDARD,&s->VideoStandard);
206
207 if ((Result == VHDERR_NOERROR) && (s->VideoStandard != NB_VHD_VIDEOSTANDARDS)) {
208 } else {
209 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Cannot detect incoming video standard from RX0. Result = 0x%08" PRIX_ULONG "\n",Result);
210 throw delta_init_exception();
211 }
212 }
213
214 for (i = 0; i < deltacast_frame_modes_count; ++i)
215 {
216 if(s->VideoStandard == (ULONG) deltacast_frame_modes[i].mode) {
221 Interface = deltacast_frame_modes[i].iface;
222 printf("[DELTACAST] %s mode selected. %dx%d @ %2.2f %s\n", deltacast_frame_modes[i].name, s->tile->width, s->tile->height,
224 break;
225 }
226 }
228 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Failed to obtain information about video format %" PRIu_ULONG ".\n", s->VideoStandard);
229 throw delta_init_exception();
230 }
231
232 /* Configure stream */
233 DELTA_TRY_CMD(VHD_SetStreamProperty(s->StreamHandle, VHD_SDI_SP_INTERFACE, Interface),
234 "Unable to set interface.");
235 DELTA_TRY_CMD(VHD_SetStreamProperty(s->StreamHandle, VHD_SDI_SP_VIDEO_STANDARD, s->VideoStandard),
236 "Unable to set video standard.");
237 DELTA_TRY_CMD(VHD_SetStreamProperty(s->StreamHandle, VHD_CORE_SP_TRANSFER_SCHEME,
238 VHD_TRANSFER_SLAVED),
239 "Unable to set transfer scheme.");
240
241 if(s->autodetect_format) {
242 Result = VHD_GetStreamProperty(s->StreamHandle, VHD_CORE_SP_BUFFER_PACKING, &Packing);
243 if (Result != VHDERR_NOERROR) {
244 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Unable to get pixel format\n");
245 throw delta_init_exception();
246 }
247 if(Packing == VHD_BUFPACK_VIDEO_YUV422_10) {
248 s->frame->color_spec = v210;
249 } else if(Packing == VHD_BUFPACK_VIDEO_YUV422_8) {
250 s->frame->color_spec = UYVY;
251 } else {
252 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Detected unknown pixel format!\n");
253 throw delta_init_exception();
254 }
255 }
256 if(s->frame->color_spec == v210 || s->frame->color_spec == RAW) {
257 Packing = VHD_BUFPACK_VIDEO_YUV422_10;
258 } else if(s->frame->color_spec == UYVY) {
259 Packing = VHD_BUFPACK_VIDEO_YUV422_8;
260 } else {
261 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Unsupported pixel format\n");
262 throw delta_init_exception();
263 }
264 printf("[DELTACAST] Pixel format '%s' selected.\n", get_codec_name(s->frame->color_spec));
265 Result = VHD_SetStreamProperty(s->StreamHandle, VHD_CORE_SP_BUFFER_PACKING, Packing);
266 if (Result != VHDERR_NOERROR) {
267 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Unable to set pixel format\n");
268 throw delta_init_exception();
269 }
270
273 if (s->audio_frame.ch_count != 1 &&
274 s->audio_frame.ch_count != 2) {
275 log_msg(LOG_LEVEL_ERROR, "[DELTACAST capture] Unable to handle channel count other than 1 or 2.\n");
276 throw delta_init_exception();
277 }
278 s->audio_frame.bps = 3;
279 s->audio_frame.sample_rate = 48000;
280 memset(&s->AudioInfo, 0, sizeof(VHD_AUDIOINFO));
281 s->pAudioChn = &s->AudioInfo.pAudioGroups[0].pAudioChannels[0];
282 s->pAudioChn->Mode = s->AudioInfo.pAudioGroups[0].pAudioChannels[1].Mode= s->audio_frame.ch_count == 1 ? VHD_AM_MONO : VHD_AM_STEREO;
283 s->pAudioChn->BufferFormat = s->AudioInfo.pAudioGroups[0].pAudioChannels[1].BufferFormat=VHD_AF_24;
284
285 /* Get the biggest audio frame size */
286 s->AudioBufferSize = VHD_GetBlockSize(s->pAudioChn->BufferFormat, s->pAudioChn->Mode) *
287 VHD_GetNbSamples((VHD_VIDEOSTANDARD) s->VideoStandard, (VHD_CLOCKDIVISOR) s->ClockSystem, VHD_ASR_48000, 0);
289 /* Create audio buffer */
290 s->audio_frame.data = (char *) calloc(1, s->audio_frame.max_size);
291 s->pAudioChn->pData = (BYTE *)
292 s->audio_frame.data;
293
294 LOG(LOG_LEVEL_NOTICE) << "[DELTACAST] Grabbing audio enabled: " << audio_desc_from_frame(&s->audio_frame) << "\n";
295 s->grab_audio = TRUE;
296 }
297
298 /* Start stream */
299 Result = VHD_StartStream(s->StreamHandle);
300 if (Result == VHDERR_NOERROR){
301 printf("[DELTACAST] Stream started.\n");
302 } else {
303 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] ERROR : Cannot start RX0 stream on DELTA-hd/sdi/codec board handle. Result = 0x%08" PRIX_ULONG "\n",Result);
304 throw delta_init_exception();
305 }
306
307 return true;
308}
309
310static int
312{
313 struct vidcap_deltacast_state *s = nullptr;
314 ULONG Result,DllVersion,NbBoards,ChnType;
315 ULONG BrdId = 0;
316
317 printf("vidcap_deltacast_init\n");
318
319 char *init_fmt = strdup(vidcap_params_get_fmt(params));
320 if (init_fmt && strcmp(init_fmt, "help") == 0) {
321 free(init_fmt);
322 usage();
323 return VIDCAP_INIT_NOERR;
324 }
325
326 s = (struct vidcap_deltacast_state *) calloc(1, sizeof(struct vidcap_deltacast_state));
327
328 if(s == NULL) {
329 printf("Unable to allocate DELTACAST state\n");
330 free(init_fmt);
331 free(s);
332 return VIDCAP_INIT_FAIL;
333 }
334
335 gettimeofday(&s->t0, NULL);
336
337 s->frame = vf_alloc(1);
338 s->tile = vf_get_tile(s->frame, 0);
339 s->frames = 0;
340 s->grab_audio = FALSE;
342 s->frame->color_spec = UYVY;
343 s->audio_frame.data = NULL;
344
345 s->BoardHandle = s->StreamHandle = s->SlotHandle = NULL;
346
347 if (init_fmt) {
348 char *save_ptr = NULL;
349 char *tok;
350 char *tmp = init_fmt;
351
352 while ((tok = strtok_r(tmp, ":", &save_ptr)) != NULL) {
353 if (strncasecmp(tok, "device=", strlen("device=")) == 0) {
354 BrdId = atoi(tok + strlen("device="));
355 } else if (strncasecmp(tok, "board=", strlen("board=")) == 0) {
356 // compat, should be device= instead
357 BrdId = atoi(tok + strlen("board="));
358 } else if (strncasecmp(tok, "mode=", strlen("mode=")) == 0) {
359 s->VideoStandard = atoi(tok + strlen("mode="));
361 } else if (strncasecmp(tok, "codec=", strlen("codec=")) == 0) {
362 tok = tok + strlen("codec=");
363 if(strcasecmp(tok, "raw") == 0)
364 s->frame->color_spec = RAW;
365 else if(strcmp(tok, "UYVY") == 0)
366 s->frame->color_spec = UYVY;
367 else if(strcmp(tok, "v210") == 0)
368 s->frame->color_spec = v210;
369 else {
370 log_msg(LOG_LEVEL_ERROR, "Wrong "
371 "codec entered.\n");
372 usage();
373 goto error;
374 }
375 } else {
376 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Wrong config option '%s'!\n", tok);
377 goto error;
378 }
379 tmp = NULL;
380 }
381 }
382 free(init_fmt);
383 init_fmt = NULL;
384
385 printf("[DELTACAST] Selected device %" PRIu_ULONG "\n", BrdId);
386
387 if(s->autodetect_format) {
388 printf("DELTACAST] We will try to autodetect incoming video format.\n");
389 }
390
391 /* Query VideoMasterHD information */
392 Result = VHD_GetApiInfo(&DllVersion,&NbBoards);
393 if (Result != VHDERR_NOERROR) {
394 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] ERROR : Cannot query VideoMasterHD"
395 " information. Result = 0x%08" PRIX_ULONG "\n",
396 Result);
397 goto error;
398 }
399 if (NbBoards == 0) {
400 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] No DELTA board detected, exiting...\n");
401 goto error;
402 }
403
404 if(BrdId >= NbBoards) {
405 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Wrong index %" PRIu_ULONG ". Found %" PRIu_ULONG " cards.\n", BrdId, NbBoards);
406 goto error;
407 }
408
409 /* Open a handle on first DELTA-hd/sdi/codec board */
410 Result = VHD_OpenBoardHandle(BrdId,&s->BoardHandle,NULL,0);
411 if (Result != VHDERR_NOERROR)
412 {
413 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] ERROR : Cannot open DELTA board %" PRIu_ULONG " handle. Result = 0x%08" PRIX_ULONG "\n",BrdId,Result);
414 goto error;
415 }
416
417 if (!delta_set_nb_channels(BrdId, s->BoardHandle, 1, 0)) {
418 goto error;
419 }
420
421 VHD_GetBoardProperty(s->BoardHandle, VHD_CORE_BP_RX0_TYPE, &ChnType);
422 if((ChnType!=VHD_CHNTYPE_SDSDI)&&(ChnType!=VHD_CHNTYPE_HDSDI)&&(ChnType!=VHD_CHNTYPE_3GSDI)) {
423 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] ERROR : The selected channel is not an SDI one\n");
424 goto error;
425 }
426
427 /* Disable RX0-TX0 by-pass relay loopthrough */
428 VHD_SetBoardProperty(s->BoardHandle,VHD_CORE_BP_BYPASS_RELAY_0,FALSE);
429 VHD_SetBoardProperty(s->BoardHandle,VHD_CORE_BP_BYPASS_RELAY_1,FALSE);
430 VHD_SetBoardProperty(s->BoardHandle,VHD_CORE_BP_BYPASS_RELAY_2,FALSE);
431 VHD_SetBoardProperty(s->BoardHandle,VHD_CORE_BP_BYPASS_RELAY_3,FALSE);
432
434 printf("\nWaiting for channel locked...\n");
435 try {
436 if(wait_for_channel(s)) {
437 s->initialized = true;
438 }
439 } catch(delta_init_exception &e) {
440 goto error;
441 }
442
443 *state = s;
444 return VIDCAP_INIT_OK;
445
446error:
447 free(init_fmt);
448
449 if (s) {
450 if(s->StreamHandle) {
451 /* Close stream handle */
452 VHD_CloseStreamHandle(s->StreamHandle);
453 }
454 if(s->BoardHandle) {
455 /* Re-establish RX0-TX0 by-pass relay loopthrough */
456 VHD_SetBoardProperty(s->BoardHandle,VHD_CORE_BP_BYPASS_RELAY_0,TRUE);
457 VHD_CloseBoardHandle(s->BoardHandle);
458 }
459 vf_free(s->frame);
460 }
461
462 free(s);
463 return VIDCAP_INIT_FAIL;
464}
465
466static void
468{
470
471 assert(s != NULL);
472
473 if(s->SlotHandle)
474 VHD_UnlockSlotHandle(s->SlotHandle);
475 VHD_StopStream(s->StreamHandle);
476 VHD_CloseStreamHandle(s->StreamHandle);
477 /* Re-establish RX0-TX0 by-pass relay loopthrough */
478 VHD_SetBoardProperty(s->BoardHandle,VHD_CORE_BP_BYPASS_RELAY_0,TRUE);
479 VHD_CloseBoardHandle(s->BoardHandle);
480
481 vf_free(s->frame);
482 free(s->audio_frame.data);
483 free(s);
484}
485
486static struct video_frame *
488{
490
491 ULONG /*SlotsCount, SlotsDropped,*/BufferSize;
492 ULONG Result;
493 BYTE *pBuffer=NULL;
494
495 if (!s->initialized) {
496 try {
497 if(wait_for_channel(s)) {
498 s->initialized = true;
499 } else {
500 return NULL;
501 }
502 } catch(delta_init_exception &e) {
503 }
504 }
505
506 *audio = NULL;
507 /* Unlock slot */
508 if(s->SlotHandle)
509 VHD_UnlockSlotHandle(s->SlotHandle);
510 Result = VHD_LockSlotHandle(s->StreamHandle,&s->SlotHandle);
511 if (Result != VHDERR_NOERROR) {
512 if (Result != VHDERR_TIMEOUT) {
513 log_msg(LOG_LEVEL_ERROR, "ERROR : Cannot lock slot on RX0 stream. Result = 0x%08" PRIX_ULONG "\n", Result);
514 }
515 else {
516 log_msg(LOG_LEVEL_ERROR, "Timeout \n");
517 }
518 return NULL;
519 }
520
521 if(s->grab_audio) {
522 /* Set the audio buffer size */
523 s->AudioBufferSize = VHD_GetBlockSize(s->pAudioChn->BufferFormat, s->pAudioChn->Mode) *
524 VHD_GetNbSamples((VHD_VIDEOSTANDARD) s->VideoStandard, (VHD_CLOCKDIVISOR) s->ClockSystem, VHD_ASR_48000, 0);
525 s->pAudioChn->DataSize = s->AudioBufferSize;
526
527 /* Extract audio */
528 Result = VHD_SlotExtractAudio(s->SlotHandle, &s->AudioInfo);
529 if(Result==VHDERR_NOERROR) {
530 s->audio_frame.data_len = s->pAudioChn->DataSize;
531 /* Do audio processing here */
532 *audio = &s->audio_frame;
533 } else {
534 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Audio grabbing error. Result = 0x%08" PRIX_ULONG "\n",Result);
535 }
536 }
537
538
539 Result = VHD_GetSlotBuffer(s->SlotHandle, VHD_SDI_BT_VIDEO, &pBuffer, &BufferSize);
540
541 if (Result != VHDERR_NOERROR) {
542 log_msg(LOG_LEVEL_ERROR, "\nERROR : Cannot get slot buffer. Result = 0x%08" PRIX_ULONG "\n",Result);
543 return NULL;
544 }
545
546 s->tile->data = (char*) pBuffer;
547 s->tile->data_len = BufferSize;
548
549 /* Print some statistics */
550 /*VHD_GetStreamProperty(s->StreamHandle,VHD_CORE_SP_SLOTS_COUNT,&SlotsCount);
551 VHD_GetStreamProperty(s->StreamHandle,VHD_CORE_SP_SLOTS_DROPPED,&SlotsDropped);
552 printf("%u frames received (%u dropped) \r",SlotsCount,SlotsDropped);*/
553 gettimeofday(&s->t, NULL);
554 double seconds = tv_diff(s->t, s->t0);
555 if (seconds >= 5) {
556 float fps = s->frames / seconds;
557 log_msg(LOG_LEVEL_INFO, "[DELTACAST cap.] %d frames in %g seconds = %g FPS\n", s->frames, seconds, fps);
558 s->t0 = s->t;
559 s->frames = 0;
560 }
561 s->frames++;
562
563 return s->frame;
564}
565
573
575
void ** state
struct audio_frame ** audio
int void(** deleter)(void *))
struct video_frame * vf_alloc(int count)
Allocates blank video frame.
void vf_free(struct video_frame *buf)
Frees video_frame structure.
const char * get_codec_name(codec_t codec)
This file contains definition of some common audio types.
#define TRUE
#define FALSE
unsigned char BYTE
Definition crypt_aes.h:71
void log_msg(int level, const char *format,...)
Definition debug.cpp:130
#define LOG_LEVEL_NOTICE
information that may be interesting
Definition debug.h:61
#define LOG_LEVEL_INFO
normal reporting
Definition debug.h:62
#define LOG_LEVEL_ERROR
general errors
Definition debug.h:59
#define LOG(level)
Definition debug.h:313
static void print_available_delta_boards()
static const int deltacast_frame_modes_count
static bool delta_set_nb_channels(ULONG BrdId, HANDLE BoardHandle, ULONG RequestedRx, ULONG RequestedTx)
#define PRIX_ULONG
static const struct deltacast_frame_mode_t deltacast_frame_modes[]
#define PRIu_ULONG
#define VIDCAP_INIT_NOERR
state not initialized, other action performed (typically help)
#define VIDCAP_INIT_OK
initialization successful
#define VIDCAP_NO_GENERIC_FPS_INDICATOR
#define VIDEO_CAPTURE_ABI_VERSION
#define VIDCAP_INIT_FAIL
error ocured
int count
Definition hd-rum.c:44
unsigned int audio_capture_channels
Definition host.cpp:163
#define DEFAULT_AUDIO_CAPTURE_CHANNELS
Definition host.h:89
@ LIBRARY_CLASS_VIDEO_CAPTURE
Definition lib_common.h:78
#define REGISTER_MODULE(name, info, lclass, abi)
Registers module to global modules' registry.
Definition lib_common.h:144
enum openssl_mode mode
#define max(a, b)
Definition rtp.c:98
const char * name
Definition settings.cpp:193
struct used to comunicate with audio capture/playback device
Definition types.h:99
int sample_rate
Definition types.h:101
char * data
Definition types.h:102
int ch_count
Definition types.h:104
int data_len
Definition types.h:103
int bps
Definition types.h:100
int max_size
Definition types.h:105
enum interlacing_t interlacing
Struct tile is an area of video_frame.
Definition types.h:279
unsigned int width
Definition types.h:280
char * data
Raw tile data. Pointer must be at least 4B aligned.
Definition types.h:287
unsigned int data_len
length of the data
Definition types.h:288
unsigned int height
Definition types.h:281
struct video_frame * frame
Definition deltacast.cpp:70
unsigned int grab_audio
Definition deltacast.cpp:84
unsigned int initialize_flags
Definition deltacast.cpp:87
struct timeval t t0
Definition deltacast.cpp:77
VHD_AUDIOINFO AudioInfo
Definition deltacast.cpp:82
VHD_AUDIOCHANNEL * pAudioChn
Definition deltacast.cpp:81
struct audio_frame audio_frame
Definition deltacast.cpp:75
unsigned int autodetect_format
Definition deltacast.cpp:85
Struct video_frame represents a video frame and contains video description.
Definition types.h:305
enum interlacing_t interlacing
Definition types.h:307
double fps
Definition types.h:308
codec_t color_spec
Definition types.h:306
double tv_diff(struct timeval curr_time, struct timeval prev_time)
Definition tv.c:97
@ UYVY
YCbCr 422 8-bit - Cb Y0 Cr Y1.
Definition types.h:71
@ RAW
RAW HD-SDI frame.
Definition types.h:82
@ v210
YCbCr 422 10-bit - xVY0U|xY2UY1|xUY3V|xY5VY4, little-endian (2 bit padding /'x'/),...
Definition types.h:75
struct audio_desc audio_desc_from_frame(const struct audio_frame *frame)
Definition utils.cpp:196
This is an umbrella header for video functions.
static const struct video_capture_info vidcap_deltacast_info
static int vidcap_deltacast_init(struct vidcap_params *params, void **state)
static void vidcap_deltacast_probe(device_info **available_cards, int *count, void(**deleter)(void *))
static struct video_frame * vidcap_deltacast_grab(void *state, struct audio_frame **audio)
#define DELTA_TRY_CMD(cmd, msg)
static bool wait_for_channel(struct vidcap_deltacast_state *s)
static void vidcap_deltacast_done(void *state)
static void usage(void)
Definition deltacast.cpp:93
const char * vidcap_params_get_fmt(const struct vidcap_params *params)
unsigned int vidcap_params_get_flags(const struct vidcap_params *params)
#define VIDCAP_FLAG_AUDIO_EMBEDDED
HD-SDI embedded audio.
struct tile * vf_get_tile(struct video_frame *buf, int pos)
Returns pointer to n-th tile from video frame Equivalent to &video_frame::tiles[pos].
const char * get_interlacing_description(enum interlacing_t interlacing)
Returns description of interlacing Eg. "progressive".