// AForge Direct Show Library
// AForge.NET framework
//
// Copyright © Andrew Kirillov, 2008
// andrew.kirillov@gmail.com
//
namespace AForge.Video.DirectShow.Internals
{
using System;
using System.Runtime.InteropServices;
///
/// This interface builds capture graphs and other custom filter graphs.
///
///
[ComImport,
Guid( "93E5A4E0-2D50-11d2-ABFA-00A0C9C6E38D" ),
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
internal interface ICaptureGraphBuilder2
{
///
/// Specify filter graph for the capture graph builder to use.
///
///
/// Filter graph's interface.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int SetFiltergraph( [In] IGraphBuilder graphBuilder );
///
/// Retrieve the filter graph that the builder is using.
///
///
/// Filter graph's interface.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int GetFiltergraph( [Out] out IGraphBuilder graphBuilder );
///
/// Create file writing section of the filter graph.
///
///
/// GUID that represents either the media subtype of the output or the
/// class identifier (CLSID) of a multiplexer filter or file writer filter.
/// Output file name.
/// Receives the multiplexer's interface.
/// Receives the file writer's IFileSinkFilter interface. Can be NULL.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int SetOutputFileName(
[In, MarshalAs( UnmanagedType.LPStruct )] Guid type,
[In, MarshalAs( UnmanagedType.LPWStr )] string fileName,
[Out] out IBaseFilter baseFilter,
[Out] out IntPtr fileSinkFilter
);
///
/// Searche the graph for a specified interface, starting from a specified filter.
///
///
/// GUID that specifies the search criteria.
/// GUID that specifies the major media type of an output pin, or NULL.
/// interface of the filter. The method begins searching from this filter.
/// Interface identifier (IID) of the interface to locate.
/// Receives found interface.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int FindInterface(
[In, MarshalAs( UnmanagedType.LPStruct )] Guid category,
[In, MarshalAs( UnmanagedType.LPStruct )] Guid type,
[In] IBaseFilter baseFilter,
[In, MarshalAs( UnmanagedType.LPStruct )] Guid interfaceID ,
[Out, MarshalAs( UnmanagedType.IUnknown )] out object retInterface
);
///
/// Connect an output pin on a source filter to a rendering filter, optionally through a compression filter.
///
///
/// Pin category.
/// Major-type GUID that specifies the media type of the output pin.
/// Starting filter for the connection.
/// Interface of an intermediate filter, such as a compression filter. Can be NULL.
/// Sink filter, such as a renderer or mux filter.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int RenderStream(
[In, MarshalAs( UnmanagedType.LPStruct )] Guid category,
[In, MarshalAs( UnmanagedType.LPStruct )] Guid mediaType,
[In, MarshalAs( UnmanagedType.IUnknown )] object source,
[In] IBaseFilter compressor,
[In] IBaseFilter renderer
);
///
/// Set the start and stop times for one or more streams of captured data.
///
///
/// Pin category.
/// Major-type GUID that specifies the media type.
/// interface that specifies which filter to control.
/// Start time.
/// Stop time.
/// Value that is sent as the second parameter of the
/// EC_STREAM_CONTROL_STARTED event notification.
/// Value that is sent as the second parameter of the
/// EC_STREAM_CONTROL_STOPPED event notification.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int ControlStream(
[In, MarshalAs( UnmanagedType.LPStruct )] Guid category,
[In, MarshalAs( UnmanagedType.LPStruct )] Guid mediaType,
[In, MarshalAs( UnmanagedType.Interface )] IBaseFilter filter,
[In] long start,
[In] long stop,
[In] short startCookie,
[In] short stopCookie
);
///
/// Preallocate a capture file to a specified size.
///
///
/// File name to create or resize.
/// Size of the file to allocate, in bytes.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int AllocCapFile(
[In, MarshalAs( UnmanagedType.LPWStr )] string fileName,
[In] long size
);
///
/// Copy the valid media data from a capture file.
///
///
/// Old file name.
/// New file name.
/// Boolean value that specifies whether pressing the ESC key cancels the copy operation.
/// IAMCopyCaptureFileProgress interface to display progress information, or NULL.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int CopyCaptureFile(
[In, MarshalAs( UnmanagedType.LPWStr )] string oldFileName,
[In, MarshalAs( UnmanagedType.LPWStr )] string newFileName,
[In, MarshalAs( UnmanagedType.Bool )] bool allowEscAbort,
[In] IntPtr callback
);
///
///
///
///
/// Interface on a filter, or to an interface on a pin.
/// Pin direction (input or output).
/// Pin category.
/// Media type.
/// Boolean value that specifies whether the pin must be unconnected.
/// Zero-based index of the pin to retrieve, from the set of matching pins.
/// Interface of the matching pin.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int FindPin(
[In, MarshalAs( UnmanagedType.IUnknown )] object source,
[In] PinDirection pinDirection,
[In, MarshalAs( UnmanagedType.LPStruct )] Guid category,
[In, MarshalAs( UnmanagedType.LPStruct )] Guid mediaType,
[In, MarshalAs( UnmanagedType.Bool )] bool unconnected,
[In] int index,
[Out, MarshalAs( UnmanagedType.Interface )] out IPin pin
);
}
}