From 1f005df2f3ff78458f332f9bf1cf2e78b6a8e8e4 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期四, 26 九月 2019 14:43:52 +0800 Subject: [PATCH] bug fix audio codec --- csrc/ffmpeg/format/FormatIn.hpp | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-) diff --git a/csrc/ffmpeg/format/FormatIn.hpp b/csrc/ffmpeg/format/FormatIn.hpp index a19d0fe..4eb7847 100644 --- a/csrc/ffmpeg/format/FormatIn.hpp +++ b/csrc/ffmpeg/format/FormatIn.hpp @@ -3,6 +3,8 @@ #include <stdint.h> #include <memory> +#include <vector> +#include "PsToEs.hpp" struct AVFormatContext; struct AVDictionary; @@ -18,8 +20,6 @@ namespace ffwrapper{ class VideoProp; - class CodedData; - class FrameData; class FormatIn { @@ -34,34 +34,36 @@ int open(const char *filename, AVDictionary **options); bool findStreamInfo(AVDictionary **options); - bool openCodec(const int type, AVDictionary **options); + bool openCodec(AVDictionary **options); - bool readPacket(AVPacket &pkt_out, int stream_index = 0); - bool readPacket(std::shared_ptr<CodedData> &data, int stream_index = 0); + int readPacket(AVPacket *pkt_out); - int decode(AVFrame* &frame, AVPacket &pkt); - int decode(std::shared_ptr<FrameData> &frame_data, - std::shared_ptr<CodedData> &data); + int decode(AVFrame* frame, AVPacket *pkt); - int readFrame(AVFrame* &frame); - int readFrame(std::shared_ptr<FrameData> &frame_data); - + 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 = 0); + AVStream *getStream(int type = -1); + std::vector<AVStream*> allStreams(); 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; }; } -- Gitblit v1.8.0