From bd76f16564e4ce2737e28eb6711b5f0211719f1f Mon Sep 17 00:00:00 2001 From: jp9000 Date: Tue, 3 Feb 2015 19:49:34 -0800 Subject: [PATCH] libobs: Add functions to get an encoder's type 'obs_encoder_get_type' to get the type of an existing encoder, and 'obs_get_encoder_type' to get the type via its identifier --- libobs/obs-encoder.c | 11 +++++++++++ libobs/obs.h | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/libobs/obs-encoder.c b/libobs/obs-encoder.c index 847bd6465..91d9e4cc4 100644 --- a/libobs/obs-encoder.c +++ b/libobs/obs-encoder.c @@ -452,6 +452,17 @@ const char *obs_get_encoder_codec(const char *id) return info ? info->codec : NULL; } +enum obs_encoder_type obs_encoder_get_type(const obs_encoder_t *encoder) +{ + return encoder ? encoder->info.type : OBS_ENCODER_AUDIO; +} + +enum obs_encoder_type obs_get_encoder_type(const char *id) +{ + struct obs_encoder_info *info = find_encoder(id); + return info ? info->type : OBS_ENCODER_AUDIO; +} + void obs_encoder_set_scaled_size(obs_encoder_t *encoder, uint32_t width, uint32_t height) { diff --git a/libobs/obs.h b/libobs/obs.h index e7ccac4bb..72ebf0fee 100644 --- a/libobs/obs.h +++ b/libobs/obs.h @@ -1195,9 +1195,15 @@ EXPORT const char *obs_encoder_get_name(const obs_encoder_t *encoder); /** Returns the codec of an encoder by the id */ EXPORT const char *obs_get_encoder_codec(const char *id); +/** Returns the type of an encoder by the id */ +EXPORT enum obs_encoder_type obs_get_encoder_type(const char *id); + /** Returns the codec of the encoder */ EXPORT const char *obs_encoder_get_codec(const obs_encoder_t *encoder); +/** Returns the type of an encoder */ +EXPORT enum obs_encoder_type obs_encoder_get_type(const obs_encoder_t *encoder); + /** * Sets the scaled resolution for a video encoder. Set width and height to 0 * to disable scaling. If the encoder is active, this function will trigger