| | |
| | | |
| | | #include "../ffmpeg/format/FormatIn.hpp" |
| | | #include "../ffmpeg/data/CodedData.hpp" |
| | | #include "../ffmpeg/log/log.hpp" |
| | | using namespace logif; |
| | | |
| | | namespace cffmpeg_wrap{ |
| | | stream::stream(ffwrapper::FormatIn *in, const int maxSize) |
| | |
| | | list_pkt_.clear(); |
| | | } |
| | | |
| | | int stream::SetPacket(std::shared_ptr<ffwrapper::CodedData> data, int64_t &id){ |
| | | if (data){ |
| | | |
| | | int stream::SetPacket(const CPacket &pkt){ |
| | | if (pkt.data){ |
| | | // 如果包是音频包,但是不使用音频,直接返回 |
| | | if (!audio_ && streamRef_->isAudioPkt(&data->getAVPacket())){ |
| | | if (!audio_ && streamRef_->isAudioPkt(&pkt.data->getAVPacket())){ |
| | | return 0; |
| | | } |
| | | |
| | | std::lock_guard<std::mutex> locker(mutex_avpkt_); |
| | | list_pkt_.push_back({data, id}); |
| | | list_pkt_.push_back(pkt); |
| | | |
| | | while(list_pkt_.size() > max_size_/2*3){ |
| | | list_pkt_.pop_front(); |