Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
cinder::qtime::MovieGl Class Reference

QuickTime movie playback as OpenGL textures Textures are always bound to the GL_TEXTURE_RECTANGLE_ARB target. More...

#include <QuickTime.h>

Inheritance diagram for cinder::qtime::MovieGl:
[legend]

Classes

struct  Obj
 

Public Member Functions

 MovieGl ()
 
 MovieGl (const fs::path &path)
 
 MovieGl (const class MovieLoader &loader)
 
 MovieGl (const void *data, size_t dataSize, const std::string &fileNameHint, const std::string &mimeTypeHint="")
 Constructs a MovieGl from a block of memory of size dataSize pointed to by data, which must not be disposed of during the lifetime of the movie. More...
 
 MovieGl (DataSourceRef dataSource, const std::string mimeTypeHint="")
 
const gl::Texture getTexture ()
 Returns the gl::Texture representing the Movie's current frame, bound to the GL_TEXTURE_RECTANGLE_ARB target. More...
 
bool checkPlayable ()
 Returns whether the movie has loaded and buffered enough to playback without interruption. More...
 
int32_t getWidth () const
 Returns the width of the movie in pixels. More...
 
int32_t getHeight () const
 Returns the height of the movie in pixels. More...
 
Vec2i getSize () const
 Returns the size of the movie in pixels. More...
 
float getAspectRatio () const
 Returns the movie's aspect ratio, the ratio of its width to its height. More...
 
Area getBounds () const
 the Area defining the Movie's bounds in pixels: [0,0]-[width,height] More...
 
float getPixelAspectRatio () const
 Returns the movie's pixel aspect ratio. Returns 1.0 if the movie does not contain an explicit pixel aspect ratio. More...
 
float getDuration () const
 Returns the movie's length measured in seconds. More...
 
float getFramerate () const
 Returns the movie's framerate measured as frames per second. More...
 
int32_t getNumFrames () const
 Returns the total number of frames (video samples) in the movie. More...
 
bool hasAlpha () const
 Returns whether the first video track in the movie contains an alpha channel. Returns false in the absence of visual media. More...
 
bool hasVisuals () const
 Returns whether a movie contains at least one visual track, defined as Video, MPEG, Sprite, QuickDraw3D, Text, or TimeCode tracks. More...
 
bool hasAudio () const
 Returns whether a movie contains at least one audio track, defined as Sound, Music, or MPEG tracks. More...
 
bool checkNewFrame ()
 Returns whether a movie has a new frame available. More...
 
float getCurrentTime () const
 Returns the current time of a movie in seconds. More...
 
void seekToTime (float seconds)
 Sets the movie to the time seconds. More...
 
void seekToFrame (int frame)
 Sets the movie time to the start time of frame frame. More...
 
void seekToStart ()
 Sets the movie time to its beginning. More...
 
void seekToEnd ()
 Sets the movie time to its end. More...
 
void setActiveSegment (float startTime, float duration)
 Limits the active portion of a movie to a subset beginning at startTime seconds and lasting for duration seconds. QuickTime will not process the movie outside the active segment. More...
 
void resetActiveSegment ()
 Resets the active segment to be the entire movie. More...
 
void setLoop (bool loop=true, bool palindrome=false)
 Sets whether the movie is set to loop during playback. If palindrome is true, the movie will "ping-pong" back and forth. More...
 
void stepForward ()
 Advances the movie by one frame (a single video sample). Ignores looping settings. More...
 
void stepBackward ()
 Steps backward by one frame (a single video sample). Ignores looping settings. More...
 
void setRate (float rate)
 Sets the playback rate, which begins playback immediately for nonzero values. 1.0 represents normal speed. Negative values indicate reverse playback and 0 stops. More...
 
void setVolume (float volume)
 Sets the audio playback volume ranging from [0 - 1.0]. More...
 
float getVolume () const
 Gets the audio playback volume ranging from [0 - 1.0]. More...
 
void setupMonoFft (uint32_t numBands)
 Sets up Fourier analysis on the movie using numBands distinct bands in a single (mono) channel. This data is only available during playback. More...
 
void setupStereoFft (uint32_t numBands)
 Sets up Fourier analysis on the movie using numBands distinct bands in a two (stereo) channels. This data is only available during playback. More...
 
void setupMultiChannelFft (uint32_t numBands)
 Sets up Fourier analysis on the movie using numBands distinct bands in as many channels as the audo track contains. To determine the number of channels, use getNumFftChannels(). This data is only available during playback. More...
 
float * getFftData () const
 
uint32_t getNumFftBands () const
 
uint32_t getNumFftChannels () const
 
bool isPlaying () const
 Returns whether the movie is currently playing or is paused/stopped. More...
 
bool isDone () const
 Returns whether the movie has completely finished playing. More...
 
void play ()
 Begins movie playback. More...
 
void stop ()
 Stops movie playback. More...
 
void setNewFrameCallback (void(*aNewFrameCallback)(long, void *), void *aNewFrameCallbackRefcon)
 Sets a function which is called whenever the movie has rendered a new frame during playback. Generally only necessary for advanced users. More...
 
::Movie getMovieHandle () const
 Returns the native QuickTime Movie data structure. More...
 

Static Public Member Functions

static MovieGlRef create (const fs::path &path)
 
static MovieGlRef create (const MovieLoaderRef &loader)
 
static MovieGlRef create (const void *data, size_t dataSize, const std::string &fileNameHint, const std::string &mimeTypeHint="")
 
static MovieGlRef create (DataSourceRef dataSource, const std::string mimeTypeHint="")
 

Protected Member Functions

void allocateVisualContext ()
 
virtual MovieBase::ObjgetObj () const
 
void init ()
 
void updateFrame ()
 
void updateLoadState ()
 
void setupFft (FourCharCode code, uint32_t bandNum, uint8_t channelNum)
 
TimeValue getStartTimeOfFirstSample () const
 
void initFromPath (const fs::path &filePath)
 
void initFromLoader (const class MovieLoader &loader)
 
void initFromMemory (const void *data, size_t dataSize, const std::string &fileNameHint, const std::string &mimeTypeHint)
 
void initFromDataSource (DataSourceRef dataSource, const std::string &mimeTypeHint)
 

Static Protected Member Functions

static int32_t countFrames (::Movie theMovie)
 

Protected Attributes

std::shared_ptr< ObjmObj
 
typedef std::shared_ptr< Obj >
MovieGl::* 
unspecified_bool_type
 Emulates shared_ptr-like behavior. More...
 
 operator unspecified_bool_type () const
 Emulates shared_ptr-like behavior. More...
 
void reset ()
 Emulates shared_ptr-like behavior. More...
 

Detailed Description

QuickTime movie playback as OpenGL textures Textures are always bound to the GL_TEXTURE_RECTANGLE_ARB target.

Remarks
On Mac OS X, the destination CGLContext must be the current context when the MovieGl is constructed. If that doesn't mean anything to you, you should be fine. A call to app::restoreWindowContext() can be used to force this to be the case.

Member Typedef Documentation

typedef std::shared_ptr<Obj> MovieGl::* cinder::qtime::MovieGl::unspecified_bool_type

Emulates shared_ptr-like behavior.

Constructor & Destructor Documentation

cinder::qtime::MovieGl::MovieGl ( )
cinder::qtime::MovieGl::MovieGl ( const fs::path &  path)
cinder::qtime::MovieGl::MovieGl ( const class MovieLoader loader)
cinder::qtime::MovieGl::MovieGl ( const void data,
size_t  dataSize,
const std::string fileNameHint,
const std::string mimeTypeHint = "" 
)

Constructs a MovieGl from a block of memory of size dataSize pointed to by data, which must not be disposed of during the lifetime of the movie.

fileNameHint and mimeTypeHint provide important hints to QuickTime about the contents of the file. Omit both of them at your peril. "video/quicktime" is often a good choice for mimeTypeHint.

cinder::qtime::MovieGl::MovieGl ( DataSourceRef  dataSource,
const std::string  mimeTypeHint = "" 
)

Member Function Documentation

static MovieGlRef cinder::qtime::MovieGl::create ( const fs::path &  path)
static
MovieGlRef cinder::qtime::MovieGl::create ( const MovieLoaderRef loader)
static
static MovieGlRef cinder::qtime::MovieGl::create ( const void data,
size_t  dataSize,
const std::string fileNameHint,
const std::string mimeTypeHint = "" 
)
static
static MovieGlRef cinder::qtime::MovieGl::create ( DataSourceRef  dataSource,
const std::string  mimeTypeHint = "" 
)
static
const gl::Texture cinder::qtime::MovieGl::getTexture ( )

Returns the gl::Texture representing the Movie's current frame, bound to the GL_TEXTURE_RECTANGLE_ARB target.

void cinder::qtime::MovieGl::allocateVisualContext ( )
protected
virtual MovieBase::Obj* cinder::qtime::MovieGl::getObj ( ) const
protectedvirtual
cinder::qtime::MovieGl::operator unspecified_bool_type ( ) const

Emulates shared_ptr-like behavior.

void cinder::qtime::MovieGl::reset ( )

Emulates shared_ptr-like behavior.

bool cinder::qtime::MovieBase::checkPlayable ( )
inherited

Returns whether the movie has loaded and buffered enough to playback without interruption.

Returns
The movie has loaded and buffered enough to playback without interruption
int32_t cinder::qtime::MovieBase::getWidth ( ) const
inherited

Returns the width of the movie in pixels.

int32_t cinder::qtime::MovieBase::getHeight ( ) const
inherited

Returns the height of the movie in pixels.

Vec2i cinder::qtime::MovieBase::getSize ( ) const
inherited

Returns the size of the movie in pixels.

float cinder::qtime::MovieBase::getAspectRatio ( ) const
inherited

Returns the movie's aspect ratio, the ratio of its width to its height.

Area cinder::qtime::MovieBase::getBounds ( ) const
inherited

the Area defining the Movie's bounds in pixels: [0,0]-[width,height]

float cinder::qtime::MovieBase::getPixelAspectRatio ( ) const
inherited

Returns the movie's pixel aspect ratio. Returns 1.0 if the movie does not contain an explicit pixel aspect ratio.

float cinder::qtime::MovieBase::getDuration ( ) const
inherited

Returns the movie's length measured in seconds.

float cinder::qtime::MovieBase::getFramerate ( ) const
inherited

Returns the movie's framerate measured as frames per second.

See also
http://developer.apple.com/mac/library/qa/qa2001/qa1262.html Technical Q&A QA1262
int32_t cinder::qtime::MovieBase::getNumFrames ( ) const
inherited

Returns the total number of frames (video samples) in the movie.

bool cinder::qtime::MovieBase::hasAlpha ( ) const
inherited

Returns whether the first video track in the movie contains an alpha channel. Returns false in the absence of visual media.

See also
http://developer.apple.com/qa/qtmtb/qtmtb17.html Technical Q&A QTMTB17
bool cinder::qtime::MovieBase::hasVisuals ( ) const
inherited

Returns whether a movie contains at least one visual track, defined as Video, MPEG, Sprite, QuickDraw3D, Text, or TimeCode tracks.

bool cinder::qtime::MovieBase::hasAudio ( ) const
inherited

Returns whether a movie contains at least one audio track, defined as Sound, Music, or MPEG tracks.

bool cinder::qtime::MovieBase::checkNewFrame ( )
inherited

Returns whether a movie has a new frame available.

float cinder::qtime::MovieBase::getCurrentTime ( ) const
inherited

Returns the current time of a movie in seconds.

void cinder::qtime::MovieBase::seekToTime ( float  seconds)
inherited

Sets the movie to the time seconds.

void cinder::qtime::MovieBase::seekToFrame ( int  frame)
inherited

Sets the movie time to the start time of frame frame.

void cinder::qtime::MovieBase::seekToStart ( )
inherited

Sets the movie time to its beginning.

void cinder::qtime::MovieBase::seekToEnd ( )
inherited

Sets the movie time to its end.

void cinder::qtime::MovieBase::setActiveSegment ( float  startTime,
float  duration 
)
inherited

Limits the active portion of a movie to a subset beginning at startTime seconds and lasting for duration seconds. QuickTime will not process the movie outside the active segment.

void cinder::qtime::MovieBase::resetActiveSegment ( )
inherited

Resets the active segment to be the entire movie.

void cinder::qtime::MovieBase::setLoop ( bool  loop = true,
bool  palindrome = false 
)
inherited

Sets whether the movie is set to loop during playback. If palindrome is true, the movie will "ping-pong" back and forth.

void cinder::qtime::MovieBase::stepForward ( )
inherited

Advances the movie by one frame (a single video sample). Ignores looping settings.

void cinder::qtime::MovieBase::stepBackward ( )
inherited

Steps backward by one frame (a single video sample). Ignores looping settings.

void cinder::qtime::MovieBase::setRate ( float  rate)
inherited

Sets the playback rate, which begins playback immediately for nonzero values. 1.0 represents normal speed. Negative values indicate reverse playback and 0 stops.

void cinder::qtime::MovieBase::setVolume ( float  volume)
inherited

Sets the audio playback volume ranging from [0 - 1.0].

float cinder::qtime::MovieBase::getVolume ( ) const
inherited

Gets the audio playback volume ranging from [0 - 1.0].

void cinder::qtime::MovieBase::setupMonoFft ( uint32_t  numBands)
inherited

Sets up Fourier analysis on the movie using numBands distinct bands in a single (mono) channel. This data is only available during playback.

void cinder::qtime::MovieBase::setupStereoFft ( uint32_t  numBands)
inherited

Sets up Fourier analysis on the movie using numBands distinct bands in a two (stereo) channels. This data is only available during playback.

void cinder::qtime::MovieBase::setupMultiChannelFft ( uint32_t  numBands)
inherited

Sets up Fourier analysis on the movie using numBands distinct bands in as many channels as the audo track contains. To determine the number of channels, use getNumFftChannels(). This data is only available during playback.

float * cinder::qtime::MovieBase::getFftData ( ) const
inherited
uint32_t cinder::qtime::MovieBase::getNumFftBands ( ) const
inherited
uint32_t cinder::qtime::MovieBase::getNumFftChannels ( ) const
inherited
bool cinder::qtime::MovieBase::isPlaying ( ) const
inherited

Returns whether the movie is currently playing or is paused/stopped.

bool cinder::qtime::MovieBase::isDone ( ) const
inherited

Returns whether the movie has completely finished playing.

void cinder::qtime::MovieBase::play ( )
inherited

Begins movie playback.

void cinder::qtime::MovieBase::stop ( )
inherited

Stops movie playback.

void cinder::qtime::MovieBase::setNewFrameCallback ( void(*)(long, void *)  aNewFrameCallback,
void aNewFrameCallbackRefcon 
)
inherited

Sets a function which is called whenever the movie has rendered a new frame during playback. Generally only necessary for advanced users.

::Movie cinder::qtime::MovieBase::getMovieHandle ( ) const
inherited

Returns the native QuickTime Movie data structure.

void cinder::qtime::MovieBase::init ( )
protectedinherited
void cinder::qtime::MovieBase::updateFrame ( )
protectedinherited
void cinder::qtime::MovieBase::updateLoadState ( )
protectedinherited
void cinder::qtime::MovieBase::setupFft ( FourCharCode  code,
uint32_t  bandNum,
uint8_t  channelNum 
)
protectedinherited
int32_t cinder::qtime::MovieBase::countFrames ( ::Movie  theMovie)
staticprotectedinherited
TimeValue cinder::qtime::MovieBase::getStartTimeOfFirstSample ( ) const
protectedinherited
void cinder::qtime::MovieBase::initFromPath ( const fs::path &  filePath)
protectedinherited
void cinder::qtime::MovieBase::initFromLoader ( const class MovieLoader loader)
protectedinherited
void cinder::qtime::MovieBase::initFromMemory ( const void data,
size_t  dataSize,
const std::string fileNameHint,
const std::string mimeTypeHint 
)
protectedinherited
void cinder::qtime::MovieBase::initFromDataSource ( DataSourceRef  dataSource,
const std::string mimeTypeHint 
)
protectedinherited

Member Data Documentation

std::shared_ptr<Obj> cinder::qtime::MovieGl::mObj
protected

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