mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
clang-format: Increase column limit from 80 to 120
This commit is contained in:
@@ -29,18 +29,15 @@ static void *decklink_output_create(obs_data_t *settings, obs_output_t *output)
|
||||
ComPtr<DeckLinkDevice> device;
|
||||
device.Set(deviceEnum->FindByHash(decklinkOutput->deviceHash));
|
||||
if (device) {
|
||||
DeckLinkDeviceMode *mode =
|
||||
device->FindOutputMode(decklinkOutput->modeID);
|
||||
DeckLinkDeviceMode *mode = device->FindOutputMode(decklinkOutput->modeID);
|
||||
|
||||
struct video_scale_info to = {};
|
||||
to.format = VIDEO_FORMAT_BGRA;
|
||||
to.width = mode->GetWidth();
|
||||
to.height = mode->GetHeight();
|
||||
to.range = VIDEO_RANGE_FULL;
|
||||
to.colorspace = (device->GetSupportsHDRMetadata() &&
|
||||
!decklinkOutput->force_sdr)
|
||||
? VIDEO_CS_2100_PQ
|
||||
: VIDEO_CS_709;
|
||||
to.colorspace = (device->GetSupportsHDRMetadata() && !decklinkOutput->force_sdr) ? VIDEO_CS_2100_PQ
|
||||
: VIDEO_CS_709;
|
||||
|
||||
obs_output_set_video_conversion(output, &to);
|
||||
}
|
||||
@@ -73,8 +70,7 @@ static bool decklink_output_start(void *data)
|
||||
|
||||
decklink->audio_samplerate = aoi.samples_per_sec;
|
||||
decklink->audio_planes = 2;
|
||||
decklink->audio_size =
|
||||
get_audio_size(AUDIO_FORMAT_16BIT, aoi.speakers, 1);
|
||||
decklink->audio_size = get_audio_size(AUDIO_FORMAT_16BIT, aoi.speakers, 1);
|
||||
|
||||
decklink->start_timestamp = 0;
|
||||
|
||||
@@ -89,8 +85,7 @@ static bool decklink_output_start(void *data)
|
||||
|
||||
struct obs_video_info ovi;
|
||||
if (!obs_get_video_info(&ovi)) {
|
||||
LOG(LOG_ERROR,
|
||||
"Start failed: could not retrieve obs_video_info!");
|
||||
LOG(LOG_ERROR, "Start failed: could not retrieve obs_video_info!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -138,15 +133,12 @@ static void decklink_output_raw_video(void *data, struct video_data *frame)
|
||||
decklink->UpdateVideoFrame(frame);
|
||||
}
|
||||
|
||||
static bool prepare_audio(DeckLinkOutput *decklink,
|
||||
const struct audio_data *frame,
|
||||
struct audio_data *output)
|
||||
static bool prepare_audio(DeckLinkOutput *decklink, const struct audio_data *frame, struct audio_data *output)
|
||||
{
|
||||
*output = *frame;
|
||||
|
||||
if (frame->timestamp < decklink->start_timestamp) {
|
||||
uint64_t duration = util_mul_div64(frame->frames, 1000000000ULL,
|
||||
decklink->audio_samplerate);
|
||||
uint64_t duration = util_mul_div64(frame->frames, 1000000000ULL, decklink->audio_samplerate);
|
||||
uint64_t end_ts = frame->timestamp + duration;
|
||||
uint64_t cutoff;
|
||||
|
||||
@@ -156,12 +148,10 @@ static bool prepare_audio(DeckLinkOutput *decklink,
|
||||
cutoff = decklink->start_timestamp - frame->timestamp;
|
||||
output->timestamp += cutoff;
|
||||
|
||||
cutoff = util_mul_div64(cutoff, decklink->audio_samplerate,
|
||||
1000000000ULL);
|
||||
cutoff = util_mul_div64(cutoff, decklink->audio_samplerate, 1000000000ULL);
|
||||
|
||||
for (size_t i = 0; i < decklink->audio_planes; i++)
|
||||
output->data[i] +=
|
||||
decklink->audio_size * (uint32_t)cutoff;
|
||||
output->data[i] += decklink->audio_size * (uint32_t)cutoff;
|
||||
|
||||
output->frames -= (uint32_t)cutoff;
|
||||
}
|
||||
@@ -183,9 +173,7 @@ static void decklink_output_raw_audio(void *data, struct audio_data *frames)
|
||||
decklink->WriteAudio(&in);
|
||||
}
|
||||
|
||||
static bool decklink_output_device_changed(obs_properties_t *props,
|
||||
obs_property_t *list,
|
||||
obs_data_t *settings)
|
||||
static bool decklink_output_device_changed(obs_properties_t *props, obs_property_t *list, obs_data_t *settings)
|
||||
{
|
||||
const char *hash = obs_data_get_string(settings, DEVICE_HASH);
|
||||
if (*hash) {
|
||||
@@ -197,8 +185,7 @@ static bool decklink_output_device_changed(obs_properties_t *props,
|
||||
bool itemFound = false;
|
||||
|
||||
for (size_t i = 0; i < itemCount; i++) {
|
||||
const char *curHash =
|
||||
obs_property_list_item_string(list, i);
|
||||
const char *curHash = obs_property_list_item_string(list, i);
|
||||
if (strcmp(hash, curHash) == 0) {
|
||||
itemFound = true;
|
||||
break;
|
||||
@@ -224,18 +211,14 @@ static bool decklink_output_device_changed(obs_properties_t *props,
|
||||
obs_property_list_item_disable(modeList, 0, true);
|
||||
obs_property_list_item_disable(keyerList, 0, true);
|
||||
} else {
|
||||
const std::vector<DeckLinkDeviceMode *> &modes =
|
||||
device->GetOutputModes();
|
||||
const std::vector<DeckLinkDeviceMode *> &modes = device->GetOutputModes();
|
||||
|
||||
struct obs_video_info ovi;
|
||||
if (obs_get_video_info(&ovi)) {
|
||||
for (DeckLinkDeviceMode *mode : modes) {
|
||||
if (mode->IsEqualFrameRate(
|
||||
ovi.fps_num, ovi.fps_den)) {
|
||||
obs_property_list_add_int(
|
||||
modeList,
|
||||
mode->GetName().c_str(),
|
||||
mode->GetId());
|
||||
if (mode->IsEqualFrameRate(ovi.fps_num, ovi.fps_den)) {
|
||||
obs_property_list_add_int(modeList, mode->GetName().c_str(),
|
||||
mode->GetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,13 +226,11 @@ static bool decklink_output_device_changed(obs_properties_t *props,
|
||||
obs_property_list_add_int(keyerList, "Disabled", 0);
|
||||
|
||||
if (device->GetSupportsExternalKeyer()) {
|
||||
obs_property_list_add_int(keyerList, "External",
|
||||
1);
|
||||
obs_property_list_add_int(keyerList, "External", 1);
|
||||
}
|
||||
|
||||
if (device->GetSupportsInternalKeyer()) {
|
||||
obs_property_list_add_int(keyerList, "Internal",
|
||||
2);
|
||||
obs_property_list_add_int(keyerList, "Internal", 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -262,23 +243,18 @@ static obs_properties_t *decklink_output_properties(void *unused)
|
||||
UNUSED_PARAMETER(unused);
|
||||
obs_properties_t *props = obs_properties_create();
|
||||
|
||||
obs_property_t *list = obs_properties_add_list(props, DEVICE_HASH,
|
||||
TEXT_DEVICE,
|
||||
OBS_COMBO_TYPE_LIST,
|
||||
OBS_COMBO_FORMAT_STRING);
|
||||
obs_property_set_modified_callback(list,
|
||||
decklink_output_device_changed);
|
||||
obs_property_t *list =
|
||||
obs_properties_add_list(props, DEVICE_HASH, TEXT_DEVICE, OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
|
||||
obs_property_set_modified_callback(list, decklink_output_device_changed);
|
||||
|
||||
fill_out_devices(list);
|
||||
|
||||
obs_properties_add_list(props, MODE_ID, TEXT_MODE, OBS_COMBO_TYPE_LIST,
|
||||
OBS_COMBO_FORMAT_INT);
|
||||
obs_properties_add_list(props, MODE_ID, TEXT_MODE, OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
|
||||
|
||||
obs_properties_add_bool(props, AUTO_START, TEXT_AUTO_START);
|
||||
obs_properties_add_bool(props, FORCE_SDR, TEXT_FORCE_SDR);
|
||||
|
||||
obs_properties_add_list(props, KEYER, TEXT_ENABLE_KEYER,
|
||||
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
|
||||
obs_properties_add_list(props, KEYER, TEXT_ENABLE_KEYER, OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user