0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

libobs: Add obs_encoder_parent_video() method

Allows parent video object of an encoder with an FPS divisor to be
fetched.
This commit is contained in:
tt2468 2024-01-27 03:56:16 +00:00 committed by Lain
parent 64caf0401d
commit d584aed501
3 changed files with 27 additions and 1 deletions

View File

@ -526,10 +526,14 @@ General Encoder Functions
---------------------
.. function:: video_t *obs_encoder_video(const obs_encoder_t *encoder)
video_t *obs_encoder_parent_video(const obs_encoder_t *encoder)
audio_t *obs_encoder_audio(const obs_encoder_t *encoder)
:return: The video/audio handler associated with this encoder, or
*NULL* if none or not a matching encoder type
*NULL* if none or not a matching encoder type.
*parent_video* returns the "original" video handler
associated with this encoder, regardless of whether an FPS
divisor is set.
---------------------

View File

@ -1232,6 +1232,21 @@ video_t *obs_encoder_video(const obs_encoder_t *encoder)
return encoder->fps_override ? encoder->fps_override : encoder->media;
}
video_t *obs_encoder_parent_video(const obs_encoder_t *encoder)
{
if (!obs_encoder_valid(encoder, "obs_encoder_parent_video"))
return NULL;
if (encoder->info.type != OBS_ENCODER_VIDEO) {
blog(LOG_WARNING,
"obs_encoder_parent_video: "
"encoder '%s' is not a video encoder",
obs_encoder_get_name(encoder));
return NULL;
}
return encoder->media;
}
audio_t *obs_encoder_audio(const obs_encoder_t *encoder)
{
if (!obs_encoder_valid(encoder, "obs_encoder_audio"))

View File

@ -2558,6 +2558,13 @@ EXPORT void obs_encoder_set_audio(obs_encoder_t *encoder, audio_t *audio);
*/
EXPORT video_t *obs_encoder_video(const obs_encoder_t *encoder);
/**
* Returns the parent video output context used with this encoder, or NULL if not
* a video context. Used when an FPS divisor is set, where the original video
* context would not otherwise be gettable.
*/
EXPORT video_t *obs_encoder_parent_video(const obs_encoder_t *encoder);
/**
* Returns the audio output context used with this encoder, or NULL if not
* a audio context