JEDI Quicktime Project

Team Lead: George Birbilis
<birbilis AT kagi DOT com>
 

What is QuickTime?

QuickTime® is a huge multimedia API that originated on the Apple Macintosh. To find out about QuickTime use these links:

For info about Quicktime® products
Authoring File formats
Tutorials
Apple Developer Connection - QuickTime

The idea is to make a foundation that will build a market for QT controls for Delphi. QT is a multimedia API that can cover lots of areas of multimedia. Of course, as part of the foundation the team will provide several controls for free (e.g. the QTFileDialog control with image/movie previewing, etc.)

JEDI's MPL license covers the case of companies marketing their own shareware components for Quicktime based on our free headers, ported Apple sample code, utils etc. foundation. This would also make a critical mass of people contributing free stuff for the QuickTime-Delphi project (like an exchange project - they get something for free, they feel obliged to contribute something too).

Downloads

File Date Contents

The qtmlClient.DLL library

- - A separate download because of its size. Please also take note of the FAQ items I have added regarding this DLL.

The whole bundle of files

2008-08-11 Contains all you need. Includes
  • Work-in-Progress - several completed translations that are READY FOR TESTING
  • Additions to qt_QuicktimeVR.pas, now supporting "view state calls". I have now almost finished the "QuickTime VR" support.
  • The QuickTime Utilities package contains some needed utility units for compiling the simple player application. Much of the Apple sample code is, or will be, ported into this package
  • QuickTime Components package containing the freeware components the QT JEDI team is designing/implementing. The .pas files are still the same, but "Delphi4" and "Delphi5" folders with binaries are now provided instead of the older "bin" (DCUs) and "Delphi5" (D5 package) folders.
  • Most useful thing in it is a property editor for filename properties that shows a QT file dialog with preview (for images/videos/qtvr/etc.). Also has a QTFileDialog component but is yet unfinished...
  • QuickTime Simple Player, an application written by me (George Birbilis) to demonstrate the conversions at work. The latest version has some additions aimed at better support for MPEG files.

C2PasFilter code filter tool

Nov 2001 A utility I developed to speed up code conversion. It can work on multiple lines, e.g. the 'funcs' button can run through and convert many proc declarations from the QT headers; similarly for the the 'vars' button, which converts syntax like:

int x;
double y;

  to

x:int;
y:double;

c2pasFilter

These c2pasFilter sources are not clever code, although the string-parsing routines in ac_strings.pas are quite useful. Some snippets would be of use in the development of an automatic QT headers translator.

Developers

Anyone working on QT-SDK C code/declarations and adding to the headers please contribute the changes to the JEDI-QT effort by emailing them to me (birbilis AT kagi DOT com) with the subject "New QT Translations" first for inspection before uploading to the FTP area. Please do make use of the C2PasFilter tool.

QuickTime F A Q

I'm getting error 'Einvalidop - Invalid floating point operation'

please see this Apple QuickTime list posting for a solution to this QuickTime issue with Delphi. You can make a unit with wrapper calls for any JEDI QuickTime functions you find that have this problem. Those wrappers would do the workaround mentioned at the above posting and call the original JEDI functions (that map to calls to QuickTime DLLs). Please consider contributing any such unit or your list of problematic functions to JEDI. We have already reported this issue to Apple, but you can still file a bug at their bugreporter page.

How can I open a movie from my Delphi program?

To open a movie, you use FSMakeFSSpec to make a file spec (a file object - Apple/MacOS style of programming similar to file handles in UNIX/C) and then you open a movie object (I think OpenMovie call) from the FSSpec you created.

At the QT samples site of Apple and in their docs there's plenty of code about this.

The following code is from my TQTControl/TQTVRControl code (those are commercial components, can buy from my QT4Delphi site if you want them):
procedure TQTControl.setFilename;
var fs:FSSpec;
    movieResFile:short;
begin
  fFileName:=value;
  if (not qtInited) then exit; //window handle not inited yet... will try to 
                               //load from the filename property later
  CloseMovie; //dispose any previous movie&controller (can't reuse a controller, 
              //cause we may have now loaded some 
              //other movie type that needs other controller, say QTVR)
  if (value='') then exit; //just do a CloseMovie if the new filename=''
  try
    SetGWorld(CGrafPtr(GetNativeWindowPort(handle)),nil); //!!!
    FSMakeFSSpec(0,0,@value,@fs);
    if (OpenMovieFile(@fs,@movieResFile,fsRdPerm)<>noErr) then 
      exit; //raise Exception.Create('Couldn''t open file '+value);
    NewMovieFromFile(@theMovie,movieResFile,nil,nil,newMovieActive,nil);
    CloseMovieFile(movieResFile);

    setTheMovie(theMovie); //?can we use a local myMovie var 
                           //and then do on a property theMovie:=myMovie ??? 
                           //(or does QT keep those movie var pointers)
  except
    {Handle it}
  end;
end;

Delphi is missing qd3d.dll. Quicktime is installed. What is the qd3d.dll?

It's QuickDraw3D. InitializeQT is calling InitializeQD3D or something like that. QuickDraw3D is a bit abandoned by Apple, but it should be available as an optional component in the QT installer (press custom when installing QT and check for a "QuickDraw 3D item").

QD3D wasn't an optional QT component in the past... we have to check if it is now and may have to do some changes to QT-JEDI to pass flags to QT initialization routines to not initialize QD3D at startup.

Will the SimplePlayer application play MPEGs?

MPEG files are supported by my commercial QT Controls, but the SimplePlayer crashes with MPEGs. I'm looking into why that is happening. SimplePlayer seems to also not open some other files that my controls do open. The movie seems to open OK when stepping the SimplePlayer code with the Delphi debugger but the problem seems to be a crash in QT when the movie is played.

When I try to install this component Delphi says:
"Can`t load package ...\QuickTime.bpl.  The device linked to system does not work."
What can I do?

I got some feedback from Alexey Smirnov that the QTMLClient.DLL of QT5 SDK causes a loading problem for QuickTime.bpl (he tried on WinME/Delphi5) then delivers this message.

Dmitry said that using the QTMLClient.DLL from the QT4 SDK (the one distributed on our download page) it now worked OK for him. I will try to look into it sooner or later...

What about Delphi 6 headers?

Since the sources are available you can compile them with Delphi6 too.
If you find out that DCUs of QT-JEDI build with Delphi5 don't work in Delphi6, please let me know. In that case, please do a build of the sources with Delphi6 and sent me the build DCUs so that we can put them on the JEDI site for downloading [for developers' ease to avoid rebuilding].

It seems a bit weird that you need the DLL, I tried the quicktime c++ sample application and I don't recall it using any external DLL. Having a DLL may have "issues" with redistribution since it doesn't seem to come with the default QuickTime install.

the DLL is for free, have checked it with Apple's QT team long ago...the DLL is needed because Delphi can't use C's .lib files and static linking of C libraries. The DLL also provides name-mungled-free versions (C++ does name mungling and changes names of exported procs to add info about the method's syntax etc.)

Can you possibly change the code so that the qtmlClient.dll it isn't required by default? or say, not used if the dll doesn't exist ...

This isn't possible (see previous FAQ). To do that I'd have to find each C++ name-mungled name and where it is in the various QT DLLs. The QuickTime team from Apple is providing this DLL for ease of use in non-C++ environments (also in Borland's BC++ or C++Builder which uses different name-mungling from Microsoft's VC++)

I`m trying to work with QTVRSetMouseOverHotSpotProc. My example:
    ==cut==
function TForm1.MyMouseOverHotSpotProc(qtvr:QTVRInstance; hotSpotID:UInt32 ; 
                                       flags:UInt32 ; refCon:SInt32 ):OSErr;
begin
  MyMouseOverHotSpotProc:=noErr;
end;
   ==cut==
procedure TForm1.OpenMovie;
    ==cut==
    QTVRSetMouseOverHotSpotProc(myInstance,MyMouseOverHotSpotProc, 0, 0);
    ==cut==
and I see error message - "Incompatible types: Calling conventions differ".

See the definition of the MouseOverHotSpotProc routine, it isn't a method pointer, it's a function pointer. (Methods have an extra hidden parameter passed with the "self" pointer [the object instance]. So you need to use a function in your unit, not an object method.

Also see the end of that function pointer type definition, if it has a "cdecl", you need to also use "cdecl" for your function (see "calling conventions" in the Delphi help).
e.g.
function MyMouseOverHotSpotProc(qtvr:QTVRInstance;hotSpotID:Uint32;
                                flags:UInt32;refCon:SInt32):OSErr; cdecl;
begin
//...
end;


If I do remember well, in my TQTVRControl (a commercial one, see the QT4Delphi website), I've made a unit that acts as a dispatcher for events: there's only one function for the event handler and it checks the "refCon" parameter to get the pointer of the object and cast it to TQTVRControl and call its appropriate OnXXX event handler method, if there's one set (if the respective OnXXX property is not nil).

So when I register the event handler, I always do for example something like:
QTVRSetMouseOverHotSpotProc(MyQTVRControl.movie, 
                            Dispatcher.MouseOverHotSpotDispatcher, 
                            0, MyQTVRControl);


(Dispatcher is a unit, I could also write MouseOverHotSpotDispatcher cause I have "uses Dispatcher" in that code, but for clarity I prefer to write the unit name, dot, then the dispatcher function name: just warning to not fool you and think that MouseOverHotSpotDispatcher is a method cause it isn't: it's just a function in the Dispatcher unit).

The function MouseOverHotSpotDispatcher should do something like:
function MouseOverHotSpotDispatcher(qtvr:QTVRInstance;hotSpotID:Uint32;
                                    flags:UInt32;refCon:SInt32):OSErr; cdecl;
begin
 (refcon as TQTVRControl).onMouseOver(qtvr,hotspotID,flags);
end;


This site and the pages contained within are Copyright 1997-2006, Project JEDI. For questions and comments regarding this site please contact webmaster-AT-delphi-jedi.org
Jedi NOW!

Find software, books and training materials at our sponsor's site, www.href.com