Forum > DirectX

DSPack for Lazarus - Win32 DirectShow Multimedia components

(1/10) > >>

TheBlackSheep:
Hello Everyone

I've been through the DSPack sources and modified them to work with Lazarus (hopefully they'll still compile with Delphi too).  In the progdigy forums there's mention that the SVN source did work but I couldn't get it to compile without a reasonable amount of changes.

There's probably some stuff that doesn't quite convert correctly (I can't get the VMRBitmap to work the same as it does in Delphi) but thought if other's had a play they may see what's not correct.  Ideally we can submit the modified sources back to progdigy so they can add full(?) support for Lazarus too.

It's currently setup to use the pl_win_directx unit from CodeTyphon so if you don't use this version of Lazarus then you'll probably need to include a different requirement (or possibly convert the DSPack version of the DirectX files instead).

Anyway, the the intial stab at this conversion is here;

https://github.com/TheBlackSheep/DSPack-Lazarus

If anyone spots any errors I'd be grateful if you'd point them out - I'd particularly like to find out why the VMRBitmap doesn't work the way it does on Delphi.

TheBlackSheep

count:
Thanks for component!
Say, is it possible not to  use pl_win_directx? I've failed with it actually. Thanks!

TheBlackSheep:
Hi count

if you unzip the clootie DirecX92 pas headers (i.e. the "FPC_DirectX92.zip" file) from here;

http://www.clootie.ru/fpc/index.html

into the same folder as the dspack source, together with the DirectShow9.pas file from here;

http://dspack.googlecode.com/svn-history/r7/trunk/src/DirectX9/DirectShow9.pas

you will need to edit this one slightly (it wouldn't compile for me without it)


--- Code: ---    {$IFDEF FPC}
    // martin begin - changed apPin to "var" because "out" crashes
    function QueryInternalConnections(var apPin: IPin; var nPin: ULONG): HResult; stdcall;
    // martin end
    {$ELSE}
    function QueryInternalConnections(out apPin: IPin; var nPin: ULONG): HResult; stdcall;
    {$ENDIF}

--- End code ---

I found this FPC change to the code is unnecessary so just replace all the above with;


--- Code: ---    function QueryInternalConnections(out apPin: IPin; var nPin: ULONG): HResult; stdcall;

--- End code ---

(this may have been necessary on an older verion of FPC and this change is no longer required)

then just remove the pl_win_directx requirement and re-install it.

I still couldn't get the VMRBitmap working with this version the way it does under Delphi but maybe you'll have more success with how you want to use the dspack components.

Best of luck!

TheBlackSheep

TheBlackSheep:
5 mins of playing around with this and I realised there is no problem VMRBitmap - it does work (although I'm not using it properly) - my problem was with assigning a bitmap image on a form from within a test application to a temporary bitmap,


--- Code: ---    Bitmap := TBitmap.Create;
    Bitmap.Assign(CurrentImage.Picture.Bitmap);  //<-- this line didn't work although does in Delphi

    VMRBitmap.LoadBitmap( Bitmap );
    VMRBitmap.Source := VMRBitmap.Canvas.ClipRect;
    VMRBitmap.DrawTo(0,0,1, 1, trkAlpha.Position/10);
    Bitmap.Free;   
--- End code ---

Replacing the line with a direct load from a file, as in;


--- Code: ---    Bitmap.LoadFromFile(CurrentFileName);       
--- End code ---

and I do get a merging of the images (an onionskin effect)

However, I can't seem to turn it off again by loading an "EmptyBitmap" as in;


--- Code: ---    VMRBitmap.LoadEmptyBitmap(640, 480, pf24bit, clBlack);
    VMRBitmap.Source := VMRBitmap.Canvas.ClipRect;
    VMRBitmap.DrawTo(0,0,1,1,0);     

--- End code ---

which I've just tested on Delphi and it does turn off fine with the same code.

Anyway, I am trying to concentrate on the 5dpo version (Linux) but thought I'd share that the DSPack & VMRBitmap seems to be working ok albeit I'm still missing something in my code for Lazarus and Delphi versions of the same app.

TheBlackSheep

Edit: creating a bitmap and then loading that is the equivalent of LoadEmptyBitmap and appears to work fine, as in;


--- Code: ---    Bitmap := TBitmap.Create;
    VMRBitmap.LoadBitmap( Bitmap );
    VMRBitmap.Source := VMRBitmap.Canvas.ClipRect;
    VMRBitmap.DrawTo(0,0,1,1,0);
    Bitmap.Free;   
--- End code ---
 

Riccardo Giuliani:
Hello TheBlackSheep

I'm trying the alternative solution to avoid CodeTyphon; put the DirectShow9.pas and the FPC_DirectX92 folder both into the dspack for Lazarus folder, commented the FPC related code as suggested... but when I try to compile I get this error:

--- Code: ---C:\lazarus\DSPack-Lazarus-8584331\DXSUtil.pas(913,74) Fatal: Syntax error, ":" expected but "identifier IID" found

--- End code ---

which relates to this code line (in DSXUtil.pas):

--- Code: ---function QueryInterface( {$IFDEF FPC} constref {$ELSE} const {$ENDIF}IID: TGUID; out Obj): HResult; stdcall;
--- End code ---

What I have exactly done is to install the dspack package (with all files inside this folder) and launched its compilation, falling into the above error.

What am I missing?
Don't know if it depends on a previous conflicting configuration of Lazarus, or on other required files not available.
About the first idea, I rebuilt Lazarus: nothing changed.
Second one has come in my mind after reading of this
http://www.clootie.ru/delphi/download_dx90.html#Headers_DirectX90

I'm using Lazarus 0.9.30 and FPC 2.4.2 on Windows XP.

Hope someone could help me. Thanks

Navigation

[0] Message Index

[#] Next page

Go to full version