Add ffmpeg_remuxer

This commit is contained in:
Kamil Trzcinski
2022-04-08 13:33:54 +02:00
parent 253628b61e
commit 3240fa9336
8 changed files with 311 additions and 247 deletions

36
ffmpeg/remuxer.h Normal file
View File

@ -0,0 +1,36 @@
#ifdef USE_FFMPEG
#include <libavcodec/avcodec.h>
#include <libavformat/avio.h>
#include <libavformat/avformat.h>
#define FFMPEG_DATA_PACKET_EOF AVERROR_EOF
#else
#define FFMPEG_DATA_PACKET_EOF -1
#endif
typedef int (*ffmpeg_data_packet)(void *opaque, uint8_t *buf, int buf_size);
typedef struct ffmpeg_remuxer_s {
const char *name;
const char *input_format;
const char *video_format;
void *opaque;
ffmpeg_data_packet read_packet;
ffmpeg_data_packet write_packet;
#ifdef USE_FFMPEG
AVIOContext *input_avio;
AVFormatContext *input_context;
AVDictionary *input_opts;
AVIOContext *output_avio;
AVFormatContext *output_context;
AVPacket *packet;
AVDictionary *output_opts;
int video_stream;
uint64_t start_time;
#endif
} ffmpeg_remuxer_t;
int ffmpeg_remuxer_open(ffmpeg_remuxer_t *remuxer);
int ffmpeg_remuxer_feed(ffmpeg_remuxer_t *remuxer);
int ffmpeg_remuxer_close(ffmpeg_remuxer_t *remuxer);