forked from andrewkirillov/AForge.NET
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathIPin.cs
191 lines (175 loc) · 6.82 KB
/
IPin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
// 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;
/// <summary>
/// This interface is exposed by all input and output pins of DirectShow filters.
/// </summary>
///
[ComImport,
Guid( "56A86891-0AD4-11CE-B03A-0020AF0BA770" ),
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
internal interface IPin
{
/// <summary>
/// Connects the pin to another pin.
/// </summary>
///
/// <param name="receivePin">Other pin to connect to.</param>
/// <param name="mediaType">Type to use for the connections (optional).</param>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int Connect( [In] IPin receivePin, [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
/// <summary>
/// Makes a connection to this pin and is called by a connecting pin.
/// </summary>
///
/// <param name="receivePin">Connecting pin.</param>
/// <param name="mediaType">Media type of the samples to be streamed.</param>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int ReceiveConnection( [In] IPin receivePin, [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
/// <summary>
/// Breaks the current pin connection.
/// </summary>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int Disconnect( );
/// <summary>
/// Returns a pointer to the connecting pin.
/// </summary>
///
/// <param name="pin">Receives <b>IPin</b> interface of connected pin (if any).</param>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int ConnectedTo( [Out] out IPin pin );
/// <summary>
/// Returns the media type of this pin's connection.
/// </summary>
///
/// <param name="mediaType">Pointer to an <see cref="AMMediaType"/> 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 <b>lSampleSize</b>, which is set to 1, and
/// <b>FixedSizeSamples</b>, which is set to <b>true</b>.</param>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int ConnectionMediaType( [Out, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
/// <summary>
/// Retrieves information about this pin (for example, the name, owning filter, and direction).
/// </summary>
///
/// <param name="pinInfo"><see cref="PinInfo"/> structure that receives the pin information.</param>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int QueryPinInfo( [Out] out PinInfo pinInfo );
/// <summary>
/// Retrieves the direction for this pin.
/// </summary>
///
/// <param name="pinDirection">Receives direction of the pin.</param>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int QueryDirection( out PinDirection pinDirection );
/// <summary>
/// Retrieves an identifier for the pin.
/// </summary>
///
/// <param name="id">Pin identifier.</param>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int QueryId( [Out, MarshalAs( UnmanagedType.LPWStr )] out string id );
/// <summary>
/// Queries whether a given media type is acceptable by the pin.
/// </summary>
///
/// <param name="mediaType"><see cref="AMMediaType"/> structure that specifies the media type.</param>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int QueryAccept( [In, MarshalAs( UnmanagedType.LPStruct )] AMMediaType mediaType );
/// <summary>
/// Provides an enumerator for this pin's preferred media types.
/// </summary>
///
/// <param name="enumerator">Address of a variable that receives a pointer to the <b>IEnumMediaTypes</b> interface.</param>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int EnumMediaTypes( IntPtr enumerator );
/// <summary>
/// Provides an array of the pins to which this pin internally connects.
/// </summary>
///
/// <param name="apPin">Address of an array of <b>IPin</b> pointers.</param>
/// <param name="nPin">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.</param>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int QueryInternalConnections( IntPtr apPin, [In, Out] ref int nPin );
/// <summary>
/// Notifies the pin that no additional data is expected.
/// </summary>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int EndOfStream( );
/// <summary>
/// Begins a flush operation.
/// </summary>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int BeginFlush( );
/// <summary>
/// Ends a flush operation.
/// </summary>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int EndFlush( );
/// <summary>
/// Specifies that samples following this call are grouped as a segment with a given start time, stop time, and rate.
/// </summary>
///
/// <param name="start">Start time of the segment, relative to the original source, in 100-nanosecond units.</param>
/// <param name="stop">End time of the segment, relative to the original source, in 100-nanosecond units.</param>
/// <param name="rate">Rate at which this segment should be processed, as a percentage of the original rate.</param>
///
/// <returns>Return's <b>HRESULT</b> error code.</returns>
///
[PreserveSig]
int NewSegment(
long start,
long stop,
double rate );
}
}