(API Change) libobs: Pass type data to get_name callbacks
API changed from: obs_source_info::get_name(void) obs_output_info::get_name(void) obs_encoder_info::get_name(void) obs_service_info::get_name(void) API changed to: obs_source_info::get_name(void *type_data) obs_output_info::get_name(void *type_data) obs_encoder_info::get_name(void *type_data) obs_service_info::get_name(void *type_data) This allows the type data to be used when getting the name of the object (useful for plugin wrappers primarily). NOTE: Though a parameter was added, this is backward-compatible with older plugins due to calling convention. The new parameter will simply be ignored by older plugins, and the stack (if used) will be cleaned up by the caller.
This commit is contained in:
@@ -33,7 +33,7 @@ struct obs_encoder_info *find_encoder(const char *id)
|
||||
const char *obs_encoder_get_display_name(const char *id)
|
||||
{
|
||||
struct obs_encoder_info *ei = find_encoder(id);
|
||||
return ei ? ei->get_name() : NULL;
|
||||
return ei ? ei->get_name(ei->type_data) : NULL;
|
||||
}
|
||||
|
||||
static bool init_encoder(struct obs_encoder *encoder, const char *name,
|
||||
|
@@ -120,9 +120,10 @@ struct obs_encoder_info {
|
||||
/**
|
||||
* Gets the full translated name of this encoder
|
||||
*
|
||||
* @return Translated name of the encoder
|
||||
* @param type_data The type_data variable of this structure
|
||||
* @return Translated name of the encoder
|
||||
*/
|
||||
const char *(*get_name)(void);
|
||||
const char *(*get_name)(void *type_data);
|
||||
|
||||
/**
|
||||
* Creates the encoder with the specified settings
|
||||
|
@@ -35,7 +35,7 @@ const struct obs_output_info *find_output(const char *id)
|
||||
const char *obs_output_get_display_name(const char *id)
|
||||
{
|
||||
const struct obs_output_info *info = find_output(id);
|
||||
return (info != NULL) ? info->get_name() : NULL;
|
||||
return (info != NULL) ? info->get_name(info->type_data) : NULL;
|
||||
}
|
||||
|
||||
static const char *output_signals[] = {
|
||||
|
@@ -36,7 +36,7 @@ struct obs_output_info {
|
||||
|
||||
uint32_t flags;
|
||||
|
||||
const char *(*get_name)(void);
|
||||
const char *(*get_name)(void *type_data);
|
||||
|
||||
void *(*create)(obs_data_t *settings, obs_output_t *output);
|
||||
void (*destroy)(void *data);
|
||||
|
@@ -42,9 +42,10 @@ static inline void signal_item_remove(struct obs_scene_item *item)
|
||||
calldata_free(¶ms);
|
||||
}
|
||||
|
||||
static const char *scene_getname(void)
|
||||
static const char *scene_getname(void *unused)
|
||||
{
|
||||
/* TODO: locale */
|
||||
UNUSED_PARAMETER(unused);
|
||||
return "Scene";
|
||||
}
|
||||
|
||||
|
@@ -30,7 +30,7 @@ const struct obs_service_info *find_service(const char *id)
|
||||
const char *obs_service_get_display_name(const char *id)
|
||||
{
|
||||
const struct obs_service_info *info = find_service(id);
|
||||
return (info != NULL) ? info->get_name() : NULL;
|
||||
return (info != NULL) ? info->get_name(info->type_data) : NULL;
|
||||
}
|
||||
|
||||
obs_service_t *obs_service_create(const char *id, const char *name,
|
||||
|
@@ -32,7 +32,7 @@ struct obs_service_info {
|
||||
/* required */
|
||||
const char *id;
|
||||
|
||||
const char *(*get_name)(void);
|
||||
const char *(*get_name)(void *type_data);
|
||||
void *(*create)(obs_data_t *settings, obs_service_t *service);
|
||||
void (*destroy)(void *data);
|
||||
|
||||
|
@@ -112,7 +112,7 @@ const char *obs_source_get_display_name(enum obs_source_type type,
|
||||
const char *id)
|
||||
{
|
||||
const struct obs_source_info *info = get_source_info(type, id);
|
||||
return (info != NULL) ? info->get_name() : NULL;
|
||||
return (info != NULL) ? info->get_name(info->type_data) : NULL;
|
||||
}
|
||||
|
||||
/* internal initialization */
|
||||
|
@@ -133,9 +133,10 @@ struct obs_source_info {
|
||||
/**
|
||||
* Get the translated name of the source type
|
||||
*
|
||||
* @return The translated name of the source type
|
||||
* @param type_data The type_data variable of this structure
|
||||
* @return The translated name of the source type
|
||||
*/
|
||||
const char *(*get_name)(void);
|
||||
const char *(*get_name)(void *type_data);
|
||||
|
||||
/**
|
||||
* Creates the source data for the source
|
||||
|
Reference in New Issue
Block a user