1 #ifndef OPENMW_MWGUI_VIDEOWIDGET_H
2 #define OPENMW_MWGUI_VIDEOWIDGET_H
3 
4 #include <memory>
5 
6 #include <MyGUI_Widget.h>
7 
8 namespace Video
9 {
10     class VideoPlayer;
11 }
12 
13 namespace VFS
14 {
15     class Manager;
16 }
17 
18 namespace MWGui
19 {
20 
21     /**
22      * Widget that plays a video.
23      */
24     class VideoWidget : public MyGUI::Widget
25     {
26     public:
27         MYGUI_RTTI_DERIVED(VideoWidget)
28 
29         VideoWidget();
30 
31         ~VideoWidget();
32 
33         /// Set the VFS (virtual file system) to find the videos on.
34         void setVFS(const VFS::Manager* vfs);
35 
36         void playVideo (const std::string& video);
37 
38         int getVideoWidth();
39         int getVideoHeight();
40 
41         /// @return Is the video still playing?
42         bool update();
43 
44         /// Return true if a video is currently playing and it has an audio stream.
45         bool hasAudioStream();
46 
47         /// Stop video and free resources (done automatically on destruction)
48         void stop();
49 
50         void pause();
51         void resume();
52         bool isPaused() const;
53 
54         /// Adjust the coordinates of this video widget relative to its parent,
55         /// based on the dimensions of the playing video.
56         /// @param stretch Stretch the video to fill the whole screen? If false,
57         ///                black bars may be added to fix the aspect ratio.
58         void autoResize (bool stretch);
59 
60     private:
61         const VFS::Manager* mVFS;
62         std::unique_ptr<MyGUI::ITexture> mTexture;
63         std::unique_ptr<Video::VideoPlayer> mPlayer;
64     };
65 
66 }
67 
68 #endif
69