You.i Engine
YiVideoSurfaceView.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_VIDEO_SURFACE_VIEW_H_
3 #define _YI_VIDEO_SURFACE_VIEW_H_
4 
5 #include "utility/YiColor.h"
6 #include "utility/YiTime.h"
7 #include "view/YiSceneView.h"
8 
9 class CYIAssetTexture;
10 class CYIClosedCaptionsSceneNode;
12 class CYISceneNode;
13 class CYIVideoSurface;
15 
33 {
34 public:
38  enum class FitMode
39  {
41  };
42 
45 
46  virtual bool Init() override;
47 
62  void SetVideoSurface(CYIVideoSurface *pVideoSurface);
63 
70  void ResizePlatformSurface();
71 
72 protected:
76  static bool ApplyVideoToNode(CYISceneNode *pVideoNode, CYIVideoSurfaceTexture *pVideoSurface);
77 
81  float GetViewWorldAspectRatio() const;
82 
86  float GetVideoAspectRatio() const;
87 
88  virtual bool OnFrameTimeUpdated(std::chrono::microseconds frameTime) override;
89 
90 private:
91  void SurfaceSizeChanged(const glm::ivec2 &surfaceSize);
92 
98  void LetterboxVideo(float videoAspectRatio, float viewAspectRatio);
99 
100  CYIVideoSurface *m_pVideoSurface;
101  CYIClosedCaptionsSceneNode *m_pClosedCaptionsNode;
102  CYISceneNode *m_pVideoNode;
103  bool m_renderingToTexture;
104 
105  FitMode m_fitMode;
106 
108 };
109 
110 #endif // _YI_VIDEO_SURFACE_VIEW_H_
The base class for all view types. Views are containers of renderable elements that often define inte...
Definition: YiSceneView.h:47
A texture asset representing an image which will be loaded into the GPU.
Definition: YiAssetTexture.h:22
static bool ApplyVideoToNode(CYISceneNode *pVideoNode, CYIVideoSurfaceTexture *pVideoSurface)
void SetVideoSurface(CYIVideoSurface *pVideoSurface)
FitMode
Specifies how the video frame will be made to fit the view when the video aspect ratio is different f...
Definition: YiVideoSurfaceView.h:38
float GetViewWorldAspectRatio() const
Definition: YiTime.h:28
virtual bool OnFrameTimeUpdated(std::chrono::microseconds frameTime) override
A scene node is the base type for all nodes which are used by the scene manager; it is an integral pa...
Definition: YiSceneNode.h:99
virtual bool Init() override
Definition: YiPerspectiveCameraSceneNode.h:39
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:257
Representation of a CYIAbstractVideoPlayer's video surface, if the player is rendering to a texture...
Definition: YiVideoSurfaceTexture.h:17
void ResizePlatformSurface()
Representation of a CYIAbstractVideoPlayer's video surface.
Definition: YiVideoSurface.h:34
float GetVideoAspectRatio() const
View representation of a CYIAbstractVideoPlayer's CYIVideoSurface.
Definition: YiVideoSurfaceView.h:32