39 lines
654 B
C++
39 lines
654 B
C++
#pragma once
|
|
extern "C"
|
|
{
|
|
#include "libswscale/swscale.h"
|
|
#include "libavutil/imgutils.h"
|
|
#include "libavcodec/codec.h"
|
|
#include "libavformat/avformat.h"
|
|
}
|
|
|
|
typedef struct {
|
|
int src_width;
|
|
int src_height;
|
|
AVPixelFormat src_fmt;
|
|
|
|
int dst_width;
|
|
int dst_height;
|
|
AVPixelFormat dst_fmt;
|
|
|
|
int frame_rate;
|
|
int bit_rate;
|
|
int gop_size;
|
|
} INFO;
|
|
|
|
class ffvideo {
|
|
public:
|
|
|
|
void initH264();
|
|
void initSws();
|
|
void process_data(int dts, int pts, void(*cb)(ffvideo*));
|
|
|
|
int* line_size;
|
|
SwsContext* sws_ctx;
|
|
INFO info;
|
|
int src_size, dst_size;
|
|
uint8_t* src_buffer, * dst_buffer;
|
|
AVFrame* dst_frame;
|
|
AVPacket* dst_packet;
|
|
AVCodecContext* encoder_ctx;
|
|
}; |