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;
60 namespace cinder {
namespace qtime {
117 void setLoop(
bool loop =
true,
bool palindrome =
false );
151 void setNewFrameCallback(
void(*aNewFrameCallback)(
long,
void * ),
void *aNewFrameCallbackRefcon );
170 void initFromMemory(
const void *data,
size_t dataSize,
const std::string &fileNameHint,
const std::string &mimeTypeHint );
216 MovieSurface(
const fs::path &path );
217 MovieSurface(
const class MovieLoader &loader );
220 MovieSurface(
const void *data,
size_t dataSize,
const std::string &fileNameHint,
const std::string &mimeTypeHint =
"" );
221 MovieSurface(
DataSourceRef dataSource,
const std::string mimeTypeHint =
"" );
223 static MovieSurfaceRef create(
const fs::path &path ) {
return std::shared_ptr<MovieSurface>(
new MovieSurface( path ) ); }
225 static MovieSurfaceRef create(
const void *data,
size_t dataSize,
const std::string &fileNameHint,
const std::string &mimeTypeHint =
"" )
226 {
return std::shared_ptr<MovieSurface>(
new MovieSurface( data, dataSize, fileNameHint, mimeTypeHint ) ); }
228 {
return std::shared_ptr<MovieSurface>(
new MovieSurface( dataSource, mimeTypeHint ) ); }
234 void allocateVisualContext();
236 struct Obj :
public MovieBase::Obj {
239 virtual void releaseFrame();
245 std::shared_ptr<Obj> mObj;
246 virtual MovieBase::Obj* getObj()
const {
return mObj.get(); }
251 typedef std::shared_ptr<Obj> MovieSurface::*unspecified_bool_type;
252 operator unspecified_bool_type()
const {
return ( mObj.get() == 0 ) ? 0 : &MovieSurface::mObj; }
253 void reset() { mObj.reset(); }
258 typedef std::shared_ptr<MovieGl> MovieGlRef;
263 class MovieGl :
public MovieBase {
265 MovieGl() : MovieBase() {}
266 MovieGl(
const fs::path &path );
267 MovieGl(
const class MovieLoader &loader );
270 MovieGl(
const void *data,
size_t dataSize,
const std::string &fileNameHint,
const std::string &mimeTypeHint =
"" );
271 MovieGl(
DataSourceRef dataSource,
const std::string mimeTypeHint =
"" );
273 static MovieGlRef create(
const fs::path &path ) {
return std::shared_ptr<MovieGl>(
new MovieGl( path ) ); }
275 static MovieGlRef create(
const void *data,
size_t dataSize,
const std::string &fileNameHint,
const std::string &mimeTypeHint =
"" )
276 {
return std::shared_ptr<MovieGl>(
new MovieGl( data, dataSize, fileNameHint, mimeTypeHint ) ); }
277 static MovieGlRef create(
DataSourceRef dataSource,
const std::string mimeTypeHint =
"" )
278 {
return std::shared_ptr<MovieGl>(
new MovieGl( dataSource, mimeTypeHint ) ); }
281 const gl::Texture getTexture();
284 void allocateVisualContext();
286 struct Obj :
public MovieBase::Obj {
290 virtual void releaseFrame();
293 gl::Texture mTexture;
294 #if defined( CINDER_MSW )
295 gl::TextureCache mTextureCache;
299 std::shared_ptr<Obj> mObj;
300 virtual MovieBase::Obj* getObj()
const {
return mObj.get(); }
305 typedef std::shared_ptr<Obj> MovieGl::*unspecified_bool_type;
306 operator unspecified_bool_type()
const {
return ( mObj.get() == 0 ) ? 0 : &MovieGl::mObj; }
307 void reset() { mObj.reset(); }
314 MovieLoader(
const Url &url );
316 static MovieLoaderRef create(
const Url &url ) {
return std::shared_ptr<MovieLoader>(
new MovieLoader( url ) ); }
319 bool checkLoaded()
const;
321 bool checkPlayable()
const;
323 bool checkPlaythroughOk()
const;
326 void waitForLoaded()
const;
328 void waitForPlayable()
const;
330 void waitForPlaythroughOk()
const;
333 const Url& getUrl()
const {
return mObj->mUrl; }
336 ::Movie getMovieHandle()
const {
return mObj->mMovie; }
339 ::Movie transferMovieHandle()
const { mObj->mOwnsMovie =
false;
return mObj->mMovie; }
342 void updateLoadState()
const;
345 Obj(
const Url &url );
348 mutable bool mOwnsMovie;
351 mutable bool mLoaded, mPlayable, mPlaythroughOK;
354 std::shared_ptr<Obj> mObj;
359 typedef std::shared_ptr<Obj> MovieLoader::*unspecified_bool_type;
360 operator unspecified_bool_type()
const {
return ( mObj.get() == 0 ) ? 0 : &MovieLoader::mObj; }
361 void reset() { mObj.reset(); }
365 inline int32_t floatToFixed(
float fl ) {
return ((int32_t)((
float)(fl) * ((int32_t) 0x00010000L))); }
377 class QuickTimeExc :
public std::exception {
380 class QuickTimePathInvalidExc :
public QuickTimeExc {
383 class QuickTimeFileInvalidExc :
public QuickTimeExc {
386 class QuickTimeExcUrlInvalid :
public QuickTimeExc {
389 class QuickTimeErrorLoadingExc :
public QuickTimeExc {
392 class QuickTimeExcFft :
public QuickTimeExc {
396 #endif // ! defined( __LP64__ )