Recent

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

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1248
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #15 on: February 26, 2015, 02:36:40 pm »
I need to find example DSPack to use DeckLink card or other similar card for video output?
...I would like this in analog TV connected to my DeckLink Card.

Find and run a binary of the following (AMCap).  If it can see your card, then you can control the card via DirectShow.

https://msdn.microsoft.com/en-us/library/windows/desktop/dd373424(v=vs.85).aspx

To find the binary, download and install Windows SDK (back in my day it was in a separate DirectX SDK, looks like they've merged...)

Back in the old DirectX SDK, there was very comprehensive documentation for the AMCap sample.  I wrote a DVR in Delphi based off that documentation.  Hopefully it's still there in the Windows SDK...   And before you ask, I don't have any of the DVR code, I was working under contract for that and handed all code over...

If you don't want to download the entire SDK just to test viability, then I've added a build of AMCap to SourceForge...

http://sourceforge.net/p/lazarusvideoutilities/code/HEAD/tree/trunk/DirectShow%20Samples/

As for using AMCap, looks like someone has put together a decent FAQ

http://noeld.com/amfaq.htm

So yeah:

Step 1:  Confirm that card is able to be controlled DirectShow by AMCap
Step 2:  Either plough through the AMCap sourcecode from the SDK, or the documentation and work out what's next...  I'd recommend both...
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 #16 on: February 26, 2015, 07:41:53 pm »
Thanks Mr. Mike.Cornflake
 I will do as you suggested.  :D

carmeloconny

  • New Member
  • *
  • Posts: 29
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #17 on: February 27, 2015, 11:43:32 am »
yes, my card is recognized by AMCAP.
I do a test with:
Quote
SysDev:= TSysDevEnum.Create(CLSID_VideoInputDeviceCategory);
    if SysDev.CountFilters > 0 then
    begin
      for i:= 0 to SysDev.CountFilters - 1 do
         ListBox1.Items.Add(SysDev.Filters.FriendlyName);
    end;                                                         
I see my DeckLink card and my web-cam.
I look for a way to use DeckLink video output analogic.
I have not found an example code for this.  :-\
----------------------------------------------------
other problem:
1) with properties BaseFilter click (TBaseFilter). ( error in Properties click )
 2) FilterGraph1 GraphichEdit: = True (error in run)
 graphedt.exe not see my video files to run the application.
 I have installed:
 pl_Win_DirectX.zip (824KB) and pl_Win_DSPack.zip (270KB) of Mr. Sternas,
http://www.pilotlogic.com/sitejoom/index.php/forum/pl-win-dspack/2153-lab-pl-win-dspack-tests?limitstart=0
 I have installed and tried WindowsSDK 8.1 or WindowsSDK 7.1 .
 I have win7 32bit


Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1248
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #18 on: February 27, 2015, 12:03:24 pm »
yes, my card is recognized by AMCAP.

Excellent news.

I have not found an example code for this.  :-\

I'll have a quick look around tonight and get back to you.  I'm diving back into DirectShow to help someone else anyway...

A lot of the sample code out there is C++, you will likely have to do some translation yourself along the way...

2) FilterGraph1 GraphichEdit: = True (error in run)

I reported this to PilotLogic myself two years ago (in the same thread your referencing).    I've already tried and failed to fix this myself - though if someone else could, that would be great :-)   To workaround, simply set GraphEdit := False.  It's required for the RunningObjectTable, which is useful for debug purposes.  Essentially, with GraphEdit := True, you have the ability to view (and manipulate) your running Graph in GraphEdit.    By setting it to false, you just lose this visual debug tool.

1) with properties BaseFilter click (TBaseFilter). ( error in Properties click )

Absolutely nothing anyone can do to help you with this without you sharing code :-(   I've tried trying to glimpse your code in the supplied screenshots, but it's just enough.  Please post code (as full as possible) and highlight the line the error occurs on.
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 #19 on: February 27, 2015, 12:39:23 pm »
Quote
I reported this to PilotLogic myself two years ago (in the same thread your referencing).    I've already tried and failed to fix this myself - though if someone else could, that would be great :-)   To workaround, simply set GraphEdit := False.  It's required for the RunningObjectTable, which is useful for debug purposes.  Essentially, with GraphEdit := True, you have the ability to view (and manipulate) your running Graph in GraphEdit.    By setting it to false, you just lose this visual debug tool.
ok i've understood. work without.
----------------------------------------------
Quote
Absolutely nothing anyone can do to help you with this without you sharing code :-(   I've tried trying to glimpse your code in the supplied screenshots, but it's just enough.  Please post code (as full as possible) and highlight the line the error occurs on.
example: I have a form and insert Tfilter object ispector click TBaseFilter. (Here error)
in attaching I put what I should have, I receive error.
 This is BUG of DsPack component?
------------------------------------------
I await your response to make work DeckLink video output.
 thanks very much  ;)
« Last Edit: February 27, 2015, 12:41:11 pm by carmeloconny »

carmeloconny

  • New Member
  • *
  • Posts: 29
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #20 on: February 27, 2015, 12:49:37 pm »
I found this very interesting to understand DSpack work:
Quote
http://www.vwlowen.co.uk/directshow/page01.htm
  ;)
I asked author tutorial to help me for DeckLink Out-put, he replied that they can not help  :-\

P.S.:
"Blackmagic DeckLink SDK 10.1" there is this example to use DeckLink and DsPack
« Last Edit: February 27, 2015, 12:59:20 pm by carmeloconny »

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1248
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #21 on: February 27, 2015, 04:52:59 pm »
I've submitted a patch for the RunningObjectTable issue.  Unfortunately I *think* I need a 64bit GraphEdt to confirm, and I currently can't find one...

http://bugs.freepascal.org/view.php?id=27555
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 #22 on: February 28, 2015, 12:47:10 pm »
cited Mike.Cornflake
Quote
I'll have a quick look around tonight and get back to you.  I'm diving back into DirectShow to help someone else anyway...

A lot of the sample code out there is C++, you will likely have to do some translation yourself along the way...
I found this old tutorial for Delphi:
http://tutoriels.pecaudchristopher.com/TutorielDSPACK234Delphi.php
this tutorial do what my serve.
I try to realize application, attached my example.
You able to watch this and my help? because my application is not working.

carmeloconny

  • New Member
  • *
  • Posts: 29
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #23 on: March 11, 2015, 09:49:56 am »
Hello
 how to change the format type to media video?
 which filter to use?
 I have to use format standard out: 720x576
Quote
hr := (fgRender as IGraphBuilder).AddSourceFilter(StringToOleStr('C:\film\01\video.mp4'),
 'Source Filter', SourceFilter);

Quote
ZeroMemory(@Mt, sizeof(AM_MEDIA_TYPE));
 Mt.MajorType := MEDIATYPE_Video;
 Mt.SubType := MEDIASUBTYPE_RGB32;
 Mt.FormatType := FORMAT_MPEG2_VIDEO;
 Mt.cbFormat := sizeof(MPEG2VIDEOINFO) + sizeof(SegHdr);
 Mt.pbFormat := CoTaskMemAlloc(Mt.cbFormat);
 ZeroMemory(Mt.pbFormat, Mt.cbFormat);

 RCSRC.Left := 0;
 RCSRC.Top:= 0;
 RCSRC.Right := 0;
 RCSRC.Bottom := 0;

 pWIH.hdr.rcSource := RCSRC;
 //*****
 pWIH.hdr.rcTarget.Left:=0;
 pWIH.hdr.rcTarget.Top:=0;
 pWIH.hdr.rcTarget.Bottom:=576;
 pWIH.hdr.rcTarget.Right:=720;

 // pWIH.hdr.rcTarget := Rect(0,0,720,576);
 //****
 pWIH.hdr.AvgTimePerFrame := 333667;
 // pWIH.hdr.AvgTimePerFrame := 278335;
 pWIH.hdr.dwPictAspectRatioX := 4;
 pWIH.hdr.dwPictAspectRatioY := 3;
 pWIH.hdr.bmiHeader.biSize := 40;
 pWIH.hdr.bmiHeader.biWidth := 720; //720
 pWIH.hdr.bmiHeader.biHeight := 576; //480
 pWIH.cbSequenceHeader := sizeof(segHdr);

 CopyMemory(@pWIH.dwSequenceHeader, @segHdr, sizeof(seghdr));

https://msdn.microsoft.com/en-us/library/windows/desktop/dd407277(v=vs.85).aspx
This works only MPG2 file.

 how can I work with all video formats?
 and which filter to use?
***********************************************
https://msdn.microsoft.com/en-us/library/windows/desktop/dd407277(v=vs.85).aspx
can I use this for my project?
 There is an example code with DSpack e pascal Lazarus language?


 thank you for help me.
« Last Edit: March 11, 2015, 12:22:04 pm by carmeloconny »

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1248
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #24 on: March 11, 2015, 07:01:02 pm »
Hello
 how to change the format type to media video?
 which filter to use?

While I got mediatypes working 12 years ago (sigh) - I no longer have that code with me (company owned code).  For my recent DSPack work, I've only ever been interested in playing video - and for that, the general FilterGraph.RenderFile is more than sufficient...

This works only MPG2 file.

 how can I work with all video formats?
 and which filter to use?

As I say, with regards to MPEG-2, I've only ever ensured a valid codec is installed on the system, then used the standard FilterGraph.RenderFile('C:\film\01\video.mp4') to play the video.   

If insufficient filters exist in the graph, then RenderFile adds video/audio renderers (as required) then attempts to build up the graph between them. RenderFile then attempts to connect all the pins together using the most valid mediatypes - automatically. 

Looks like you're attempting to do something other than play video...  So I've no concrete advice, only ideas. 

Try adding a consumer of some sort to the graph (video renderer, file writer - whatever it is you're trying to do), add whatever other filters you need.  Don't attempt to connect any pins, don't attempt to set any mediatypes.  Once everything is in the FilterGraph - try calling FilterGraph.RenderFile(<source filename>).

Here's some sample code of me adding a Filter to the FilterGraph before calling RenderFile...  And in this case, just happens to be a MPEG2 filter...

Code: [Select]
Function TFrameDirectShowVideo.Play: Boolean;
Const
  CLSID_MOONLIGHT_ELECARD_DECODER_2: TGUID = '{F50B3F13-19C4-11CF-AA9A-02608C9BABA2}';
  CLSID_MOONLIGHT_ELECARD_DECODER_4: TGUID = '{BC4EB321-771F-4E9F-AF67-37C631ECA106}';
Var
  oFilter: IBaseFilter;
  sExt: String;
Begin
  Result := False;

  If Assigned(FDSFilterGraph) And FileExists(FFilename) Then
    If FDSFilterGraph.State = gsPaused Then
      Result := FDSFilterGraph.Play
    Else
    Begin
      FDuration := -1;

      If FDSFilterGraph.Active Then
        FDSFilterGraph.Active := False;

      oFilter := nil;

      FDSFilterGraph.Active := True;

      sExt := Lowercase(ExtractFileExt(FFilename));

      // Having to do this in case the Microsoft DVD Decoder is in town...
      If (sExt = '.mpg') Or (sExt = '.pkt') Then
        If SUCCEEDED(CoCreateInstance(CLSID_MOONLIGHT_ELECARD_DECODER_2,
                                 nil, CLSCTX_INPROC_SERVER, IID_IBaseFilter, oFilter)) Then
          FDSFilterGraph.AddFilter(oFilter, 'Elecard MPEG2 Video Decoder')
        Else If SUCCEEDED(CoCreateInstance(CLSID_MOONLIGHT_ELECARD_DECODER_4, nil,
                                        CLSCTX_INPROC_SERVER, IID_IBaseFilter, oFilter)) Then
          FDSFilterGraph.AddFilter(oFilter, 'Elecard MPEG2 Video Decoder');

      FDSFilterGraph.RenderFile(WideString(FFilename));

      Result := FDSFilterGraph.Play;
    End;
End;

RenderFile will always attempt to use the Filters already existing in the graph *before* adding any new ones.  On Windows 7 and above - when playing video, Microsoft have started breaking the DirectShow Filter Priorities, and instead just inserts a Microsoft filter for handling MPEG-2.  I don't know why they do that - I've never seen it work.  So the above code is me forcing a filter I know works into the Graph so that DirectShow won't add the Microsoft one...
 
(Don't worry about the .pkt extension.  It is probably very specific to just the industry I work in...)

Who knows - This approach might work for you...  Sorry if it doesn't - I'm not in a position to research further...

Depends on where you got your DSPack from, you may need to move Procedure AddFilter(AFilter: IBaseFilter; sName : UnicodeString);  in DSPack.pas to Public.   (Change already made in my copy, not done in PilotLogic's version)

The above  code should play ANY video for which there is a valid DirectShow codec installed on the system...  I've only had a quick look, but I'm having some problems sourcing a decent DirectShow mp4 filter...   In all honesty, for playback I'm in the process to switching to mplayer/ffmpeg routines as I'm tired of endlessly ensuring the correct codecs are installed on client PCs...
« Last Edit: March 11, 2015, 07:05:41 pm by Mike.Cornflake »
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 #25 on: March 11, 2015, 07:36:55 pm »
thank you very much for your response.
 I must use :
Quote
hr := ICapGraph.RenderStream(nil,nil, SourceFilter, nil, VideoWindow1 as IBaseFilter);
 hr := ICapGraph.RenderStream(nil,nil, InfinitePinFilter, nil, IVideoRenderFilter);
because I have to see the video of "VideoWindows" application on the desktop and in out-put DeckLink card.

in the window on the desktop work all formats. The DeckLink card I have to send a 720x576 video "TV standard".

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1248
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #26 on: March 11, 2015, 07:48:48 pm »
thank you very much for your response.
 I must use :
Code: [Select]
hr := ICapGraph.RenderStream(nil,nil, SourceFilter, nil, VideoWindow1 as IBaseFilter);
 hr := ICapGraph.RenderStream(nil,nil, InfinitePinFilter, nil, IVideoRenderFilter);[/quote]

Yes, I remember now.  RenderFile was good for one-path graphs, not for the InfiniteTee...

UPDATE:  Doh!  I don't even think RenderFile is available on the CaptureGraphBuilder - only on the FilterGraph - sorry for the misdirection...

Have you found the example code that ships with PilotLogic's CodeTypon? 

There were a lot of DSPack examples in there.  I'm hoping one was for WebCams, because what you're doing is functionality similar to that scenario...  (Display WebCAM video + record encoded video)
« Last Edit: March 11, 2015, 07:53:09 pm by Mike.Cornflake »
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

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1248
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #27 on: March 11, 2015, 07:59:10 pm »
Wait :-(

Can you explain simply what it you're trying to achieve?  I'm trying to get a picture of the graph you need.  I've been thinking you're using the DeckLink card for video capture.  I now doubt that...

From what you've said, and forgetting audio, I now think you're doing something like this...

  File.mp4 --> DeckLink Decoder --> VideoRenderer

But I can't see the need for an InfiniteTee in there...

(I had thought you were doing:

DeckLink Encoder --> InfiniteTee --> Video Renderer
                                         |
                                         +-------> File Writer  )
« Last Edit: March 11, 2015, 08:02:54 pm by Mike.Cornflake »
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 #28 on: March 12, 2015, 10:51:24 am »
My project :
---------------------------------------------------------------------
Play List   --> Infinite tee  --> Monitor PC
                                      --> DeckLick          --> TV analogical
                     Infinite tee --> Default Audio PC
                                      --> DeckLinkAudio --> TV analogical
------------- attached diagram in the post ------------------------
I work with DSPack  "PilotLogic's CodeTypon"
http://www.pilotlogic.com/sitejoom/index.php/forum/pl-win-dspack/2153-lab-pl-win-dspack-tests

my code:
Component DSpack in the form  : 1) Tfiltergraph.name := fgRender;       
                                                 2)  TVideoWindow1.name := VideoWindow1;
Quote
procedure TForm1.Button1Click(Sender: TObject);
const sVideoRenderCategory: string ='External Renderers';
      sVideoRender:string = 'Decklink Video Render';
var
     i,j                                    : integer;
     SysDev, FilterEnum                     : TSysDevEnum;

     CLSID_VideoRender, G                   : TGUID;


     IVideoRenderFilter,
     SourceFilter, EstAudioInterFilter,
     IVideoWindows,
     DefaultAudioFilter,
     InfinitePinFilter,
     DemultiplexFilter,
     InfinitePinFilterAudio,
     ResizeVideoRenderer                     : IBaseFilter;


      // type media
     mt     : AM_Media_Type;
     rcSrc  : Rect;
     SeqHdr : array of Byte;

     pWIH : TMPEG2VIDEOINFO;



begin
  fgRender.ClearGraph;
 (fgRender as IGraphBuilder).QueryInterface(IID_IMediaControl, mc);
 (fgRender as IGraphBuilder).QueryInterface(IID_IMediaEvent, mEvent); 
//******************* assegn file video  ******************
hr := (fgRender as IGraphBuilder).AddSourceFilter(StringToOleStr('C:\film\video720x576.mpg'),
    'Source Filter', SourceFilter);   
//***********************************************************
//***********  Add filter External device   DeckLink ***************
SysDev:= TSysDevEnum.Create;
for i:= 0 to SysDev.CountCategories-1 do
  begin
  if SysDev.Categories.FriendlyName = sVideoRenderCategory then
    begin
   G:=SysDev.Categories.CLSID;
   FilterEnum:=TSysDevEnum.Create(G);
   for j:= 0 to FilterEnum.CountFilters-1 do
      begin
      if FilterEnum.Filters[j].FriendlyName= sVideoRender then
        begin
        CLSID_VideoRender:=FilterEnum.Filters[j].CLSID;
        break;
        end;
      end;
    end;
  end;
SysDev.Free;
FilterEnum.Free;

hr := CoCreateInstance(CLSID_VideoRender,nil, CLSCTX_INPROC_SERVER,
                      IID_IBaseFilter,IVideoRenderFilter);

//(fgRender as IGraphBuilder).AddFilter(IVideoRenderFilter,'Decklink Video Render');
(fgRender as IGraphBuilder).AddFilter(IVideoRenderFilter,PWideChar(sVideoRender));

//****************add filter AUDIO DECKLINK ***************

   SysDev:= TSysDevEnum.Create;
for i:= 0 to SysDev.CountCategories-1 do
  begin
  if SysDev.Categories.FriendlyName = 'Audio Renderers' then
    begin
   G:=SysDev.Categories.CLSID;
    FilterEnum:=TSysDevEnum.Create(G);
   for j:= 0 to FilterEnum.CountFilters-1 do
      begin
//    if FilterEnum.Filters[j].FriendlyName = 'Altoparlanti (Blackmagic Audio)' then
      if FilterEnum.Filters[j].FriendlyName = 'Decklink Audio Render' then
        begin
        CLSID_AudioRender:= FilterEnum.Filters[j].CLSID;
        break;
        end;
      end;
    end;
  end;
SysDev.Free;
FilterEnum.Free;
hr := CoCreateInstance(CLSID_AudioRender, nil,
                       CLSCTX_INPROC_SERVER, IID_IBaseFilter,
                  EstAudioInterFilter);
(fgRender as IGraphBuilder).AddFilter(EstAudioInterFilter,'Decklink Audio Render');   
//****************add filter  Default DirectSound Device ***********
    SysDev:= TSysDevEnum.Create;
for i:= 0 to SysDev.CountCategories-1 do
  begin
  if SysDev.Categories.FriendlyName = 'Audio Renderers' then
    begin
   G:=SysDev.Categories.CLSID;
    FilterEnum:=TSysDevEnum.Create(G);
   for j:= 0 to FilterEnum.CountFilters-1 do
      begin
      if FilterEnum.Filters[j].FriendlyName = 'Default DirectSound Device' then
        begin
        CLSID_AudioRender:= FilterEnum.Filters[j].CLSID;
        break;
        end;
      end;
    end;
  end;
SysDev.Free;
FilterEnum.Free;
hr := CoCreateInstance(CLSID_AudioRender, nil, CLSCTX_INPROC_SERVER,
                       IID_IBaseFilter, DefaultAudioFilter);
(fgRender as IGraphBuilder).AddFilter(DefaultAudioFilter,
                              'Default DirectSound Device');

 //*************************************************************
 //***************add filter - Infinite Pin Tee Filter VIDEO *******

 hr := CoCreateInstance(CLSID_InfTee, nil, CLSCTX_INPROC_SERVER,
                        IID_IBaseFilter, InfinitePinFilter);
(fgRender as IGraphBuilder).AddFilter(InfinitePinFilter,'Infinite Pin Tee Filter');

//*********************************************************
//****************** create GRAPH ****************************

 hr := CoCreateInstance(CLSID_CaptureGraphBuilder2, nil, CLSCTX_INPROC_SERVER,
                        IID_ICaptureGraphBuilder2, ICapGraph);
 ICapGraph.SetFilterGraph(fgRender as IGraphBuilder);
                 //*****************


 hr := ICapGraph.RenderStream(nil,nil, SourceFilter, nil, VideoWindow1 as IBaseFilter);
 hr := ICapGraph.RenderStream(nil,nil, InfinitePinFilter, nil, IVideoRenderFilter);

   // **********  add filter  InfinitePinFilterAudio *******
       hr := CoCreateInstance(CLSID_InfTee, nil, CLSCTX_INPROC_SERVER,
                                    IID_IBaseFilter, InfinitePinFilterAudio);
      (fgRender as IGraphBuilder).AddFilter(InfinitePinFilterAudio,'Infinite Pin Tee Filter');

  //****************************************************
 hr := ICapGraph.RenderStream(nil,nil, SourceFilter, nil, DefaultAudioFilter);
 hr := ICapGraph.RenderStream(nil,nil, InfinitePinFilterAudio, nil, EstAudioInterFilter);

  //**************** RUN GRAPH  ************************   
 fgRender.Play;
 mc.Run;
 //****************************************************
To see the graph with GraphEdit I use this function, because pl_Win_DSPack has a bug with GraphEdit property = true.
Quote

function TForm1.saveGRF(fichier:widestring;fg:TFiltergraph):Boolean;

var  hr:Hresult;
     pStorage:IStorage;
     pStream:IStream;
     pPersist:IPersistStream;

begin
    result:=false;
 try
  try
   hr:= StgCreateDocfile(pwidechar(fichier),STGM_CREATE or STGM_TRANSACTED or
                         STGM_READWRITE or STGM_SHARE_EXCLUSIVE,0, pStorage);

   if FAILED(hr) then exit;
    hr:= pStorage.CreateStream('ActiveMovieGraph',STGM_WRITE or STGM_CREATE or
                               STGM_SHARE_EXCLUSIVE,0, 0, pStream);
      if FAILED(hr) then exit;

    fg.QueryInterface(IPersistStream,pPersist);
    hr:= pPersist.Save(pStream, TRUE);
      if FAILED(hr) then exit;
    pStorage.Commit(STGC_DEFAULT);
      if FAILED(hr) then exit;
    result:=true;

except
end;
 finally
  pStorage:=nil;
  pStream:=nil;
  pPersist:=nil;
 end;

end;                       
I send graphic attached
-------------------- My problem -----not see all format video-------------------
Now my project with video.mpg2 720x576 works!
If I run different video format, eg DivX or MPEG HD video, I see on the desktop "videowindows" I do not see in DeckLink -> TV.
Audio, I feel speacker PC and -> DeckLink -> TV ok!
---- -----    ------- -----------  ------------  ----  --------
sorry for my english language, helps me google translate  :-\

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1248
Re: DSPack for Lazarus - Win32 DirectShow Multimedia components
« Reply #29 on: March 13, 2015, 02:46:57 am »
Excellent set of information there, many thanks.

Err.  Disclaimer.  Although I'm trying to help, please remember it's 12 years since I played with DirectShow.  That's a *long* time ago :-)

Secondly:  I apologise.  I know English isn't your first language, yet still I talk alot :-(

Now, Nothing to do with the subject at hand.  You're using [ quote ] tags for your code.  Instead use [ code ] tags. (obviously, no spaces - I'm adding those so the tags don't get rendered).  Using [ quote ], your [ i ] indexes get interpreted as Start Italics.  On the other hand, if you use [ i ] inside a [ code ] tag, the forum knows not to start italics.

Next, unfortunately I can't open your .grf file as I don't have the right filters installed.  That doesn't matter though as the graphic you included tells me everything I needed to know.  UPDATE:  Nope, I now doubt your graphic.  Can you post a screenshot of GraphEdit?

Off topic: I'm nicking your code to generate .grf files - that's brilliant :-)

Other observations:
FilterEnum:=TSysDevEnum.Create(G)

Nice.  I missed that the DSPack had this helper, and was still relying on the DirectShow enumerations...   Does the following replacement work?

Code: [Select]
   SysDev:= TSysDevEnum.Create(CLSID_AudioRendererCategory);
  CLSID_AudioRender := SysDev.Filters[SysDev.FilterIndexOfFriendlyName('Decklink Audio Render')].CLSID;
  SysDev.Free;

UPDATE: original post edited.  It was all speculation and now I've found a DeckLink sample, there was no need for it...
« Last Edit: March 13, 2015, 03:49:34 am by Mike.Cornflake »
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