#ifndef AVPACKETQUEUEMANAGER_H
#define AVPACKETQUEUEMANAGER_H

#include <QMutex>
#include <QQueue>

#include "ffmpeginclude.h"

class AVPacketQueueManager {
public:
    AVPacketQueueManager();

    void enqueueDecodePacket(AVPacket* pkt);
    void enqueueSavePacket(AVPacket* pkt);
    void enqueuePushPacket(AVPacket* pkt);

    AVPacket* dequeueDecodePacket();
    AVPacket* dequeueSavePacket();
    AVPacket* dequeuePushPacket();

    void clearDecodeQueue();
    void clearSaveQueue();
    void clearPushQueue();

    // bool isEmptyDecodeQueue();
    bool isEmptySaveQueue();

private:
    int QUEUECAPACITY = 100;
    QQueue<AVPacket*> m_decodeQueue;
    QQueue<AVPacket*> m_saveQueue;
    QQueue<AVPacket*> m_pushQueue;
    QMutex m_decodeMutex;  // 共享的互斥锁
    QMutex m_saveMutex;    // 共享的互斥锁
    QMutex m_pushMutex;    // 共享的互斥锁
};

#endif  // AVPACKETQUEUEMANAGER_H
