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  typedef GLPolygon _BaseClass;
99 
100  /** Create a new GlsMovieTexture.
101  * \param generateInstance Whether or not to generate an instance name
102  * for this inputdevice */
103  GLSGEN_GLSMOVIETEXTURE_EXPORT GlsMovieTexture( bool generateInstance = false );
104 
105  GLSGEN_GLSMOVIETEXTURE_EXPORT GlsMovieTexture( const GlsMovieTexture& that, const bool generateNames );
106 
107  /** Destructs a GlsMovieTexture object */
108  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT ~GlsMovieTexture();
109 
110  static GLSGEN_GLSMOVIETEXTURE_EXPORT DisplayObject* CreateInstance();
111 
112  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void SetAvailableAttributes( unsigned int value );
113 
114  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT DisplayObject* CloneObject( bool generateNames = false );
115 
116  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void CopyProperties( DisplayObject* src );
117 
118  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT InterfaceListType* GetCppInterfaceDescription( InterfaceListType* addToThisList = NULL );
119  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void GetCppInterfaceDescriptionFree( InterfaceListType* array );
120 
121  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void PreDraw( const OpenGLMatrices& parentMatrices, Culler& culler );
122  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Draw( void );
123  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Calculate( double time );
124 
125  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void SetValue( int spec, va_list& args );
126 
127  //////////////////////////////////////////////////
128  // GlsMovieTexture specific operations
129  //////////////////////////////////////////////////
130  /** Sets the desired video source file */
131  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void MovieSource( const GlsPropString& s );
132  /** Gets the capture device index */
133  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT GlsPropString MovieSource();
134 
135  /** 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. */
136  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Loop( const bool& should_loop );
137  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT bool Loop();
138 
139  /** Sets the playing state of the movie. should_play == false is equivalent to STOP */
140  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Playing( const bool& should_play );
141  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT bool Playing();
142 
143  /** Sets the paused state of the movie. */
144  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void Paused( const bool& should_pause );
145  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT bool Paused();
146 
147  /** Sets the position of the stream pointer by percent. */
148  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void PlayPosition( const float& pct );
149  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT float PlayPosition();
150 
151  /** Sets the position of the stream pointer by frame number. */
152  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void CurrentAbsoluteFrame( const unsigned int& frame );
153  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT unsigned int CurrentAbsoluteFrame();
154 
155  /** Sets the audio playback behavior. */
156  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void SoundEnabled( const bool& soundon );
157  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT bool SoundEnabled();
158 
159  /** Sets the audio volume */
160  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT void SoundVolume( const float& volume );
161  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT float SoundVolume();
162 
163  /** Gets the length of the movie (in milliseconds). */
164  virtual GLSGEN_GLSMOVIETEXTURE_EXPORT int DurationInMS();
165 
166 protected:
167  // Stores the name of the movie file
168  GlsPropString _movieFile;
169 
170  // States whether sound should be enabled or not
171  bool _soundEnabled;
172 
173  // Controls colume of sound (from 0.0f to 1.0f)
174  float _soundVolume;
175 
176  // Stores the current play position percent
177  float _playPositionPercent;
178 
179  // Stores the previous play position percent
180  float _previousPlayPositionPercent;
181 
182  // Stores the current frame of the movie
183  unsigned int _currentAbsoluteFrame;
184 
185  // Stores the previous frame count
186  unsigned int _previousAbsoluteFrame;
187 
188  // Instance of CVideoTexture class that interfaces with D3D
189  CVideoTexture* _vidTex;
190 };
191 
192 } // namespace disti
193 
194 #endif
Definition: cull.h:49
virtual void Playing(const bool &should_play)
virtual void SoundEnabled(const bool &soundon)
Definition: dynamic_array.h:62
virtual void CurrentAbsoluteFrame(const unsigned int &frame)
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:301
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:1213
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