forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 2
/
record_driver.h
187 lines (149 loc) · 4.57 KB
/
record_driver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* 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.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RECORD_DRIVER_H
#define __RECORD_DRIVER_H
#include <stdint.h>
#include <stddef.h>
#include <boolean.h>
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
enum ffemu_pix_format
{
FFEMU_PIX_RGB565 = 0,
FFEMU_PIX_BGR24,
FFEMU_PIX_ARGB8888
};
/* Parameters passed to ffemu_new() */
struct ffemu_params
{
/* Framerate per second of input video. */
double fps;
/* Sample rate of input audio. */
double samplerate;
/* Desired output resolution. */
unsigned out_width;
unsigned out_height;
/* Total size of framebuffer used in input. */
unsigned fb_width;
unsigned fb_height;
/* Aspect ratio of input video. Parameters are passed to the muxer,
* the video itself is not scaled.
*/
float aspect_ratio;
/* Audio channels. */
unsigned channels;
/* Input pixel format. */
enum ffemu_pix_format pix_fmt;
/* Filename to dump to. */
const char *filename;
/* Path to config. Optional. */
const char *config;
};
struct ffemu_video_data
{
const void *data;
unsigned width;
unsigned height;
int pitch;
bool is_dupe;
};
struct ffemu_audio_data
{
const void *data;
size_t frames;
};
typedef struct record_driver
{
void *(*init)(const struct ffemu_params *params);
void (*free)(void *data);
bool (*push_video)(void *data,const struct ffemu_video_data *video_data);
bool (*push_audio)(void *data, const struct ffemu_audio_data *audio_data);
bool (*finalize)(void *data);
const char *ident;
} record_driver_t;
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);
/**
* 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 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);
/**
* 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 record_driver_init_first(const record_driver_t **backend, void **data,
const struct ffemu_params *params);
void recording_dump_frame(const void *data, unsigned width,
unsigned height, size_t pitch);
bool recording_deinit(void);
void find_record_driver(void);
/**
* recording_init:
*
* Initializes recording.
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool recording_init(void);
bool *recording_is_enabled(void);
void recording_set_state(bool state);
void recording_push_audio(const int16_t *data, size_t samples);
void *recording_driver_get_data_ptr(void);
void recording_driver_clear_data_ptr(void);
void recording_driver_set_data_ptr(void *data);
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);
extern void *recording_data;
RETRO_END_DECLS
#endif