video analysis2.0拆分,ffmpeg封装go接口库
zhangmeng
2019-09-20 be9c1d1f659b0ff31f656424c478e83a4f7c53b5
csrc/worker/stream.cpp
@@ -1,10 +1,13 @@
#include "stream.hpp"
#include "../ffmpeg/data/CodedData.hpp"
#include "../ffmpeg/format/FormatIn.hpp"
namespace cffmpeg_wrap{
    stream::stream(const int maxSize)
    :max_size_(maxSize)
    stream::stream(ffwrapper::FormatIn *in, const int maxSize)
    :streamRef_(in)
    ,max_size_(maxSize)
    ,audio_(false)
    {}
    stream::~stream(){
@@ -14,6 +17,13 @@
    int stream::SetPacket(std::shared_ptr<ffwrapper::CodedData> data){
        if (data){
            auto audio = streamRef_->isAudioPkt(data->getAVPacket());
            // 如果包是音频包,但是不使用音频,直接返回
            if (!audio_ && audio){
                return 0;
            }
            std::lock_guard<std::mutex> locker(mutex_avpkt_);
            list_avpkt_.push_back(data);