(API Change) obs_reset_video: Use return codes

Changed API functions:
libobs: obs_reset_video

Before, video initialization returned a boolean, but "failed" is too
little information, if it fails due to lack of device capabilities or
bad video device parameters, the front-end needs to know that.

The OBS Basic UI has also been updated to reflect this API change.
This commit is contained in:
jp9000
2014-07-20 17:40:57 -07:00
parent e62f965d3e
commit 778cc2b318
13 changed files with 150 additions and 72 deletions

View File

@@ -26,7 +26,7 @@ extern "C" {
EXPORT const char *device_name(void);
EXPORT int device_type(void);
EXPORT const char *device_preprocessor_name(void);
EXPORT device_t device_create(struct gs_init_data *data);
EXPORT int device_create(device_t *device, struct gs_init_data *data);
EXPORT void device_destroy(device_t device);
EXPORT void device_entercontext(device_t device);
EXPORT void device_leavecontext(device_t device);

View File

@@ -27,7 +27,7 @@ struct gs_exports {
const char *(*device_name)(void);
int (*device_type)(void);
const char *(*device_preprocessor_name)(void);
device_t (*device_create)(struct gs_init_data *data);
int (*device_create)(device_t *device, struct gs_init_data *data);
void (*device_destroy)(device_t device);
void (*device_entercontext)(device_t device);
void (*device_leavecontext)(device_t device);

View File

@@ -137,15 +137,17 @@ int gs_create(graphics_t *pgraphics, const char *module,
module))
goto error;
graphics->device = graphics->exports.device_create(data);
if (!graphics->device)
errcode = graphics->exports.device_create(&graphics->device, data);
if (errcode != GS_SUCCESS)
goto error;
if (!graphics_init(graphics))
if (!graphics_init(graphics)) {
errcode = GS_ERROR_FAIL;
goto error;
}
*pgraphics = graphics;
return GS_SUCCESS;
return errcode;
error:
gs_destroy(graphics);

View File

@@ -392,8 +392,9 @@ EXPORT texture_t texrender_gettexture(texrender_t texrender);
/* global functions */
#define GS_SUCCESS 0
#define GS_ERROR_MODULE_NOT_FOUND -1
#define GS_ERROR_FAIL -2
#define GS_ERROR_FAIL -1
#define GS_ERROR_MODULE_NOT_FOUND -2
#define GS_ERROR_NOT_SUPPORTED -3
struct gs_window {
#if defined(_WIN32)