1 Star 1 Fork 1

孙全/QFFmpeg

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
QFFmpegAudioDecoder.h 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
liu-wenwu 提交于 2015-04-26 17:18 . First Commit
#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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sunshengquan110/QFFmpeg.git
git@gitee.com:sunshengquan110/QFFmpeg.git
sunshengquan110
QFFmpeg
QFFmpeg
master

搜索帮助