On 16.02.2008, at 01:16, Emily Mower wrote: > Hello, > > I am currently creating an FLTK gui designed for real-time video > evaluation. I was browsing online and I came cross the "RFC: next > generation FLTK features" website ( > http://www.mail-archive.com/[email protected]/msg00827.html) in which > someone > stated that they had a somewhat functional Fl_Quicktime_Widget > developed for > displaying quicktime movies within the gui. I was therefore > wondering if > you know of any location where such a file could be obtained. Thanks!
Yes, no guarantees whatsoever. There surely is a better (or correct)way to do this. : Flmp_Quicktime_Player.H: // // "$Id: Flmp_Quicktime_Player.H 4650 2005-11-18 10:08:13Z matt $" // // Quicktime Player support for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2007 by Matthias Melcher. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Library General Public License for more details. // // You should have received a copy of the GNU Library General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA. // // Please report all bugs and problems on the following page: // // http://www.matthiasm.com/ // #ifndef _FLMP_QUICKTIME_PLAYER_ #define _FLMP_QUICKTIME_PLAYER_ #include <FL/Fl.H> #include <FL/Fl_Box.H> #ifdef __APPLE__ # include <FL/x.H> # include <FL/fl_draw.H> # include <QuickTime/QuickTime.h> #endif class Flmp_Quicktime : public Fl_Box { public: Flmp_Quicktime(int x, int y, int w, int h, const char *l=0); void movie(const char *filename); void play(); void stop(); void set_loop(int i=1); char is_playing(); #ifdef __APPLE__ void draw(); void show(); void hide(); protected: void rInitialize(); void rOpenMovie(); void rPlay(); void rStop(); void rSetLoop(); static bool _initialized; bool _play; bool _set_loop; bool _loop; bool _stop; bool _playing; bool _new_filename; char *_filename; ControlRef _controller; MovieController _mc; Movie _movie; static void is_playing_tmr(void*); #endif }; #endif // // End of "$Id: Flmp_Quicktime_Player.H 4650 2005-11-18 10:08:13Z matt $". // --- Flmp_Quiktime_Player.cxx // // "$Id: Flmp_Quicktime_Player.cxx 4650 2005-11-18 10:08:13Z matt $" // // Quicktime player support for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2007 by Matthias Melcher. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Library General Public License for more details. // // You should have received a copy of the GNU Library General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA. // // Please report all bugs and problems on the following page: // // http://www.matthiasm.com // #include "../FL/Flmp_Quicktime_Player.H" #include <FL/Fl.H> #ifdef __APPLE__ #include <QuickTime/QuickTime.h> #include <stdio.h> bool PathToFSSpec(const char *path, FSSpec *spec) { FSRef ref; return FSPathMakeRef((UInt8*)path, &ref, NULL) == noErr && FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL, spec, NULL) == noErr; } void Flmp_Quicktime::stop() { _stop = true; redraw(); } void Flmp_Quicktime::set_loop(int i) { _set_loop = true; _loop = i; redraw(); } Flmp_Quicktime::Flmp_Quicktime(int x, int y, int w, int h, const char *l) : Fl_Box(x, y, w, h, l) { box(FL_DOWN_BOX); align(FL_ALIGN_TOP); _playing = false; _play = false; _stop = false; _loop = false; _set_loop = false; _filename = 0L; _new_filename = false; _controller = 0L; _movie = 0L; _mc = 0L; } void Flmp_Quicktime::movie(const char *filename) { _filename = strdup(filename); _new_filename = true; redraw(); } void Flmp_Quicktime::play() { _play = true; redraw(); } void Flmp_Quicktime::show() { if (_controller) { MCSetVisible(_mc, TRUE); } Fl_Box::show(); } void Flmp_Quicktime::hide() { if (_controller) { MCSetVisible(_mc, FALSE); } Fl_Box::show(); } char Flmp_Quicktime::is_playing() { if (!_movie) return 0; return !IsMovieDone(_movie); } void Flmp_Quicktime::draw() { Fl_Box::draw(); if (!_initialized) rInitialize(); if (_new_filename) rOpenMovie(); if (_stop) rStop(); if (_play) rPlay(); if (_set_loop) rSetLoop(); MCDraw(_mc, fl_window); if (!IsMovieDone(_movie)) redraw(); else if (_playing) { _playing = false; if (callback()) do_callback(); } } void Flmp_Quicktime::is_playing_tmr(void *w) { Flmp_Quicktime *p = (Flmp_Quicktime*)w; if (p->_movie && p->_playing) { if (IsMovieDone(p->_movie)) { p->_playing = false; if (p->callback()) p->do_callback(); } else { Fl::repeat_timeout(0.1, is_playing_tmr, w); } } } void Flmp_Quicktime::rInitialize() { EnterMovies(); _initialized = true; } void Flmp_Quicktime::rOpenMovie() { if (_movie) { if (_controller) { MCRemoveMovie(_mc); } DisposeMovie(_movie); _movie = 0L; } OSStatus ret; FSSpec fileSpec; PathToFSSpec(_filename, &fileSpec); short resRefNum; short resId = movieInDataForkResID; ret = OpenMovieFile(&fileSpec, &resRefNum, fsRdPerm); ret = GetMoviesError(); unsigned char resName[1024]; ret = NewMovieFromFile(&_movie, resRefNum, &resId, resName, newMovieActive, 0L); ret = GetMoviesError(); _new_filename = false; // GetMovieBox(...); // create a controller if needed, or assign new movie to old controller if (!_controller) { Rect r; GetMovieBox(_movie, &r); Fl_Boxtype b = box(); r.left = x()+Fl::box_dx(b); r.right = r.left+w()-Fl::box_dw(b); r.top = y()+Fl::box_dy(b); r.bottom = r.top+h()-Fl::box_dh(b); ret = CreateMovieControl( fl_window, &r, _movie, kMovieControlOptionHideController, &_controller ); GetControlData(_controller, 0, kMovieControlDataMovieController, sizeof(MovieController), &_mc, 0L); SetMovieBox(_movie, &r); // this will ignore the aspect ration, but cover the controls } else { Rect r; GetMovieBox(_movie, &r); Fl_Boxtype b = box(); r.left = x()+Fl::box_dx(b); r.right = r.left+w()-Fl::box_dw(b); r.top = y()+Fl::box_dy(b); r.bottom = r.top+h()-Fl::box_dh(b); Point where = { r.top, r.left }; SetMovieBox(_movie, &r); // this will ignore the aspect ration, but cover the controls MCSetMovie(_mc, _movie, fl_window, where); } } void Flmp_Quicktime::rPlay() { _play = false; _playing = true; Fl::add_timeout(0.3, is_playing_tmr, this); _set_loop = false; Boolean lp = _loop ? TRUE : FALSE; MCDoAction(_mc, mcActionSetLooping, (void*)lp); StartMovie(_movie); } void Flmp_Quicktime::rStop() { _stop = false; //Fixed rate = FloatToFixed(0.0); StopMovie(_movie); //MCDoAction(_mc, mcActionPlay, (void*)rate); } void Flmp_Quicktime::rSetLoop() { _set_loop = false; Boolean lp = _loop ? TRUE : FALSE; MCDoAction(_mc, mcActionSetLooping, (void*)lp); } bool Flmp_Quicktime::_initialized = false; #else Flmp_Quicktime::Flmp_Quicktime(int x, int y, int w, int h, const char *l) : Fl_Box(FL_BORDER_BOX, x, y, w, h, l) { } void Flmp_Quicktime::movie(const char *filename) { } void Flmp_Quicktime::play() { } void Flmp_Quicktime::stop() { } void Flmp_Quicktime::set_loop(int i) { } #endif // // End of "$Id: Flmp_Quicktime_Player.cxx 4650 2005-11-18 10:08:13Z matt $". // ---- http://robowerk.com/ _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

