| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #pragma once
- #include "WallpaperEngine/Core/CVideo.h"
- #include "WallpaperEngine/Render/CWallpaper.h"
- extern "C"
- {
- #include <libavcodec/avcodec.h>
- #include <libavformat/avformat.h>
- #include <libavutil/imgutils.h>
- #include <libswscale/swscale.h>
- }
- namespace WallpaperEngine::Render
- {
- class CVideo : public CWallpaper
- {
- public:
- CVideo (Core::CVideo* video, CContainer* container);
- void render () override;
- Core::CVideo* getVideo ();
- protected:
- friend class CWallpaper;
- static const std::string Type;
- private:
- void setSize (int width, int height);
- void restartStream ();
- void getNextFrame ();
- void writeFrameToImage ();
- AVFormatContext* m_formatCtx = nullptr;
- AVCodecContext* m_codecCtx = nullptr;
- AVFrame* m_videoFrame = nullptr;
- AVFrame* m_videoFrameRGB = nullptr;
- SwsContext* m_swsCtx = nullptr;
- uint8_t* m_buffer = nullptr;
- int m_videoStream = -1, m_audioStream = -1;
- };
- };
|