From 51ae9666369e12416777ec42948180f94ce2af42 Mon Sep 17 00:00:00 2001 From: sunchenglong <2977914955@qq.com> Date: 星期五, 21 二月 2025 16:39:12 +0800 Subject: [PATCH] Merge branch 'master' of ssh://115.28.86.8:29418/~admin/FaceX_AI_智能守卫 --- Client/董澎韬/code/qffmpeg.h | 73 ++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 0 deletions(-) diff --git "a/Client/\350\221\243\346\276\216\351\237\254/code/qffmpeg.h" "b/Client/\350\221\243\346\276\216\351\237\254/code/qffmpeg.h" new file mode 100644 index 0000000..9f92d44 --- /dev/null +++ "b/Client/\350\221\243\346\276\216\351\237\254/code/qffmpeg.h" @@ -0,0 +1,73 @@ +#ifndef QFFMPEG_H +#define QFFMPEG_H + +//蹇呴』鍔犱互涓嬪唴瀹�,鍚﹀垯缂栬瘧涓嶈兘閫氳繃,涓轰簡鍏煎C鍜孋99鏍囧噯 +#ifndef INT64_C +#define INT64_C +#define UINT64_C +#endif + +//寮曞叆ffmpeg澶存枃浠� +extern "C" +{ +#include <libavcodec/avcodec.h> //瀹炵幇闊宠棰戠殑缂栬В鐮佸姛鑳� +#include <libavformat/avformat.h> //瀹炵幇闊宠棰戞枃浠剁殑璇诲彇鍜屽啓鍏ュ姛鑳斤紝鏀寔澶氱闊宠棰戞牸寮� +#include <libavfilter/avfilter.h> +#include <libswscale/swscale.h> +#include <libavutil/frame.h> +#include <libavutil/imgutils.h> +} + +// 寮曞叆SDL2澶存枃浠� +//extern "C" +//{ +// #include "SDL.h" +//} + +#include <QObject> +#include <QMutex> +#include <QImage> + +class QFFmpeg : public QObject +{ + Q_OBJECT +public: + explicit QFFmpeg(QObject *parent = 0); + ~QFFmpeg(); + + bool Init(); // 鍒濆鍖� + void Play(); // 鎾斁 + + void SetUrl(QString url){this->url=url;} // 璁剧疆瑙嗛婧� + + QString Url()const{return url;} + int VideoWidth()const{return videoWidth;} + int VideoHeight()const{return videoHeight;} + void SetIndex(int x){this->index=x;} + +private: + QMutex mutex; + AVPicture pAVPicture; + AVFormatContext *pAVFormatContext; + AVCodecContext *pAVCodecContext; + AVFrame *pAVFrame; + SwsContext * pSwsContext; + AVPacket pAVPacket; + + QString url; + int videoWidth; + int videoHeight; + int videoStreamIndex; + int index; + + // SDL鐩稿叧 +// SDL_Window *sdlWindow; +// SDL_Renderer *sdlRenderer; +// SDL_Texture *sdlTexture; + +signals: + void GetImage(const QImage &image,int x); // 鍙戦�佽В鐮佸悗鐨勫浘鍍忎俊鍙� + +}; + +#endif // QFFMPEG_H -- Gitblit v1.8.0