#ifndef FFMPEGINCLUDE_H #define FFMPEGINCLUDE_H extern "C" { #include #include #include #include #include #include #include #include #include #include #include #include "libavcodec/avcodec.h" } #include #include #include #include #include "global.h" #define PRINT_LOG 1 #define ERROR_LEN 1024 // 异常信息数组长度 /** * @brief 显示ffmpeg函数调用异常信息 * @param err */ inline void showError(int err) { char *m_error = new char[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) { // QCoreApplication::processEvents(QEventLoop::AllEvents, // 1); // 处理事件并短暂阻塞 // } // } #endif // FFMPEGINCLUDE_H