# Cinder

# 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>`

Inherits cinder::qtime::MovieBase.

List of all members.

## Classes
struct | Obj
## Public Member Functions
| MovieGl ()
| MovieGl (const std::string &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.
| 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.
bool | checkPlayable ()
| Returns whether the movie has loaded and buffered enough to playback without interruption.
int32_t | getWidth () const
| Returns the width of the movie in pixels.
int32_t | getHeight () const
| Returns the height of the movie in pixels.
float | getAspectRatio () const
| Returns the movie's aspect ratio, the ratio of its width to its height.
float | getDuration () const
| Returns the movie's length measured in seconds.
float | getFramerate () const
| Returns the movie's framerate measured as frames per second.
int32_t | getNumFrames () const
| Returns the total number of frames (video samples) in the movie.
bool | hasAlpha () const
| Returns whether the first video track in the movie contains an alpha channel. Returns false in the absence of visual media.
bool | hasVisuals () const
| Returns whether a movie contains at least one visual track, defined as Video, MPEG, Sprite, QuickDraw3D, Text, or TimeCode tracks.
bool | hasAudio () const
| Returns whether a movie contains at least one audio track, defined as Sound, Music, or MPEG tracks.
float | getCurrentTime () const
| Returns the current time of a movie in seconds.
void | seekToTime (float seconds)
| Sets the movie to the time seconds.
void | seekToFrame (int frame)
| Sets the movie time to the start time of frame frame.
void | seekToStart ()
| Sets the movie time to its beginning.
void | seekToEnd ()
| Sets the movie time to its end.
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.
void | resetActiveSegment ()
| Resets the active segment to be the entire movie.
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.
void | stepForward ()
| Advances the movie by one frame (a single video sample). Ignores looping settings.
void | stepBackward ()
| Steps backward by one frame (a single video sample). Ignores looping settings.
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.
void | setVolume (float volume)
| Sets the audio playback volume ranging from [0 - 1.0].
float | getVolume () const
| Gets the audio playback volume ranging from [0 - 1.0].
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.
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.
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.
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.
bool | isDone () const
| Returns whether the movie has completely finished playing.
void | play ()
| Begins movie playback.
void | stop ()
| Stops movie playback.
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.
::Movie | getMovieHandle () const
| Returns the native QuickTime Movie data structure.
## Protected Member Functions
void | allocateVisualContext ()
virtual MovieBase::Obj * | getObj () const
void | init ()
void | updateFrame ()
void | updateLoadState ()
void | setupFft (FourCharCode code, uint32_t bandNum, uint8_t channelNum)
TimeValue | getStartTimeOfFirstSample () const
void | initFromPath (const std::string &path)
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
shared_ptr< Obj > | mObj
typedef shared_ptr< Obj > MovieGl::* | unspecified_bool_type
| Emulates shared_ptr-like behavior.
| operator unspecified_bool_type ()
| Emulates shared_ptr-like behavior.
void | reset ()
| Emulates shared_ptr-like behavior.

## 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 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 std::string & | 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

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`[protected, virtual]`

Implements cinder::qtime::MovieBase.

cinder::qtime::MovieGl::operator unspecified_bool_type | ( |  | ) |

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.

float cinder::qtime::MovieBase::getAspectRatio | ( |  | ) | const`[inherited]`

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

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.

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 | ( |  | ) | `[protected, inherited]`

void cinder::qtime::MovieBase::updateFrame | ( |  | ) | `[protected, inherited]`

void cinder::qtime::MovieBase::updateLoadState | ( |  | ) | `[protected, inherited]`

void cinder::qtime::MovieBase::setupFft | ( | FourCharCode | code,
|  | uint32_t | bandNum,
|  | uint8_t | channelNum |
| ) |  |  | `[protected, inherited]`

int32_t cinder::qtime::MovieBase::countFrames | ( | ::Movie | theMovie | ) | `[static, protected, inherited]`

TimeValue cinder::qtime::MovieBase::getStartTimeOfFirstSample | ( |  | ) | const`[protected, inherited]`

void cinder::qtime::MovieBase::initFromPath | ( | const std::string & | path | ) | `[protected, inherited]`

void cinder::qtime::MovieBase::initFromLoader | ( | const class MovieLoader & | loader | ) | `[protected, inherited]`

void cinder::qtime::MovieBase::initFromMemory | ( | const void * | data,
|  | size_t | dataSize,
|  | const std::string & | fileNameHint,
|  | const std::string & | mimeTypeHint |
| ) |  |  | `[protected, inherited]`

void cinder::qtime::MovieBase::initFromDataSource | ( | DataSourceRef | dataSource,
|  | const std::string & | mimeTypeHint |
| ) |  |  | `[protected, inherited]`

## Member Data Documentation

shared_ptr<Obj> cinder::qtime::MovieGl::mObj`[protected]`

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

- include/cinder/qtime/QuickTime.h
- src/cinder/qtime/QuickTime.cpp