26 #if ! defined( __LP64__ )
39 #if defined( CINDER_MAC )
40 #include <QuickTime/QuickTime.h>
41 #if defined( __OBJC__ )
50 #if defined( CINDER_MSW )
51 typedef struct MovieType** Movie;
52 typedef struct OpaqueQTVisualContext* QTVisualContextRef;
53 typedef long TimeValue;
54 typedef struct QTAudioFrequencyLevels QTAudioFrequencyLevels;
55 typedef unsigned long FourCharCode;
56 typedef struct __CVBuffer* CVBufferRef;
57 typedef CVBufferRef CVImageBufferRef;
60 namespace cinder {
namespace qtime {
117 void setLoop(
bool loop =
true,
bool palindrome =
false );
151 void setNewFrameCallback(
void(*aNewFrameCallback)(
long,
void * ),
void *aNewFrameCallbackRefcon );
162 void setupFft( FourCharCode code, uint32_t bandNum, uint8_t channelNum );
185 virtual void newFrame( CVImageBufferRef cvImage ) = 0;
226 {
return std::shared_ptr<MovieSurface>(
new MovieSurface( data, dataSize, fileNameHint, mimeTypeHint ) ); }
228 {
return std::shared_ptr<MovieSurface>(
new MovieSurface( dataSource, mimeTypeHint ) ); }
240 virtual void newFrame( CVImageBufferRef cvImage );
266 MovieGl(
const fs::path &path );
276 {
return std::shared_ptr<MovieGl>(
new MovieGl( data, dataSize, fileNameHint, mimeTypeHint ) ); }
278 {
return std::shared_ptr<MovieGl>(
new MovieGl( dataSource, mimeTypeHint ) ); }
291 virtual void newFrame( CVImageBufferRef cvImage );
294 #if defined( CINDER_MSW )
365 inline int32_t
floatToFixed(
float fl ) {
return ((int32_t)((
float)(fl) * ((int32_t) 0x00010000L))); }
396 #endif // ! defined( __LP64__ )
bool mLoaded
Definition: QuickTime.h:351
virtual void newFrame(CVImageBufferRef cvImage)
Definition: QuickTime.cpp:702
virtual ~Obj()
Definition: QuickTime.cpp:203
void prepareForDestruction()
Definition: QuickTime.cpp:216
virtual ~MovieBase()
Definition: QuickTime.h:67
int32_t getQuickTimeVersion()
Returns 0 if QuickTime is not available, otherwise an integer encoding of the QuickTime version...
Definition: QuickTime.cpp:939
bool hasAudio() const
Returns whether a movie contains at least one audio track, defined as Sound, Music, or MPEG tracks.
Definition: QuickTime.cpp:296
float getFramerate() const
Returns the movie's framerate measured as frames per second.
Definition: QuickTime.cpp:245
float getDuration() const
Returns the movie's length measured in seconds.
Definition: QuickTime.h:85
static MovieGlRef create(DataSourceRef dataSource, const std::string mimeTypeHint="")
Definition: QuickTime.h:277
void updateLoadState()
Definition: QuickTime.cpp:221
void * mNewFrameCallbackRefcon
Definition: QuickTime.h:201
const gl::Texture getTexture()
Returns the gl::Texture representing the Movie's current frame, bound to the GL_TEXTURE_RECTANGLE_ARB...
Definition: QuickTime.cpp:848
bool mPlayingForward
Definition: QuickTime.h:191
bool mPlayable
Definition: QuickTime.h:190
void setupStereoFft(uint32_t numBands)
Sets up Fourier analysis on the movie using numBands distinct bands in a two (stereo) channels...
Definition: QuickTime.cpp:560
GLsizei const GLchar ** string
Definition: GLee.h:2427
static MovieGlRef create(const fs::path &path)
Definition: QuickTime.h:273
static MovieSurfaceRef create(const fs::path &path)
Definition: QuickTime.h:223
void reset()
Emulates shared_ptr-like behavior.
Definition: QuickTime.h:253
void startQuickTime()
Initializes QuickTime system-wide. Safe to call multiple times.
Definition: QuickTime.cpp:74
int32_t mWidth
Definition: QuickTime.h:187
Vec2i getSize() const
Returns the size of the movie in pixels.
Definition: QuickTime.h:77
QuickTime movie playback as OpenGL textures Textures are always bound to the GL_TEXTURE_RECTANGLE_ARB...
Definition: QuickTime.h:263
std::shared_ptr< MovieGl > MovieGlRef
Definition: QuickTime.h:257
void resetActiveSegment()
Resets the active segment to be the entire movie.
Definition: QuickTime.cpp:358
Obj()
Definition: QuickTime.cpp:195
Definition: QuickTime.h:286
void setVolume(float volume)
Sets the audio playback volume ranging from [0 - 1.0].
Definition: QuickTime.cpp:510
virtual Obj * getObj() const =0
~Obj()
Definition: QuickTime.cpp:740
Definition: QuickTime.h:311
void initFromPath(const fs::path &filePath)
Definition: QuickTime.cpp:136
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:1011
Surface mSurface
Definition: QuickTime.h:242
static MovieSurfaceRef create(DataSourceRef dataSource, const std::string mimeTypeHint="")
Definition: QuickTime.h:227
void stepForward()
Advances the movie by one frame (a single video sample). Ignores looping settings.
Definition: QuickTime.cpp:423
void reset()
Emulates shared_ptr-like behavior.
Definition: QuickTime.h:361
void seekToFrame(int frame)
Sets the movie time to the start time of frame frame.
Definition: QuickTime.cpp:312
void lock()
Definition: QuickTime.h:179
Definition: QuickTime.h:173
typedef void(APIENTRYP GLEEPFNGLBLENDCOLORPROC)(GLclampf red
float getVolume() const
Gets the audio playback volume ranging from [0 - 1.0].
Definition: QuickTime.cpp:517
bool checkPlaythroughOk() const
Returns whether the movie is ready for playthrough, implying media data is still downloading, but all data is expected to arrive before it is needed.
Definition: QuickTime.cpp:880
Definition: QuickTime.h:377
Url mUrl
Definition: QuickTime.h:350
static MovieSurfaceRef create(const void *data, size_t dataSize, const std::string &fileNameHint, const std::string &mimeTypeHint="")
Definition: QuickTime.h:225
void stepBackward()
Steps backward by one frame (a single video sample). Ignores looping settings.
Definition: QuickTime.cpp:437
void initFromDataSource(DataSourceRef dataSource, const std::string &mimeTypeHint)
Definition: QuickTime.cpp:150
void reset()
Emulates shared_ptr-like behavior.
Definition: QuickTime.h:307
void setupMonoFft(uint32_t numBands)
Sets up Fourier analysis on the movie using numBands distinct bands in a single (mono) channel...
Definition: QuickTime.cpp:555
void seekToStart()
Sets the movie time to its beginning.
Definition: QuickTime.cpp:328
void waitForPlaythroughOk() const
Waits until the movie is ready for playthrough, implying media data is still downloading, but all data is expected to arrive before it is needed.
Definition: QuickTime.cpp:903
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-po...
Definition: QuickTime.cpp:380
static int32_t countFrames(::Movie theMovie)
Definition: QuickTime.cpp:365
void(* mNewFrameCallback)(long timeValue, void *refcon)
Definition: QuickTime.h:200
int32_t mHeight
Definition: QuickTime.h:187
virtual void releaseFrame()
Definition: QuickTime.cpp:712
QTVisualContextRef mVisualContext
Definition: QuickTime.h:197
void seekToEnd()
Sets the movie time to its end.
Definition: QuickTime.cpp:333
std::shared_ptr< MovieLoader > MovieLoaderRef
Definition: QuickTime.h:62
void setupFft(FourCharCode code, uint32_t bandNum, uint8_t channelNum)
Definition: QuickTime.cpp:522
Represents an OpenGL Texture. Implicitly shared object.
Definition: Texture.h:41
float getAspectRatio() const
Returns the movie's aspect ratio, the ratio of its width to its height.
Definition: QuickTime.h:79
bool isDone() const
Returns whether the movie has completely finished playing.
Definition: QuickTime.cpp:628
void init()
Definition: QuickTime.cpp:172
Obj(const Url &url)
Definition: QuickTime.cpp:922
MovieSurface()
Definition: QuickTime.h:215
const Url & getUrl() const
Returns the original Url that the MovieLoader is loading.
Definition: QuickTime.h:333
::Movie mMovie
Definition: QuickTime.h:349
void setActiveSegment(float startTime, float duration)
Limits the active portion of a movie to a subset beginning at startTime seconds and lasting for durat...
Definition: QuickTime.cpp:338
bool checkNewFrame()
Returns whether a movie has a new frame available.
Definition: QuickTime.cpp:456
int32_t getNumFrames() const
Returns the total number of frames (video samples) in the movie.
Definition: QuickTime.cpp:254
bool mPlayable
Definition: QuickTime.h:351
::Movie mMovie
Definition: QuickTime.h:198
bool mPlaythroughOK
Definition: QuickTime.h:351
void quickTimeTask()
Gives QuickTime an opportunity to update all playing movies by calling ::MoviesTask. Generally only necessary when playing audio-only movies on Windows.
Definition: QuickTime.cpp:977
::Movie getMovieHandle() const
Returns the native QuickTime Movie data structure but still maintains ownership of it...
Definition: QuickTime.h:336
MovieBase()
Definition: QuickTime.h:157
Definition: QuickTime.h:65
std::shared_ptr< Obj > mObj
Definition: QuickTime.h:354
void seekToTime(float seconds)
Sets the movie to the time seconds.
Definition: QuickTime.cpp:307
~Obj()
Definition: QuickTime.cpp:933
Definition: QuickTime.h:386
int32_t getWidth() const
Returns the width of the movie in pixels.
Definition: QuickTime.h:73
std::shared_ptr< Obj > MovieLoader::* unspecified_bool_type
Emulates shared_ptr-like behavior.
Definition: QuickTime.h:359
uint32_t mFFTNumBandLevels
Definition: QuickTime.h:195
Definition: QuickTime.h:344
virtual void releaseFrame()=0
virtual void newFrame(CVImageBufferRef cvImage)=0
void initFromLoader(const class MovieLoader &loader)
Definition: QuickTime.cpp:125
std::shared_ptr< Obj > mObj
Definition: QuickTime.h:299
void waitForPlayable() const
Waits until the movie is in a playable state, implying the movie is fully formed and can be played bu...
Definition: QuickTime.cpp:895
MovieLoader()
Definition: QuickTime.h:313
uint32_t getNumFftChannels() const
Definition: QuickTime.cpp:603
void setNewFrameCallback(void(*aNewFrameCallback)(long, void *), void *aNewFrameCallbackRefcon)
Sets a function which is called whenever the movie has rendered a new frame during playback...
Definition: QuickTime.cpp:643
::Movie transferMovieHandle() const
Returns the native QuickTime Movie and marks itself as no longer the owner. In general you should not...
Definition: QuickTime.h:339
void updateFrame()
Definition: QuickTime.cpp:474
int32_t mFrameCount
Definition: QuickTime.h:188
float getCurrentTime() const
Returns the current time of a movie in seconds.
Definition: QuickTime.cpp:302
bool hasVisuals() const
Returns whether a movie contains at least one visual track, defined as Video, MPEG, Sprite, QuickDraw3D, Text, or TimeCode tracks.
Definition: QuickTime.cpp:290
std::shared_ptr< MovieSurface > MovieSurfaceRef
Definition: QuickTime.h:210
Obj()
Definition: QuickTime.cpp:735
void allocateVisualContext()
Definition: QuickTime.cpp:686
std::shared_ptr< Obj > MovieSurface::* unspecified_bool_type
Emulates shared_ptr-like behavior.
Definition: QuickTime.h:251
bool checkPlayable() const
Returns whether the movie is playable, implying the movie is fully formed and can be played but media...
Definition: QuickTime.cpp:873
bool checkPlayable()
Returns whether the movie has loaded and buffered enough to playback without interruption.
Definition: QuickTime.cpp:237
void allocateVisualContext()
Definition: QuickTime.cpp:774
void setupMultiChannelFft(uint32_t numBands)
Sets up Fourier analysis on the movie using numBands distinct bands in as many channels as the audo t...
Definition: QuickTime.cpp:565
bool mOwnsMovie
Definition: QuickTime.h:348
Definition: QuickTime.h:236
void unlock()
Definition: QuickTime.h:180
Definition: QuickTime.h:392
virtual MovieBase::Obj * getObj() const
Definition: QuickTime.h:246
void play()
Begins movie playback.
Definition: QuickTime.cpp:633
virtual void releaseFrame()
Definition: QuickTime.cpp:800
virtual ~Obj()
Definition: QuickTime.cpp:652
DataSourceRef mDataSource
Definition: QuickTime.h:204
uint32_t mFFTNumChannels
Definition: QuickTime.h:196
FourCharCode mFFTFourCharCode
Definition: QuickTime.h:194
uint32_t getNumFftBands() const
Definition: QuickTime.cpp:598
std::string getQuickTimeVersionString()
Returns an empty string if QuickTime is not available, otherwise a human readable string of the Quick...
Definition: QuickTime.cpp:960
std::shared_ptr< Obj > mObj
Definition: QuickTime.h:245
int32_t getHeight() const
Returns the height of the movie in pixels.
Definition: QuickTime.h:75
std::mutex mMutex
Definition: QuickTime.h:203
float * getFftData() const
Definition: QuickTime.cpp:608
bool mPalindrome
Definition: QuickTime.h:191
bool checkLoaded() const
Returns whether the movie is in a loaded state, implying its structures are ready for reading but it ...
Definition: QuickTime.cpp:866
Area getBounds() const
the Area defining the Movie's bounds in pixels: [0,0]-[width,height]
Definition: QuickTime.h:81
MovieGl()
Definition: QuickTime.h:265
static MovieGlRef create(const void *data, size_t dataSize, const std::string &fileNameHint, const std::string &mimeTypeHint="")
Definition: QuickTime.h:275
void stop()
Stops movie playback.
Definition: QuickTime.cpp:638
Definition: Texture.h:279
void initFromMemory(const void *data, size_t dataSize, const std::string &fileNameHint, const std::string &mimeTypeHint)
Definition: QuickTime.cpp:143
bool isPlaying() const
Returns whether the movie is currently playing or is paused/stopped.
Definition: QuickTime.cpp:623
gl::Texture mTexture
Definition: QuickTime.h:293
Definition: QuickTime.h:383
virtual MovieBase::Obj * getObj() const
Definition: QuickTime.h:300
Definition: QuickTime.h:213
bool mLoaded
Definition: QuickTime.h:190
void setRate(float rate)
Sets the playback rate, which begins playback immediately for nonzero values. 1.0 represents normal s...
Definition: QuickTime.cpp:451
std::shared_ptr< Obj > MovieGl::* unspecified_bool_type
Emulates shared_ptr-like behavior.
Definition: QuickTime.h:305
std::shared_ptr< class DataSource > DataSourceRef
Definition: DataSource.h:35
Surface getSurface()
Returns the Surface8u representing the Movie's current frame.
Definition: QuickTime.cpp:717
void waitForLoaded() const
Waits until the movie is in a loaded state, which implies its structures are ready for reading but it...
Definition: QuickTime.cpp:887
float getPixelAspectRatio() const
Returns the movie's pixel aspect ratio. Returns 1.0 if the movie does not contain an explicit pixel a...
Definition: QuickTime.cpp:94
::Movie getMovieHandle() const
Returns the native QuickTime Movie data structure.
Definition: QuickTime.h:154
TimeValue getStartTimeOfFirstSample() const
Definition: QuickTime.cpp:414
int32_t floatToFixed(float fl)
Definition: QuickTime.h:365
float mDuration
Definition: QuickTime.h:189
QTAudioFrequencyLevels * mFFTData
Definition: QuickTime.h:193
bool hasAlpha() const
Returns whether the first video track in the movie contains an alpha channel. Returns false in the ab...
Definition: QuickTime.cpp:264
Definition: QuickTime.h:380
static MovieLoaderRef create(const Url &url)
Definition: QuickTime.h:316
Vec2< int > Vec2i
Definition: Vector.h:1313
bool mLoop
Definition: QuickTime.h:191
virtual void newFrame(CVImageBufferRef cvImage)
Definition: QuickTime.cpp:805
void updateLoadState() const
Definition: QuickTime.cpp:911
Definition: QuickTime.h:389