Browse Source

libobs: Add obs_get_encoder_codec function

This allows the ability to get the codec of an encoder via its
identifier string
jp9000 10 years ago
parent
commit
0e398c89be
2 changed files with 9 additions and 0 deletions
  1. 6 0
      libobs/obs-encoder.c
  2. 3 0
      libobs/obs.h

+ 6 - 0
libobs/obs-encoder.c

@@ -446,6 +446,12 @@ const char *obs_encoder_get_codec(const obs_encoder_t *encoder)
 	return encoder ? encoder->info.codec : NULL;
 }
 
+const char *obs_get_encoder_codec(const char *id)
+{
+	struct obs_encoder_info *info = find_encoder(id);
+	return info ? info->codec : NULL;
+}
+
 void obs_encoder_set_scaled_size(obs_encoder_t *encoder, uint32_t width,
 		uint32_t height)
 {

+ 3 - 0
libobs/obs.h

@@ -1192,6 +1192,9 @@ EXPORT void obs_encoder_destroy(obs_encoder_t *encoder);
 EXPORT void obs_encoder_set_name(obs_encoder_t *encoder, const char *name);
 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 codec of the encoder */
 EXPORT const char *obs_encoder_get_codec(const obs_encoder_t *encoder);