RetroArch
Classes | Macros | Typedefs | Functions | Variables
record_ffmpeg.c File Reference
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <retro_assert.h>
#include <compat/msvc.h>
#include <compat/strl.h>
#include <boolean.h>
#include <queues/fifo_queue.h>
#include <rthreads/rthreads.h>
#include <gfx/scaler/scaler.h>
#include <gfx/video_frame.h>
#include <file/config_file.h>
#include <audio/audio_resampler.h>
#include <audio/conversion/float_to_s16.h>
#include <audio/conversion/s16_to_float.h>
#include <libavcodec/avcodec.h>
#include <libavutil/imgutils.h>
#include <libavutil/mathematics.h>
#include <libavutil/avutil.h>
#include <libavutil/avstring.h>
#include <libavutil/opt.h>
#include <libavutil/version.h>
#include <libavformat/avformat.h>
#include <libavutil/avconfig.h>
#include <libavutil/pixdesc.h>
#include <libswscale/swscale.h>
#include "../record_driver.h"
#include "../../configuration.h"
#include "../../gfx/video_driver.h"
#include "../../verbosity.h"
Include dependency graph for record_ffmpeg.c:

Classes

struct  ff_video_info
 
struct  ff_audio_info
 
struct  ff_muxer_info
 
struct  ff_config_param
 
struct  ffmpeg
 

Macros

#define AV_CODEC_FLAG_QSCALE   CODEC_FLAG_QSCALE
 
#define AV_CODEC_FLAG_GLOBAL_HEADER   CODEC_FLAG_GLOBAL_HEADER
 
#define AV_INPUT_BUFFER_MIN_SIZE   FF_MIN_BUFFER_SIZE
 
#define PIX_FMT_RGB32   AV_PIX_FMT_RGB32
 
#define PIX_FMT_YUV444P   AV_PIX_FMT_YUV444P
 
#define PIX_FMT_YUV420P   AV_PIX_FMT_YUV420P
 
#define PIX_FMT_BGR24   AV_PIX_FMT_BGR24
 
#define PIX_FMT_RGB24   AV_PIX_FMT_RGB24
 
#define PIX_FMT_RGB8   AV_PIX_FMT_RGB8
 
#define PIX_FMT_RGB565   AV_PIX_FMT_RGB565
 
#define PIX_FMT_NONE   AV_PIX_FMT_NONE
 
#define PixelFormat   AVPixelFormat
 
#define av_frame_alloc   avcodec_alloc_frame
 
#define av_frame_free   avcodec_free_frame
 
#define MAX_FRAMES   32
 

Typedefs

typedef struct ffmpeg ffmpeg_t
 

Functions

static bool ffmpeg_codec_has_sample_format (enum AVSampleFormat fmt, const enum AVSampleFormat *fmts)
 
static void ffmpeg_audio_resolve_format (struct ff_audio_info *audio, const AVCodec *codec)
 
static void ffmpeg_audio_resolve_sample_rate (ffmpeg_t *handle, const AVCodec *codec)
 
static bool ffmpeg_init_audio (ffmpeg_t *handle)
 
static bool ffmpeg_init_video (ffmpeg_t *handle)
 
static bool ffmpeg_init_config_common (struct ff_config_param *params, unsigned preset)
 
static bool ffmpeg_init_config (struct ff_config_param *params, const char *config)
 
static bool ffmpeg_init_muxer_pre (ffmpeg_t *handle)
 
static bool ffmpeg_init_muxer_post (ffmpeg_t *handle)
 
static void ffmpeg_thread (void *data)
 
static bool init_thread (ffmpeg_t *handle)
 
static void deinit_thread (ffmpeg_t *handle)
 
static void deinit_thread_buf (ffmpeg_t *handle)
 
static void ffmpeg_free (void *data)
 
static voidffmpeg_new (const struct record_params *params)
 
static bool ffmpeg_push_video (void *data, const struct record_video_data *vid)
 
static bool ffmpeg_push_audio (void *data, const struct record_audio_data *audio_data)
 
static bool encode_video (ffmpeg_t *handle, AVPacket *pkt, AVFrame *frame)
 
static void ffmpeg_scale_input (ffmpeg_t *handle, const struct record_video_data *vid)
 
static bool ffmpeg_push_video_thread (ffmpeg_t *handle, const struct record_video_data *vid)
 
static void planarize_float (float *out, const float *in, size_t frames)
 
static void planarize_s16 (int16_t *out, const int16_t *in, size_t frames)
 
static void planarize_audio (ffmpeg_t *handle)
 
static bool encode_audio (ffmpeg_t *handle, AVPacket *pkt, bool dry)
 
static void ffmpeg_audio_resample (ffmpeg_t *handle, struct record_audio_data *aud)
 
static bool ffmpeg_push_audio_thread (ffmpeg_t *handle, struct record_audio_data *aud, bool require_block)
 
static void ffmpeg_flush_audio (ffmpeg_t *handle, void *audio_buf, size_t audio_buf_size)
 
static void ffmpeg_flush_video (ffmpeg_t *handle)
 
static void ffmpeg_flush_buffers (ffmpeg_t *handle)
 
static bool ffmpeg_finalize (void *data)
 

Variables

AVFormatContext * ctx
 
const record_driver_t record_ffmpeg
 

Macro Definition Documentation

◆ AV_CODEC_FLAG_GLOBAL_HEADER

#define AV_CODEC_FLAG_GLOBAL_HEADER   CODEC_FLAG_GLOBAL_HEADER

◆ AV_CODEC_FLAG_QSCALE

#define AV_CODEC_FLAG_QSCALE   CODEC_FLAG_QSCALE

◆ av_frame_alloc

#define av_frame_alloc   avcodec_alloc_frame

◆ av_frame_free

#define av_frame_free   avcodec_free_frame

◆ AV_INPUT_BUFFER_MIN_SIZE

#define AV_INPUT_BUFFER_MIN_SIZE   FF_MIN_BUFFER_SIZE

◆ MAX_FRAMES

#define MAX_FRAMES   32

◆ PIX_FMT_BGR24

#define PIX_FMT_BGR24   AV_PIX_FMT_BGR24

◆ PIX_FMT_NONE

#define PIX_FMT_NONE   AV_PIX_FMT_NONE

◆ PIX_FMT_RGB24

#define PIX_FMT_RGB24   AV_PIX_FMT_RGB24

◆ PIX_FMT_RGB32

#define PIX_FMT_RGB32   AV_PIX_FMT_RGB32

◆ PIX_FMT_RGB565

#define PIX_FMT_RGB565   AV_PIX_FMT_RGB565

◆ PIX_FMT_RGB8

#define PIX_FMT_RGB8   AV_PIX_FMT_RGB8

◆ PIX_FMT_YUV420P

#define PIX_FMT_YUV420P   AV_PIX_FMT_YUV420P

◆ PIX_FMT_YUV444P

#define PIX_FMT_YUV444P   AV_PIX_FMT_YUV444P

◆ PixelFormat

#define PixelFormat   AVPixelFormat

Typedef Documentation

◆ ffmpeg_t

typedef struct ffmpeg ffmpeg_t

Function Documentation

◆ deinit_thread()

static void deinit_thread ( ffmpeg_t handle)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deinit_thread_buf()

static void deinit_thread_buf ( ffmpeg_t handle)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ encode_audio()

static bool encode_audio ( ffmpeg_t handle,
AVPacket *  pkt,
bool  dry 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ encode_video()

static bool encode_video ( ffmpeg_t handle,
AVPacket *  pkt,
AVFrame *  frame 
)
static
Here is the caller graph for this function:

◆ ffmpeg_audio_resample()

static void ffmpeg_audio_resample ( ffmpeg_t handle,
struct record_audio_data aud 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_audio_resolve_format()

static void ffmpeg_audio_resolve_format ( struct ff_audio_info audio,
const AVCodec *  codec 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_audio_resolve_sample_rate()

static void ffmpeg_audio_resolve_sample_rate ( ffmpeg_t handle,
const AVCodec *  codec 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_codec_has_sample_format()

static bool ffmpeg_codec_has_sample_format ( enum AVSampleFormat  fmt,
const enum AVSampleFormat *  fmts 
)
static
Here is the caller graph for this function:

◆ ffmpeg_finalize()

static bool ffmpeg_finalize ( void data)
static
Here is the call graph for this function:

◆ ffmpeg_flush_audio()

static void ffmpeg_flush_audio ( ffmpeg_t handle,
void audio_buf,
size_t  audio_buf_size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_flush_buffers()

static void ffmpeg_flush_buffers ( ffmpeg_t handle)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_flush_video()

static void ffmpeg_flush_video ( ffmpeg_t handle)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_free()

static void ffmpeg_free ( void data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_init_audio()

static bool ffmpeg_init_audio ( ffmpeg_t handle)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_init_config()

static bool ffmpeg_init_config ( struct ff_config_param params,
const char *  config 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_init_config_common()

static bool ffmpeg_init_config_common ( struct ff_config_param params,
unsigned  preset 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_init_muxer_post()

static bool ffmpeg_init_muxer_post ( ffmpeg_t handle)
static
Here is the caller graph for this function:

◆ ffmpeg_init_muxer_pre()

static bool ffmpeg_init_muxer_pre ( ffmpeg_t handle)
static
Here is the caller graph for this function:

◆ ffmpeg_init_video()

static bool ffmpeg_init_video ( ffmpeg_t handle)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_new()

static void* ffmpeg_new ( const struct record_params params)
static
Here is the call graph for this function:

◆ ffmpeg_push_audio()

static bool ffmpeg_push_audio ( void data,
const struct record_audio_data audio_data 
)
static
Here is the call graph for this function:

◆ ffmpeg_push_audio_thread()

static bool ffmpeg_push_audio_thread ( ffmpeg_t handle,
struct record_audio_data aud,
bool  require_block 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_push_video()

static bool ffmpeg_push_video ( void data,
const struct record_video_data vid 
)
static
Here is the call graph for this function:

◆ ffmpeg_push_video_thread()

static bool ffmpeg_push_video_thread ( ffmpeg_t handle,
const struct record_video_data vid 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_scale_input()

static void ffmpeg_scale_input ( ffmpeg_t handle,
const struct record_video_data vid 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ffmpeg_thread()

static void ffmpeg_thread ( void data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_thread()

static bool init_thread ( ffmpeg_t handle)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ planarize_audio()

static void planarize_audio ( ffmpeg_t handle)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ planarize_float()

static void planarize_float ( float *  out,
const float *  in,
size_t  frames 
)
static
Here is the caller graph for this function:

◆ planarize_s16()

static void planarize_s16 ( int16_t out,
const int16_t in,
size_t  frames 
)
static
Here is the caller graph for this function:

Variable Documentation

◆ ctx

AVFormatContext* ctx

◆ record_ffmpeg

const record_driver_t record_ffmpeg
Initial value:
= {
"ffmpeg",
}
static bool ffmpeg_push_video(void *data, const struct record_video_data *vid)
Definition: record_ffmpeg.c:1043
static bool ffmpeg_finalize(void *data)
Definition: record_ffmpeg.c:1581
static bool ffmpeg_push_audio(void *data, const struct record_audio_data *audio_data)
Definition: record_ffmpeg.c:1113
static void * ffmpeg_new(const struct record_params *params)
Definition: record_ffmpeg.c:1001
static void ffmpeg_free(void *data)
Definition: record_ffmpeg.c:950