libobs: Add obs_obj_invalid function

Determines whether an obs object was created successfully.  If a plugin
that's used for a saved object is removed (third party plugins), its
data will become invalid, but the objects can often still be created for
the sake of preserving user settings, but sometimes these objects can
cause problems if they're actually used (such as using them for
transitions).
This commit is contained in:
jp9000 2016-04-03 21:44:04 -07:00
parent 1faaba73b0
commit 822ffb8519
2 changed files with 10 additions and 0 deletions

View file

@ -1831,3 +1831,12 @@ const char *obs_obj_get_id(void *obj)
return NULL;
}
bool obs_obj_invalid(void *obj)
{
struct obs_context_data *context = obj;
if (!context)
return true;
return !context->data;
}

View file

@ -575,6 +575,7 @@ enum obs_obj_type {
EXPORT enum obs_obj_type obs_obj_get_type(void *obj);
EXPORT const char *obs_obj_get_id(void *obj);
EXPORT bool obs_obj_invalid(void *obj);
/* ------------------------------------------------------------------------- */