// AForge Direct Show Library
// AForge.NET framework
//
// Copyright © Andrew Kirillov, 2007
// andrew.kirillov@gmail.com
//
namespace AForge.Video.DirectShow.Internals
{
using System;
using System.Runtime.InteropServices;
///
/// This interface is exposed by all input and output pins of DirectShow filters.
///
///
[ComImport,
Guid( "56A86891-0AD4-11CE-B03A-0020AF0BA770" ),
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
internal interface IPin
{
///
/// Connects the pin to another pin.
///
///
/// Other pin to connect to.
/// Type to use for the connections (optional).
///
/// Return's HRESULT error code.
///
[PreserveSig]
int Connect( [In] IPin receivePin, [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
///
/// Makes a connection to this pin and is called by a connecting pin.
///
///
/// Connecting pin.
/// Media type of the samples to be streamed.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int ReceiveConnection( [In] IPin receivePin, [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
///
/// Breaks the current pin connection.
///
///
/// Return's HRESULT error code.
///
[PreserveSig]
int Disconnect( );
///
/// Returns a pointer to the connecting pin.
///
///
/// Receives IPin interface of connected pin (if any).
///
/// Return's HRESULT error code.
///
[PreserveSig]
int ConnectedTo( [Out] out IPin pin );
///
/// Returns the media type of this pin's connection.
///
///
/// Pointer to an structure. If the pin is connected,
/// the media type is returned. Otherwise, the structure is initialized to a default state in which
/// all elements are 0, with the exception of lSampleSize, which is set to 1, and
/// FixedSizeSamples, which is set to true.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int ConnectionMediaType( [Out, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
///
/// Retrieves information about this pin (for example, the name, owning filter, and direction).
///
///
/// structure that receives the pin information.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int QueryPinInfo( [Out] out PinInfo pinInfo );
///
/// Retrieves the direction for this pin.
///
///
/// Receives direction of the pin.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int QueryDirection( out PinDirection pinDirection );
///
/// Retrieves an identifier for the pin.
///
///
/// Pin identifier.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int QueryId( [Out, MarshalAs( UnmanagedType.LPWStr )] out string id );
///
/// Queries whether a given media type is acceptable by the pin.
///
///
/// structure that specifies the media type.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int QueryAccept( [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
///
/// Provides an enumerator for this pin's preferred media types.
///
///
/// Address of a variable that receives a pointer to the IEnumMediaTypes interface.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int EnumMediaTypes( IntPtr enumerator );
///
/// Provides an array of the pins to which this pin internally connects.
///
///
/// Address of an array of IPin pointers.
/// On input, specifies the size of the array. When the method returns,
/// the value is set to the number of pointers returned in the array.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int QueryInternalConnections( IntPtr apPin, [In, Out] ref int nPin );
///
/// Notifies the pin that no additional data is expected.
///
///
/// Return's HRESULT error code.
///
[PreserveSig]
int EndOfStream( );
///
/// Begins a flush operation.
///
///
/// Return's HRESULT error code.
///
[PreserveSig]
int BeginFlush( );
///
/// Ends a flush operation.
///
///
/// Return's HRESULT error code.
///
[PreserveSig]
int EndFlush( );
///
/// Specifies that samples following this call are grouped as a segment with a given start time, stop time, and rate.
///
///
/// Start time of the segment, relative to the original source, in 100-nanosecond units.
/// End time of the segment, relative to the original source, in 100-nanosecond units.
/// Rate at which this segment should be processed, as a percentage of the original rate.
///
/// Return's HRESULT error code.
///
[PreserveSig]
int NewSegment(
long start,
long stop,
double rate );
}
}