forked from ArduPilot/MissionPlanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBaseClasses.cs
13864 lines (11938 loc) · 397 KB
/
BaseClasses.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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices.ComTypes;
using System.Security.Permissions;
using System.Security;
using System.Threading;
using System.Windows.Forms;
using Sonic;
using DirectShow;
using System.Drawing;
using System.IO;
#region Assembly
[assembly: AssemblyTitle("DirectShow BaseClasses")]
[assembly: AssemblyDescription(".NET Implementation of DirectShow BaseClasses")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright © Maxim Kartavenkov aka Sonic 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(false)]
[assembly: ComVisible(true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode = true)]
[assembly: Guid("C842BC09-EFAE-417f-9EAE-6783CDC173A5")]
[assembly: AssemblyVersion("1.0.0.6")]
[assembly: AssemblyFileVersion("1.0.0.6")]
[assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CLASSES_ROOT")]
#endregion
namespace DirectShow.BaseClasses
{
#region AMovieSetup Attribute
[ComVisible(false)]
[AttributeUsage(AttributeTargets.Class)]
public class AMovieSetup : Attribute
{
#region Constants
public const string CLSID_LegacyAmFilterCategory = "083863F1-70DE-11d0-BD40-00A0C911CE86";
public const string CLSID_VideoInputDeviceCategory = "860BB310-5D01-11d0-BD3B-00A0C911CE86";
public const string CLSID_VideoCompressorCategory = "33D9A760-90C8-11d0-BD43-00A0C911CE86";
public const string CLSID_AudioCompressorCategory = "33D9A761-90C8-11d0-BD43-00A0C911CE86";
public const string CLSID_AudioInputDeviceCategory = "33D9A762-90C8-11d0-BD43-00A0C911CE86";
public const string CLSID_AudioRendererCategory = "E0F158E1-CB04-11d0-BD4E-00A0C911CE86";
public const string CLSID_MidiRendererCategory = "4EFE2452-168A-11d1-BC76-00C04FB9453B";
#endregion
#region Varables
protected bool m_bShouldRegister = true;
protected Merit m_Merit = Merit.DoNotUse;
protected int m_iVersion = 1;
protected string m_sName = null;
protected Guid m_Category = Guid.Empty;
#endregion
#region Constructor
public AMovieSetup()
{
}
public AMovieSetup(bool _register)
:this()
{
m_bShouldRegister = _register;
}
public AMovieSetup(string _name)
:this()
{
m_sName = _name;
}
public AMovieSetup(Merit _merit)
:this()
{
m_Merit = _merit;
}
public AMovieSetup(Merit _merit, string _category)
: this(_merit)
{
m_Category = new Guid(_category);
}
public AMovieSetup(string _name, Merit _merit)
: this(_name)
{
m_Merit = _merit;
}
public AMovieSetup(string _name, Merit _merit, string _category)
: this(_name, _merit)
{
m_Category = new Guid(_category);
}
#endregion
#region Properties
public string Name
{
get { return m_sName; }
}
public bool ShouldRegister
{
get { return m_bShouldRegister; }
}
public int Version
{
get { return m_iVersion; }
}
public Merit FilterMerit
{
get { return m_Merit; }
}
public Guid Category
{
get { return m_Category; }
}
#endregion
}
#endregion
#region PropertyPages Attribute
[ComVisible(false)]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public class PropPageSetup : Attribute
{
#region Variables
private List<Guid> m_Guids = new List<Guid>();
#endregion
#region Constructor
public PropPageSetup(string _guid)
{
m_Guids.Add(new Guid(_guid));
}
public PropPageSetup(string _guid1, string _guid2)
: this(_guid1)
{
m_Guids.Add(new Guid(_guid2));
}
public PropPageSetup(string _guid1, string _guid2, string _guid3)
:this(_guid1,_guid2)
{
m_Guids.Add(new Guid(_guid3));
}
public PropPageSetup(Type _type)
{
m_Guids.Add(_type.GUID);
}
public PropPageSetup(Type _type1, Type _type2)
: this(_type1)
{
m_Guids.Add(_type2.GUID);
}
public PropPageSetup(Type _type1,Type _type2,Type _type3)
:this(_type1,_type2)
{
m_Guids.Add(_type3.GUID);
}
#endregion
#region Properties
public List<Guid> Guids
{
get { return m_Guids; }
}
#endregion
}
#endregion
#region File Extension Register Attribute
[ComVisible(false)]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public class RegisterFileExtension : Attribute
{
#region Variables
private string m_sExtension = "";
private Guid m_MediaType = Guid.Empty;
private Guid m_SubType = Guid.Empty;
#endregion
#region Constructor
public RegisterFileExtension(string _extension)
{
m_sExtension = _extension;
}
public RegisterFileExtension(string _extension,string _MediaType,string _SubType)
: this(_extension)
{
if (!String.IsNullOrEmpty(_MediaType))
{
m_MediaType = new Guid(_MediaType);
}
if (!String.IsNullOrEmpty(_SubType))
{
m_SubType = new Guid(_SubType);
}
}
#endregion
#region Properties
public string Extension
{
get { return m_sExtension; }
}
public Guid MediaType
{
get { return m_MediaType; }
}
public Guid SubType
{
get { return m_SubType; }
}
#endregion
}
#endregion
#region Protocol Register Attribute
[ComVisible(false)]
[AttributeUsage(AttributeTargets.Class, AllowMultiple=true)]
public class RegisterProtocolExtension : Attribute
{
#region Variables
private string m_sProtocol = "";
private List<string> m_Extensions = new List<string>();
#endregion
#region Constructor
public RegisterProtocolExtension(string _protocol)
{
m_sProtocol = _protocol;
}
public RegisterProtocolExtension(string _protocol, string _extension)
: this(_protocol)
{
if (!String.IsNullOrEmpty(_extension))
{
m_Extensions.Add(_extension);
}
}
#endregion
#region Properties
public string Protocol
{
get { return m_sProtocol; }
}
public List<string> Extensions
{
get { return m_Extensions; }
}
#endregion
}
#endregion
#region MediaType Register Attribute
[ComVisible(false)]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public class RegisterMediaType : Attribute
{
#region Constants
public const string MEDIATYPE_Stream = "{E436EB83-524F-11CE-9F53-0020AF0BA770}";
#endregion
#region Variables
private Guid m_FilterGuid = typeof(DSFileSourceAsync).GUID;
private Guid m_MajorType = MediaType.Stream;
private Guid m_SubType = Guid.Empty;
private string m_Sequence = "";
#endregion
#region Constructor
public RegisterMediaType(string _subtype, string _sequence)
: this(null,null,_subtype, _sequence)
{
}
public RegisterMediaType(string _filter, string _subtype, string _sequence)
: this(_filter, null, _subtype, _sequence)
{
}
public RegisterMediaType(string _filter, string _majortype, string _subtype, string _sequence)
{
if (!String.IsNullOrEmpty(_filter))
{
m_FilterGuid = new Guid(_filter);
}
if (!String.IsNullOrEmpty(_majortype))
{
m_MajorType = new Guid(_majortype);
}
if (!String.IsNullOrEmpty(_subtype))
{
m_SubType = new Guid(_subtype);
}
if (!String.IsNullOrEmpty(_sequence))
{
m_Sequence = _sequence;
}
}
#endregion
#region Properties
public Guid FilterGuid
{
get { return m_FilterGuid; }
}
public Guid MajorType
{
get { return m_MajorType; }
}
public Guid SubType
{
get { return m_SubType; }
}
public string Sequence
{
get { return m_Sequence; }
}
#endregion
}
#endregion
#region BaseEnum
[ComVisible(false)]
[ClassInterface(ClassInterfaceType.None)]
public class BaseEnum : COMHelper
{
#region Variables
protected int m_iIndex = 0;
protected object m_Owner = null;
protected int m_iCount = 0;
#endregion
#region Properties
public object Owner
{
get { return m_Owner; }
}
public int Index
{
get { return m_iIndex; }
}
public int Count
{
get { return m_iCount; }
}
#endregion
#region Constructor
public BaseEnum(object _owner)
{
ASSERT(_owner != null);
m_Owner = _owner;
Reset();
}
~BaseEnum()
{
ASSERT(m_Owner);
m_Owner = null;
}
#endregion
#region Protected Methods
protected virtual bool IsOutOfSync()
{
return false;
}
protected virtual void OnReset()
{
}
#endregion
#region Public Methods
public virtual int Reset()
{
m_iIndex = 0;
if (IsOutOfSync())
{
OnReset();
}
return NOERROR;
}
public virtual int Skip(int cSkip)
{
if (IsOutOfSync()) return VFW_E_ENUM_OUT_OF_SYNC;
if (m_iIndex + cSkip > m_iCount)
{
return S_FALSE;
}
m_iIndex += cSkip;
return NOERROR;
}
#endregion
}
#endregion
#region EnumPins
[ComVisible(false)]
[ClassInterface(ClassInterfaceType.None)]
public class EnumPins : BaseEnum, IEnumPins
{
#region Constructor
public EnumPins(BaseFilter _filter)
: base(_filter)
{
m_iCount = _filter.Pins.Count;
}
#endregion
#region Overridden Methods
protected override bool IsOutOfSync()
{
lock ((m_Owner as BaseFilter).FilterLock)
{
return m_iCount != (m_Owner as BaseFilter).Pins.Count;
}
}
protected override void OnReset()
{
lock ((m_Owner as BaseFilter).FilterLock)
{
m_iCount = (m_Owner as BaseFilter).Pins.Count;
}
}
#endregion
#region IEnumPins Members
public virtual int Clone(out IEnumPins ppEnum)
{
ppEnum = new EnumPins((BaseFilter)m_Owner);
return NOERROR;
}
public virtual int Next(int cPins, IPin[] ppPins, IntPtr pcFetched)
{
if (ppPins == null) return E_POINTER;
ASSERT(ppPins.Length >= cPins);
if (pcFetched != IntPtr.Zero)
{
Marshal.WriteInt32(pcFetched, 0);
}
else
if (cPins > 1)
{
return E_INVALIDARG;
}
if (IsOutOfSync())
{
OnReset();
}
int _count = 0;
if (m_iCount == m_iIndex) return S_FALSE;
while (m_iIndex < m_iCount && _count < cPins)
{
if (IsOutOfSync()) return VFW_E_ENUM_OUT_OF_SYNC;
lock ((m_Owner as BaseFilter).FilterLock)
{
ppPins[_count++] = (IPin)(m_Owner as BaseFilter).Pins[m_iIndex++];
}
}
if (pcFetched != IntPtr.Zero)
{
Marshal.WriteInt32(pcFetched, _count);
}
return (_count == cPins ? S_OK : S_FALSE);
}
#endregion
}
#endregion
#region EnumMediaTypes
/// <summary>
/// IEnumMediaTypes implementation
/// </summary>
[ComVisible(false)]
[ClassInterface(ClassInterfaceType.None)]
public class EnumMediaTypes : BaseEnum, IEnumMediaTypes
{
#region Constructor
public EnumMediaTypes(BasePin _pin)
: base(_pin)
{
}
#endregion
#region Overridden Methods
protected override bool IsOutOfSync()
{
return false;
}
protected override void OnReset()
{
m_iCount = 0;// (m_Owner as BasePin).AMediaTypes.Count;
}
#endregion
#region IEnumMediaTypes Members
public virtual int Clone(out IntPtr ppEnum)
{
EnumMediaTypes _enum = new EnumMediaTypes((BasePin)m_Owner);
ppEnum = Marshal.GetComInterfaceForObject(_enum, typeof(IEnumMediaTypes));
return NOERROR;
}
public virtual int Next(int cMediaTypes, IntPtr ppMediaTypes, IntPtr pcFetched)
{
if (ppMediaTypes == IntPtr.Zero) return E_POINTER;
if (pcFetched != IntPtr.Zero)
{
Marshal.WriteInt32(pcFetched, 0);
}
else
if (cMediaTypes > 1)
{
return E_INVALIDARG;
}
if (IsOutOfSync())
{
OnReset();
}
int _count = 0;
while (cMediaTypes > 0)
{
AMMediaType mt = null;
AMMediaType.Init(ref mt);
int hr = (m_Owner as BasePin).GetMediaType(m_iIndex++, ref mt);
if (S_OK != hr)
{
break;
}
IntPtr _pmt = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(AMMediaType)));
if (_pmt == IntPtr.Zero)
{
AMMediaType.Free(ref mt);
GC.Collect();
break;
}
Marshal.StructureToPtr(mt, _pmt, true);
Marshal.WriteIntPtr(ppMediaTypes, _count * Marshal.SizeOf(typeof(IntPtr)), _pmt);
_count++;
cMediaTypes--;
}
if (pcFetched != IntPtr.Zero)
{
Marshal.WriteInt32(pcFetched, _count);
}
return (0 == cMediaTypes ? S_OK : S_FALSE);
}
public override int Skip(int cSkip)
{
if (cSkip == 0)
{
return S_OK;
}
if (IsOutOfSync()) return VFW_E_ENUM_OUT_OF_SYNC;
m_iIndex += cSkip;
AMMediaType mt = null;
try
{
AMMediaType.Init(ref mt);
return (S_OK == (m_Owner as BasePin).GetMediaType(m_iIndex - 1, ref mt)) ? S_OK : S_FALSE;
}
finally
{
AMMediaType.Free(ref mt);
GC.Collect();
}
}
#endregion
};
#endregion
#region Base Prop Page Support
[ComVisible(false)]
[SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode = true)]
[SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)]
[ClassInterface(ClassInterfaceType.None)]
public class PropPageSupport : COMHelper, ISpecifyPropertyPages
{
#region Variables
protected List<Guid> m_Pages = new List<Guid>();
#endregion
#region Properties
public List<Guid> Pages
{
get { return m_Pages; }
}
#endregion
#region Constructor
protected PropPageSupport()
{
Attribute[] _attributes = Attribute.GetCustomAttributes(this.GetType(), typeof(PropPageSetup));
if (_attributes != null)
{
foreach (PropPageSetup _setup in _attributes)
{
if (_setup != null && _setup.Guids.Count > 0)
{
for (int i = 0; i < _setup.Guids.Count; i++)
{
m_Pages.Add(_setup.Guids[i]);
}
}
}
}
}
#endregion
#region ISpecifyPropertyPages Members
public virtual int GetPages(out DsCAUUID pPages)
{
pPages = new DsCAUUID();
try
{
if (m_Pages.Count > 0)
{
pPages.cElems = m_Pages.Count;
int cb = Marshal.SizeOf(typeof(Guid));
pPages.pElems = Marshal.AllocCoTaskMem(cb * m_Pages.Count);
IntPtr _ptr = pPages.pElems;
for (int i = 0; i < m_Pages.Count; i++)
{
Marshal.StructureToPtr(m_Pages[i], _ptr, false);
_ptr = new IntPtr(_ptr.ToInt32() + cb);
}
return NOERROR;
}
else
{
pPages.cElems = 0;
pPages.pElems = IntPtr.Zero;
return E_NOTIMPL;
}
}
finally
{
GC.Collect();
}
}
#endregion
}
#endregion
#region BasePin
[ComVisible(false)]
[SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode = true)]
[SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)]
[ClassInterface(ClassInterfaceType.None)]
public abstract class BasePin : PropPageSupport, IPin, IQualityControl
{
#region Variables
protected BaseFilter m_Filter = null;
protected string m_sName = "";
protected object m_Lock = null;
protected PinDirection m_Direction = PinDirection.Input;
protected AMMediaType m_mt = null;
protected bool m_bCanReconnectWhenActive = false;
protected bool m_bTryMyTypesFirst = false;
protected bool m_bRunTimeError = false;
protected long m_tStart = 0;
protected long m_tStop = MAX_LONG;
protected double m_dRate = 1.0;
protected IntPtr m_QualitySink = IntPtr.Zero;
protected IntPtr m_ConnectedPin = IntPtr.Zero;
protected IntPtr m_pAllocator = IntPtr.Zero;
#endregion
#region Properties
public IQualityControl QualitySync
{
get
{
if (m_QualitySink != IntPtr.Zero)
{
return (IQualityControl)Marshal.GetObjectForIUnknown(m_QualitySink);
}
return null;
}
}
public IMemAllocatorImpl Allocator
{
get
{
return new IMemAllocatorImpl(m_pAllocator);
}
}
public IntPtr AllocatorPtr
{
get { return m_pAllocator; }
set
{
if (m_pAllocator != IntPtr.Zero) Marshal.Release(m_pAllocator);
m_pAllocator = value;
if (m_pAllocator != IntPtr.Zero) Marshal.AddRef(m_pAllocator);
}
}
public PinDirection Direction
{
get { return m_Direction; }
}
public BaseFilter Filter
{
get { return m_Filter; }
}
public string Name
{
get { return m_sName; }
}
public bool IsConnected
{
get { return m_ConnectedPin != IntPtr.Zero; }
}
public IPinImpl Connected
{
get
{
return new IPinImpl(m_ConnectedPin);
}
}
public bool IsStopped
{
get { return m_Filter.State == FilterState.Stopped; }
}
public bool CanReconnectWhenActive
{
get { return m_bCanReconnectWhenActive; }
set { m_bCanReconnectWhenActive = value; }
}
public long CurrentStopTime
{
get { return m_tStop; }
}
public long CurrentStartTime
{
get { return m_tStart; }
}
public double CurrentRate
{
get { return m_dRate; }
}
public AMMediaType CurrentMediaType
{
get { return m_mt; }
set { AMMediaType.Copy(value,ref m_mt); }
}
#endregion
#region Constructor
public BasePin(string _name, BaseFilter _filter, object _lock, PinDirection _direction)
{
ASSERT(_filter != null && _lock != null);
m_Filter = _filter;
m_Lock = _lock;
m_sName = _name;
m_Direction = _direction;
AMMediaType.Init(ref m_mt);
}
~BasePin()
{
if (m_pAllocator != IntPtr.Zero)
{
Marshal.Release(m_pAllocator);
}
m_pAllocator = IntPtr.Zero;
AMMediaType.Free(ref m_mt);
m_Filter = null;
if (m_ConnectedPin != IntPtr.Zero)
{
Marshal.Release(m_ConnectedPin);
}
m_ConnectedPin = IntPtr.Zero;
if (m_QualitySink != IntPtr.Zero)
{
Marshal.Release(m_QualitySink);
m_QualitySink = IntPtr.Zero;
}
}
#endregion
#region Abstract Methods
public abstract int CheckMediaType(AMMediaType pmt);
#endregion
#region Virtual Methods
#region Public Methods
public virtual int BreakConnect()
{
return NOERROR;
}
public virtual int CompleteConnect(ref IPinImpl pReceivePin)
{
return NOERROR;
}
public virtual int Active()
{
return NOERROR;
}
public virtual int Inactive()
{
m_bRunTimeError = false;
return NOERROR;
}
public virtual int Run(long tStart)
{
return NOERROR;
}
public virtual int CheckConnect(ref IPinImpl _pin)
{
PinDirection _direction;
HRESULT hr = (HRESULT)_pin.QueryDirection(out _direction);
if (hr.Failed) return hr;
if (_direction == m_Direction)
{
return VFW_E_INVALID_DIRECTION;
}
return NOERROR;
}
public virtual int SetMediaType(AMMediaType mt)
{
AMMediaType.Copy(mt, ref m_mt);
return NOERROR;
}
public virtual int GetMediaType(int iPosition, ref AMMediaType pMediaType)
{
return E_UNEXPECTED;
}
#endregion
#region Protected Methods
protected virtual int DisconnectInternal()
{
if (m_ConnectedPin != IntPtr.Zero)
{
int hr = BreakConnect();