Recent

Author Topic: DSPack for Lazarus - Win32 DirectShow Multimedia components  (Read 84233 times)

TheBlackSheep

  • Jr. Member
  • **
  • Posts: 93
DSPack for Lazarus - Win32 DirectShow Multimedia components
« on: April 29, 2012, 06:20:43 pm »
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

  • New Member
  • *
  • Posts: 16
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #1 on: June 14, 2012, 07:58:28 pm »
Thanks for component!
Say, is it possible not to  use pl_win_directx? I've failed with it actually. Thanks!

TheBlackSheep

  • Jr. Member
  • **
  • Posts: 93
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #2 on: June 16, 2012, 08:12:14 pm »
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: [Select]
    {$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}

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

Code: [Select]
    function QueryInternalConnections(out apPin: IPin; var nPin: ULONG): HResult; stdcall;

(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

  • Jr. Member
  • **
  • Posts: 93
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #3 on: June 16, 2012, 10:03:52 pm »
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: [Select]
    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;   

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

Code: [Select]
    Bitmap.LoadFromFile(CurrentFileName);       
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: [Select]
    VMRBitmap.LoadEmptyBitmap(640, 480, pf24bit, clBlack);
    VMRBitmap.Source := VMRBitmap.Canvas.ClipRect;
    VMRBitmap.DrawTo(0,0,1,1,0);     

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: [Select]
    Bitmap := TBitmap.Create;
    VMRBitmap.LoadBitmap( Bitmap );
    VMRBitmap.Source := VMRBitmap.Canvas.ClipRect;
    VMRBitmap.DrawTo(0,0,1,1,0);
    Bitmap.Free;   
 
« Last Edit: June 16, 2012, 10:30:21 pm by TheBlackSheep »

Riccardo Giuliani

  • New Member
  • *
  • Posts: 40
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #4 on: June 23, 2012, 04:10:11 pm »
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: [Select]
C:\lazarus\DSPack-Lazarus-8584331\DXSUtil.pas(913,74) Fatal: Syntax error, ":" expected but "identifier IID" found

which relates to this code line (in DSXUtil.pas):
Code: [Select]
function QueryInterface( {$IFDEF FPC} constref {$ELSE} const {$ENDIF}IID: TGUID; out Obj): HResult; stdcall;
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

Andru

  • Full Member
  • ***
  • Posts: 112
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #5 on: June 23, 2012, 04:28:34 pm »
Quote
I'm using Lazarus 0.9.30 and FPC 2.4.2 on Windows XP.
This version of FPC missing constref, try to use FPC 2.6.0

Riccardo Giuliani

  • New Member
  • *
  • Posts: 40
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #6 on: June 24, 2012, 11:02:27 am »
Upgraded to FPC 2.6.0, and the compiler goes well... until it stops due to this error
Code: [Select]
C:\lazarus\DSPack-Lazarus-8584331\BaseFilterEditor.pas(887,16) Error: Identifier not found "BrushCopy"
related to
Code: [Select]
BrushCopy(Bounds(Rect.Left + Offset, Rect.Top, Bitmap.Width, Bitmap.Height),
          Bitmap, Bounds(0, 0, Bitmap.Width, Bitmap.Height), clOlive);  {render bitmap}
inside procedure TFormBaseFilter.PinsDrawItem.

I looked for explanations on internet, and found that this problem seems quite recent, from bugtracker http://62.166.198.202/view.php?id=8047; and here the status is set to resolved.
Don't know what to do. Anybody knows?
Thanks

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #7 on: June 24, 2012, 11:49:24 am »
Haven't looked at the bug, but instead of FPC 2.6.0, you could use FPC 2.6.1 (the fixes 2.6 branch), which contain stability updates to 2.6.0.

Also, check the bug report for which version it was fixed. It may be for 2.7 (current trunk/development version). A fix may have been backported to (implemented in) FPC 2.6.1, but not to 2.6.0 as that release will not be changed.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Riccardo Giuliani

  • New Member
  • *
  • Posts: 40
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #8 on: June 24, 2012, 11:57:59 am »
You're right, the fix is just for Lazarus 0.9.31 SVN, while I'm actually using 0.9.30.4.
This even if my SVN revision is 35940, and the fixed one is 35134.
Anyway, I must try the 0.9.31 to be sure.
Thanks again.

Riccardo Giuliani

  • New Member
  • *
  • Posts: 40
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #9 on: June 24, 2012, 05:34:29 pm »
Ok
With snapshot Lazarus-1.1-37738-fpc-2.6.1-20120623-win32.exe dspack has been finally installed; not tested if it works, but now controls are available.

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1263
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #10 on: January 15, 2013, 06:08:02 am »
I've been using the DSPack bundled with CodeTyphon 2.9 (Lazarus 1.1) for the past week or so, and other than some form inheritance issues (which were easy enough to work around - just dynamically create the controls at run time), it's all been smooth sailing.  Haven't tried capture or DVD yet, just video playback.

Kicking myself actually.  Around 2003/2004 I created similar code to DSPack, based on the Clootie headers.  Looking at the copyright dates for DSPack, looks like I could have avoided months of work back then :-)

Does anyone know if the DSPack used in CodeTyphon is the port completed by TheBlackSheep?
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

carmeloconny

  • New Member
  • *
  • Posts: 29
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #11 on: February 15, 2015, 10:24:03 am »
Hello everyone.
I would like to use DSPack components for my project with Lazarus.
I Lazarus Ver. 1.2.6 with FPC 2.6.4 in windows 7 32 bit

I have done this:
1) download from DSPack
https://github.com/TheBlackSheep/DSPack-Lazarus
2) download "FPC_DirectX92.zip" extract files in the directory DSPack

http://www.clootie.ru/fpc/index.html
3)
   Download DirectShow9.pas file, copied to the directory DSPack
http://dspack.googlecode.com/svn-history/r7/trunk/src/DirectX9/DirectShow9.pas
I remove from package "pl_win_directx", and compiled package.
Error in "BaseClass.pas" file

Quote
    // martin begin
    //result := ti.Invoke(Pointer(Integer(Self)), DISPID, Flags, TDispParams(Params),
    //  Variant(VarResult^), ActiveX.EXCEPINFO(ExcepInfo^), UINT(ArgErr^));
    // martin end   
I replaced it with:
Quote
result := ti.Invoke(Pointer(Integer(Self)), DISPID, Flags, TDispParams(Params),
      VarResult, ExcepInfo, ArgErr);

Package successfully compiled and installed, now palette DSPack components OK.
Perform a test project with components:
TFilterGraph, TVideoWindow a button to do this:
Quote
    if not FilterGraph.Active then
         begin FilterGraph.Active := true; end;     ( ERRORE in RUN : exsternal SIGSEGV.   Errore di classe. )

   FilterGraph.ClearGraph;
    FilterGraph.RenderFile('C:\film\01\01.mp4');
    FilterGraph.Play;

Can anyone tell me where I went wrong? Help please.

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1263
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #12 on: February 18, 2015, 06:47:01 am »
Can't see anything obviously wrong with the little code snippet you've posted.  You haven't shown how've connected the different components together...

The port by TheBlackSheep is reasonably stale.  The guys over at PilotLogic took this work and expanded it a little, fixing some other items.  http://www.pilotlogic.com/sitejoom/index.php/codetyphon

To the best of knowledge (it's now been over a year since I last checked), you cannot independently download their DirectX and DSPack components.

*cough*  I took a copy of their work middle of last year.  It's here if you want it...
https://svn.code.sf.net/p/lazarusvideoutilities/code/trunk/Packages/

(Yeah, don't look too closely at that SourceForge project, though the code in the link posted is good.  It was in the days when I thought I would have free time in my future: that hasn't happened and that project (and others) has languished)
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

carmeloconny

  • New Member
  • *
  • Posts: 29
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #13 on: February 23, 2015, 08:23:16 pm »
Mike.Cornflake Thanks for your response.
I after many attempts I have installed pl_Win_DirectX, pl_Win_DSPack
Quote
http://www.pilotlogic.com/sitejoom/index.php/forum/pl-win-dspack/2153-lab-pl-win-dspack-tests
This package works.

Now I study examples to understand this technology.
I found an example that is what I want to do:
Quote
http://tutoriels.pecaudchristopher.com/TutorielDSPACK234Delphi.php
I have some problems, but I hope I can achieve this example of the tutorial.

For now, I thank you and excuse me for writing post late.
And you excuse for my english

carmeloconny

  • New Member
  • *
  • Posts: 29
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #14 on: February 26, 2015, 01:21:43 pm »
I need to find example DSPack to use DeckLink card or other similar card for video output?
In dspack \ samples I do not understand how.
In internet I have not found such to be studied to make my project.
I manage to capture and video from web cam input, I can play video from harddisk, and see in Tvideowindows component. I would like this in analog TV connected to my DeckLink Card.

 

TinyPortal © 2005-2018