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 #define LIB_BASE_NAME "gls_movie_texture"
59 #include "gls_auto_lib.h"
60 #undef LIB_BASE_NAME
61 
62 // Force inclusion of the DirectShow library
63 #ifndef NO_GLS_AUTOLIB
64 # define LIB_BASE_NAME "strmbase"
65 # ifdef GLS_LIB_TYPE
66 # undef GLS_LIB_TYPE
67 # endif
68 # define GLS_LIB_TYPE ""
69 # include "gls_auto_lib.h"
70 # undef GLS_LIB_TYPE
71 # undef LIB_BASE_NAME
72 #endif
73 
74 class CVideoTexture;
75 
76 namespace disti
77 {
78 // SetValue enumerations
79 enum
80 {
81  GLS_GLSMOVIETEXTURE_FIRST_VALUE = GLS_LAST_INITIALIZER + 1,
82  GLS_GLSMOVIETEXTURE_MOVIESOURCE,
83  GLS_GLSMOVIETEXTURE_LOOP,
84  GLS_GLSMOVIETEXTURE_SOUNDENABLED,
85  GLS_GLSMOVIETEXTURE_SOUNDVOLUME
86 };
87 
88 /** Runtime implementation of a GlsMovieTexture */
89 class GlsMovieTexture : public GLPolygon
90 {
91  friend class GlsMovieTextureEditor;
92 
93 private:
94  GlsMovieTexture& operator=( const GlsMovieTexture& ) DISTI_SPECIAL_MEM_FUN_DELETE;
95  GlsMovieTexture( const GlsMovieTexture& ) DISTI_SPECIAL_MEM_FUN_DELETE;
96 
97 public:
98  DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
99  typedef GLPolygon _BaseClass;
100  typedef GLPolygon BaseClass;
101 
102  /** Create a new GlsMovieTexture.
103  * \param generateInstance Whether or not to generate an instance name
104  * for this inputdevice */
105  GLSGEN_GLSMOVIETEXTURE_EXPORT GlsMovieTexture( bool generateInstance = false );
106 
107  GLSGEN_GLSMOVIETEXTURE_EXPORT GlsMovieTexture( const GlsMovieTexture& that, const bool generateNames );
108 
109  /** Destructs a GlsMovieTexture object */
110  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT ~GlsMovieTexture();
111 
112  static GLSGEN_GLSMOVIETEXTURE_EXPORT DisplayObject* CreateInstance();
113 
114  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void SetAvailableAttributes( unsigned int value );
115 
116  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT DisplayObject* CloneObject( bool generateNames = false );
117 
118  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void CopyProperties( DisplayObject* src );
119 
120  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT InterfaceListType* GetCppInterfaceDescription( InterfaceListType* addToThisList = NULL );
121  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void GetCppInterfaceDescriptionFree( InterfaceListType* array );
122 
123  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void PreDraw( const OpenGLMatrices& parentMatrices, Culler& culler );
124  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Draw( void );
125  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Calculate( double time );
126 
127  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void SetValue( int spec, va_list& args );
128 
129  //////////////////////////////////////////////////
130  // GlsMovieTexture specific operations
131  //////////////////////////////////////////////////
132  /** Sets the desired video source file */
133  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void MovieSource( const GlsPropString& s );
134  /** Gets the capture device index */
135  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT GlsPropString MovieSource();
136 
137  /** 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. */
138  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Loop( const bool& should_loop );
139  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT bool Loop();
140 
141  /** Sets the playing state of the movie. should_play == false is equivalent to STOP */
142  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Playing( const bool& should_play );
143  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT bool Playing();
144 
145  /** Sets the paused state of the movie. */
146  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Paused( const bool& should_pause );
147  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT bool Paused();
148 
149  /** Sets the position of the stream pointer by percent. */
150  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void PlayPosition( const float& pct );
151  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT float PlayPosition();
152 
153  /** Sets the position of the stream pointer by frame number. */
154  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void CurrentAbsoluteFrame( const unsigned int& frame );
155  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT unsigned int CurrentAbsoluteFrame();
156 
157  /** Sets the audio playback behavior. */
158  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void SoundEnabled( const bool& soundon );
159  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT bool SoundEnabled();
160 
161  /** Sets the audio volume */
162  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void SoundVolume( const float& volume );
163  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT float SoundVolume();
164 
165  /** Gets the length of the movie (in milliseconds). */
166  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT int DurationInMS();
167 
168 protected:
169  // Stores the name of the movie file
170  GlsPropString _movieFile;
171 
172  // States whether sound should be enabled or not
173  bool _soundEnabled;
174 
175  // Controls colume of sound (from 0.0f to 1.0f)
176  float _soundVolume;
177 
178  // Stores the current play position percent
179  float _playPositionPercent;
180 
181  // Stores the previous play position percent
182  float _previousPlayPositionPercent;
183 
184  // Stores the current frame of the movie
185  unsigned int _currentAbsoluteFrame;
186 
187  // Stores the previous frame count
188  unsigned int _previousAbsoluteFrame;
189 
190  // Instance of CVideoTexture class that interfaces with D3D
191  CVideoTexture* _vidTex;
192 };
193 
194 } // namespace disti
195 
196 #endif
Definition: cull.h:49
virtual void Playing(const bool &should_play)
virtual void SoundEnabled(const bool &soundon)
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:436
Definition: dynamic_array.h:66
virtual void CurrentAbsoluteFrame(const unsigned int &frame)
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:473
virtual void SetAvailableAttributes(unsigned int value)
The Polygon class. Implements Polygons.
Definition: glpolygon.h:55
virtual void CopyProperties(DisplayObject *src)
Definition: display.h:98
The disti::GLPolygon class. Implements Polygons.
virtual DisplayObject * CloneObject(bool generateNames=false)
virtual InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL)
virtual int DurationInMS()
virtual void GetCppInterfaceDescriptionFree(InterfaceListType *array)
virtual GlsPropString MovieSource()
Definition: util.h:1414
virtual void Paused(const bool &should_pause)
virtual void SetValue(int spec, va_list &args)
The gls_auto_lib.
virtual void PlayPosition(const float &pct)
Definition: gls_movie_texture.h:89
virtual void Loop(const bool &should_loop)
virtual void SoundVolume(const float &volume)
virtual void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler)
virtual void Calculate(double time)
Macros and helper code to determine what subset of C++11/14/17 is available.
virtual void Draw(void)
Definition: bmpimage.h:46