Vuo  1.2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Instance Methods | Class Methods | Protected Attributes | List of all members
VuoAvPlayerObject Class Reference

Description

https://b33p.net/kosada/node/9140

Internal video player implementation. Use VuoVideoPlayer to work with video.

Instance Methods

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

Class Methods

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

Protected Attributes

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

Method Documentation

- (unsigned int) audioChannels

return the number of available audio channels

- (bool) audioEnabled

is audio playback enabled?

- (bool) canBeginPlayback

Is the video ready to begin playback?

- (bool) canPlayAudio

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

- (bool) copyNextVideoSampleBuffer

read the next video samplebuffer to store.

read the next video sample buffer

- (bool) decodePreceedingVideoSamples

decode a number of video samples prior to the current timestamp

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

Get the number of audio channels.

- (VuoReal) getCurrentTimestamp

Get the last decoded video timestamp.

- (VuoReal) getDuration

get the total duration of this asset

- (double) getFrameRate

the ideal framerate

- (id) init

Initialize new instance.

Creates a new player.

- (bool) nextAudioFrame: (VuoAudioFrame*)  frame

Get the last decoded audio frame.

this shouldn't ever happen, but if it does realloc samples and change the audioChannelCount size

- (bool) nextVideoFrame: (VuoVideoFrame*)  frame

Get the last decoded video frame.

Returns the current frame's image.

+ (void) releaseAssetReader: (AVAssetReader*)  reader

Release an AVAssetReader after a 200 ms delay.

- (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.

- (bool) setAssetReaderTimeRange: (CMTimeRange)  timeRange

reset the assetreader to a new range.

audio settings

- (void) setPlaybackRate: (double)  rate

unload the currently playing video

Set the rate of playback.

playback is swapping directions, clear the caches

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

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

- (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.

Member Data Documentation

- (AVAsset*) asset
protected

The AVAsset currnetly loaded.

- (AVAssetReader*) assetReader
protected

asset reader

- (AVAssetReaderTrackOutput*) assetReaderAudioTrackOutput
protected

audio reader output

- (AVAssetReaderTrackOutput*) assetReaderVideoTrackOutput
protected

video reader output

- (Float32*) audioBuffer
protected

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

- (size_t) audioBufferCapacity
protected

the capacity in byte size that the audioBuffer possesses

- (unsigned int) audioBufferChannelCount
protected

how many channels copyNextSampleBuffer gives the audio buffer.

- (unsigned int) audioBufferSampleIndex
protected

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

- (unsigned int) audioBufferSamplesPerChannel
protected

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

- (unsigned int) audioChannelCount
protected

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

- (float) audioTimestamp
protected

the last timestamp as reported by the audio asset reader.

- (void*) avDecoderCppObject
protected

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

- (bool) containsUnplayableAudio
protected

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

- (VuoGlContext) glContext
protected

Context for textureCache

- (volatile bool) isReady
protected

is the asset ready to begin playback

- (float) nominalFrameRate
protected

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

- (float) playbackRate
protected

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

- (bool) playOnReady
protected

shoudl play once tracks are ready?

- (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.

- (CVOpenGLTextureCacheRef) textureCache
protected

GL_TEXTURE_RECTANGLEs from the movie.

- (NSMutableArray*) videoQueue
protected

list of video frames to be output

- (float) videoTimestamp
protected

AVPlayer object.

The current frame timestamp where start of video = 0.


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