2024-10-08 02:29:00 +00:00
|
|
|
#ifndef ENCODER_H
|
|
|
|
#define ENCODER_H
|
|
|
|
|
2024-11-02 02:19:01 +00:00
|
|
|
#include <filesystem>
|
|
|
|
|
2024-10-10 07:23:13 +00:00
|
|
|
extern "C" {
|
2024-10-08 02:29:00 +00:00
|
|
|
#include <libavcodec/avcodec.h>
|
|
|
|
#include <libavformat/avformat.h>
|
2024-10-10 07:23:13 +00:00
|
|
|
#include <libavutil/opt.h>
|
|
|
|
}
|
2024-10-08 02:29:00 +00:00
|
|
|
|
|
|
|
#include "libvideo2x.h"
|
|
|
|
|
|
|
|
int init_encoder(
|
2024-10-10 07:23:13 +00:00
|
|
|
AVBufferRef *hw_ctx,
|
2024-11-02 02:19:01 +00:00
|
|
|
std::filesystem::path out_fpath,
|
2024-10-10 07:23:13 +00:00
|
|
|
AVFormatContext *ifmt_ctx,
|
2024-10-08 02:29:00 +00:00
|
|
|
AVFormatContext **ofmt_ctx,
|
|
|
|
AVCodecContext **enc_ctx,
|
|
|
|
AVCodecContext *dec_ctx,
|
2024-10-10 07:23:13 +00:00
|
|
|
EncoderConfig *encoder_config,
|
2024-11-06 00:00:00 +00:00
|
|
|
int in_vstream_idx,
|
|
|
|
int *out_vstream_idx,
|
2024-10-21 23:54:22 +00:00
|
|
|
int **stream_map
|
2024-10-08 02:29:00 +00:00
|
|
|
);
|
|
|
|
|
2024-10-29 00:00:00 +00:00
|
|
|
int write_frame(
|
2024-10-10 07:23:13 +00:00
|
|
|
AVFrame *frame,
|
|
|
|
AVCodecContext *enc_ctx,
|
|
|
|
AVFormatContext *ofmt_ctx,
|
2024-11-06 00:00:00 +00:00
|
|
|
int out_vstream_idx
|
2024-10-10 07:23:13 +00:00
|
|
|
);
|
2024-10-08 02:29:00 +00:00
|
|
|
|
2024-11-06 00:00:00 +00:00
|
|
|
int flush_encoder(AVCodecContext *enc_ctx, AVFormatContext *ofmt_ctx, int out_vstream_idx);
|
2024-10-08 02:29:00 +00:00
|
|
|
|
|
|
|
#endif // ENCODER_H
|