57#define DELTACAST_MAGIC 0x01005e02
87 printf(
"deltacast (output) options:\n");
88 printf(
"\t-d deltacast[:device=<index>]\n");
92 printf(
"\nDefault board is 0.\n");
110 if (Result != VHDERR_NOERROR) {
114 Result = VHD_GetSlotBuffer(s->
SlotHandle,VHD_SDI_BT_VIDEO,&pBuffer,&BufferSize);
115 if (Result != VHDERR_NOERROR) {
138 pthread_mutex_lock(&s->
lock);
142 s->
AudioInfo.pAudioGroups[i / 4].pAudioChannels[i % 4].DataSize = 0;
145 if (Result != VHDERR_BUFFERTOOSMALL)
155 s->
AudioInfo.pAudioGroups[0].pAudioChannels[0].DataSize = ret;
160 if (Result != VHDERR_NOERROR)
165 pthread_mutex_unlock(&s->
lock);
170 gettimeofday(&tv, NULL);
173 double fps = s->
frames / seconds;
188 int VideoStandard = 0;
230 Result = VHD_OpenStreamHandle(s->
BoardHandle,VHD_ST_TX0,VHD_SDI_STPROC_DISJOINED_VIDEO,NULL,&s->
StreamHandle,NULL);
233 if (Result != VHDERR_NOERROR) {
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);
243 if (Result != VHDERR_NOERROR) {
259 *available_cards =
nullptr;
261 ULONG Result,DllVersion,NbBoards;
262 Result = VHD_GetApiInfo(&DllVersion,&NbBoards);
263 if (Result != VHDERR_NOERROR) {
271 for (ULONG i = 0; i < NbBoards; i++)
275 ULONG Result = VHD_OpenBoardHandle(i,&
BoardHandle,NULL,0);
276 VHD_GetBoardProperty(
BoardHandle, VHD_CORE_BP_BOARD_TYPE, &BoardType);
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;
286 if (Result == VHDERR_NOERROR)
288 std::string board{
"Unknown DELTACAST type"};
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);
306 ULONG Result,DllVersion,NbBoards,ChnType;
316 gettimeofday(&s->
tv, NULL);
328 if(
fmt && strcmp(
fmt,
"help") == 0) {
337 char *tmp = strdup(
fmt);
338 char *save_ptr = NULL;
341 tok = strtok_r(tmp,
":", &save_ptr);
348 if (strncasecmp(tok,
"device=", strlen(
"device=")) == 0) {
349 BrdId = atoi(tok + strlen(
"device="));
360 Result = VHD_GetApiInfo(&DllVersion,&NbBoards);
361 if (Result != VHDERR_NOERROR) {
363 " information. Result = 0x%08" PRIX_ULONG "\n",
372 if(BrdId >= NbBoards) {
378 Result = VHD_OpenBoardHandle(BrdId,&s->
BoardHandle,NULL,0);
379 if (Result != VHDERR_NOERROR)
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)) {
399 VHD_SetBoardProperty(s->
BoardHandle,VHD_SDI_BP_CLOCK_SYSTEM,VHD_CLOCKDIV_1);
401 pthread_mutex_init(&s->
lock, NULL);
437 int rgb_shift[] = {0, 8, 16};
450 if(
sizeof(rgb_shift) > *
len) {
453 memcpy(
val, rgb_shift,
sizeof(rgb_shift));
454 *
len =
sizeof(rgb_shift);
461 if(
sizeof(supported_il_modes) <= *
len) {
462 memcpy(
val, supported_il_modes,
sizeof(supported_il_modes));
466 *
len =
sizeof(supported_il_modes);
472 desc->sample_rate = 48000;
473 desc->ch_count = std::max(
desc->ch_count, 16);
493 pthread_mutex_lock(&s->
lock);
495 for(i = 0; i < 16; ++i) {
511 memset(&s->
AudioInfo, 0,
sizeof(VHD_AUDIOINFO));
513 VHD_AUDIOCHANNEL *pAudioChn=NULL;
514 pAudioChn = &s->
AudioInfo.pAudioGroups[i / 4].pAudioChannels[i % 4];
515 pAudioChn->Mode = VHD_AM_MONO;
518 pAudioChn->BufferFormat = VHD_AF_16;
521 pAudioChn->BufferFormat = VHD_AF_20;
524 pAudioChn->BufferFormat = VHD_AF_24;
528 pthread_mutex_unlock(&s->
lock);
535 pthread_mutex_unlock(&s->
lock);
544 int channel_len =
frame->data_len /
frame->ch_count;
546 pthread_mutex_lock(&s->
lock);
547 for(i = 0; i <
frame->ch_count; ++i) {
551 pthread_mutex_unlock(&s->
lock);
struct video_frame long long nonblock
struct video_frame * frame
const char unsigned int flags
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.
This file contains definition of some common audio types.
void log_msg(int level, const char *format,...)
#define LOG_LEVEL_NOTICE
information that may be interesting
#define LOG_LEVEL_INFO
normal reporting
#define LOG_LEVEL_ERROR
general errors
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)
static std::unordered_map< ULONG, std::string > board_type_map
static const struct deltacast_frame_mode_t deltacast_frame_modes[]
#define PITCH_DEFAULT
default pitch, i. e. respective linesize
#define VIDEO_DISPLAY_ABI_VERSION
#define DISPLAY_NO_GENERIC_FPS_INDICATOR
#define DISPLAY_FLAG_AUDIO_EMBEDDED
@ 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
@ LIBRARY_CLASS_VIDEO_DISPLAY
#define REGISTER_MODULE(name, info, lclass, abi)
Registers module to global modules' registry.
void ring_buffer_destroy(struct ring_buffer *ring)
struct ring_buffer * ring_buffer_init(int size)
int ring_buffer_read(struct ring_buffer *ring, char *out, int max_len)
void ring_buffer_write(struct ring_buffer *ring, const char *in, int len)
struct used to comunicate with audio capture/playback device
enum interlacing_t interlacing
struct ring_buffer * audio_channels[16]
unsigned long int frames_last
struct audio_desc audio_desc
unsigned int audio_configured
struct video_frame * frame
Struct tile is an area of video_frame.
char * data
Raw tile data. Pointer must be at least 4B aligned.
unsigned int data_len
length of the data
enum interlacing_t interlacing
unsigned int width
width of every tile (!)
unsigned int height
height of every tile (!)
Struct video_frame represents a video frame and contains video description.
enum interlacing_t interlacing
double tv_diff(struct timeval curr_time, struct timeval prev_time)
@ UPPER_FIELD_FIRST
First stored field is top, followed by bottom.
@ PROGRESSIVE
progressive frame
@ SEGMENTED_FRAME
Segmented frame. Contains the same data as progressive frame.
@ UYVY
YCbCr 422 8-bit - Cb Y0 Cr Y1.
@ v210
YCbCr 422 10-bit - xVY0U|xY2UY1|xUY3V|xY5VY4, little-endian (2 bit padding /'x'/),...
void demux_channel(char *out, char *in, int bps, int in_len, int in_stream_channels, int pos_in_stream)
This is an umbrella header for video functions.
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 const struct video_display_info display_deltacast_info
static void show_help(void)
static struct video_frame * display_deltacast_getf(void *state)
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".