代码拉取完成,页面将自动刷新
#ifndef QFFMPEGAUDIODECODER_H
#define QFFMPEGAUDIODECODER_H
#include <QThread>
#include <QQueue>
#include <QMutex>
#include <QSemaphore>
#include "QOpenALEngine.h"
#include <QTimer>
#include <QQueue>
#include "QFFmpegClock.h"
extern "C"{
#include "libavutil/avstring.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "libavutil/dict.h"
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/avassert.h"
#include "libavutil/time.h"
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswscale/swscale.h"
#include "libavutil/opt.h"
#include "libavcodec/avfft.h"
#include "libswresample/swresample.h"
}
typedef struct FFAVPacket {
AVPacket pkt;
int serial;
} FFAVPacket;
class QFFmpegAudioDecoder : public QThread
{
Q_OBJECT
public:
explicit QFFmpegAudioDecoder(QObject *parent = 0);
~QFFmpegAudioDecoder();
void setCodecCtx(AVCodecContext *mAudioCtx);
void setStream(AVStream *mStream);
void addPacket(AVPacket pkt);
int getQueueLength();
void setClock(QFFmpegClock *clock);
double getAudioTime();
signals:
public slots:
private:
AVCodecContext *mAudioCtx;
QQueue<FFAVPacket> queue;
QMutex mutex;
QSemaphore sema;
SwrContext *swr_ctx;
QOpenALEngine *al;
QTimer *timer;
AVStream *mStream;
double mAudioClock;
double mBufferStartTime;
QQueue<double> mBufferTimes;
QFFmpegClock *mClock;
protected:
void run();
private slots:
void timerUpdate();
void timerStart();
};
#endif // QFFMPEGAUDIODECODER_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。