This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#ifndef FFMPEGINCLUDE_H
#define FFMPEGINCLUDE_H
extern"C"{
#include<libavformat/avformat.h>
#include<libavutil/channel_layout.h>
#include<libavutil/common.h>
#include<libavutil/frame.h>
#include<libavutil/imgutils.h>
#include<libavutil/mem.h>
#include<libavutil/opt.h>
#include<libavutil/parseutils.h>
#include<libavutil/samplefmt.h>
#include<libavutil/time.h>
#include<libswscale/swscale.h>
#include"libavcodec/avcodec.h"
}
#include<QCoreApplication>
#include<QDebug>
#include<QElapsedTimer>
#include<QEventLoop>
#include"global.h"
#define PRINT_LOG 1
#define ERROR_LEN 1024 // 异常信息数组长度
/**
* @brief 显示ffmpeg函数调用异常信息
* @param err
*/
inlinevoidshowError(interr){
char*m_error=newchar[ERROR_LEN];// 保存异常信息
#if PRINT_LOG
memset(m_error,0,ERROR_LEN);// 将数组置零
av_strerror(err,m_error,ERROR_LEN);
qWarning()<<"DecodeVideo Error:"<<m_error;
#else
Q_UNUSED(err)
#endif
delete[]m_error;// 释放内存
}
// void highPrecisionSleep(qint64 microseconds) {
// QElapsedTimer timer;
// timer.start();
// QEventLoop loop;
// while (timer.nsecsElapsed() < microseconds * 1000) {