Vuo  2.0.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
VuoVideoPlayer Class Reference

Description

Video playback using a decoder to read video.

Definition at line 28 of file VuoVideoPlayer.h.

Public Member Functions

void Destroy ()
 Release resources used by this player instance. More...
 
void SetVideoDelegate (void(*func)(VuoVideoFrame))
 Set the pointer to the static function that will be called when a new video frame is available. More...
 
void SetAudioDelegate (void(*func)(VuoList_VuoAudioSamples))
 Set the pointer to the static function that will be called when a new audio frame is available. More...
 
void SetFinishedDelegate (void(*func)())
 Set the pointer to the static function that will be called when playback reaches the final frame (or first frame if playback rate is negative). More...
 
void SetPlaybackRate (double rate)
 Set the playback speed. Can be negative or positive. Events to videoFrameReceivedDelegate will be sent at a rate of video fps * rate. More...
 
void Play ()
 Returns true if media contains audio, false otherwise. More...
 
void Pause ()
 Stop playback (but don't move the playhead). More...
 
bool Seek (double second) VuoWarnUnusedResult
 Seek to a position in the video track. More...
 
double GetCurrentTimestamp ()
 Returns the last decoded video frame timestamp. More...
 
double GetLastFrameDelta ()
 Returns the last frame delta (current frame timestamp - last frame timestamp). This is not guaranteed to be accurate to the framerate, as video can have variable rates. More...
 
double GetDuration ()
 Returns the duration in seconds of the video associated with this player. More...
 
bool GetCurrentVideoFrame (VuoVideoFrame *frame) VuoWarnUnusedResult
 Get the last decoded image. More...
 
bool GetVideoFrameAtSecond (double second, VuoVideoFrame *videoFrame) VuoWarnUnusedResult
 Get a video frame at the requested second. More...
 
unsigned int GetAudioChannels ()
 Return the number of audio channels available. More...
 
bool IsReady ()
 True if the video is loaded and ready to play, else false. If false, some values may not yet be available (duration, channel counts, etc) More...
 
bool IsPlaying ()
 True if the player is running, false otherwise. More...
 
bool NextVideoFrame (VuoVideoFrame *frame) VuoWarnUnusedResult
 Get the next video frame. Always false if currently playing. More...
 
bool NextAudioFrame (VuoAudioFrame *frame) VuoWarnUnusedResult
 Get the next audio frame. Always false if currently playing. More...
 

Static Public Member Functions

static VuoVideoPlayerCreate (VuoUrl url, VuoVideoOptimization optimization)
 Create a new video player instance. More...
 

Public Attributes

VuoUrl videoPath
 The path to the movie file. More...
 
void(* videoFrameReceivedDelegate )(VuoVideoFrame)
 Delegate to call when a new video frame is available. More...
 
void(* audioFrameReceivedDelegate )(VuoList_VuoAudioSamples)
 Delegate to call when a new audio frame is available. More...
 
void(* videoPlaybackFinishedDelegate )(void)
 Delegate to call when video playback completes or loops. More...
 
VuoLoopType loop
 What to do when playback is finished. More...
 

Member Function Documentation

◆ Create()

VuoVideoPlayer * VuoVideoPlayer::Create ( VuoUrl  url,
VuoVideoOptimization  optimization 
)
static

Create a new video player instance.

If url is not found, or the media is playable Create will return null and clean up any resources allocated in the process.

if optimization is set to forward or auto, assume forward playback.

Definition at line 39 of file VuoVideoPlayer.cc.

◆ Destroy()

void VuoVideoPlayer::Destroy ( )

Release resources used by this player instance.

wait til ondecoderplaybackready is invoked before destroying things.

Definition at line 106 of file VuoVideoPlayer.cc.

◆ GetAudioChannels()

unsigned int VuoVideoPlayer::GetAudioChannels ( )

Return the number of audio channels available.

Definition at line 408 of file VuoVideoPlayer.cc.

◆ GetCurrentTimestamp()

double VuoVideoPlayer::GetCurrentTimestamp ( )

Returns the last decoded video frame timestamp.

Definition at line 386 of file VuoVideoPlayer.cc.

◆ GetCurrentVideoFrame()

bool VuoVideoPlayer::GetCurrentVideoFrame ( VuoVideoFrame frame)

Get the last decoded image.

This may be null, and will return false in the event that no frame is available. Images associated with returned frames have a retain count of 1.

Definition at line 505 of file VuoVideoPlayer.cc.

◆ GetDuration()

double VuoVideoPlayer::GetDuration ( )

Returns the duration in seconds of the video associated with this player.

if ffmpeg didn't load, let avfoundation think about it before returning

Definition at line 391 of file VuoVideoPlayer.cc.

◆ GetLastFrameDelta()

double VuoVideoPlayer::GetLastFrameDelta ( )

Returns the last frame delta (current frame timestamp - last frame timestamp). This is not guaranteed to be accurate to the framerate, as video can have variable rates.

Definition at line 381 of file VuoVideoPlayer.cc.

◆ GetVideoFrameAtSecond()

bool VuoVideoPlayer::GetVideoFrameAtSecond ( double  second,
VuoVideoFrame videoFrame 
)

Get a video frame at the requested second.

Definition at line 424 of file VuoVideoPlayer.cc.

◆ IsPlaying()

bool VuoVideoPlayer::IsPlaying ( )
inline

True if the player is running, false otherwise.

Definition at line 244 of file VuoVideoPlayer.h.

◆ IsReady()

bool VuoVideoPlayer::IsReady ( )

True if the video is loaded and ready to play, else false. If false, some values may not yet be available (duration, channel counts, etc)

Definition at line 158 of file VuoVideoPlayer.cc.

◆ NextAudioFrame()

bool VuoVideoPlayer::NextAudioFrame ( VuoAudioFrame frame)

Get the next audio frame. Always false if currently playing.

Definition at line 526 of file VuoVideoPlayer.cc.

◆ NextVideoFrame()

bool VuoVideoPlayer::NextVideoFrame ( VuoVideoFrame frame)

Get the next video frame. Always false if currently playing.

Definition at line 518 of file VuoVideoPlayer.cc.

◆ Pause()

void VuoVideoPlayer::Pause ( )

Stop playback (but don't move the playhead).

Definition at line 262 of file VuoVideoPlayer.cc.

◆ Play()

void VuoVideoPlayer::Play ( )

Returns true if media contains audio, false otherwise.

Begins decoding and sending video/audio frames through delegates.

Definition at line 241 of file VuoVideoPlayer.cc.

◆ Seek()

bool VuoVideoPlayer::Seek ( double  second)

Seek to a position in the video track.

0 is always the start of playback. second will be clamped to 0 ≤ second ≤ duration.

Definition at line 286 of file VuoVideoPlayer.cc.

◆ SetAudioDelegate()

void VuoVideoPlayer::SetAudioDelegate ( void(*)(VuoList_VuoAudioSamples func)
inline

Set the pointer to the static function that will be called when a new audio frame is available.

Definition at line 205 of file VuoVideoPlayer.h.

◆ SetFinishedDelegate()

void VuoVideoPlayer::SetFinishedDelegate ( void(*)()  func)
inline

Set the pointer to the static function that will be called when playback reaches the final frame (or first frame if playback rate is negative).

Definition at line 213 of file VuoVideoPlayer.h.

◆ SetPlaybackRate()

void VuoVideoPlayer::SetPlaybackRate ( double  rate)

Set the playback speed. Can be negative or positive. Events to videoFrameReceivedDelegate will be sent at a rate of video fps * rate.

Definition at line 272 of file VuoVideoPlayer.cc.

◆ SetVideoDelegate()

void VuoVideoPlayer::SetVideoDelegate ( void(*)(VuoVideoFrame func)
inline

Set the pointer to the static function that will be called when a new video frame is available.

The player handles timing.

Definition at line 198 of file VuoVideoPlayer.h.

Member Data Documentation

◆ audioFrameReceivedDelegate

void(* VuoVideoPlayer::audioFrameReceivedDelegate) (VuoList_VuoAudioSamples)

Delegate to call when a new audio frame is available.

Definition at line 184 of file VuoVideoPlayer.h.

◆ loop

VuoLoopType VuoVideoPlayer::loop

What to do when playback is finished.

Definition at line 192 of file VuoVideoPlayer.h.

◆ videoFrameReceivedDelegate

void(* VuoVideoPlayer::videoFrameReceivedDelegate) (VuoVideoFrame)

Delegate to call when a new video frame is available.

Definition at line 181 of file VuoVideoPlayer.h.

◆ videoPath

VuoUrl VuoVideoPlayer::videoPath

The path to the movie file.

Definition at line 178 of file VuoVideoPlayer.h.

◆ videoPlaybackFinishedDelegate

void(* VuoVideoPlayer::videoPlaybackFinishedDelegate) (void)

Delegate to call when video playback completes or loops.

Note that this is only called when making use of the VuoVideoPlayer playback functionality - that is, if you're stepping and seeking frames manually this event will not fire.

Definition at line 189 of file VuoVideoPlayer.h.


The documentation for this class was generated from the following files: