{
demux_sys_t *sys = demux_->p_sys;
- if (videoFrame)
- {
- if (videoFrame->GetFlags() & bmdFrameHasNoInputSource)
- {
+ if (videoFrame) {
+ if (videoFrame->GetFlags() & bmdFrameHasNoInputSource) {
msg_Warn(demux_, "No input signal detected");
return S_OK;
}
void *frame_bytes;
videoFrame->GetBytes(&frame_bytes);
- for (int y = 0; y < height; ++y)
- {
+ for (int y = 0; y < height; ++y) {
const uint8_t *src = (const uint8_t *)frame_bytes + stride * y;
uint8_t *dst = video_frame->p_buffer + width * bpp * y;
memcpy(dst, src, width * bpp);
es_out_Send(demux_->out, sys->video_es, video_frame);
}
- if (audioFrame)
- {
+ if (audioFrame) {
const int bytes = audioFrame->GetSampleFrameCount() * sizeof(int16_t) * sys->channels;
block_t *audio_frame = block_New(demux_, bytes);
c = bmdAudioConnectionAESEBU;
else if (!strcmp(opt, "analog"))
c = bmdAudioConnectionAnalog;
- else
- {
+ else {
msg_Err(demux, "Invalid audio-connection: `%s\' specified", opt);
free(opt);
return VLC_EGENERIC;
}
- if (sys->config->SetInt(bmdDeckLinkConfigAudioInputConnection, c) != S_OK)
- {
+ if (sys->config->SetInt(bmdDeckLinkConfigAudioInputConnection, c) != S_OK) {
msg_Err(demux, "Failed to set audio input connection");
return VLC_EGENERIC;
}
c = bmdVideoConnectionComposite;
else if (!strcmp(opt, "svideo"))
c = bmdVideoConnectionSVideo;
- else
- {
+ else {
msg_Err(demux, "Invalid video-connection: `%s\' specified", opt);
free(opt);
return VLC_EGENERIC;
}
free(opt);
- if (sys->config->SetInt(bmdDeckLinkConfigVideoInputConnection, c) != S_OK)
- {
+ if (sys->config->SetInt(bmdDeckLinkConfigVideoInputConnection, c) != S_OK) {
msg_Err(demux, "Failed to set video input connection");
return VLC_EGENERIC;
}
IDeckLinkDisplayModeIterator *display_iterator = NULL;
IDeckLinkIterator *decklink_iterator = CreateDeckLinkIteratorInstance();
- if (!decklink_iterator)
- {
+ if (!decklink_iterator) {
msg_Err(demux, "DeckLink drivers not found.");
goto finish;
}
card_index = var_InheritInteger(demux, "decklink-card-index");
- if (card_index < 0)
- {
+ if (card_index < 0) {
msg_Err(demux, "Invalid card index %d", card_index);
goto finish;
}
- for (int i = 0; i <= card_index; i++)
- {
+ for (int i = 0; i <= card_index; i++) {
if (sys->card)
sys->card->Release();
- if (decklink_iterator->Next(&sys->card) != S_OK)
- {
+ if (decklink_iterator->Next(&sys->card) != S_OK) {
msg_Err(demux, "DeckLink PCI card %d not found", card_index);
goto finish;
}
}
const char *model_name;
- if (sys->card->GetModelName(&model_name) != S_OK)
- {
+ if (sys->card->GetModelName(&model_name) != S_OK) {
msg_Err(demux, "Could not get model name");
goto finish;
}
msg_Dbg(demux, "Opened DeckLink PCI card %d (%s)", card_index, model_name);
- if (sys->card->QueryInterface(IID_IDeckLinkInput, (void**)&sys->input) != S_OK)
- {
+ if (sys->card->QueryInterface(IID_IDeckLinkInput, (void**)&sys->input) != S_OK) {
msg_Err(demux, "Card has no inputs");
goto finish;
}
/* Set up the video and audio sources. */
- if (sys->card->QueryInterface(IID_IDeckLinkConfiguration, (void**)&sys->config) != S_OK)
- {
+ if (sys->card->QueryInterface(IID_IDeckLinkConfiguration, (void**)&sys->config) != S_OK) {
msg_Err(demux, "Failed to get configuration interface");
goto finish;
}
goto finish;
/* Get the list of display modes. */
- if (sys->input->GetDisplayModeIterator(&display_iterator) != S_OK)
- {
+ if (sys->input->GetDisplayModeIterator(&display_iterator) != S_OK) {
msg_Err(demux, "Failed to enumerate display modes");
goto finish;
}
b_found_mode = false;
- for (;;)
- {
+ for (;;) {
IDeckLinkDisplayMode *display_mode;
if ((display_iterator->Next(&display_mode) != S_OK) || !display_mode)
break;
memcpy(sz_mode_id_text, &mode_id, sizeof(mode_id));
const char *mode_name;
- if (display_mode->GetName(&mode_name) != S_OK)
- {
+ if (display_mode->GetName(&mode_name) != S_OK) {
msg_Err(demux, "Failed to get display mode name");
display_mode->Release();
goto finish;
}
BMDTimeValue frame_duration, time_scale;
- if (display_mode->GetFrameRate(&frame_duration, &time_scale) != S_OK)
- {
+ if (display_mode->GetFrameRate(&frame_duration, &time_scale) != S_OK) {
msg_Err(demux, "Failed to get frame rate");
display_mode->Release();
goto finish;
(int)display_mode->GetWidth(), (int)display_mode->GetHeight(),
double(time_scale) / frame_duration, field_dominance);
- if (wanted_mode_id == mode_id)
- {
+ if (wanted_mode_id == mode_id) {
b_found_mode = true;
width = display_mode->GetWidth();
height = display_mode->GetHeight();
display_mode->Release();
}
- if (!b_found_mode)
- {
+ if (!b_found_mode) {
msg_Err(demux, "Unknown video mode specified. "
"Run VLC with -vv to get a list of supported modes.");
goto finish;
}
- if (sys->input->EnableVideoInput(htonl(wanted_mode_id), bmdFormat8BitYUV, 0) != S_OK)
- {
+ if (sys->input->EnableVideoInput(htonl(wanted_mode_id), bmdFormat8BitYUV, 0) != S_OK) {
msg_Err(demux, "Failed to enable video input");
goto finish;
}
/* Set up audio. */
sys->channels = var_InheritInteger(demux, "decklink-audio-channels");
rate = var_InheritInteger(demux, "decklink-audio-rate");
- if (rate > 0 && sys->channels > 0)
- {
- if (sys->input->EnableAudioInput(rate, bmdAudioSampleType16bitInteger, sys->channels) != S_OK)
- {
+ if (rate > 0 && sys->channels > 0) {
+ if (sys->input->EnableAudioInput(rate, bmdAudioSampleType16bitInteger, sys->channels) != S_OK) {
msg_Err(demux, "Failed to enable audio input");
goto finish;
}
sys->delegate = new DeckLinkCaptureDelegate(demux);
sys->input->SetCallback(sys->delegate);
- if (sys->input->StartStreams() != S_OK)
- {
+ if (sys->input->StartStreams() != S_OK) {
msg_Err(demux, "Could not start streaming from SDI card. This could be caused "
"by invalid video mode or flags, access denied, or card already in use.");
goto finish;
if (sys->config)
sys->config->Release();
- if (sys->input)
- {
+ if (sys->input) {
sys->input->StopStreams();
sys->input->Release();
}