reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

ofVideoPlayer.h
Go to the documentation of this file.
1#pragma once
2
3#include "ofTexture.h"
4#include "ofVideoBaseTypes.h"
5#include "ofConstants.h"
6
7
8//---------------------------------------------
10
11 public:
12
14
15
16 bool load(std::string name);
17 void loadAsync(std::string name);
18 OF_DEPRECATED_MSG("Use load instead",bool loadMovie(std::string name));
19
20
26 std::string getMoviePath() const;
27
28 bool setPixelFormat(ofPixelFormat pixelFormat);
30
36 void closeMovie();
42 void close();
43
48 void update();
49 void play();
50 void stop();
51
52 bool isFrameNew() const;
54 const ofPixels& getPixels() const;
55 OF_DEPRECATED_MSG("Use getPixels() instead", ofPixels& getPixelsRef());
56 OF_DEPRECATED_MSG("Use getPixels() instead", const ofPixels& getPixelsRef() const);
57 float getPosition() const;
58 float getSpeed() const;
59 float getDuration() const;
60 bool getIsMovieDone() const;
61
62 void setPosition(float pct);
63 void setVolume(float volume);
64 void setLoopState(ofLoopType state);
66 void setSpeed(float speed);
67 void setFrame(int frame);
68
69 void setUseTexture(bool bUse);
70 bool isUsingTexture() const;
72 const ofTexture & getTexture() const;
73 OF_DEPRECATED_MSG("Use getTexture",ofTexture & getTextureReference());
74 OF_DEPRECATED_MSG("Use getTexture",const ofTexture & getTextureReference() const);
75 std::vector<ofTexture> & getTexturePlanes();
76 const std::vector<ofTexture> & getTexturePlanes() const;
77 void draw(float x, float y, float w, float h) const;
78 void draw(float x, float y) const;
87 void bind() const;
94 void unbind() const;
95
96 void setAnchorPercent(float xPct, float yPct);
97 void setAnchorPoint(float x, float y);
98 void resetAnchor();
99
100 void setPaused(bool bPause);
101
102 int getCurrentFrame() const;
103 int getTotalNumFrames() const;
104
105 void firstFrame();
106 void nextFrame();
107 void previousFrame();
108
109 float getHeight() const;
110 float getWidth() const;
111
112 bool isPaused() const;
113 bool isLoaded() const;
114 bool isPlaying() const;
115 bool isInitialized() const;
116
125 void setPlayer(std::shared_ptr<ofBaseVideoPlayer> newPlayer);
134 std::shared_ptr<ofBaseVideoPlayer> getPlayer();
143 const std::shared_ptr<ofBaseVideoPlayer> getPlayer() const;
144
152 template<typename PlayerType>
153 std::shared_ptr<PlayerType> getPlayer(){
154 return std::dynamic_pointer_cast<PlayerType>(getPlayer());
155 }
156
164 template<typename PlayerType>
165 const std::shared_ptr<PlayerType> getPlayer() const{
166 return std::dynamic_pointer_cast<PlayerType>(getPlayer());
167 }
168
169 private:
171 void initDefaultPlayer();
173 std::shared_ptr<ofBaseVideoPlayer> player;
175 std::vector<ofTexture> tex;
182 ofTexture * playerTex;
184 bool bUseTexture;
186 mutable ofPixelFormat internalPixelFormat;
188 std::string moviePath;
189};
virtual void draw(float x, float y) const
Draw at a position at the native size.
Definition ofGraphicsBaseTypes.h:150
A base class representing a drawable video source.
Definition ofVideoBaseTypes.h:103
A wrapper class for an OpenGL texture.
Definition ofTexture.h:253
Definition ofVideoPlayer.h:9
float getWidth() const
Get the width.
Definition ofVideoPlayer.cpp:492
bool getIsMovieDone() const
Definition ofVideoPlayer.cpp:372
float getPosition() const
Definition ofVideoPlayer.cpp:355
void stop()
Definition ofVideoPlayer.cpp:297
float getDuration() const
Definition ofVideoPlayer.cpp:346
ofPixels & getPixels()
Get a reference to the underlying ofPixels.
Definition ofVideoPlayer.cpp:172
ofVideoPlayer()
Definition ofVideoPlayer.cpp:59
int getCurrentFrame() const
Definition ofVideoPlayer.cpp:363
OF_DEPRECATED_MSG("Use getTexture", ofTexture &getTextureReference())
float getSpeed() const
Definition ofVideoPlayer.cpp:408
bool isFrameNew() const
Definition ofVideoPlayer.cpp:239
bool isPlaying() const
Definition ofVideoPlayer.cpp:526
float getHeight() const
Get the height.
Definition ofVideoPlayer.cpp:501
void setAnchorPoint(float x, float y)
Set the anchor point the item is drawn around in pixels.
Definition ofVideoPlayer.cpp:447
void setFrame(int frame)
Definition ofVideoPlayer.cpp:338
std::vector< ofTexture > & getTexturePlanes()
Definition ofVideoPlayer.cpp:220
std::shared_ptr< PlayerType > getPlayer()
Get a pointer to the internal video player implementation.
Definition ofVideoPlayer.h:153
void previousFrame()
Definition ofVideoPlayer.cpp:394
bool isInitialized() const
Determine if the video source is initialized.
Definition ofVideoPlayer.cpp:534
OF_DEPRECATED_MSG("Use load instead", bool loadMovie(std::string name))
bool isUsingTexture() const
Definition ofVideoPlayer.cpp:437
void setLoopState(ofLoopType state)
Definition ofVideoPlayer.cpp:316
bool isPaused() const
Definition ofVideoPlayer.cpp:510
void draw(float x, float y, float w, float h) const
Draw at a position with the specified size.
Definition ofVideoPlayer.cpp:457
void setPosition(float pct)
Definition ofVideoPlayer.cpp:331
bool isLoaded() const
Definition ofVideoPlayer.cpp:518
ofPixelFormat getPixelFormat() const
Definition ofVideoPlayer.cpp:110
void resetAnchor()
Reset the anchor point to (0, 0).
Definition ofVideoPlayer.cpp:452
void setPaused(bool bPause)
Definition ofVideoPlayer.cpp:416
void setAnchorPercent(float xPct, float yPct)
Set the anchor point the item is drawn around as a percentage.
Definition ofVideoPlayer.cpp:442
bool load(std::string name)
Definition ofVideoPlayer.cpp:118
void setUseTexture(bool bUse)
Enable or disable internal ofTexture use.
Definition ofVideoPlayer.cpp:423
OF_DEPRECATED_MSG("Use getPixels() instead", const ofPixels &getPixelsRef() const)
void nextFrame()
Definition ofVideoPlayer.cpp:387
int getTotalNumFrames() const
Definition ofVideoPlayer.cpp:484
const std::shared_ptr< PlayerType > getPlayer() const
Get a const pointer to the internal video player implementation.
Definition ofVideoPlayer.h:165
void unbind() const
Unbinds the video texture from the current rendering context.
Definition ofVideoPlayer.cpp:476
void update()
Update the video player's internal state to continue playback.
Definition ofVideoPlayer.cpp:247
OF_DEPRECATED_MSG("Use getTexture", const ofTexture &getTextureReference() const)
bool setPixelFormat(ofPixelFormat pixelFormat)
Set the requested ofPixelFormat.
Definition ofVideoPlayer.cpp:89
void play()
Definition ofVideoPlayer.cpp:290
std::string getMoviePath() const
Get the path to the loaded video file.
Definition ofVideoPlayer.cpp:167
OF_DEPRECATED_MSG("Use getPixels() instead", ofPixels &getPixelsRef())
ofLoopType getLoopState() const
Definition ofVideoPlayer.cpp:322
void loadAsync(std::string name)
Definition ofVideoPlayer.cpp:151
std::shared_ptr< ofBaseVideoPlayer > getPlayer()
Get a pointer to the internal video player implementation.
Definition ofVideoPlayer.cpp:74
void setVolume(float volume)
Definition ofVideoPlayer.cpp:304
void closeMovie()
Closes the movie file and releases its resources.
Definition ofVideoPlayer.cpp:277
void setPlayer(std::shared_ptr< ofBaseVideoPlayer > newPlayer)
Set the internal video player implementation.
Definition ofVideoPlayer.cpp:67
void setSpeed(float speed)
Definition ofVideoPlayer.cpp:401
void firstFrame()
Definition ofVideoPlayer.cpp:380
void bind() const
Binds the video texture to the current rendering context.
Definition ofVideoPlayer.cpp:468
ofTexture & getTexture()
Definition ofVideoPlayer.cpp:192
void close()
Closes the movie file releases its resources.
Definition ofVideoPlayer.cpp:282
ofPixelFormat
Used to represent the available pixel formats.
Definition ofPixels.h:68
ofLoopType
Used to represent the available video looping modes.
Definition ofVideoBaseTypes.h:11