RetroArch/record/ffemu.c

84 lines
2.1 KiB
C
Raw Normal View History

2012-04-21 21:13:50 +00:00
/* RetroArch - A frontend for libretro.
2014-01-01 00:50:59 +00:00
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
2015-01-07 16:46:50 +00:00
* Copyright (C) 2011-2015 - Daniel De Matteis
2011-12-24 12:46:12 +00:00
*
2012-04-21 21:13:50 +00:00
* RetroArch is free software: you can redistribute it and/or modify it under the terms
2011-12-24 12:46:12 +00:00
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
2012-04-21 21:13:50 +00:00
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
2011-12-24 12:46:12 +00:00
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
2012-04-21 21:31:57 +00:00
* You should have received a copy of the GNU General Public License along with RetroArch.
2011-12-24 12:46:12 +00:00
* If not, see <http://www.gnu.org/licenses/>.
*/
2014-05-04 09:47:55 +00:00
#include <string.h>
#include "ffemu.h"
#include "../dynamic.h"
2011-12-25 11:47:47 +00:00
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
2014-05-04 09:47:55 +00:00
static const ffemu_backend_t *ffemu_backends[] = {
#ifdef HAVE_FFMPEG
&ffemu_ffmpeg,
2012-09-02 21:49:30 +00:00
#endif
2014-05-04 09:47:55 +00:00
NULL,
2011-12-25 15:11:48 +00:00
};
2011-01-03 16:51:17 +00:00
2015-01-12 02:50:54 +00:00
/**
* 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.
**/
2014-05-04 09:47:55 +00:00
const ffemu_backend_t *ffemu_find_backend(const char *ident)
{
2013-10-22 19:26:33 +00:00
unsigned i;
2015-01-12 02:50:54 +00:00
2014-05-04 09:47:55 +00:00
for (i = 0; ffemu_backends[i]; i++)
{
2014-05-04 09:47:55 +00:00
if (!strcmp(ffemu_backends[i]->ident, ident))
return ffemu_backends[i];
}
2011-01-03 16:51:17 +00:00
return NULL;
}
2015-01-12 02:50:54 +00:00
/**
* 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,
const struct ffemu_params *params)
2011-01-03 16:51:17 +00:00
{
2014-05-04 09:47:55 +00:00
unsigned i;
2015-01-12 02:50:54 +00:00
2014-05-04 09:47:55 +00:00
for (i = 0; ffemu_backends[i]; i++)
2011-06-14 19:35:31 +00:00
{
2014-05-04 09:47:55 +00:00
void *handle = ffemu_backends[i]->init(params);
2015-01-12 02:50:54 +00:00
if (!handle)
continue;
*backend = ffemu_backends[i];
*data = handle;
return true;
2011-06-14 19:35:31 +00:00
}
2014-05-04 09:47:55 +00:00
return false;
2011-06-14 19:35:31 +00:00
}