9#pragma warning(push, 2)
13#include <libavcodec/avcodec.h>
14#include <libavformat/avformat.h>
25 mutable std::mutex initMutex;
26 std::condition_variable initCV;
27 bool initialized =
false;
29 mutable std::mutex dataMutex;
30 std::condition_variable dataCV;
31 long long lastFrame = 0;
41 void init(AVCodecContext *decoderContext) {
43 std::lock_guard<std::mutex> lock(initMutex);
44 this->initialized =
true;
49 std::unique_lock<std::mutex> lock(initMutex);
50 while (!initialized) {
56 std::lock_guard<std::mutex> lock(dataMutex);
62 long long getData(std::vector<uint8_t> &data) {
63 std::lock_guard<std::mutex> lock(dataMutex);
68 long long getNextData(std::vector<uint8_t> &data,
long long lastFrameSeen) {
69 std::unique_lock<std::mutex> lock(dataMutex);
70 while (this->lastFrame == lastFrameSeen) {
74 return this->lastFrame;
Definition: FFmpegFrameSink.h:23
virtual ~FFmpegFrameSink()
Definition: FFmpegFrameSink.h:39
virtual void virtualOutputFrame(AVFrame *frame)=0
long long getNextData(std::vector< uint8_t > &data, long long lastFrameSeen)
Definition: FFmpegFrameSink.h:68
virtual void getDataWithoutLock(std::vector< uint8_t > &data)=0
void outputFrame(AVFrame *frame)
Definition: FFmpegFrameSink.h:55
virtual AVMediaType getType() const =0
void waitForInit()
Definition: FFmpegFrameSink.h:48
virtual void virtualInit(AVCodecContext *decoderContext)=0
long long getData(std::vector< uint8_t > &data)
Definition: FFmpegFrameSink.h:62
void init(AVCodecContext *decoderContext)
Definition: FFmpegFrameSink.h:41