video analysis2.0拆分,ffmpeg封装go接口库
zhangmeng
2022-04-26 ab3d17cd44625a762fc10f0f1fd8f2c46b980aff
csrc/ffmpeg/format/FormatIn.hpp
@@ -3,8 +3,9 @@
#include <stdint.h>
#include <memory>
#include <vector>
#ifdef GB28181
#include "PsToEs.hpp"
#endif
struct AVFormatContext;
struct AVDictionary;
@@ -25,11 +26,14 @@
   {
   public:
      explicit FormatIn(bool hw=true);
      explicit FormatIn(const VideoProp &prop, bool hw=true);
      ~FormatIn();
      
   public:
      int openWithCustomIO(void *opaque, read_packet fn, AVDictionary **options=NULL);
#ifdef GB28181
        int openGb28181(const char *filename, AVDictionary **options);
#endif
      int open(const char *filename, AVDictionary **options);
      bool findStreamInfo(AVDictionary **options);
@@ -47,23 +51,28 @@
      bool allocCodec(AVCodec *dec, AVStream *s, AVDictionary **options);
   public:
      AVStream *getStream(int type = -1);
      std::vector<AVStream*> allStreams();
      AVCodecContext *getCodecContext(int type = 0);
      AVFormatContext *getFromatContext(){return ctx_;}
      const double getFPS()const{return fps_;}
      const bool IsHEVC()const;
      const bool IsAVC1()const;
   private:
       AVFormatContext    *ctx_;
       AVCodecContext       *dec_ctx_;
       int             vs_idx_;
      int             as_idx_;
      VideoProp          *prop_;
       bool             hw_accl_;
      double             fps_;
   private:
      AVIOContext         *io_ctx_;
      uint8_t          *read_io_buff_;
      const int          read_io_buff_size_;
#ifdef GB28181
      GB28181API         *handle_gb28181;
#endif
   };
}