Skip to content

Commit

Permalink
libobs: Add function to get encoder object's defaults
Browse files Browse the repository at this point in the history
Rather than relying on the encoder's type identifier, additionally allow
the ability to get defaults via an encoder object.
  • Loading branch information
jp9000 committed Jul 20, 2018
1 parent 2f49bf0 commit 621c519
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/sphinx/reference-encoders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ General Encoder Functions
---------------------

.. function:: obs_data_t *obs_encoder_defaults(const char *id)
obs_data_t *obs_encoder_get_defaults(const obs_encoder_t *encoder)
:return: An incremented reference to the encoder's default settings

Expand Down
8 changes: 8 additions & 0 deletions libobs/obs-encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,14 @@ obs_data_t *obs_encoder_defaults(const char *id)
return (info) ? get_defaults(info) : NULL;
}

obs_data_t *obs_encoder_get_defaults(const obs_encoder_t *encoder)
{
if (!obs_encoder_valid(encoder, "obs_encoder_defaults"))
return NULL;

return get_defaults(&encoder->info);
}

obs_properties_t *obs_get_encoder_properties(const char *id)
{
const struct obs_encoder_info *ei = find_encoder(id);
Expand Down
1 change: 1 addition & 0 deletions libobs/obs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1815,6 +1815,7 @@ EXPORT enum video_format obs_encoder_get_preferred_video_format(

/** Gets the default settings for an encoder type */
EXPORT obs_data_t *obs_encoder_defaults(const char *id);
EXPORT obs_data_t *obs_encoder_get_defaults(const obs_encoder_t *encoder);

/** Returns the property list, if any. Free with obs_properties_destroy */
EXPORT obs_properties_t *obs_get_encoder_properties(const char *id);
Expand Down

0 comments on commit 621c519

Please sign in to comment.