Rename ffemu_audio_data/ffemu_video_data

This commit is contained in:
twinaphex 2018-09-18 10:22:34 +02:00
parent c2cee6e8f0
commit b4dc1fbb5b
4 changed files with 49 additions and 50 deletions

View File

@ -213,7 +213,7 @@ typedef struct ffmpeg
struct ff_muxer_info muxer;
struct ff_config_param config;
struct ffemu_params params;
struct record_params params;
scond_t *cond;
slock_t *cond_lock;
@ -279,8 +279,8 @@ static void ffmpeg_audio_resolve_format(struct ff_audio_info *audio,
static void ffmpeg_audio_resolve_sample_rate(ffmpeg_t *handle,
const AVCodec *codec)
{
struct ff_config_param *params = &handle->config;
struct ffemu_params *param = &handle->params;
struct ff_config_param *params = &handle->config;
struct record_params *param = &handle->params;
/* We'll have to force resampling to some supported sampling rate. */
if (codec->supported_samplerates && !params->sample_rate)
@ -316,11 +316,11 @@ static void ffmpeg_audio_resolve_sample_rate(ffmpeg_t *handle,
static bool ffmpeg_init_audio(ffmpeg_t *handle)
{
settings_t *settings = config_get_ptr();
struct ff_config_param *params = &handle->config;
struct ff_audio_info *audio = &handle->audio;
struct ffemu_params *param = &handle->params;
AVCodec *codec = avcodec_find_encoder_by_name(
settings_t *settings = config_get_ptr();
struct ff_config_param *params = &handle->config;
struct ff_audio_info *audio = &handle->audio;
struct record_params *param = &handle->params;
AVCodec *codec = avcodec_find_encoder_by_name(
*params->acodec ? params->acodec : "flac");
if (!codec)
{
@ -403,9 +403,9 @@ static bool ffmpeg_init_audio(ffmpeg_t *handle)
static bool ffmpeg_init_video(ffmpeg_t *handle)
{
size_t size;
struct ff_config_param *params = &handle->config;
struct ff_video_info *video = &handle->video;
struct ffemu_params *param = &handle->params;
struct ff_config_param *params = &handle->config;
struct ff_video_info *video = &handle->video;
struct record_params *param = &handle->params;
AVCodec *codec = NULL;
if (*params->vcodec)
@ -677,7 +677,7 @@ static bool init_thread(ffmpeg_t *handle)
handle->cond = scond_new();
handle->audio_fifo = fifo_new(32000 * sizeof(int16_t) *
handle->params.channels * MAX_FRAMES / 60); /* Some arbitrary max size. */
handle->attr_fifo = fifo_new(sizeof(struct ffemu_video_data) * MAX_FRAMES);
handle->attr_fifo = fifo_new(sizeof(struct record_video_data) * MAX_FRAMES);
handle->video_fifo = fifo_new(handle->params.fb_width * handle->params.fb_height *
handle->video.pix_size * MAX_FRAMES);
@ -784,7 +784,7 @@ static void ffmpeg_free(void *data)
free(handle);
}
static void *ffmpeg_new(const struct ffemu_params *params)
static void *ffmpeg_new(const struct record_params *params)
{
ffmpeg_t *handle = NULL;
@ -823,13 +823,13 @@ error:
}
static bool ffmpeg_push_video(void *data,
const struct ffemu_video_data *vid)
const struct record_video_data *vid)
{
unsigned y;
bool drop_frame;
struct ffemu_video_data attr_data;
struct record_video_data attr_data;
ffmpeg_t *handle = (ffmpeg_t*)data;
int offset = 0;
int offset = 0;
if (!handle || !vid)
return false;
@ -893,7 +893,7 @@ static bool ffmpeg_push_video(void *data,
}
static bool ffmpeg_push_audio(void *data,
const struct ffemu_audio_data *audio_data)
const struct record_audio_data *audio_data)
{
ffmpeg_t *handle = (ffmpeg_t*)data;
@ -975,7 +975,7 @@ static bool encode_video(ffmpeg_t *handle, AVPacket *pkt, AVFrame *frame)
}
static void ffmpeg_scale_input(ffmpeg_t *handle,
const struct ffemu_video_data *vid)
const struct record_video_data *vid)
{
/* Attempt to preserve more information if we scale down. */
bool shrunk = handle->params.out_width < vid->width
@ -1012,7 +1012,7 @@ static void ffmpeg_scale_input(ffmpeg_t *handle,
}
static bool ffmpeg_push_video_thread(ffmpeg_t *handle,
const struct ffemu_video_data *vid)
const struct record_video_data *vid)
{
AVPacket pkt;
@ -1151,7 +1151,7 @@ static bool encode_audio(ffmpeg_t *handle, AVPacket *pkt, bool dry)
}
static void ffmpeg_audio_resample(ffmpeg_t *handle,
struct ffemu_audio_data *aud)
struct record_audio_data *aud)
{
if (!handle->audio.use_float && !handle->audio.resampler)
return;
@ -1215,7 +1215,7 @@ static void ffmpeg_audio_resample(ffmpeg_t *handle,
}
static bool ffmpeg_push_audio_thread(ffmpeg_t *handle,
struct ffemu_audio_data *aud, bool require_block)
struct record_audio_data *aud, bool require_block)
{
size_t written_frames = 0;
@ -1270,7 +1270,7 @@ static void ffmpeg_flush_audio(ffmpeg_t *handle, void *audio_buf,
if (avail)
{
struct ffemu_audio_data aud = {0};
struct record_audio_data aud = {0};
fifo_read(handle->audio_fifo, audio_buf, avail);
@ -1317,7 +1317,7 @@ static void ffmpeg_flush_buffers(ffmpeg_t *handle)
do
{
struct ffemu_video_data attr_buf;
struct record_video_data attr_buf;
did_work = false;
@ -1325,7 +1325,7 @@ static void ffmpeg_flush_buffers(ffmpeg_t *handle)
{
if (fifo_read_avail(handle->audio_fifo) >= audio_buf_size)
{
struct ffemu_audio_data aud = {0};
struct record_audio_data aud = {0};
fifo_read(handle->audio_fifo, audio_buf, audio_buf_size);
@ -1399,7 +1399,7 @@ static void ffmpeg_thread(void *data)
while (ff->alive)
{
struct ffemu_video_data attr_buf;
struct record_video_data attr_buf;
bool avail_video = false;
bool avail_audio = false;
@ -1443,7 +1443,7 @@ static void ffmpeg_thread(void *data)
if (avail_audio && audio_buf)
{
struct ffemu_audio_data aud = {0};
struct record_audio_data aud = {0};
slock_lock(ff->lock);
fifo_read(ff->audio_fifo, audio_buf, audio_buf_size);
@ -1461,7 +1461,7 @@ static void ffmpeg_thread(void *data)
av_free(audio_buf);
}
const record_driver_t ffemu_ffmpeg = {
const record_driver_t record_ffmpeg = {
ffmpeg_new,
ffmpeg_free,
ffmpeg_push_video,

View File

@ -31,19 +31,19 @@ static void record_null_free(void *data)
{
}
static void *record_null_new(const struct ffemu_params *params)
static void *record_null_new(const struct record_params *params)
{
return NULL;
}
static bool record_null_push_video(void *data,
const struct ffemu_video_data *video_data)
const struct record_video_data *video_data)
{
return false;
}
static bool record_null_push_audio(void *data,
const struct ffemu_audio_data *audio_data)
const struct record_audio_data *audio_data)
{
return false;
}
@ -53,7 +53,7 @@ static bool record_null_finalize(void *data)
return false;
}
const record_driver_t ffemu_null = {
const record_driver_t record_null = {
record_null_new,
record_null_free,
record_null_push_video,

View File

@ -40,9 +40,9 @@
static const record_driver_t *record_drivers[] = {
#ifdef HAVE_FFMPEG
&ffemu_ffmpeg,
&record_ffmpeg,
#endif
&ffemu_null,
&record_null,
NULL,
};
@ -169,7 +169,7 @@ const record_driver_t *ffemu_find_backend(const char *ident)
* 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)
const struct record_params *params)
{
unsigned i;
@ -191,10 +191,9 @@ bool record_driver_init_first(const record_driver_t **backend, void **data,
void recording_dump_frame(const void *data, unsigned width,
unsigned height, size_t pitch, bool is_idle)
{
bool has_gpu_record = false;
uint8_t *gpu_buf = NULL;
struct ffemu_video_data
ffemu_data = {0};
bool has_gpu_record = false;
uint8_t *gpu_buf = NULL;
struct record_video_data ffemu_data = {0};
video_driver_get_record_status(&has_gpu_record,
&gpu_buf);
@ -305,7 +304,7 @@ void streaming_set_state(bool state)
void recording_push_audio(const int16_t *data, size_t samples)
{
struct ffemu_audio_data ffemu_data;
struct record_audio_data ffemu_data;
ffemu_data.data = data;
ffemu_data.frames = samples / 2;
@ -321,11 +320,11 @@ void recording_push_audio(const int16_t *data, size_t samples)
*
* Returns: true (1) if successful, otherwise false (0).
**/
bool recording_init()
bool recording_init(void)
{
char output[PATH_MAX_LENGTH];
char buf[PATH_MAX_LENGTH];
struct ffemu_params params = {0};
struct record_params params = {0};
struct retro_system_av_info *av_info = video_viewport_get_system_av_info();
bool recording_enabled = recording_is_enabled();
settings_t *settings = config_get_ptr();

View File

@ -32,7 +32,7 @@ enum ffemu_pix_format
};
/* Parameters passed to ffemu_new() */
struct ffemu_params
struct record_params
{
/* Framerate per second of input video. */
double fps;
@ -65,7 +65,7 @@ struct ffemu_params
const char *config;
};
struct ffemu_video_data
struct record_video_data
{
const void *data;
unsigned width;
@ -74,7 +74,7 @@ struct ffemu_video_data
bool is_dupe;
};
struct ffemu_audio_data
struct record_audio_data
{
const void *data;
size_t frames;
@ -82,16 +82,16 @@ struct ffemu_audio_data
typedef struct record_driver
{
void *(*init)(const struct ffemu_params *params);
void *(*init)(const struct record_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 (*push_video)(void *data, const struct record_video_data *video_data);
bool (*push_audio)(void *data, const struct record_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;
extern const record_driver_t record_ffmpeg;
extern const record_driver_t record_null;
/**
* config_get_record_driver_options:
@ -142,7 +142,7 @@ const char *record_driver_find_ident(int idx);
* 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);
const struct record_params *params);
void recording_dump_frame(const void *data, unsigned width,
unsigned height, size_t pitch, bool is_idle);