com.teamdev.jxcapture.video.win.directshow
Class FilterGraphManager

java.lang.Object
  extended by com.teamdev.jxcapture.video.win.directshow.FilterGraphManager

public class FilterGraphManager
extends java.lang.Object

Base implementation of filter graph that allows to build IFilterGraph graph object.
It allows to add/remove codecs to the filter graph, connect filters.


Nested Class Summary
static class FilterGraphManager.GraphThreadMode
           
 
Constructor Summary
FilterGraphManager()
          Creates filter graph manager.
FilterGraphManager(FilterGraphManager.GraphThreadMode threadMode)
          Creates filter graph manager.
 
Method Summary
 void addFilter(FilterWrapper filterWrapper)
          Adds the specified filter to this graph.
 void clearGraph()
          Removes all filters that are connected to this filter graph.
 void configureVideoWindow(boolean showPreview)
          Configures video window.
 FilterWrapper connectFilters(FilterWrapper sourceFilter, FilterWrapper destFilter, FilterWrapper[] alternateFilters)
          Connects the specified source filter to the dest filter.
 void connectPins(PinWrapper outputPin, PinWrapper inputPin)
           
protected  IGraphBuilder createFilterGraph(FilterGraphManager.GraphThreadMode threadMode)
           
 FilterWrapper findAnyFilter(java.lang.String... filterCLSIDs)
          Service function that searches for any of specified filters in this graph.
 FilterWrapper findFilter(java.lang.String filterCLSID)
          Service function that searches for the specified filters in this graph.
protected  java.util.List<IBaseFilter> getConnectedFilters()
          Returns filters which are connected to this filter graph.
 IGraphBuilder getFilterGraph()
          Returns filter graph peer.
 java.util.Set<FilterWrapper> getFilters()
          Returns the list that contains all filters in the graph.
 void release()
          Release this filter graph manager.
protected  void removeAllFilters()
          Removes all filters from this filter graph.
 void removeFilter(FilterWrapper filterWrapper)
          Removes the specified filter from this graph.
 void renderFile(java.io.File file)
          Renders a specified file
protected  void setNullSinkFilter()
           
protected  void synchronizeFilterSet()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterGraphManager

public FilterGraphManager()
Creates filter graph manager.


FilterGraphManager

public FilterGraphManager(FilterGraphManager.GraphThreadMode threadMode)
Creates filter graph manager.

Parameters:
threadMode - defines graph threading mode
Method Detail

createFilterGraph

protected IGraphBuilder createFilterGraph(FilterGraphManager.GraphThreadMode threadMode)

clearGraph

public void clearGraph()
Removes all filters that are connected to this filter graph.


getConnectedFilters

protected java.util.List<IBaseFilter> getConnectedFilters()
Returns filters which are connected to this filter graph.

Returns:
list of filters

removeAllFilters

protected void removeAllFilters()
Removes all filters from this filter graph.


release

public void release()
Release this filter graph manager.


getFilterGraph

public IGraphBuilder getFilterGraph()
Returns filter graph peer.

Returns:
filter graph peer

addFilter

public void addFilter(FilterWrapper filterWrapper)
Adds the specified filter to this graph.

Parameters:
filterWrapper - filter to join

removeFilter

public void removeFilter(FilterWrapper filterWrapper)
Removes the specified filter from this graph.

Parameters:
filterWrapper - filter to remove

connectFilters

public FilterWrapper connectFilters(FilterWrapper sourceFilter,
                                    FilterWrapper destFilter,
                                    FilterWrapper[] alternateFilters)
Connects the specified source filter to the dest filter. If they fail to connect, method tries to connect one of the alternate filters.

Parameters:
sourceFilter - source filter
destFilter - dest filter
alternateFilters - alternate filter
Returns:
connected filter; null if none of filters were connected.

configureVideoWindow

public void configureVideoWindow(boolean showPreview)
Configures video window.

Parameters:
showPreview - true makes video window visible; false makes video window hidden.

synchronizeFilterSet

protected void synchronizeFilterSet()

getFilters

public java.util.Set<FilterWrapper> getFilters()
Returns the list that contains all filters in the graph.

Returns:
list of filters

findAnyFilter

public FilterWrapper findAnyFilter(java.lang.String... filterCLSIDs)
Service function that searches for any of specified filters in this graph.

Parameters:
filterCLSIDs - CLSIDs of required filters
Returns:
found filter or null if nothing found

findFilter

public FilterWrapper findFilter(java.lang.String filterCLSID)
Service function that searches for the specified filters in this graph.

Parameters:
filterCLSID - CLSIDs of required filter
Returns:
found filter or null if nothing found

connectPins

public void connectPins(PinWrapper outputPin,
                        PinWrapper inputPin)

renderFile

public void renderFile(java.io.File file)
                throws UnsupportedStreamException
Renders a specified file

Parameters:
file - file to render
Throws:
UnsupportedStreamException - if the specified file could not be rendered

setNullSinkFilter

protected void setNullSinkFilter()