ffemu.c - Document

This commit is contained in:
twinaphex 2015-01-12 03:50:54 +01:00
parent a17788a1f8
commit 2dadadab56
2 changed files with 48 additions and 6 deletions

View File

@ -30,9 +30,19 @@ static const ffemu_backend_t *ffemu_backends[] = {
NULL, NULL,
}; };
/**
* ffemu_find_backend:
* @ident : Identifier of driver to find.
*
* Finds a recording driver with the name @ident.
*
* Returns: recording driver handle if successful, otherwise
* NULL.
**/
const ffemu_backend_t *ffemu_find_backend(const char *ident) const ffemu_backend_t *ffemu_find_backend(const char *ident)
{ {
unsigned i; unsigned i;
for (i = 0; ffemu_backends[i]; i++) for (i = 0; ffemu_backends[i]; i++)
{ {
if (!strcmp(ffemu_backends[i]->ident, ident)) if (!strcmp(ffemu_backends[i]->ident, ident))
@ -42,20 +52,32 @@ const ffemu_backend_t *ffemu_find_backend(const char *ident)
return NULL; return NULL;
} }
/**
* gfx_ctx_init_first:
* @backend : Recording backend handle.
* @data : Recording data handle.
* @params : Recording info parameters.
*
* Finds first suitable recording context driver and initializes.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool ffemu_init_first(const ffemu_backend_t **backend, void **data, bool ffemu_init_first(const ffemu_backend_t **backend, void **data,
const struct ffemu_params *params) const struct ffemu_params *params)
{ {
unsigned i; unsigned i;
for (i = 0; ffemu_backends[i]; i++) for (i = 0; ffemu_backends[i]; i++)
{ {
void *handle = ffemu_backends[i]->init(params); void *handle = ffemu_backends[i]->init(params);
if (handle)
{ if (!handle)
continue;
*backend = ffemu_backends[i]; *backend = ffemu_backends[i];
*data = handle; *data = handle;
return true; return true;
} }
}
return false; return false;
} }

View File

@ -93,7 +93,27 @@ typedef struct ffemu_backend
extern const ffemu_backend_t ffemu_ffmpeg; extern const ffemu_backend_t ffemu_ffmpeg;
/**
* ffemu_find_backend:
* @ident : Identifier of driver to find.
*
* Finds a recording driver with the name @ident.
*
* Returns: recording driver handle if successful, otherwise
* NULL.
**/
const ffemu_backend_t *ffemu_find_backend(const char *ident); const ffemu_backend_t *ffemu_find_backend(const char *ident);
/**
* gfx_ctx_init_first:
* @backend : Recording backend handle.
* @data : Recording data handle.
* @params : Recording info parameters.
*
* Finds first suitable recording context driver and initializes.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool ffemu_init_first(const ffemu_backend_t **backend, void **data, bool ffemu_init_first(const ffemu_backend_t **backend, void **data,
const struct ffemu_params *params); const struct ffemu_params *params);