aja: Only allow output formats matching OBS framerate
parent
eb7bb07a79
commit
7095f0dd70
|
@ -146,7 +146,8 @@ void populate_io_selection_output_list(const std::string &cardID,
|
|||
}
|
||||
|
||||
void populate_video_format_list(NTV2DeviceID deviceID, obs_property_t *list,
|
||||
NTV2VideoFormat genlockFormat, bool want4KHFR)
|
||||
NTV2VideoFormat genlockFormat, bool want4KHFR,
|
||||
bool matchFPS)
|
||||
{
|
||||
VideoFormatList videoFormats = {};
|
||||
VideoStandardList orderedStandards = {};
|
||||
|
@ -179,6 +180,20 @@ void populate_video_format_list(NTV2DeviceID deviceID, obs_property_t *list,
|
|||
if (genlockFormat != NTV2_FORMAT_UNKNOWN)
|
||||
addFormat = IsMultiFormatCompatible(genlockFormat, vf);
|
||||
|
||||
struct obs_video_info ovi;
|
||||
if (matchFPS && obs_get_video_info(&ovi)) {
|
||||
NTV2FrameRate frameRate =
|
||||
GetNTV2FrameRateFromVideoFormat(vf);
|
||||
ULWord fpsNum = 0;
|
||||
ULWord fpsDen = 0;
|
||||
GetFramesPerSecond(frameRate, fpsNum, fpsDen);
|
||||
uint32_t obsFrameTime =
|
||||
1000000 * ovi.fps_den / ovi.fps_num;
|
||||
uint32_t ajaFrameTime = 1000000 * fpsDen / fpsNum;
|
||||
if (obsFrameTime != ajaFrameTime)
|
||||
addFormat = false;
|
||||
}
|
||||
|
||||
if (addFormat) {
|
||||
std::string name = NTV2VideoFormatToString(vf, true);
|
||||
obs_property_list_add_int(list, name.c_str(), (int)vf);
|
||||
|
|
|
@ -42,7 +42,7 @@ extern void populate_io_selection_output_list(const std::string &cardID,
|
|||
extern void
|
||||
populate_video_format_list(NTV2DeviceID deviceID, obs_property_t *list,
|
||||
NTV2VideoFormat genlockFormat = NTV2_FORMAT_UNKNOWN,
|
||||
bool want4KHFR = false);
|
||||
bool want4KHFR = false, bool matchFPS = false);
|
||||
extern void populate_pixel_format_list(NTV2DeviceID deviceID,
|
||||
obs_property_t *list);
|
||||
extern void populate_sdi_transport_list(obs_property_t *list,
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
// Log AJA Output video/audio delay and av-sync
|
||||
// #define AJA_OUTPUT_STATS
|
||||
|
||||
#define MATCH_OBS_FRAMERATE true
|
||||
|
||||
static constexpr uint32_t kNumCardFrames = 3;
|
||||
static const int64_t kDefaultStatPeriod = 3000000000;
|
||||
static const int64_t kAudioSyncAdjust = 20000;
|
||||
|
@ -849,7 +851,7 @@ bool aja_output_device_changed(void *data, obs_properties_t *props,
|
|||
|
||||
obs_property_list_clear(vid_fmt_list);
|
||||
populate_video_format_list(deviceID, vid_fmt_list, videoFormatChannel1,
|
||||
false);
|
||||
false, MATCH_OBS_FRAMERATE);
|
||||
|
||||
obs_property_list_clear(pix_fmt_list);
|
||||
populate_pixel_format_list(deviceID, pix_fmt_list);
|
||||
|
|
Loading…
Reference in New Issue