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

Classes | |
class | MEDXDeviceManager |
class | METexture |
class | ofMEEventProcessor |
Public Member Functions | |
ofMediaFoundationPlayer () | |
~ofMediaFoundationPlayer () | |
bool | load (std::string name) override |
Load a video resource by name. | |
void | loadAsync (std::string name) override |
Asynchronously load a video resource by name. | |
void | close () override |
Close the video source. | |
bool | isInitialized () const override |
Returns true if a video is loaded. | |
void | update () override |
Update the object's state. | |
bool | isFrameNew () const override |
void | play () override |
Play the video from the current playhead position. | |
void | stop () override |
Pause and reset the playhead position to the first frame. | |
void | setPaused (bool bPause) override |
Set the paused state of the video. | |
bool | isLoaded () const override |
Returns true if a video is loaded. | |
bool | isPlaying () const override |
Returns true if the loaded video is playing. | |
float | getWidth () const override |
Get the width in pixels of the loaded video. | |
float | getHeight () const override |
Get the height in pixels of the loaded video. | |
ofTexture * | getTexturePtr () |
Get a pointer to the video texture used internally if it exists. | |
bool | isPaused () const override |
Returns true if the video is paused. | |
void | setPosition (float pct) override |
Set the position of the playhead. | |
void | setSpeed (float speed) override |
Set the video playback speed. | |
void | setVolume (float volume) override |
Set the volume of the video player. | |
void | setFrame (int frame) override |
Set the current frame by frame number. | |
int | getCurrentFrame () const override |
Get the current playhead position as a frame number. | |
int | getTotalNumFrames () const override |
Get the total number of frames in the currently loaded video. | |
void | setLoopState (ofLoopType state) override |
Set the video loop state. | |
ofLoopType | getLoopState () const override |
Get the current loop state of the video. | |
float | getPosition () const override |
Get the current playhead position of the loaded video. | |
float | getSpeed () const override |
Get the playback speed of the video player. | |
float | getDuration () const override |
Get the duration of the loaded video in seconds. | |
bool | getIsMovieDone () const override |
Returns true if the loaded video has finished playing. | |
bool | hasAudio () |
bool | hasVideo () |
void | firstFrame () override |
Set the playhead position to the first frame. | |
void | nextFrame () override |
Advance the playhead forward one frame. | |
void | previousFrame () override |
Advance the playhead backward one frame. | |
bool | setPixelFormat (ofPixelFormat pixelFormat) override |
Set the requested ofPixelFormat. | |
ofPixelFormat | getPixelFormat () const override |
ofPixels & | getPixels () override |
Get a reference to the underlying ofPixels. | |
const ofPixels & | getPixels () const override |
Get a const reference to the underlying ofPixels. | |
void | setUsingHWAccel (bool ab) |
bool | isUsingHWAccel () |
float | getFrameRate () |
![]() | |
virtual | ~ofBaseVideoPlayer () |
Destroys the ofBaseVideoPlayer. | |
![]() | |
virtual | ~ofBaseVideo () |
Destroy the ofBaseVideo. | |
![]() | |
virtual | ~ofBaseHasPixels_ () |
Destroy the ofAbstractHasPixels. | |
![]() | |
virtual | ~ofAbstractHasPixels () |
Destroy the ofAbstractHasPixels. | |
![]() | |
virtual | ~ofBaseUpdates () |
Destroy the ofBaseUpdates. | |
Static Public Member Functions | |
static std::string | MFEventToString (MF_MEDIA_ENGINE_EVENT aevent) |
static std::string | MFErrorToString (MF_MEDIA_ENGINE_ERR aerror) |
static void | setDurationHackEnabled (bool ab) |
static std::shared_ptr< MEDXDeviceManager > | getDxDeviceManager () |
Public Attributes | |
ofEvent< MF_MEDIA_ENGINE_EVENT > | MFEngineEvent |
ofEvent< MF_MEDIA_ENGINE_ERR > | MFErrorEvent |
Protected Member Functions | |
bool | _load (std::string name, bool abAsync) |
void | OnMediaEngineEvent (DWORD aEvent, DWORD_PTR param1, DWORD param2) override |
void | handleMEEvent (DWORD aevent) |
void | updateDuration () |
Protected Attributes | |
std::shared_ptr< METexture > | mMeTexture |
bool | mBUseHWAccel = true |
bool | mBReady = false |
bool | mBLoaded = false |
bool | mBNewFrame = false |
double | mDuration = 0.0 |
float | mWidth = 0.f |
float | mHeight = 0.f |
bool | mBDone = false |
bool | mBPlaying = false |
bool | mBCanSeek = false |
float | mFramerate = 1.f / 30.f |
int | mEstimatedNumFrames = 1 |
ofPixelFormat | mPixFormat |
ofLoopType | mLoopType = OF_LOOP_NONE |
float | mTargetSeekPercent = -1.0 |
double | mTimeStartedSeek = 0.0 |
double | mTimePlayback = 0.0 |
std::shared_ptr< ofMEEventProcessor > | mEventProcessor |
DXGI_FORMAT | m_d3dFormat = DXGI_FORMAT_B8G8R8A8_UNORM |
Microsoft::WRL::ComPtr< IMFMediaEngine > | m_spMediaEngine |
Microsoft::WRL::ComPtr< IMFMediaEngineEx > | m_spEngineEx |
CRITICAL_SECTION | m_critSec |
std::queue< DWORD > | mEventsQueue |
std::mutex | mMutexEvents |
ofFbo | mFbo |
ofTexture | mCopyTex |
ofPixels | mPixels |
bool | mBUpdatePixels = false |
bool | mBLoadAsync = false |
std::atomic_bool | mBIsDoneAtomic |
std::atomic_bool | mBIsClosedAtomic |
std::condition_variable | mWaitCondition |
Static Protected Attributes | |
static bool | sBAllowDurationHack = true |
static std::shared_ptr< MEDXDeviceManager > | sDeviceManager |
Friends | |
class | ofMediaFoundationSoundPlayer |
Constructor & Destructor Documentation
◆ ofMediaFoundationPlayer()
ofMediaFoundationPlayer::ofMediaFoundationPlayer | ( | ) |
◆ ~ofMediaFoundationPlayer()
ofMediaFoundationPlayer::~ofMediaFoundationPlayer | ( | ) |
Member Function Documentation
◆ _load()
|
protected |
◆ close()
|
overridevirtual |
Close the video source.
Implements ofBaseVideo.
◆ firstFrame()
|
overridevirtual |
Set the playhead position to the first frame.
This is functionally equivalent to setFrame(0) or setPosition(0.0).
Reimplemented from ofBaseVideoPlayer.
◆ getCurrentFrame()
|
overridevirtual |
Get the current playhead position as a frame number.
- Returns
- The current playhead position as a frame number.
Reimplemented from ofBaseVideoPlayer.
◆ getDuration()
|
overridevirtual |
Get the duration of the loaded video in seconds.
- Returns
- The duration of the loaded video in seconds.
Reimplemented from ofBaseVideoPlayer.
◆ getDxDeviceManager()
|
static |
◆ getFrameRate()
|
inline |
◆ getHeight()
|
overridevirtual |
Get the height in pixels of the loaded video.
- Returns
- The height in pixels of the loaded video or 0 if none is loaded.
Implements ofBaseVideoPlayer.
◆ getIsMovieDone()
|
overridevirtual |
Returns true if the loaded video has finished playing.
- Returns
- True if the loaded video has finished playing.
Reimplemented from ofBaseVideoPlayer.
◆ getLoopState()
|
overridevirtual |
◆ getPixelFormat()
|
overridevirtual |
- Returns
- the current ofPixelFormat.
Implements ofBaseVideo.
◆ getPixels() [1/2]
|
overridevirtual |
Get a const reference to the underlying ofPixels.
- Returns
- a const reference the underlying ofPixels.
Implements ofBaseHasPixels_< unsigned char >.
◆ getPixels() [2/2]
|
overridevirtual |
Get a reference to the underlying ofPixels.
- Returns
- a reference the underlying ofPixels.
Implements ofBaseHasPixels_< unsigned char >.
◆ getPosition()
|
overridevirtual |
Get the current playhead position of the loaded video.
This value is a normalized floating point value between 0.0 and 1.0 that represents the position of the playhead. 0.0 maps to the first frame of the loaded video and 1.0 maps to the last frame of the loaded video.
- Returns
- A value between 0.0 and 1.0 representing playhead position.
Reimplemented from ofBaseVideoPlayer.
◆ getSpeed()
|
overridevirtual |
Get the playback speed of the video player.
When the loop state is OF_LOOP_NONE or OF_LOOP_NORMAL, positive speed will scale a forward playback rate while a negative speed will scale a a backward playback rate. When the loop state is OF_LOOP_PALINDROME, the direction of playback will change each loop, but the playback rate will still be scaled by the absolute value of the speed.
- Returns
- The playback speed of the video player.
Reimplemented from ofBaseVideoPlayer.
◆ getTexturePtr()
|
virtual |
Get a pointer to the video texture used internally if it exists.
If the video player implementation supports direct-to-texture rendering, this method will return a pointer to the internal texture. If direct-to-texture rendering is not supported, nullptr is returned.
- Returns
- A valid pointer to the internal texture, otherwise a nullptr.
Reimplemented from ofBaseVideoPlayer.
◆ getTotalNumFrames()
|
overridevirtual |
Get the total number of frames in the currently loaded video.
- Returns
- The total number of frames in the currently loaded video.
Reimplemented from ofBaseVideoPlayer.
◆ getWidth()
|
overridevirtual |
Get the width in pixels of the loaded video.
- Returns
- The width in pixels of the loaded video or 0 if none is loaded.
Implements ofBaseVideoPlayer.
◆ handleMEEvent()
|
protected |
◆ hasAudio()
bool ofMediaFoundationPlayer::hasAudio | ( | ) |
◆ hasVideo()
bool ofMediaFoundationPlayer::hasVideo | ( | ) |
◆ isFrameNew()
|
overridevirtual |
- Returns
- true if the pixel data was updated since the last call to update().
Implements ofBaseVideo.
◆ isInitialized()
|
overridevirtual |
Returns true if a video is loaded.
This is helpful when loading a video with loadAsync(). This is also an alias of isLoaded().
- See also
- loadAsync()
- Returns
- True if a video is loaded.
Reimplemented from ofBaseVideoPlayer.
◆ isLoaded()
|
overridevirtual |
Returns true if a video is loaded.
This is helpful when loading a video with loadAsync(). This is also an alias of isInitialized().
- See also
- loadAsync()
- Returns
- True if a video is loaded.
Implements ofBaseVideoPlayer.
◆ isPaused()
|
overridevirtual |
Returns true if the video is paused.
- Returns
- True if the video is paused.
Implements ofBaseVideoPlayer.
◆ isPlaying()
|
overridevirtual |
Returns true if the loaded video is playing.
- Returns
- True if the loaded video is playing.
Implements ofBaseVideoPlayer.
◆ isUsingHWAccel()
|
inline |
◆ load()
|
overridevirtual |
Load a video resource by name.
The list of supported video types and sources (e.g. rtsp:// sources) is implementation dependent.
- Parameters
-
name The name of the video resource to load.
- Returns
- True if the video was loaded successfully.
- See also
- loadAsync()
Implements ofBaseVideoPlayer.
◆ loadAsync()
|
overridevirtual |
Asynchronously load a video resource by name.
The list of supported video types and sources (e.g. rtsp:// sources) is implementation dependent.
When this method is used to load a video resouce, users can determine when the video is loaded by calling isLoaded().
- Parameters
-
name The name of the video resource to load.
- See also
- isLoaded()
Reimplemented from ofBaseVideoPlayer.
◆ MFErrorToString()
|
static |
◆ MFEventToString()
|
static |
◆ nextFrame()
|
overridevirtual |
Advance the playhead forward one frame.
This allows the user to advance through the video manually one frame at a time without calling play().
Reimplemented from ofBaseVideoPlayer.
◆ OnMediaEngineEvent()
|
overrideprotectedvirtual |
Implements of::MediaEngineNotifyCallback.
◆ play()
|
overridevirtual |
Play the video from the current playhead position.
- See also
- getPosition()
- setPostion()
Implements ofBaseVideoPlayer.
◆ previousFrame()
|
overridevirtual |
Advance the playhead backward one frame.
This allows the user to advance backward through the video manually one frame at a time without calling play().
Reimplemented from ofBaseVideoPlayer.
◆ setDurationHackEnabled()
|
static |
◆ setFrame()
|
overridevirtual |
Set the current frame by frame number.
Similar to setPosition(), but accepts a frame number instead of a normalized floating point value. Frame count begins with the first frame as 0 and the last frame as getTotalNumFrames() - 1.
- Parameters
-
frame The frame number to set the new playhead to.
Reimplemented from ofBaseVideoPlayer.
◆ setLoopState()
|
overridevirtual |
Set the video loop state.
- Parameters
-
state The loop state of the video.
- See also
- ofLoopType
Reimplemented from ofBaseVideoPlayer.
◆ setPaused()
|
overridevirtual |
Set the paused state of the video.
- Parameters
-
bPause True to pause the video, false to play.
Reimplemented from ofBaseVideoPlayer.
◆ setPixelFormat()
|
overridevirtual |
Set the requested ofPixelFormat.
- Parameters
-
pixelFormat the requested ofPixelFormat.
- Returns
- true if the format was successfully changed.
Implements ofBaseVideo.
◆ setPosition()
|
overridevirtual |
Set the position of the playhead.
This value is a normalized floating point value between 0.0 and 1.0 that represents the position of the playhead. 0.0 maps to the first frame of the loaded video and 1.0 maps to the last frame of the loaded video.
- Parameters
-
pct A value between 0.0 and 1.0 representing playhead position.
Reimplemented from ofBaseVideoPlayer.
◆ setSpeed()
|
overridevirtual |
Set the video playback speed.
When the loop state is OF_LOOP_NONE or OF_LOOP_NORMAL, positive speed will scale a forward playback rate while a negative speed will scale a a backward playback rate. When the loop state is OF_LOOP_PALINDROME, the direction of playback will change each loop, but the playback rate will still be scaled by the absolute value of the speed.
To play a video forward at normal speed, set the loop state to OF_LOOP_NONE or OF_LOOP_NORMAL and a speed of 1.0. To double the playback rate, set the speed to 2.0. To play a video backward, set the speed to a negative number. A speed 0.25 will play the video at 1/4 the the normal rate and a rate of 0.0 will effectively stop playback.
- Parameters
-
speed The desired playback speed of the video.
Reimplemented from ofBaseVideoPlayer.
◆ setUsingHWAccel()
|
inline |
◆ setVolume()
|
overridevirtual |
Set the volume of the video player.
This value is a normalized floating point value between 0.0 and 1.0 that represents the video player volume. 0.0 maps to silence and 1.0 maps to maximum volume.
- Parameters
-
volume A value between 0.0 and 1.0 representing volume.
Reimplemented from ofBaseVideoPlayer.
◆ stop()
|
overridevirtual |
Pause and reset the playhead position to the first frame.
Implements ofBaseVideoPlayer.
◆ update()
|
overridevirtual |
Update the object's state.
Implements ofBaseUpdates.
◆ updateDuration()
|
protected |
Friends And Related Symbol Documentation
◆ ofMediaFoundationSoundPlayer
|
friend |
Member Data Documentation
◆ m_critSec
|
protected |
◆ m_d3dFormat
|
protected |
◆ m_spEngineEx
|
protected |
◆ m_spMediaEngine
|
protected |
◆ mBCanSeek
|
protected |
◆ mBDone
|
protected |
◆ mBIsClosedAtomic
|
protected |
◆ mBIsDoneAtomic
|
protected |
◆ mBLoadAsync
|
protected |
◆ mBLoaded
|
protected |
◆ mBNewFrame
|
protected |
◆ mBPlaying
|
protected |
◆ mBReady
|
protected |
◆ mBUpdatePixels
|
mutableprotected |
◆ mBUseHWAccel
|
protected |
◆ mCopyTex
|
protected |
◆ mDuration
|
mutableprotected |
◆ mEstimatedNumFrames
|
protected |
◆ mEventProcessor
|
protected |
◆ mEventsQueue
|
protected |
◆ mFbo
|
protected |
◆ MFEngineEvent
ofEvent<MF_MEDIA_ENGINE_EVENT> ofMediaFoundationPlayer::MFEngineEvent |
◆ MFErrorEvent
ofEvent<MF_MEDIA_ENGINE_ERR> ofMediaFoundationPlayer::MFErrorEvent |
◆ mFramerate
|
protected |
◆ mHeight
|
protected |
◆ mLoopType
|
protected |
◆ mMeTexture
|
protected |
◆ mMutexEvents
|
protected |
◆ mPixels
|
protected |
◆ mPixFormat
|
protected |
◆ mTargetSeekPercent
|
protected |
◆ mTimePlayback
|
protected |
◆ mTimeStartedSeek
|
protected |
◆ mWaitCondition
|
protected |
◆ mWidth
|
protected |
◆ sBAllowDurationHack
|
staticprotected |
◆ sDeviceManager
|
staticprotected |
The documentation for this class was generated from the following files:
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/video/ofMediaFoundationPlayer.h
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/video/ofMediaFoundationPlayer.cpp