(API Change) Remove encoder callback boilerplate
API Changed (in struct obs_encoder_info): ---------------------------------------- bool (*get_audio_info)(void *data, struct audio_convert_info *info); bool (*get_video_info)(void *data, struct video_scale_info *info); To: ---------------------------------------- void (*get_audio_info)(void *data, struct audio_convert_info *info); void (*get_video_info)(void *data, struct video_scale_info *info); The encoder video/audio information callbacks no longer need to manually query the libobs video/audio information, that information is now passed via the parameter, which the callbacks can modify. The refactor that reduces boilerplate in the encoder video/audio information callbacks also removes the need for their return values, so change the return types to void.
This commit is contained in:
@@ -289,21 +289,18 @@ static inline bool ValidResolution(uint32_t width, uint32_t height)
|
||||
(width == 1024 && height == 768);
|
||||
}
|
||||
|
||||
static bool GetDShowVideoInfo(void *data, struct video_scale_info *info)
|
||||
static void GetDShowVideoInfo(void *data, struct video_scale_info *info)
|
||||
{
|
||||
DShowEncoder *encoder = reinterpret_cast<DShowEncoder*>(data);
|
||||
video_t *video = obs_encoder_video(encoder->context);
|
||||
const struct video_output_info *vid_info = video_output_get_info(video);
|
||||
|
||||
encoder->format = VIDEO_FORMAT_I420;
|
||||
|
||||
if (vid_info->format == VIDEO_FORMAT_I420 &&
|
||||
ValidResolution(vid_info->width, vid_info->height))
|
||||
return false;
|
||||
if (info->format == VIDEO_FORMAT_I420 &&
|
||||
ValidResolution(info->width, info->height))
|
||||
return;
|
||||
|
||||
info->format = VIDEO_FORMAT_I420;
|
||||
info->width = vid_info->width;
|
||||
info->height = vid_info->height;
|
||||
info->width = info->width;
|
||||
info->height = info->height;
|
||||
info->range = VIDEO_RANGE_DEFAULT;
|
||||
info->colorspace = VIDEO_CS_DEFAULT;
|
||||
|
||||
@@ -316,8 +313,6 @@ static bool GetDShowVideoInfo(void *data, struct video_scale_info *info)
|
||||
info->width = 1280;
|
||||
info->height = 720;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void GetDShowEncoderDefauts(obs_data_t *settings)
|
||||
|
Reference in New Issue
Block a user