| GL Studio C++ Runtime API

gls_movie_texture.h
Go to the documentation of this file.
1/*! \file
2 \brief The GlsMovieTexture class
3
4 \par Copyright Information
5
6 Copyright (c) 2017 by The DiSTI Corporation.<br>
7 11301 Corporate Blvd; Suite 100<br>
8 Orlando, Florida 32817<br>
9 USA<br>
10 <br>
11 All rights reserved.<br>
12
13 This Software contains proprietary trade secrets of DiSTI and may not be
14 reproduced, in whole or part, in any form, or by any means of electronic,
15 mechanical, or otherwise, without the written permission of DiSTI. Said
16 permission may be derived through the purchase of applicable DiSTI product
17 licenses which detail the distribution rights of this content and any
18 Derivative Works based on this or other copyrighted DiSTI Software.
19
20 NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26
27 LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34 EXCEED FIVE DOLLARS (US$5.00).
35
36 The aforementioned terms and restrictions are governed by the laws of the
37 State of Florida and the United States of America.
38
39*/
40#ifndef INCLUDE_GLS_MOVIE_TEXTURE_H
41#define INCLUDE_GLS_MOVIE_TEXTURE_H
42#include "glpolygon.h"
43#include "gls_cpp_lang_support.h"
44
45/// Provides support for creating DLLs.
46#if( defined( GLSGEN_EXPORT_GLSMOVIETEXTURE ) || defined( GLSGEN_IMPORT_GLSMOVIETEXTURE ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
47 && defined( _MSC_VER )
48# if defined( GLSGEN_EXPORT_GLSMOVIETEXTURE ) || defined( GLS_EXPORT_GENERATED )
49# define GLSGEN_GLSMOVIETEXTURE_EXPORT __declspec( dllexport )
50# else
51# define GLSGEN_GLSMOVIETEXTURE_EXPORT __declspec( dllimport )
52# endif
53#else
54# define GLSGEN_GLSMOVIETEXTURE_EXPORT
55#endif
56///////////////////////////////////////////////////////////////////////////////
57
58/// Automatically link the runtime library plugin (on Windows).
59#define LIB_BASE_NAME "gls_movie_texture"
60#include "gls_auto_lib.h"
61#undef LIB_BASE_NAME
62
63/// Force inclusion of the DirectShow library.
64#ifndef NO_GLS_AUTOLIB
65# define LIB_BASE_NAME "strmbase"
66# ifdef GLS_LIB_TYPE
67# undef GLS_LIB_TYPE
68# endif
69/// DirectShow is always statically linked.
70# define GLS_LIB_TYPE ""
71# include "gls_auto_lib.h"
72# undef GLS_LIB_TYPE
73# undef LIB_BASE_NAME
74#endif
75
76 class CVideoTexture;
77
78 namespace disti
79{
80// SetValue enumerations
81 enum
82{
83 GLS_GLSMOVIETEXTURE_FIRST_VALUE = GLS_LAST_INITIALIZER + 1,
84 GLS_GLSMOVIETEXTURE_MOVIESOURCE,
85 GLS_GLSMOVIETEXTURE_LOOP,
86 GLS_GLSMOVIETEXTURE_SOUNDENABLED,
87 GLS_GLSMOVIETEXTURE_SOUNDVOLUME
88};
89
90/** Runtime implementation of a GlsMovieTexture */
91 class GlsMovieTexture : public GLPolygon
92{
93 friend class GlsMovieTextureEditor;
94
95 private:
96 GlsMovieTexture& operator=( const GlsMovieTexture& ) DISTI_SPECIAL_MEM_FUN_DELETE;
97 GlsMovieTexture( const GlsMovieTexture& ) DISTI_SPECIAL_MEM_FUN_DELETE;
98
99 public:
100 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
101 typedef GLPolygon _BaseClass; ///< Deprecated typedef for the base class.
102 typedef GLPolygon BaseClass; ///< Typedef for the base class.
103
104 /// Constructor
105 /// \param generateInstance Whether or not to generate an instance name for this object.
106 GLSGEN_GLSMOVIETEXTURE_EXPORT GlsMovieTexture( bool generateInstance = false );
107
108 /// Copy constructor
109 /// \param that The object to copy from.
110 /// \param generateNames Whether or not to generate an instance name for this object.
111 GLSGEN_GLSMOVIETEXTURE_EXPORT GlsMovieTexture( const GlsMovieTexture& that, const bool generateNames );
112
113 /** Destructs a GlsMovieTexture object */
114 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT ~GlsMovieTexture();
115
116 /// \return A pointer to a new GlsMovieTexture object.
117 static GLSGEN_GLSMOVIETEXTURE_EXPORT DisplayObject* CreateInstance();
118
119 /// \copydoc DisplayObject::SetAvailableAttributes
120 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void SetAvailableAttributes( unsigned int value ) DISTI_METHOD_OVERRIDE;
121 /// \copydoc DisplayObject::CloneObject
122 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT DisplayObject* CloneObject( bool generateNames = false ) DISTI_METHOD_OVERRIDE;
123 /// \copydoc DisplayObject::CopyProperties
124 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void CopyProperties( DisplayObject* src ) DISTI_METHOD_OVERRIDE;
125#ifndef GLES
126 /// \copydoc DisplayObject::GetCppInterfaceDescription
127 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT InterfaceListType* GetCppInterfaceDescription( InterfaceListType* addToThisList = NULL ) DISTI_METHOD_OVERRIDE;
128 /// \copydoc DisplayObject::GetCppInterfaceDescriptionFree
129 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void GetCppInterfaceDescriptionFree( InterfaceListType* array ) DISTI_METHOD_OVERRIDE;
130#endif
131 /// \copydoc DisplayObject::PreDraw
132 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void PreDraw( const OpenGLMatrices& current, Culler& culler ) DISTI_METHOD_OVERRIDE;
133 /// \copydoc DisplayObject::Draw
134 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Draw() DISTI_METHOD_OVERRIDE;
135 /// \copydoc DisplayObject::Calculate
136 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Calculate( double time ) DISTI_METHOD_OVERRIDE;
137 /// \copydoc DisplayObject::SetValue
138 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void SetValue( int spec, va_list& args ) DISTI_METHOD_OVERRIDE;
139
140 //////////////////////////////////////////////////
141 // GlsMovieTexture specific operations
142 //////////////////////////////////////////////////
143
144 /// Sets the desired video source file.
145 /// \param s The path to the video source file to set.
146 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void MovieSource( const GlsPropString& s );
147
148 /// \return The path to the current video source file.
149 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT GlsPropString MovieSource();
150
151 /// Sets the looping state of the movie. should_loop == true will cause the movie to "rewind" and start playing again when the end is reached.
152 /// \param should_loop The new looping state.
153 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Loop( const bool& should_loop );
154
155 /// \return The current looping state of the movie.
156 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT bool Loop();
157
158 /// Sets the playing state of the movie. should_play == false is equivalent to STOP.
159 /// \param should_play The new playing state.
160 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Playing( const bool& should_play );
161
162 /// \return The current playing state of the movie.
163 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT bool Playing();
164
165 /// Sets the paused state of the movie.
166 /// \param should_pause The new paused state.
167 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Paused( const bool& should_pause );
168
169 /// \return The current paused state of the movie.
170 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT bool Paused();
171
172 /// Sets the position of the stream pointer by percent.
173 /// \param pct The new percentage position in playback.
174 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void PlayPosition( const float& pct );
175
176 /// \return The current playback position, in percent.
177 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT float PlayPosition();
178
179 /// Sets the position of the stream pointer by frame number.
180 /// \param frame The absolute frame number to set the playback position.
181 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void CurrentAbsoluteFrame( const unsigned int& frame );
182
183 /// \return The current playback position, in absolute frames.
184 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT unsigned int CurrentAbsoluteFrame();
185
186 /// Sets the audio playback behavior.
187 /// \param soundon The new sound playback state.
188 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void SoundEnabled( const bool& soundon );
189
190 /// \return Whether or not the movie can play sound.
191 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT bool SoundEnabled();
192
193 /// Sets the audio volume from 0.0 to 1.0.
194 /// \param volume The new volume value.
195 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void SoundVolume( const float& volume );
196
197 /// \return The current movie volume from 0.0 to 1.0.
198 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT float SoundVolume();
199
200 /// \return The length of the movie in milliseconds.
201 virtual GLSGEN_GLSMOVIETEXTURE_EXPORT int DurationInMS();
202
203protected:
204 GlsPropString _movieFile; ///< Stores the name of the movie file.
205 bool _soundEnabled; ///< States whether sound should be enabled or not.
206 float _soundVolume; ///< Controls colume of sound (from 0.0f to 1.0f).
207 float _playPositionPercent; ///< Stores the current play position percent.
208 float _previousPlayPositionPercent; ///< Stores the previous play position percent.
209 unsigned int _currentAbsoluteFrame; ///< Stores the current frame of the movie.
210 unsigned int _previousAbsoluteFrame; ///< Stores the previous frame count.
211 CVideoTexture* _vidTex; ///< Instance of CVideoTexture class that interfaces with D3D.
212};
213
214} // namespace disti
215
216#endif
disti::Culler
Definition: cull.h:50
disti::DisplayObject
Definition: display.h:96
disti::DynamicArray
Definition: dynamic_array.h:79
disti::GLPolygon
The Polygon class. Implements Polygons.
Definition: glpolygon.h:56
disti::GlsMovieTexture
Definition: gls_movie_texture.h:92
disti::GlsMovieTexture::SoundVolume
virtual float SoundVolume()
disti::GlsMovieTexture::DurationInMS
virtual int DurationInMS()
disti::GlsMovieTexture::SetAvailableAttributes
virtual void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
disti::GlsMovieTexture::_movieFile
GlsPropString _movieFile
Stores the name of the movie file.
Definition: gls_movie_texture.h:204
disti::GlsMovieTexture::Draw
virtual void Draw() DISTI_METHOD_OVERRIDE
disti::GlsMovieTexture::SoundEnabled
virtual bool SoundEnabled()
disti::GlsMovieTexture::CloneObject
virtual DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
disti::GlsMovieTexture::_previousAbsoluteFrame
unsigned int _previousAbsoluteFrame
Stores the previous frame count.
Definition: gls_movie_texture.h:210
disti::GlsMovieTexture::Playing
virtual bool Playing()
disti::GlsMovieTexture::_vidTex
CVideoTexture * _vidTex
Instance of CVideoTexture class that interfaces with D3D.
Definition: gls_movie_texture.h:211
disti::GlsMovieTexture::CurrentAbsoluteFrame
virtual unsigned int CurrentAbsoluteFrame()
disti::GlsMovieTexture::SetValue
virtual void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
disti::GlsMovieTexture::_soundVolume
float _soundVolume
Controls colume of sound (from 0.0f to 1.0f).
Definition: gls_movie_texture.h:206
disti::GlsMovieTexture::PreDraw
virtual void PreDraw(const OpenGLMatrices &current, Culler &culler) DISTI_METHOD_OVERRIDE
disti::GlsMovieTexture::MovieSource
virtual GlsPropString MovieSource()
disti::GlsMovieTexture::Calculate
virtual void Calculate(double time) DISTI_METHOD_OVERRIDE
disti::GlsMovieTexture::CreateInstance
static DisplayObject * CreateInstance()
disti::GlsMovieTexture::_previousPlayPositionPercent
float _previousPlayPositionPercent
Stores the previous play position percent.
Definition: gls_movie_texture.h:208
disti::GlsMovieTexture::_playPositionPercent
float _playPositionPercent
Stores the current play position percent.
Definition: gls_movie_texture.h:207
disti::GlsMovieTexture::Paused
virtual bool Paused()
disti::GlsMovieTexture::Loop
virtual bool Loop()
disti::GlsMovieTexture::PlayPosition
virtual float PlayPosition()
disti::GlsMovieTexture::_soundEnabled
bool _soundEnabled
States whether sound should be enabled or not.
Definition: gls_movie_texture.h:205
disti::GlsMovieTexture::_currentAbsoluteFrame
unsigned int _currentAbsoluteFrame
Stores the current frame of the movie.
Definition: gls_movie_texture.h:209
disti::GlsMovieTexture::CopyProperties
virtual void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
disti::GlsPropString
Definition: util.h:1607
disti::OpenGLMatrices
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:544
glpolygon.h
The disti::GLPolygon class. Implements Polygons.
gls_auto_lib.h
The gls_auto_lib.
gls_cpp_lang_support.h
Macros and helper code to determine what subset of C++11/14/17 is available.
DISTI_SPECIAL_MEM_FUN_DELETE
#define DISTI_SPECIAL_MEM_FUN_DELETE
Macro to wrap function deletion, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:246
DISTI_DEPRECATED
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:488
DISTI_METHOD_OVERRIDE
#define DISTI_METHOD_OVERRIDE
Macro to wrap the override keyword, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:222
GLSGEN_GLSMOVIETEXTURE_EXPORT
#define GLSGEN_GLSMOVIETEXTURE_EXPORT
Provides support for creating DLLs.
Definition: gls_movie_texture.h:54
disti
Definition: bmpimage.h:47