Vuo  2.0.1
Instance Methods | Class Methods | Protected Attributes | List of all members
VuoAvPlayerObject Class Reference

Description

Internal video player implementation.

Use VuoVideoPlayer to work with video.

Definition at line 28 of file VuoAvPlayerObject.h.

Instance Methods

(id) - init
 Initialize new instance. More...
 
(void) - setPlayerCallback:target:
 tell this player where the decoder is so that it can invoke callbacks More...
 
(bool) - setURL:
 Set the file path and begin loading assets. More...
 
(void) - setPlaybackRate:
 unload the currently playing video More...
 
(bool) - decodePreceedingVideoSamples
 decode a number of video samples prior to the current timestamp More...
 
(bool) - seekToSecond:withRange:frame:
 seek playhead to point and time range to decode within. If range is < 0, duration - second is set as range. More...
 
(bool) - canBeginPlayback
 Is the video ready to begin playback? More...
 
(bool) - nextVideoFrame:
 Get the last decoded video frame. More...
 
(bool) - nextAudioFrame:
 Get the last decoded audio frame. More...
 
(VuoReal- getCurrentTimestamp
 Get the last decoded video timestamp. More...
 
(bool) - setAssetReaderTimeRange:
 reset the assetreader to a new range. More...
 
(bool) - copyNextVideoSampleBuffer
 read the next video samplebuffer to store. More...
 
(unsigned int) - getAudioChannelCount:
 Get the number of audio channels. More...
 
(bool) - audioEnabled
 is audio playback enabled? More...
 
(VuoReal- getDuration
 get the total duration of this asset More...
 
(double) - getFrameRate
 the ideal framerate More...
 
(bool) - canPlayAudio
 true if no audio stream is found, or one is fonud and the decoder is capable of playing it More...
 
(unsigned int) - audioChannels
 return the number of available audio channels More...
 

Class Methods

(void) + releaseAssetReader:
 Release an AVAssetReader after a 200 ms delay. More...
 

Protected Attributes

AVAsset * asset
 The AVAsset currnetly loaded. More...
 
float videoTimestamp
 AVPlayer object. More...
 
AVAssetReader * assetReader
 asset reader More...
 
VuoAvTrackOutputassetReaderVideoTrackOutput
 video reader output More...
 
AVAssetReaderTrackOutput * assetReaderAudioTrackOutput
 audio reader output More...
 
volatile bool isReady
 is the asset ready to begin playback More...
 
bool playOnReady
 shoudl play once tracks are ready? More...
 
float playbackRate
 the speed of playback (used to decide which direction to decode video in, and whether audio should be read or not) More...
 
float nominalFrameRate
 the playback speed that this asset wants to be played at by default More...
 
void * avDecoderCppObject
 A pointer to the C++ VuoAvDecoder object that's driving this thing. Used to fire callbacks into C++ land. More...
 
void(* readyToPlayCallback )(void *decoderCppObject, bool canPlayMedia)
 A function pointer to a static C++ function that accepts a pointer to a VuoAvDecoder object to send an OnDecoderReady event. More...
 
NSMutableArray * videoQueue
 list of video frames to be output More...
 
Float32 * audioBuffer
 Holds audio extracted from copyNextSampleBuffer until an audio frame comes to collect it. Is interleaved. More...
 
float audioTimestamp
 the last timestamp as reported by the audio asset reader. More...
 
size_t audioBufferCapacity
 the capacity in byte size that the audioBuffer possesses More...
 
unsigned int audioBufferChannelCount
 how many channels copyNextSampleBuffer gives the audio buffer. More...
 
unsigned int audioBufferSamplesPerChannel
 the number of samples one channel of audio contains in the audioBuffer More...
 
unsigned int audioBufferSampleIndex
 The current index that audio frames are copying samples from the audioBuffer. More...
 
unsigned int audioChannelCount
 How many channels of audio are in the current asset track. More...
 
bool containsUnplayableAudio
 True if there is an audio stream that cannot be played by AvFoundation. False otherwise. More...
 
bool hasAlpha
 True if the video frames have an alpha channel. More...
 
CVOpenGLTextureCacheRef textureCache
 GL_TEXTURE_RECTANGLEs from the movie. More...
 

Method Documentation

◆ audioChannels

- (unsigned int) audioChannels

return the number of available audio channels

Definition at line 562 of file VuoAvPlayerObject.m.

◆ audioEnabled

- (bool) audioEnabled

is audio playback enabled?

Definition at line 557 of file VuoAvPlayerObject.m.

◆ canBeginPlayback

- (bool) canBeginPlayback

Is the video ready to begin playback?

Definition at line 391 of file VuoAvPlayerObject.m.

◆ canPlayAudio

- (bool) canPlayAudio

true if no audio stream is found, or one is fonud and the decoder is capable of playing it

Definition at line 396 of file VuoAvPlayerObject.m.

◆ copyNextVideoSampleBuffer

- (bool) copyNextVideoSampleBuffer

read the next video samplebuffer to store.

read the next video sample buffer

Definition at line 745 of file VuoAvPlayerObject.m.

◆ decodePreceedingVideoSamples

- (bool) decodePreceedingVideoSamples

decode a number of video samples prior to the current timestamp

Definition at line 667 of file VuoAvPlayerObject.m.

◆ getAudioChannelCount:

- (unsigned int) getAudioChannelCount: (AVAssetTrack*)  track

Get the number of audio channels.

Definition at line 524 of file VuoAvPlayerObject.m.

◆ getCurrentTimestamp

- (VuoReal) getCurrentTimestamp

Get the last decoded video timestamp.

Definition at line 629 of file VuoAvPlayerObject.m.

◆ getDuration

- (VuoReal) getDuration

get the total duration of this asset

Definition at line 682 of file VuoAvPlayerObject.m.

◆ getFrameRate

- (double) getFrameRate

the ideal framerate

Definition at line 401 of file VuoAvPlayerObject.m.

◆ init

- (id) init

Initialize new instance.

Creates a new player.

Definition at line 178 of file VuoAvPlayerObject.m.

◆ nextAudioFrame:

- (bool) nextAudioFrame: (VuoAudioFrame*)  frame

Get the last decoded audio frame.

Definition at line 687 of file VuoAvPlayerObject.m.

◆ nextVideoFrame:

- (bool) nextVideoFrame: (VuoVideoFrame*)  frame

Get the last decoded video frame.

Returns the current frame's image.

Definition at line 635 of file VuoAvPlayerObject.m.

◆ releaseAssetReader:

+ (void) releaseAssetReader: (AVAssetReader*)  reader

Release an AVAssetReader after a 200 ms delay.

Definition at line 219 of file VuoAvPlayerObject.m.

◆ seekToSecond:withRange:frame:

- (bool) seekToSecond: (float)  second
withRange: (float)  range
frame: (VuoVideoFrame *)  frame 

seek playhead to point and time range to decode within. If range is < 0, duration - second is set as range.

Definition at line 582 of file VuoAvPlayerObject.m.

◆ setAssetReaderTimeRange:

- (bool) setAssetReaderTimeRange: (CMTimeRange)  timeRange

reset the assetreader to a new range.

audio settings

Definition at line 406 of file VuoAvPlayerObject.m.

◆ setPlaybackRate:

- (void) setPlaybackRate: (double)  rate

unload the currently playing video

Set the rate of playback.

playback is swapping directions, clear the caches

Definition at line 542 of file VuoAvPlayerObject.m.

◆ setPlayerCallback:target:

- (void) setPlayerCallback: (void(*)(void* functionPtr, bool canPlayMedia))  callback
target: (void*)  decoderCppObject 

tell this player where the decoder is so that it can invoke callbacks

Definition at line 623 of file VuoAvPlayerObject.m.

◆ setURL:

- (bool) setURL: (NSURL*)  url

Set the file path and begin loading assets.

Loads media at url.

prevent race condition when trying to seek right away by enabling playback after initial setrange.

try to load a few frames of video before declaring this asset ready to play. some codecs will load and successfully extract a single frame then crap out. cough mjpeg cough

calling on main thread prevents tests from compiling in the event that isReady is false.

Definition at line 263 of file VuoAvPlayerObject.m.

Member Data Documentation

◆ asset

- (AVAsset*) asset
protected

The AVAsset currnetly loaded.

Definition at line 31 of file VuoAvPlayerObject.h.

◆ assetReader

- (AVAssetReader*) assetReader
protected

asset reader

Definition at line 37 of file VuoAvPlayerObject.h.

◆ assetReaderAudioTrackOutput

- (AVAssetReaderTrackOutput*) assetReaderAudioTrackOutput
protected

audio reader output

Definition at line 41 of file VuoAvPlayerObject.h.

◆ assetReaderVideoTrackOutput

- (VuoAvTrackOutput*) assetReaderVideoTrackOutput
protected

video reader output

Definition at line 39 of file VuoAvPlayerObject.h.

◆ audioBuffer

- (Float32*) audioBuffer
protected

Holds audio extracted from copyNextSampleBuffer until an audio frame comes to collect it. Is interleaved.

Definition at line 60 of file VuoAvPlayerObject.h.

◆ audioBufferCapacity

- (size_t) audioBufferCapacity
protected

the capacity in byte size that the audioBuffer possesses

Definition at line 64 of file VuoAvPlayerObject.h.

◆ audioBufferChannelCount

- (unsigned int) audioBufferChannelCount
protected

how many channels copyNextSampleBuffer gives the audio buffer.

Definition at line 66 of file VuoAvPlayerObject.h.

◆ audioBufferSampleIndex

- (unsigned int) audioBufferSampleIndex
protected

The current index that audio frames are copying samples from the audioBuffer.

Definition at line 70 of file VuoAvPlayerObject.h.

◆ audioBufferSamplesPerChannel

- (unsigned int) audioBufferSamplesPerChannel
protected

the number of samples one channel of audio contains in the audioBuffer

Definition at line 68 of file VuoAvPlayerObject.h.

◆ audioChannelCount

- (unsigned int) audioChannelCount
protected

How many channels of audio are in the current asset track.

Definition at line 72 of file VuoAvPlayerObject.h.

◆ audioTimestamp

- (float) audioTimestamp
protected

the last timestamp as reported by the audio asset reader.

Definition at line 62 of file VuoAvPlayerObject.h.

◆ avDecoderCppObject

- (void*) avDecoderCppObject
protected

A pointer to the C++ VuoAvDecoder object that's driving this thing. Used to fire callbacks into C++ land.

Definition at line 52 of file VuoAvPlayerObject.h.

◆ containsUnplayableAudio

- (bool) containsUnplayableAudio
protected

True if there is an audio stream that cannot be played by AvFoundation. False otherwise.

Definition at line 74 of file VuoAvPlayerObject.h.

◆ hasAlpha

- (bool) hasAlpha
protected

True if the video frames have an alpha channel.

Definition at line 76 of file VuoAvPlayerObject.h.

◆ isReady

- (volatile bool) isReady
protected

is the asset ready to begin playback

Definition at line 44 of file VuoAvPlayerObject.h.

◆ nominalFrameRate

- (float) nominalFrameRate
protected

the playback speed that this asset wants to be played at by default

Definition at line 50 of file VuoAvPlayerObject.h.

◆ playbackRate

- (float) playbackRate
protected

the speed of playback (used to decide which direction to decode video in, and whether audio should be read or not)

Definition at line 48 of file VuoAvPlayerObject.h.

◆ playOnReady

- (bool) playOnReady
protected

shoudl play once tracks are ready?

Definition at line 46 of file VuoAvPlayerObject.h.

◆ readyToPlayCallback

- (void(* readyToPlayCallback) (void *decoderCppObject, bool canPlayMedia))
protected

A function pointer to a static C++ function that accepts a pointer to a VuoAvDecoder object to send an OnDecoderReady event.

Definition at line 54 of file VuoAvPlayerObject.h.

◆ textureCache

- (CVOpenGLTextureCacheRef) textureCache
protected

GL_TEXTURE_RECTANGLEs from the movie.

Definition at line 79 of file VuoAvPlayerObject.h.

◆ videoQueue

- (NSMutableArray*) videoQueue
protected

list of video frames to be output

Definition at line 57 of file VuoAvPlayerObject.h.

◆ videoTimestamp

- (float) videoTimestamp
protected

AVPlayer object.

The current frame timestamp where start of video = 0.

Definition at line 35 of file VuoAvPlayerObject.h.


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