Support recording to MKV

Implement recording to Matroska files.

The format to use is determined by the option -F/--record-format if set,
or by the file extension (".mp4" or ".mkv").
This commit is contained in:
Romain Vimont
2019-02-09 15:20:07 +01:00
parent 1aaad6ba35
commit 0ed2373952
6 changed files with 100 additions and 11 deletions

View File

@@ -6,15 +6,24 @@
#include "common.h"
enum recorder_format {
RECORDER_FORMAT_MP4 = 1,
RECORDER_FORMAT_MKV,
};
struct recorder {
char *filename;
enum recorder_format format;
AVFormatContext *ctx;
struct size declared_frame_size;
SDL_bool header_written;
};
SDL_bool recorder_init(struct recorder *recoder, const char *filename,
SDL_bool recorder_init(struct recorder *recoder,
const char *filename,
enum recorder_format format,
struct size declared_frame_size);
void recorder_destroy(struct recorder *recorder);
SDL_bool recorder_open(struct recorder *recorder, AVCodec *input_codec);