This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
#include <ofVideoPlayer.h>

Public Member Functions | |
ofVideoPlayer () | |
bool | load (std::string name) |
void | loadAsync (std::string name) |
OF_DEPRECATED_MSG ("Use load instead", bool loadMovie(std::string name)) | |
std::string | getMoviePath () const |
Get the path to the loaded video file. | |
bool | setPixelFormat (ofPixelFormat pixelFormat) |
Set the requested ofPixelFormat. | |
ofPixelFormat | getPixelFormat () const |
void | closeMovie () |
Closes the movie file and releases its resources. | |
void | close () |
Closes the movie file releases its resources. | |
void | update () |
Update the video player's internal state to continue playback. | |
void | play () |
void | stop () |
bool | isFrameNew () const |
ofPixels & | getPixels () |
Get a reference to the underlying ofPixels. | |
const ofPixels & | getPixels () const |
Get a const reference to the underlying ofPixels. | |
OF_DEPRECATED_MSG ("Use getPixels() instead", ofPixels &getPixelsRef()) | |
OF_DEPRECATED_MSG ("Use getPixels() instead", const ofPixels &getPixelsRef() const) | |
float | getPosition () const |
float | getSpeed () const |
float | getDuration () const |
bool | getIsMovieDone () const |
void | setPosition (float pct) |
void | setVolume (float volume) |
void | setLoopState (ofLoopType state) |
ofLoopType | getLoopState () const |
void | setSpeed (float speed) |
void | setFrame (int frame) |
void | setUseTexture (bool bUse) |
Enable or disable internal ofTexture use. | |
bool | isUsingTexture () const |
ofTexture & | getTexture () |
const ofTexture & | getTexture () const |
OF_DEPRECATED_MSG ("Use getTexture", ofTexture &getTextureReference()) | |
OF_DEPRECATED_MSG ("Use getTexture", const ofTexture &getTextureReference() const) | |
std::vector< ofTexture > & | getTexturePlanes () |
const std::vector< ofTexture > & | getTexturePlanes () const |
void | draw (float x, float y, float w, float h) const |
Draw at a position with the specified size. | |
void | draw (float x, float y) const |
Draw at a position at the native size. | |
void | bind () const |
Binds the video texture to the current rendering context. | |
void | unbind () const |
Unbinds the video texture from the current rendering context. | |
void | setAnchorPercent (float xPct, float yPct) |
Set the anchor point the item is drawn around as a percentage. | |
void | setAnchorPoint (float x, float y) |
Set the anchor point the item is drawn around in pixels. | |
void | resetAnchor () |
Reset the anchor point to (0, 0). | |
void | setPaused (bool bPause) |
int | getCurrentFrame () const |
int | getTotalNumFrames () const |
void | firstFrame () |
void | nextFrame () |
void | previousFrame () |
float | getHeight () const |
Get the height. | |
float | getWidth () const |
Get the width. | |
bool | isPaused () const |
bool | isLoaded () const |
bool | isPlaying () const |
bool | isInitialized () const |
Determine if the video source is initialized. | |
void | setPlayer (std::shared_ptr< ofBaseVideoPlayer > newPlayer) |
Set the internal video player implementation. | |
std::shared_ptr< ofBaseVideoPlayer > | getPlayer () |
Get a pointer to the internal video player implementation. | |
const std::shared_ptr< ofBaseVideoPlayer > | getPlayer () const |
Get a const pointer to the internal video player implementation. | |
template<typename PlayerType > | |
std::shared_ptr< PlayerType > | getPlayer () |
Get a pointer to the internal video player implementation. | |
template<typename PlayerType > | |
const std::shared_ptr< PlayerType > | getPlayer () const |
Get a const pointer to the internal video player implementation. | |
virtual void | draw (float x, float y) const |
Draw at a position at the native size. | |
virtual void | draw (float x, float y, float w, float h) const=0 |
Draw at a position with the specified size. | |
virtual void | draw (const glm::vec2 &point) const |
Draw at a position at the native size. | |
virtual void | draw (const ofRectangle &rect) const |
Draw at a position and size specified by a rectangle. | |
virtual void | draw (const glm::vec2 &point, float w, float h) const |
Draw at a position. | |
![]() | |
virtual | ~ofBaseVideoDraws () |
Destroy the ofBaseVideoDraws. | |
![]() | |
virtual | ~ofBaseVideo () |
Destroy the ofBaseVideo. | |
![]() | |
virtual | ~ofBaseHasPixels_ () |
Destroy the ofAbstractHasPixels. | |
![]() | |
virtual | ~ofAbstractHasPixels () |
Destroy the ofAbstractHasPixels. | |
![]() | |
virtual | ~ofBaseUpdates () |
Destroy the ofBaseUpdates. | |
![]() | |
virtual | ~ofBaseDraws () |
Destroy the abstract object. | |
![]() | |
virtual | ~ofBaseHasTexturePlanes () |
Destroy the ofBaseHasTexturePlanes. | |
![]() | |
virtual | ~ofBaseHasTexture () |
Destroy the ofBaseHasTexture. | |
Constructor & Destructor Documentation
◆ ofVideoPlayer()
ofVideoPlayer::ofVideoPlayer | ( | ) |
Member Function Documentation
◆ bind()
void ofVideoPlayer::bind | ( | ) | const |
Binds the video texture to the current rendering context.
For advanced users who need to manually manage texture drawing without calling draw(). Only binds the texture if one exists.
◆ close()
|
virtual |
Closes the movie file releases its resources.
This is an alias for closeMovie().
- See also
- closeMovie()
Implements ofBaseVideo.
◆ closeMovie()
void ofVideoPlayer::closeMovie | ( | ) |
◆ draw() [1/7]
|
virtual |
Draw at a position at the native size.
Native size is determined by getWidth() and getHeight().
- Parameters
-
point Draw position.
Reimplemented from ofBaseDraws.
◆ draw() [2/7]
|
virtual |
Draw at a position.
- Parameters
-
point Draw position. w Draw width. h Draw height.
Reimplemented from ofBaseDraws.
◆ draw() [3/7]
|
virtual |
Draw at a position and size specified by a rectangle.
- Parameters
-
rect Draw position and size.
Reimplemented from ofBaseDraws.
◆ draw() [4/7]
|
virtual |
Draw at a position at the native size.
Native size is determined by getWidth() and getHeight().
- Parameters
-
x Draw position on the x axis. y Draw position on the y axis.
Reimplemented from ofBaseDraws.
◆ draw() [5/7]
|
inlinevirtual |
Draw at a position at the native size.
Native size is determined by getWidth() and getHeight().
- Parameters
-
x Draw position on the x axis. y Draw position on the y axis.
Reimplemented from ofBaseDraws.
◆ draw() [6/7]
|
virtual |
Draw at a position with the specified size.
- Parameters
-
x Draw position on the x axis. y Draw position on the y axis. w Draw width. h Draw height.
Implements ofBaseDraws.
◆ draw() [7/7]
|
virtual |
Draw at a position with the specified size.
- Parameters
-
x Draw position on the x axis. y Draw position on the y axis. w Draw width. h Draw height.
Implements ofBaseDraws.
◆ firstFrame()
void ofVideoPlayer::firstFrame | ( | ) |
◆ getCurrentFrame()
int ofVideoPlayer::getCurrentFrame | ( | ) | const |
◆ getDuration()
float ofVideoPlayer::getDuration | ( | ) | const |
◆ getHeight()
|
virtual |
◆ getIsMovieDone()
bool ofVideoPlayer::getIsMovieDone | ( | ) | const |
◆ getLoopState()
ofLoopType ofVideoPlayer::getLoopState | ( | ) | const |
◆ getMoviePath()
string ofVideoPlayer::getMoviePath | ( | ) | const |
Get the path to the loaded video file.
If no video file is loaded this returns an empty string.
- Returns
- A path to the loaded video or an empty string if not loaded.
◆ getPixelFormat()
|
virtual |
- Returns
- the current ofPixelFormat.
Implements ofBaseVideo.
◆ getPixels() [1/2]
|
virtual |
Get a reference to the underlying ofPixels.
- Returns
- a reference the underlying ofPixels.
Implements ofBaseHasPixels_< unsigned char >.
◆ getPixels() [2/2]
|
virtual |
Get a const reference to the underlying ofPixels.
- Returns
- a const reference the underlying ofPixels.
Implements ofBaseHasPixels_< unsigned char >.
◆ getPlayer() [1/4]
shared_ptr< ofBaseVideoPlayer > ofVideoPlayer::getPlayer | ( | ) |
Get a pointer to the internal video player implementation.
This returns a pointer to the ofBaseVideoPlayer interface. For implementation-specfic features, this can be cast to the subtype using dynamic_cast<MyVideoPlayerImplementation>(getPlayer()) or the templated getPlayer<MyVideoPlayerImplementation>() method.
- Returns
- A pointer to the internal video player implementation.
◆ getPlayer() [2/4]
|
inline |
Get a pointer to the internal video player implementation.
Calling getPlayer<MyVideoPlayerImplementation>() is equivalent to dynamic_pointer_cast<MyVideoPlayerImplementation>(getPlayer()).
- Returns
- A pointer to the internal video player implementation or nullptr if the cast fails.
◆ getPlayer() [3/4]
const shared_ptr< ofBaseVideoPlayer > ofVideoPlayer::getPlayer | ( | ) | const |
Get a const pointer to the internal video player implementation.
This returns a pointer to the ofBaseVideoPlayer interface. For implementation-specfic features, this can be cast to the subtype using dynamic_pointer_cast<MyVideoPlayerImplementation>(getPlayer()) or the templated getPlayer<MyVideoPlayerImplementation>() method.
- Returns
- A const pointer to the internal video player implementation.
◆ getPlayer() [4/4]
|
inline |
Get a const pointer to the internal video player implementation.
Calling getPlayer<MyVideoPlayerImplementation>() is equivalent to dynamic_pointer_cast<MyVideoPlayerImplementation>(getPlayer()).
- Returns
- A const pointer to the internal video player implementation or nullptr if the cast fails.
◆ getPosition()
float ofVideoPlayer::getPosition | ( | ) | const |
◆ getSpeed()
float ofVideoPlayer::getSpeed | ( | ) | const |
◆ getTexture() [1/2]
|
virtual |
- Returns
- a reference to the ofTexture.
Implements ofBaseHasTexture.
◆ getTexture() [2/2]
|
virtual |
- Returns
- a const reference to the ofTexture.
Implements ofBaseHasTexture.
◆ getTexturePlanes() [1/2]
|
virtual |
- Returns
- a reference to a std::vector containing the ofTexture planes.
Implements ofBaseHasTexturePlanes.
◆ getTexturePlanes() [2/2]
|
virtual |
- Returns
- a const reference to a std::vector containing the ofTexture planes.
Implements ofBaseHasTexturePlanes.
◆ getTotalNumFrames()
int ofVideoPlayer::getTotalNumFrames | ( | ) | const |
◆ getWidth()
|
virtual |
◆ isFrameNew()
|
virtual |
- Returns
- true if the pixel data was updated since the last call to update().
Implements ofBaseVideo.
◆ isInitialized()
|
virtual |
Determine if the video source is initialized.
Video sources such as cameras are often initialized with a setup() method. Video sources such as movie players are often initialized with a load() method.
- Returns
- true if the video source is initialized.
Implements ofBaseVideo.
◆ isLoaded()
bool ofVideoPlayer::isLoaded | ( | ) | const |
◆ isPaused()
bool ofVideoPlayer::isPaused | ( | ) | const |
◆ isPlaying()
bool ofVideoPlayer::isPlaying | ( | ) | const |
◆ isUsingTexture()
|
virtual |
- Returns
- true if an internal ofTexture is being used.
Implements ofBaseHasTexture.
◆ load()
bool ofVideoPlayer::load | ( | std::string | name | ) |
◆ loadAsync()
void ofVideoPlayer::loadAsync | ( | std::string | name | ) |
◆ nextFrame()
void ofVideoPlayer::nextFrame | ( | ) |
◆ OF_DEPRECATED_MSG() [1/5]
ofVideoPlayer::OF_DEPRECATED_MSG | ( | "Use getPixels() instead" | , |
const ofPixels &getPixelsRef() const | |||
) |
◆ OF_DEPRECATED_MSG() [2/5]
◆ OF_DEPRECATED_MSG() [3/5]
ofVideoPlayer::OF_DEPRECATED_MSG | ( | "Use getTexture" | , |
const ofTexture &getTextureReference() const | |||
) |
◆ OF_DEPRECATED_MSG() [4/5]
ofVideoPlayer::OF_DEPRECATED_MSG | ( | "Use getTexture" | , |
ofTexture & | getTextureReference() | ||
) |
◆ OF_DEPRECATED_MSG() [5/5]
ofVideoPlayer::OF_DEPRECATED_MSG | ( | "Use load instead" | , |
bool | loadMoviestd::string name | ||
) |
◆ play()
void ofVideoPlayer::play | ( | ) |
◆ previousFrame()
void ofVideoPlayer::previousFrame | ( | ) |
◆ resetAnchor()
|
virtual |
Reset the anchor point to (0, 0).
Reimplemented from ofBaseDraws.
◆ setAnchorPercent()
|
virtual |
Set the anchor point the item is drawn around as a percentage.
This can be useful if you want to rotate an image around a particular point.
- Parameters
-
xPct Horizontal position as a percentage (0 - 1). yPct Vertical position as a percentage (0 - 1).
Reimplemented from ofBaseDraws.
◆ setAnchorPoint()
|
virtual |
Set the anchor point the item is drawn around in pixels.
This can be useful if you want to rotate an image around a particular point.
- Parameters
-
x Horizontal texture position in pixels. y Vertical texture position in pixels.
Reimplemented from ofBaseDraws.
◆ setFrame()
void ofVideoPlayer::setFrame | ( | int | frame | ) |
◆ setLoopState()
void ofVideoPlayer::setLoopState | ( | ofLoopType | state | ) |
◆ setPaused()
void ofVideoPlayer::setPaused | ( | bool | bPause | ) |
◆ setPixelFormat()
|
virtual |
Set the requested ofPixelFormat.
- Parameters
-
pixelFormat the requested ofPixelFormat.
- Returns
- true if the format was successfully changed.
Implements ofBaseVideo.
◆ setPlayer()
void ofVideoPlayer::setPlayer | ( | std::shared_ptr< ofBaseVideoPlayer > | newPlayer | ) |
Set the internal video player implementation.
Advanced users may find it useful to set a custom internal video player implementation. The custom video player must implment the ofBaseVideoPlayer interface.
- Parameters
-
newPlayer Shared pointer to the new video player that extends from ofBaseVideoPlayer.
◆ setPosition()
void ofVideoPlayer::setPosition | ( | float | pct | ) |
◆ setSpeed()
void ofVideoPlayer::setSpeed | ( | float | speed | ) |
◆ setUseTexture()
|
virtual |
Enable or disable internal ofTexture use.
- Parameters
-
bUseTex true if an ofTexture should be used.
Implements ofBaseHasTexture.
◆ setVolume()
void ofVideoPlayer::setVolume | ( | float | volume | ) |
◆ stop()
void ofVideoPlayer::stop | ( | ) |
◆ unbind()
void ofVideoPlayer::unbind | ( | ) | const |
Unbinds the video texture from the current rendering context.
For advanced users who need to manually manage texture drawing without calling draw(). Only binds the texture if one exists.
- See also
- ofTexture::unbind()
◆ update()
|
virtual |
Update the video player's internal state to continue playback.
If normal video playback is desired, this method is usually called once per animation frame inside of ofApp::update().
Implements ofBaseUpdates.
The documentation for this class was generated from the following files:
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/video/ofVideoPlayer.h
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/video/ofVideoPlayer.cpp