Come catturare i fotogrammi usando Delphi / Dspack senza visualizzarlo su TVideowindow?

StackOverflow https://stackoverflow.com//questions/12680600

  •  12-12-2019
  •  | 
  •  

Domanda

Dspack ha un codice di esempio per riprodurre un dispositivo video compatibile con DirectShow e acquisire simultaneamente i frame video. Un TVideoWowOw è collegato al filtroGraph per visualizzare il video (Firgo-1). Se si rimuove il TVideoWowOw, il sistema operativo (Windows) avrà automaticamente attivato ActiveMovie e visualizza il video su una finestra separata (Figura-2).

C'è un modo per utilizzare Dspack per acquisire fotogrammi video senza utilizzare nessuno dei componenti GUI e senza visualizzare il video?

Dspack Forum ha qualche menzione del filtro NullRenderer ma non ci sono documentazione o esempi su come usarlo. Sembra che possiamo ottenere che se sostituiamo manualmente il rendering video con Null rendering direttamente nel graf-3 (Figura-3).

Come possiamo raggiungere il risultato mostrato in Figura 3 facendo tutte le manipolazioni all'interno del codice? Dspack non spiega come creare un rendering null.

Figure-1: The graph of the default example code
.

figura-1

Figure-2: Shows what happens if I remove the TVideoWindow
.

figura-2

Figure-3: Shows what happens if I replace Video Renderer with a 
         Null Renderer and manually connect them in the GraphEdit. 
.

figura-3

Questo è ciò che ho finito per fare (finora)

Chiamare il seguente ReassignSampleGrabberOutput poco prima di filterGraph.Play;

procedure TForm1.ReassignSampleGrabberOutput;
var
  nullRenderer : IBaseFilter;
  nullRendererPins: IEnumPins;
  nullRendererPin : IPin;
  graph:   IGraphBuilder;
begin

  nullRenderer := CreateComObject(CLSID_NullRenderer) as IBaseFilter;
  FilterGraph1.QueryInterface(IID_IGraphBuilder, graph);
  graph.AddFilter(nullRenderer, 'Null Renderer');

  nullRenderer.EnumPins(nullRendererPins);

  nullRendererPins.Reset;

  if nullRendererPins.Next(1, nullRendererPin, nil) = S_OK then
  begin
    //SampleGrabber1.OutPutPin.Disconnect;
    //SampleGrabber1.OutPutPin.Connect(nullRendererPin, nil);

    graph.Disconnect(SampleGrabber1.OutPutPin);
    graph.FindFilterByName('Video Renderer', filter);
    graph.RemoveFilter(filter);
    graph.Connect(SampleGrabber1.OutPutPin, nullRendererPin);

  end;
end;
.

È stato utile?

Soluzione

Null Renderer Filter è un filtro standard/classe.Nel codice è necessario solo istanziarlo (CoCreateInstance), aggiungerlo al grafico e collegare il suo PIN di ingresso al perno di uscita non connesso del grabber del campione.

in delphi / dspack dovrebbe essere così:

Renderer := CreateComObject(CLSID_NullRenderer) as IBaseFilter;

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top