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
|
2016-01-10 03:06:50 +00:00
|
|
|
* Copyright (C) 2011-2016 - 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/>.
|
|
|
|
*/
|
2015-01-12 20:55:41 +00:00
|
|
|
#ifndef __RECORD_DRIVER_H
|
|
|
|
#define __RECORD_DRIVER_H
|
2011-01-03 16:51:17 +00:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
2016-06-03 03:38:40 +00:00
|
|
|
|
2014-10-21 03:05:52 +00:00
|
|
|
#include <boolean.h>
|
2016-06-03 03:38:40 +00:00
|
|
|
#include <retro_common_api.h>
|
2011-01-03 16:51:17 +00:00
|
|
|
|
2016-06-03 03:38:40 +00:00
|
|
|
RETRO_BEGIN_DECLS
|
2011-01-03 16:51:17 +00:00
|
|
|
|
2012-08-25 20:38:49 +00:00
|
|
|
enum ffemu_pix_format
|
|
|
|
{
|
2012-10-19 23:12:02 +00:00
|
|
|
FFEMU_PIX_RGB565 = 0,
|
2012-08-25 20:38:49 +00:00
|
|
|
FFEMU_PIX_BGR24,
|
|
|
|
FFEMU_PIX_ARGB8888
|
|
|
|
};
|
|
|
|
|
2014-08-20 15:18:43 +00:00
|
|
|
/* Parameters passed to ffemu_new() */
|
2011-01-03 16:51:17 +00:00
|
|
|
struct ffemu_params
|
|
|
|
{
|
2015-01-07 16:46:50 +00:00
|
|
|
/* Framerate per second of input video. */
|
2011-11-16 17:56:42 +00:00
|
|
|
double fps;
|
2014-08-20 15:18:43 +00:00
|
|
|
/* Sample rate of input audio. */
|
2011-11-16 17:56:42 +00:00
|
|
|
double samplerate;
|
|
|
|
|
2014-08-20 15:18:43 +00:00
|
|
|
/* Desired output resolution. */
|
2011-01-03 16:51:17 +00:00
|
|
|
unsigned out_width;
|
|
|
|
unsigned out_height;
|
2011-06-14 20:44:54 +00:00
|
|
|
|
2014-08-20 15:18:43 +00:00
|
|
|
/* Total size of framebuffer used in input. */
|
2011-06-14 20:44:54 +00:00
|
|
|
unsigned fb_width;
|
|
|
|
unsigned fb_height;
|
2011-01-03 16:51:17 +00:00
|
|
|
|
2014-08-20 15:18:43 +00:00
|
|
|
/* Aspect ratio of input video. Parameters are passed to the muxer,
|
|
|
|
* the video itself is not scaled.
|
|
|
|
*/
|
2011-11-16 17:56:42 +00:00
|
|
|
float aspect_ratio;
|
2011-01-03 16:51:17 +00:00
|
|
|
|
2014-08-20 15:18:43 +00:00
|
|
|
/* Audio channels. */
|
2011-01-03 16:51:17 +00:00
|
|
|
unsigned channels;
|
|
|
|
|
2014-08-20 15:18:43 +00:00
|
|
|
/* Input pixel format. */
|
2012-08-25 20:38:49 +00:00
|
|
|
enum ffemu_pix_format pix_fmt;
|
2011-08-11 03:25:31 +00:00
|
|
|
|
2014-08-20 15:18:43 +00:00
|
|
|
/* Filename to dump to. */
|
2011-01-04 14:44:05 +00:00
|
|
|
const char *filename;
|
2012-11-23 21:46:21 +00:00
|
|
|
|
2014-08-20 15:18:43 +00:00
|
|
|
/* Path to config. Optional. */
|
2012-11-23 21:46:21 +00:00
|
|
|
const char *config;
|
2011-01-03 16:51:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ffemu_video_data
|
|
|
|
{
|
|
|
|
const void *data;
|
|
|
|
unsigned width;
|
|
|
|
unsigned height;
|
2012-08-25 20:38:49 +00:00
|
|
|
int pitch;
|
2011-11-22 16:27:02 +00:00
|
|
|
bool is_dupe;
|
2011-01-03 16:51:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ffemu_audio_data
|
|
|
|
{
|
2012-11-24 23:25:57 +00:00
|
|
|
const void *data;
|
2011-01-03 16:51:17 +00:00
|
|
|
size_t frames;
|
|
|
|
};
|
|
|
|
|
2015-04-15 11:37:38 +00:00
|
|
|
typedef struct record_driver
|
2014-05-04 09:47:55 +00:00
|
|
|
{
|
|
|
|
void *(*init)(const struct ffemu_params *params);
|
|
|
|
void (*free)(void *data);
|
2014-08-20 15:18:43 +00:00
|
|
|
bool (*push_video)(void *data,const struct ffemu_video_data *video_data);
|
2014-05-04 09:47:55 +00:00
|
|
|
bool (*push_audio)(void *data, const struct ffemu_audio_data *audio_data);
|
|
|
|
bool (*finalize)(void *data);
|
|
|
|
const char *ident;
|
2015-04-15 11:37:38 +00:00
|
|
|
} record_driver_t;
|
2014-05-04 09:47:55 +00:00
|
|
|
|
2015-04-15 11:37:38 +00:00
|
|
|
extern const record_driver_t ffemu_ffmpeg;
|
|
|
|
extern const record_driver_t ffemu_null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* config_get_record_driver_options:
|
|
|
|
*
|
|
|
|
* Get an enumerated list of all record driver names, separated by '|'.
|
|
|
|
*
|
|
|
|
* Returns: string listing of all record driver names, separated by '|'.
|
|
|
|
**/
|
|
|
|
const char* config_get_record_driver_options(void);
|
2014-05-04 09:47:55 +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.
|
|
|
|
**/
|
2015-04-15 11:37:38 +00:00
|
|
|
const record_driver_t *ffemu_find_backend(const char *ident);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* record_driver_find_handle:
|
|
|
|
* @idx : index of driver to get handle to.
|
|
|
|
*
|
|
|
|
* Returns: handle to record driver at index. Can be NULL
|
|
|
|
* if nothing found.
|
|
|
|
**/
|
|
|
|
const void *record_driver_find_handle(int idx);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* record_driver_find_ident:
|
|
|
|
* @idx : index of driver to get handle to.
|
|
|
|
*
|
|
|
|
* Returns: Human-readable identifier of record driver at index. Can be NULL
|
|
|
|
* if nothing found.
|
|
|
|
**/
|
|
|
|
const char *record_driver_find_ident(int idx);
|
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).
|
|
|
|
**/
|
2015-04-15 11:37:38 +00:00
|
|
|
bool record_driver_init_first(const record_driver_t **backend, void **data,
|
2014-08-20 15:18:43 +00:00
|
|
|
const struct ffemu_params *params);
|
2011-01-03 16:51:17 +00:00
|
|
|
|
2015-02-10 20:09:41 +00:00
|
|
|
void recording_dump_frame(const void *data, unsigned width,
|
|
|
|
unsigned height, size_t pitch);
|
|
|
|
|
|
|
|
bool recording_deinit(void);
|
|
|
|
|
2015-09-06 12:55:42 +00:00
|
|
|
void find_record_driver(void);
|
|
|
|
|
2015-02-10 20:09:41 +00:00
|
|
|
/**
|
|
|
|
* recording_init:
|
|
|
|
*
|
|
|
|
* Initializes recording.
|
|
|
|
*
|
|
|
|
* Returns: true (1) if successful, otherwise false (0).
|
|
|
|
**/
|
|
|
|
bool recording_init(void);
|
|
|
|
|
2015-11-18 02:08:19 +00:00
|
|
|
bool *recording_is_enabled(void);
|
|
|
|
|
|
|
|
void recording_set_state(bool state);
|
|
|
|
|
2015-11-30 00:49:17 +00:00
|
|
|
void recording_push_audio(const int16_t *data, size_t samples);
|
|
|
|
|
2015-12-05 15:05:35 +00:00
|
|
|
void *recording_driver_get_data_ptr(void);
|
|
|
|
|
|
|
|
void recording_driver_clear_data_ptr(void);
|
|
|
|
|
|
|
|
void recording_driver_set_data_ptr(void *data);
|
|
|
|
|
2016-09-30 22:47:05 +00:00
|
|
|
bool *recording_driver_get_use_output_dir_ptr(void);
|
|
|
|
|
|
|
|
unsigned *recording_driver_get_width(void);
|
|
|
|
|
|
|
|
unsigned *recording_driver_get_height(void);
|
|
|
|
|
|
|
|
void recording_driver_free_state(void);
|
|
|
|
|
2016-12-04 05:31:29 +00:00
|
|
|
extern void *recording_data;
|
|
|
|
|
2016-06-03 03:38:40 +00:00
|
|
|
RETRO_END_DECLS
|
2011-01-03 16:51:17 +00:00
|
|
|
|
|
|
|
#endif
|