UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
deltacast.cpp File Reference
#include "host.h"
#include "debug.h"
#include "deltacast_common.hpp"
#include "lib_common.h"
#include "tv.h"
#include "video.h"
#include "video_display.h"
#include "audio/types.h"
#include "audio/utils.h"
#include "utils/ring_buffer.h"
#include <algorithm>
Include dependency graph for deltacast.cpp:

Go to the source code of this file.

Classes

struct  state_deltacast
 

Macros

#define DELTACAST_MAGIC   0x01005e02
 

Functions

static void display_deltacast_done (void *state)
 
static bool display_deltacast_get_property (void *state, int property, void *val, size_t *len)
 
static struct video_frame * display_deltacast_getf (void *state)
 
static void * display_deltacast_init (struct module *parent, const char *fmt, unsigned int flags)
 
static void display_deltacast_probe (struct device_info **available_cards, int *count, void(**deleter)(void *))
 
static void display_deltacast_put_audio_frame (void *state, const struct audio_frame *frame)
 
static bool display_deltacast_putf (void *state, struct video_frame *frame, long long nonblock)
 
static bool display_deltacast_reconfigure (void *state, struct video_desc desc)
 
static bool display_deltacast_reconfigure_audio (void *state, int quant_samples, int channels, int sample_rate)
 
 REGISTER_MODULE (deltacast, &display_deltacast_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION)
 
static void show_help (void)
 

Variables

static const struct video_display_info display_deltacast_info
 

Detailed Description

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

Definition in file deltacast.cpp.

Macro Definition Documentation

◆ DELTACAST_MAGIC

#define DELTACAST_MAGIC   0x01005e02

Function Documentation

◆ display_deltacast_done()

static void display_deltacast_done ( void * state)
static

Definition at line 413 of file deltacast.cpp.

414{
415 struct state_deltacast *s = (struct state_deltacast *)state;
416
417 if(s->initialized) {
418 if(s->SlotHandle)
419 VHD_UnlockSlotHandle(s->SlotHandle);
420 VHD_StopStream(s->StreamHandle);
421 VHD_CloseStreamHandle(s->StreamHandle);
422 VHD_SetBoardProperty(s->BoardHandle,VHD_CORE_BP_BYPASS_RELAY_0,TRUE);
423 VHD_CloseBoardHandle(s->BoardHandle);
424 }
425
426 vf_free(s->frame);
427 free(s);
428}
void ** state
void vf_free(struct video_frame *buf)
Frees video_frame structure.
#define TRUE
HANDLE StreamHandle
Definition deltacast.cpp:69
struct video_frame * frame
Definition deltacast.cpp:63

References state_deltacast::BoardHandle, state_deltacast::frame, state_deltacast::initialized, state_deltacast::SlotHandle, state, state_deltacast::StreamHandle, TRUE, and vf_free().

Here is the call graph for this function:

◆ display_deltacast_get_property()

static bool display_deltacast_get_property ( void * state,
int property,
void * val,
size_t * len )
static

Definition at line 431 of file deltacast.cpp.

433{
434 UNUSED(state);
435 codec_t codecs[] = {v210, UYVY, RAW};
437 int rgb_shift[] = {0, 8, 16};
438
439 switch (property) {
441 if(sizeof(codecs) <= *len) {
442 memcpy(val, codecs, sizeof(codecs));
443 } else {
444 return false;
445 }
446
447 *len = sizeof(codecs);
448 break;
450 if(sizeof(rgb_shift) > *len) {
451 return false;
452 }
453 memcpy(val, rgb_shift, sizeof(rgb_shift));
454 *len = sizeof(rgb_shift);
455 break;
457 *(int *) val = PITCH_DEFAULT;
458 *len = sizeof(int);
459 break;
461 if(sizeof(supported_il_modes) <= *len) {
462 memcpy(val, supported_il_modes, sizeof(supported_il_modes));
463 } else {
464 return false;
465 }
466 *len = sizeof(supported_il_modes);
467 break;
469 {
470 assert(*len == sizeof(struct audio_desc));
471 struct audio_desc *desc = (struct audio_desc *) val;
472 desc->sample_rate = 48000;
473 desc->ch_count = std::max(desc->ch_count, 16);
474 desc->codec = AC_PCM;
475 desc->bps = desc->bps < 3 ? 2 : 3;
476 }
477 break;
478 default:
479 return false;
480 }
481 return true;
482}
#define UNUSED(x)
int void * val
struct video_desc desc
int void size_t * len
int property
@ AC_PCM
Definition types.h:53
#define PITCH_DEFAULT
default pitch, i. e. respective linesize
@ DISPLAY_PROPERTY_BUF_PITCH
requested framebuffer pitch - int (bytes), may be PITCH_DEFAULT
@ DISPLAY_PROPERTY_RGB_SHIFT
red,green,blue shift - int[3] (bits)
@ DISPLAY_PROPERTY_SUPPORTED_IL_MODES
display supported interlacing modes - enum interlacing_t[]
@ DISPLAY_PROPERTY_CODECS
list of natively supported codecs - codec_t[]
@ DISPLAY_PROPERTY_AUDIO_FORMAT
interlacing_t
Definition types.h:163
@ UPPER_FIELD_FIRST
First stored field is top, followed by bottom.
Definition types.h:165
@ PROGRESSIVE
progressive frame
Definition types.h:164
@ SEGMENTED_FRAME
Segmented frame. Contains the same data as progressive frame.
Definition types.h:168
codec_t
Definition types.h:65
@ 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
static struct @76 codecs[]

References AC_PCM, codecs, desc, DISPLAY_PROPERTY_AUDIO_FORMAT, DISPLAY_PROPERTY_BUF_PITCH, DISPLAY_PROPERTY_CODECS, DISPLAY_PROPERTY_RGB_SHIFT, DISPLAY_PROPERTY_SUPPORTED_IL_MODES, len, PITCH_DEFAULT, PROGRESSIVE, property, RAW, SEGMENTED_FRAME, state, UNUSED, UPPER_FIELD_FIRST, UYVY, v210, and val.

◆ display_deltacast_getf()

static struct video_frame * display_deltacast_getf ( void * state)
static

Definition at line 97 of file deltacast.cpp.

98{
99 struct state_deltacast *s = (struct state_deltacast *)state;
100 BYTE *pBuffer;
101 ULONG BufferSize;
102 ULONG Result;
103
104 assert(s->magic == DELTACAST_MAGIC);
105
106 if(!s->initialized)
107 return s->frame;
108
109 Result = VHD_LockSlotHandle(s->StreamHandle, &s->SlotHandle);
110 if (Result != VHDERR_NOERROR) {
111 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Unable to lock slot.\n");
112 return NULL;
113 }
114 Result = VHD_GetSlotBuffer(s->SlotHandle,VHD_SDI_BT_VIDEO,&pBuffer,&BufferSize);
115 if (Result != VHDERR_NOERROR) {
116 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Unable to get buffer.\n");
117 return NULL;
118 }
119
120 s->tile->data = (char *) pBuffer;
121 s->tile->data_len = BufferSize;
122
123 return s->frame;
124}
unsigned char BYTE
Definition crypt_aes.h:71
void log_msg(int level, const char *format,...)
Definition debug.cpp:130
#define LOG_LEVEL_ERROR
general errors
Definition debug.h:59
struct tile * tile
Definition deltacast.cpp:64
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
#define DELTACAST_MAGIC
Definition deltacast.cpp:57

References tile::data, tile::data_len, DELTACAST_MAGIC, state_deltacast::frame, state_deltacast::initialized, LOG_LEVEL_ERROR, log_msg(), state_deltacast::magic, state_deltacast::SlotHandle, state, state_deltacast::StreamHandle, and state_deltacast::tile.

Here is the call graph for this function:

◆ display_deltacast_init()

static void * display_deltacast_init ( struct module * parent,
const char * fmt,
unsigned int flags )
static

Definition at line 302 of file deltacast.cpp.

303{
304 UNUSED(parent);
305 struct state_deltacast *s;
306 ULONG Result,DllVersion,NbBoards,ChnType;
307 ULONG BrdId = 0;
308
309 s = (struct state_deltacast *)calloc(1, sizeof(struct state_deltacast));
311
312 s->frame = vf_alloc(1);
313 s->tile = vf_get_tile(s->frame, 0);
314 s->frames = 0;
315
316 gettimeofday(&s->tv, NULL);
317
318 s->initialized = FALSE;
320 s->play_audio = TRUE;
321 } else {
322 s->play_audio = FALSE;
323 }
324
325 s->BoardHandle = s->StreamHandle = s->SlotHandle = NULL;
327
328 if(fmt && strcmp(fmt, "help") == 0) {
329 show_help();
330 vf_free(s->frame);
331 free(s);
332 return INIT_NOERR;
333 }
334
335 if(fmt)
336 {
337 char *tmp = strdup(fmt);
338 char *save_ptr = NULL;
339 char *tok;
340
341 tok = strtok_r(tmp, ":", &save_ptr);
342 if(!tok)
343 {
344 free(tmp);
345 show_help();
346 goto error;
347 }
348 if (strncasecmp(tok, "device=", strlen("device=")) == 0) {
349 BrdId = atoi(tok + strlen("device="));
350 } else {
351 log_msg(LOG_LEVEL_ERROR, "Unknown option: %s\n\n", tok);
352 free(tmp);
353 show_help();
354 goto error;
355 }
356 free(tmp);
357 }
358
359 /* Query VideoMasterHD information */
360 Result = VHD_GetApiInfo(&DllVersion,&NbBoards);
361 if (Result != VHDERR_NOERROR) {
362 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] ERROR : Cannot query VideoMasterHD"
363 " information. Result = 0x%08" PRIX_ULONG "\n",
364 Result);
365 goto error;
366 }
367 if (NbBoards == 0) {
368 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] No DELTA board detected, exiting...\n");
369 goto error;
370 }
371
372 if(BrdId >= NbBoards) {
373 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Wrong index %" PRIu_ULONG ". Found %" PRIu_ULONG " cards.\n", BrdId, NbBoards);
374 goto error;
375 }
376
377 /* Open a handle on first DELTA-hd/sdi/codec board */
378 Result = VHD_OpenBoardHandle(BrdId,&s->BoardHandle,NULL,0);
379 if (Result != VHDERR_NOERROR)
380 {
381 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] ERROR : Cannot open DELTA board %" PRIu_ULONG " handle. Result = 0x%08" PRIX_ULONG "\n", BrdId, Result);
382 goto error;
383 }
384
385 if (!delta_set_nb_channels(BrdId, s->BoardHandle, 0, 1)) {
386 goto error;
387 }
388
389 VHD_GetBoardProperty(s->BoardHandle, VHD_CORE_BP_TX0_TYPE, &ChnType);
390 if((ChnType!=VHD_CHNTYPE_SDSDI)&&(ChnType!=VHD_CHNTYPE_HDSDI)&&(ChnType!=VHD_CHNTYPE_3GSDI)) {
391 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] ERROR : The selected channel is not an SDI one\n");
392 goto bad_channel;
393 }
394
395 /* Disable RX0-TX0 by-pass relay loopthrough */
396 VHD_SetBoardProperty(s->BoardHandle,VHD_CORE_BP_BYPASS_RELAY_0,FALSE);
397
398 /* Select a 1/1 clock system */
399 VHD_SetBoardProperty(s->BoardHandle,VHD_SDI_BP_CLOCK_SYSTEM,VHD_CLOCKDIV_1);
400
401 pthread_mutex_init(&s->lock, NULL);
402
403 return s;
404
405bad_channel:
406 VHD_CloseBoardHandle(s->BoardHandle);
407error:
408 vf_free(s->frame);
409 free(s);
410 return NULL;
411}
const char * fmt
const char unsigned int flags
struct video_frame * vf_alloc(int count)
Allocates blank video frame.
#define FALSE
static bool delta_set_nb_channels(ULONG BrdId, HANDLE BoardHandle, ULONG RequestedRx, ULONG RequestedTx)
#define PRIX_ULONG
#define PRIu_ULONG
#define DISPLAY_FLAG_AUDIO_EMBEDDED
#define INIT_NOERR
Definition host.h:73
const char * parent
Definition settings.cpp:198
pthread_mutex_t lock
Definition deltacast.cpp:72
unsigned long int frames
Definition deltacast.cpp:66
struct timeval tv
Definition deltacast.cpp:62
unsigned int audio_configured
Definition deltacast.cpp:75
unsigned int play_audio
Definition deltacast.cpp:74
static void show_help(void)
Definition deltacast.cpp:85
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].

References state_deltacast::audio_configured, state_deltacast::BoardHandle, delta_set_nb_channels(), DELTACAST_MAGIC, DISPLAY_FLAG_AUDIO_EMBEDDED, FALSE, flags, fmt, state_deltacast::frame, state_deltacast::frames, INIT_NOERR, state_deltacast::initialized, state_deltacast::lock, LOG_LEVEL_ERROR, log_msg(), state_deltacast::magic, parent, state_deltacast::play_audio, PRIu_ULONG, PRIX_ULONG, show_help(), state_deltacast::SlotHandle, state_deltacast::StreamHandle, state_deltacast::tile, TRUE, state_deltacast::tv, UNUSED, vf_alloc(), vf_free(), and vf_get_tile().

Here is the call graph for this function:

◆ display_deltacast_probe()

static void display_deltacast_probe ( struct device_info ** available_cards,
int * count,
void(** deleter )(void *) )
static

Definition at line 255 of file deltacast.cpp.

256{
258 *count = 0;
259 *available_cards = nullptr;
260
261 ULONG Result,DllVersion,NbBoards;
262 Result = VHD_GetApiInfo(&DllVersion,&NbBoards);
263 if (Result != VHDERR_NOERROR) {
264 return;
265 }
266 if (NbBoards == 0) {
267 return;
268 }
269
270 /* Query DELTA boards information */
271 for (ULONG i = 0; i < NbBoards; i++)
272 {
273 ULONG BoardType;
274 HANDLE BoardHandle = NULL;
275 ULONG Result = VHD_OpenBoardHandle(i,&BoardHandle,NULL,0);
276 VHD_GetBoardProperty(BoardHandle, VHD_CORE_BP_BOARD_TYPE, &BoardType);
277
278 *count += 1;
279 *available_cards = (struct device_info *)
280 realloc(*available_cards, *count * sizeof(struct device_info));
281 memset(*available_cards + *count - 1, 0, sizeof(struct device_info));
282 snprintf((*available_cards)[*count - 1].dev, sizeof (*available_cards)[*count - 1].dev, ":device=%d", *count - 1);
283 snprintf((*available_cards)[*count - 1].extra, sizeof (*available_cards)[*count - 1].extra, R"("embeddedAudioAvailable":"t")");
284 (*available_cards)[*count - 1].repeatable = false;
285
286 if (Result == VHDERR_NOERROR)
287 {
288 std::string board{"Unknown DELTACAST type"};
289 auto it = board_type_map.find(BoardType);
290 if (it != board_type_map.end()) {
291 board = it->second;
292 }
293 snprintf((*available_cards)[*count - 1].name,
294 sizeof (*available_cards)[*count - 1].name - 1,
295 "DELTACAST %s", board.c_str());
296 VHD_CloseBoardHandle(BoardHandle);
297 }
298 }
299
300}
int void(** deleter)(void *))
static std::unordered_map< ULONG, std::string > board_type_map
int count
Definition hd-rum.c:44
const char * name
Definition settings.cpp:193
char extra[1024]
Definition types.h:389
char dev[1024]
Definition types.h:383

References board_type_map, state_deltacast::BoardHandle, count, deleter, device_info::dev, device_info::extra, name, and UNUSED.

◆ display_deltacast_put_audio_frame()

static void display_deltacast_put_audio_frame ( void * state,
const struct audio_frame * frame )
static

Definition at line 540 of file deltacast.cpp.

541{
542 struct state_deltacast *s = (struct state_deltacast *)state;
543 int i;
544 int channel_len = frame->data_len / frame->ch_count;
545
546 pthread_mutex_lock(&s->lock);
547 for(i = 0; i < frame->ch_count; ++i) {
548 demux_channel(s->audio_tmp, frame->data, frame->bps, frame->data_len, frame->ch_count, i);
549 ring_buffer_write(s->audio_channels[i], s->audio_tmp, channel_len);
550 }
551 pthread_mutex_unlock(&s->lock);
552}
struct video_frame * frame
void ring_buffer_write(struct ring_buffer *ring, const char *in, int len)
struct ring_buffer * audio_channels[16]
Definition deltacast.cpp:79
void demux_channel(char *out, char *in, int bps, int in_len, int in_stream_channels, int pos_in_stream)
Definition utils.cpp:334

References state_deltacast::audio_channels, state_deltacast::audio_tmp, demux_channel(), frame, state_deltacast::lock, ring_buffer_write(), and state.

Here is the call graph for this function:

◆ display_deltacast_putf()

static bool display_deltacast_putf ( void * state,
struct video_frame * frame,
long long nonblock )
static

Definition at line 126 of file deltacast.cpp.

127{
128 struct state_deltacast *s = (struct state_deltacast *)state;
129 struct timeval tv;
130 int i;
131 ULONG Result;
132
133 UNUSED(frame);
135
136 assert(s->magic == DELTACAST_MAGIC);
137
138 pthread_mutex_lock(&s->lock);
139 if(s->play_audio && s->audio_configured) {
140 /* Retrieve the number of needed samples */
141 for(i = 0; i < s->audio_desc.ch_count; ++i) {
142 s->AudioInfo.pAudioGroups[i / 4].pAudioChannels[i % 4].DataSize = 0;
143 }
144 Result = VHD_SlotEmbedAudio(s->SlotHandle,&s->AudioInfo);
145 if (Result != VHDERR_BUFFERTOOSMALL)
146 {
147 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] ERROR : Cannot embed audio on TX0 stream. Result = 0x%08" PRIX_ULONG "\n", Result);
148 } else {
149 for(i = 0; i < s->audio_desc.ch_count; ++i) {
150 int ret;
151 ret = ring_buffer_read(s->audio_channels[i], (char *) s->AudioInfo.pAudioGroups[i / 4].pAudioChannels[i % 4].pData, s->AudioInfo.pAudioGroups[i / 4].pAudioChannels[i % 4].DataSize);
152 if(!ret) {
153 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Buffer underflow for channel %d.\n", i);
154 }
155 s->AudioInfo.pAudioGroups[0].pAudioChannels[0].DataSize = ret;
156 }
157 }
158 /* Embed audio */
159 Result = VHD_SlotEmbedAudio(s->SlotHandle,&s->AudioInfo);
160 if (Result != VHDERR_NOERROR)
161 {
162 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] ERROR : Cannot embed audio on TX0 stream. Result = 0x%08" PRIX_ULONG "\n",Result);
163 }
164 }
165 pthread_mutex_unlock(&s->lock);
166
167 VHD_UnlockSlotHandle(s->SlotHandle);
168 s->SlotHandle = NULL;
169
170 gettimeofday(&tv, NULL);
171 double seconds = tv_diff(tv, s->tv);
172 if (seconds > 5) {
173 double fps = s->frames / seconds;
174 log_msg(LOG_LEVEL_INFO, "[DELTACAST display] %lu frames in %g seconds = %g FPS\n",
175 s->frames, seconds, fps);
176 s->tv = tv;
177 s->frames = 0;
178 }
179 s->frames++;
180
181 return true;
182}
struct video_frame long long nonblock
#define LOG_LEVEL_INFO
normal reporting
Definition debug.h:62
int ring_buffer_read(struct ring_buffer *ring, char *out, int max_len)
int ch_count
Definition types.h:79
VHD_AUDIOINFO AudioInfo
Definition deltacast.cpp:76
struct audio_desc audio_desc
Definition deltacast.cpp:78
double tv_diff(struct timeval curr_time, struct timeval prev_time)
Definition tv.c:97

References state_deltacast::audio_channels, state_deltacast::audio_configured, state_deltacast::audio_desc, state_deltacast::AudioInfo, audio_desc::ch_count, DELTACAST_MAGIC, frame, state_deltacast::frames, state_deltacast::lock, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, log_msg(), state_deltacast::magic, nonblock, state_deltacast::play_audio, PRIX_ULONG, ring_buffer_read(), state_deltacast::SlotHandle, state, state_deltacast::tv, tv_diff(), and UNUSED.

Here is the call graph for this function:

◆ display_deltacast_reconfigure()

static bool display_deltacast_reconfigure ( void * state,
struct video_desc desc )
static

Definition at line 185 of file deltacast.cpp.

186{
187 struct state_deltacast *s = (struct state_deltacast *)state;
188 int VideoStandard = 0;
189 int i;
190 ULONG Result;
191
192 if(s->initialized) {
193 if(s->SlotHandle)
194 VHD_UnlockSlotHandle(s->SlotHandle);
195 VHD_StopStream(s->StreamHandle);
196 VHD_CloseStreamHandle(s->StreamHandle);
197 }
198
199 assert(desc.tile_count == 1);
200
201 s->tile->width = desc.width;
202 s->tile->height = desc.height;
205 s->frame->fps = desc.fps;
206
207 for (i = 0; i < deltacast_frame_modes_count; ++i)
208 {
209 if(fabs(desc.fps - deltacast_frame_modes[i].fps) < 0.01 &&
213 VideoStandard = deltacast_frame_modes[i].mode;
214 log_msg(LOG_LEVEL_NOTICE, "[DELTACAST] %s mode selected.\n", deltacast_frame_modes[i].name);
215 break;
216 }
217 }
219 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Failed to obtain video format for incoming video: %dx%d @ %2.2f %s\n", desc.width, desc.height,
221
222 goto error;
223 }
224
225 if(desc.color_spec == RAW) {
226 Result = VHD_OpenStreamHandle(s->BoardHandle,VHD_ST_TX0,VHD_SDI_STPROC_RAW,NULL,&s->StreamHandle,NULL);
227 } else if (s->play_audio == TRUE) {
228 Result = VHD_OpenStreamHandle(s->BoardHandle,VHD_ST_TX0,VHD_SDI_STPROC_JOINED,NULL,&s->StreamHandle,NULL);
229 } else {
230 Result = VHD_OpenStreamHandle(s->BoardHandle,VHD_ST_TX0,VHD_SDI_STPROC_DISJOINED_VIDEO,NULL,&s->StreamHandle,NULL);
231 }
232
233 if (Result != VHDERR_NOERROR) {
234 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Failed to open stream handle.\n");
235 goto error;
236 }
237
238 VHD_SetStreamProperty(s->StreamHandle,VHD_SDI_SP_VIDEO_STANDARD,VideoStandard);
239 VHD_SetStreamProperty(s->StreamHandle,VHD_CORE_SP_BUFFERQUEUE_DEPTH,2);
240 VHD_SetStreamProperty(s->StreamHandle,VHD_CORE_SP_BUFFERQUEUE_PRELOAD,0);
241
242 Result = VHD_StartStream(s->StreamHandle);
243 if (Result != VHDERR_NOERROR) {
244 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Unable to start stream.\n");
245 goto error;
246 }
247
248 s->initialized = TRUE;
249 return true;
250
251error:
252 return false;
253}
#define LOG_LEVEL_NOTICE
information that may be interesting
Definition debug.h:61
static const int deltacast_frame_modes_count
static const struct deltacast_frame_mode_t deltacast_frame_modes[]
enum interlacing_t interlacing
unsigned int width
Definition types.h:280
unsigned int height
Definition types.h:281
unsigned int tile_count
Definition types.h:185
codec_t color_spec
Definition types.h:182
enum interlacing_t interlacing
Definition types.h:184
double fps
Definition types.h:183
unsigned int width
width of every tile (!)
Definition types.h:179
unsigned int height
height of every tile (!)
Definition types.h:180
enum interlacing_t interlacing
Definition types.h:307
double fps
Definition types.h:308
codec_t color_spec
Definition types.h:306
const char * get_interlacing_description(enum interlacing_t interlacing)
Returns description of interlacing Eg. "progressive".

References state_deltacast::BoardHandle, video_desc::color_spec, video_frame::color_spec, deltacast_frame_modes, deltacast_frame_modes_count, desc, deltacast_frame_mode_t::fps, video_desc::fps, video_frame::fps, state_deltacast::frame, get_interlacing_description(), deltacast_frame_mode_t::height, tile::height, video_desc::height, state_deltacast::initialized, deltacast_frame_mode_t::interlacing, video_desc::interlacing, video_frame::interlacing, LOG_LEVEL_ERROR, LOG_LEVEL_NOTICE, log_msg(), deltacast_frame_mode_t::mode, name, state_deltacast::play_audio, RAW, state_deltacast::SlotHandle, state, state_deltacast::StreamHandle, state_deltacast::tile, video_desc::tile_count, TRUE, deltacast_frame_mode_t::width, tile::width, and video_desc::width.

Here is the call graph for this function:

◆ display_deltacast_reconfigure_audio()

static bool display_deltacast_reconfigure_audio ( void * state,
int quant_samples,
int channels,
int sample_rate )
static

Definition at line 485 of file deltacast.cpp.

487{
488 struct state_deltacast *s = (struct state_deltacast *)state;
489 int i;
490
491 assert(channels <= 16);
492
493 pthread_mutex_lock(&s->lock);
495 for(i = 0; i < 16; ++i) {
497 s->audio_channels[i] = NULL;
498 }
499 free(s->audio_tmp);
500
504
505 for(i = 0; i < channels; ++i) {
507 }
508 s->audio_tmp = (char *) malloc(s->audio_desc.bps * s->audio_desc.sample_rate);
509
510 /* Configure audio info */
511 memset(&s->AudioInfo, 0, sizeof(VHD_AUDIOINFO));
512 for(i = 0; i < channels; ++i) {
513 VHD_AUDIOCHANNEL *pAudioChn=NULL;
514 pAudioChn = &s->AudioInfo.pAudioGroups[i / 4].pAudioChannels[i % 4];
515 pAudioChn->Mode = VHD_AM_MONO;
516 switch(quant_samples) {
517 case 16:
518 pAudioChn->BufferFormat = VHD_AF_16;
519 break;
520 case 20:
521 pAudioChn->BufferFormat = VHD_AF_20;
522 break;
523 case 24:
524 pAudioChn->BufferFormat = VHD_AF_24;
525 break;
526 default:
527 log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Unsupported PCM audio: %d bits.\n", quant_samples);
528 pthread_mutex_unlock(&s->lock);
529 return false;
530 }
531 pAudioChn->pData = new BYTE[s->audio_desc.bps * s->audio_desc.sample_rate];
532 }
533
535 pthread_mutex_unlock(&s->lock);
536
537 return true;
538}
int int int sample_rate
int int channels
int quant_samples
void ring_buffer_destroy(struct ring_buffer *ring)
struct ring_buffer * ring_buffer_init(int size)
int sample_rate
Definition types.h:78
int bps
Definition types.h:77

References state_deltacast::audio_channels, state_deltacast::audio_configured, state_deltacast::audio_desc, state_deltacast::audio_tmp, state_deltacast::AudioInfo, audio_desc::bps, audio_desc::ch_count, channels, FALSE, state_deltacast::lock, LOG_LEVEL_ERROR, log_msg(), quant_samples, ring_buffer_destroy(), ring_buffer_init(), audio_desc::sample_rate, sample_rate, state, and TRUE.

Here is the call graph for this function:

◆ REGISTER_MODULE()

REGISTER_MODULE ( deltacast ,
& display_deltacast_info,
LIBRARY_CLASS_VIDEO_DISPLAY ,
VIDEO_DISPLAY_ABI_VERSION  )

◆ show_help()

static void show_help ( void )
static

Definition at line 85 of file deltacast.cpp.

86{
87 printf("deltacast (output) options:\n");
88 printf("\t-d deltacast[:device=<index>]\n");
89
91
92 printf("\nDefault board is 0.\n");
93
94}
static void print_available_delta_boards()

References print_available_delta_boards().

Referenced by display_deltacast_init().

Here is the call graph for this function:

Variable Documentation

◆ display_deltacast_info

const struct video_display_info display_deltacast_info
static
Initial value:
= {
NULL,
}
#define DISPLAY_NO_GENERIC_FPS_INDICATOR
static bool display_deltacast_reconfigure(void *state, struct video_desc desc)
static bool display_deltacast_get_property(void *state, int property, void *val, size_t *len)
static bool display_deltacast_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate)
static void * display_deltacast_init(struct module *parent, const char *fmt, unsigned int flags)
static bool display_deltacast_putf(void *state, struct video_frame *frame, long long nonblock)
static void display_deltacast_put_audio_frame(void *state, const struct audio_frame *frame)
static void display_deltacast_done(void *state)
static void display_deltacast_probe(struct device_info **available_cards, int *count, void(**deleter)(void *))
static struct video_frame * display_deltacast_getf(void *state)
Definition deltacast.cpp:97

Definition at line 554 of file deltacast.cpp.