#ifndef _FFMPEG_FORMAT_CONTEXT_IN_H_
|
#define _FFMPEG_FORMAT_CONTEXT_IN_H_
|
|
#include <stdint.h>
|
#include <memory>
|
#include "PsToEs.hpp"
|
|
struct AVFormatContext;
|
struct AVDictionary;
|
struct AVStream;
|
struct AVCodecContext;
|
struct AVPacket;
|
struct AVFrame;
|
struct AVCodec;
|
struct AVIOContext;
|
|
typedef int(* read_packet)(void *opaque,uint8_t *buf, int buf_size);
|
|
namespace ffwrapper{
|
|
class VideoProp;
|
|
class FormatIn
|
{
|
public:
|
explicit FormatIn(bool hw=true);
|
~FormatIn();
|
|
public:
|
int openWithCustomIO(void *opaque, read_packet fn, AVDictionary **options=NULL);
|
int openGb28181(const char *filename, AVDictionary **options);
|
|
int open(const char *filename, AVDictionary **options);
|
bool findStreamInfo(AVDictionary **options);
|
|
bool openCodec(AVDictionary **options);
|
|
int readPacket(AVPacket *pkt_out);
|
|
int decode(AVFrame* frame, AVPacket *pkt);
|
|
bool isVideoPkt(AVPacket *pkt);
|
bool isAudioPkt(AVPacket *pkt);
|
bool notVideoAudio(AVPacket *pkt);
|
private:
|
bool allocCodec(AVCodec *dec, AVStream *s, AVDictionary **options);
|
public:
|
AVStream *getStream(int type = -1);
|
AVCodecContext *getCodecContext(int type = 0);
|
AVFormatContext *getFromatContext(){return ctx_;}
|
const double getFPS()const{return fps_;}
|
private:
|
AVFormatContext *ctx_;
|
AVCodecContext *dec_ctx_;
|
int vs_idx_;
|
int as_idx_;
|
|
bool hw_accl_;
|
double fps_;
|
private:
|
AVIOContext *io_ctx_;
|
uint8_t *read_io_buff_;
|
const int read_io_buff_size_;
|
GB28181API *handle_gb28181;
|
};
|
}
|
|
#endif
|