本文整理汇总了C#中DsDevice类的典型用法代码示例。如果您正苦于以下问题:C# DsDevice类的具体用法?C# DsDevice怎么用?C# DsDevice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DsDevice类属于命名空间,在下文中一共展示了DsDevice类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: WebCamCapture
/// <summary>
///
/// </summary>
/// <param name="deviceNumber"></param>
/// <param name="frameRate"></param>
/// <param name="width"></param>
/// <param name="height"></param>
public WebCamCapture(int deviceNumber, int frameRate, int width, int height)
{
DsDevice[] devices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
if (deviceNumber > devices.Length - 1)
{
throw new ArgumentException("No video capture device found at index " + deviceNumber);
}
try
{
mFrameRate = frameRate;
mWidth = width;
mHeight = height;
mDevice = devices[deviceNumber];
InitCaptureGraph();
mPictureReady = new ManualResetEvent(false);
mImageCaptured = true;
mIsRunning = false;
}
catch
{
Dispose();
throw;
}
}
开发者ID:zhouqilin,项目名称:CasparCGPlayout,代码行数:34,代码来源:WebCamCapture.cs
示例2: PTZDevice
private PTZDevice(string name, PTZType type)
{
var devices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
var device = devices.Where(d => d.Name == name).FirstOrDefault();
_device = device;
_type = type;
if (_device == null) throw new ApplicationException(String.Format("Couldn't find device named {0}!", name));
IFilterGraph2 graphBuilder = new FilterGraph() as IFilterGraph2;
IBaseFilter filter = null;
IMoniker i = _device.Mon as IMoniker;
graphBuilder.AddSourceFilterForMoniker(i, null, _device.Name, out filter);
_camControl = filter as IAMCameraControl;
_ksPropertySet = filter as IKsPropertySet;
if (_camControl == null) throw new ApplicationException("Couldn't get ICamControl!");
if (_ksPropertySet == null) throw new ApplicationException("Couldn't get IKsPropertySet!");
//TODO: Add Absolute
if (type == PTZType.Relative &&
!(SupportFor(KSProperties.CameraControlFeature.KSPROPERTY_CAMERACONTROL_PAN_RELATIVE) &&
SupportFor(KSProperties.CameraControlFeature.KSPROPERTY_CAMERACONTROL_TILT_RELATIVE)))
{
throw new NotSupportedException("This camera doesn't appear to support Relative Pan and Tilt");
}
//TODO: Do I through NotSupported when methods are called or throw them now?
//TODO: Do I check for Zoom or ignore if it's not there?
InitZoomRanges();
}
开发者ID:JonathanTLH,项目名称:Logitech-BCC950-PTZ-Lib,代码行数:34,代码来源:PTZDevice.cs
示例3: DirectShowCamera
public DirectShowCamera(int id, int width, int height, int frameRate, DsDevice device)
: base(id, width, height, frameRate)
{
SetupDevice();
_videoInput = new Capture(id);
Name = device.Name;
}
开发者ID:HumanRemote,项目名称:HumanRemote,代码行数:7,代码来源:DirectShowCamera.cs
示例4: TvCardDVBIP
/// <summary>
/// Contstructor
/// </summary>
/// <param name="epgEvents"></param>
/// <param name="device"></param>
/// <param name="sequence"></param>
public TvCardDVBIP(IEpgEvents epgEvents, DsDevice device, int sequence) : base(epgEvents, device)
{
_cardType = CardType.DvbIP;
_sequence = sequence;
if (_sequence > 0)
{
_name = _name + "_" + _sequence;
}
}
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:15,代码来源:TvCardDVBIP.cs
示例5: CreateFilterInstance
protected IBaseFilter CreateFilterInstance(DsDevice device)
{
var guid = typeof(IBaseFilter).GUID;
object objFilter;
device.Mon.BindToObject(null, null, ref guid, out objFilter);
if (objFilter == null)
throw new NullReferenceException("Cannot bind to filter");
return (IBaseFilter)objFilter;
}
开发者ID:alnicol,项目名称:Realtek-2832U,代码行数:9,代码来源:RadioBase.cs
示例6: Remove
/// <summary>
/// use this method to indicate that the device specified no longer in use
/// </summary>
/// <param name="device">device</param>
public void Remove(DsDevice device)
{
for (int i = 0; i < _devicesInUse.Count; ++i)
{
if (_devicesInUse[i].Mon == device.Mon && _devicesInUse[i].Name == device.Name)
{
_devicesInUse.RemoveAt(i);
return;
}
}
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:15,代码来源:DevicesInUse.cs
示例7: SetupFileRecorderGraph
public void SetupFileRecorderGraph(DsDevice dev, SystemCodecEntry compressor, ref float iFrameRate, ref int iWidth, ref int iHeight, string fileName)
{
try
{
SetupGraphInternal(dev, compressor, ref iFrameRate, ref iWidth, ref iHeight, fileName);
latestBitmap = new Bitmap(iWidth, iHeight, PixelFormat.Format24bppRgb);
fullRect = new Rectangle(0, 0, latestBitmap.Width, latestBitmap.Height);
}
catch
{
CloseResources();
throw;
}
}
开发者ID:hpavlov,项目名称:video.directshowvideocapture,代码行数:15,代码来源:DirectShowCapture.cs
示例8: TvCardBase
///<summary>
/// Base constructor
///</summary>
///<param name="device">Base DS device</param>
protected TvCardBase(DsDevice device)
{
_graphState = GraphState.Idle;
_device = device;
_tunerDevice = device;
_name = device.Name;
_devicePath = device.DevicePath;
//get preload card value
if (_devicePath != null)
{
GetPreloadBitAndCardId();
GetSupportsPauseGraph();
}
}
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:19,代码来源:TvCardBase.cs
示例9: TvCardAnalog
///<summary>
/// Constrcutor for the analog
///</summary>
///<param name="device">Tuner Device</param>
public TvCardAnalog(DsDevice device)
: base(device)
{
_parameters = new ScanParameters();
_mapSubChannels = new Dictionary<int, BaseSubChannel>();
_supportsSubChannels = true;
_minChannel = 0;
_maxChannel = 128;
_camType = CamType.Default;
_conditionalAccess = null;
_cardType = CardType.Analog;
_epgGrabbing = false;
_configuration = Configuration.readConfiguration(_cardId, _name, _devicePath);
Configuration.writeConfiguration(_configuration);
}
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:19,代码来源:TvCardAnalog.cs
示例10: SelectIndex
public void SelectIndex(DsDevice dev)
{
// Highlight the specified device (if we can find it)
if (dev != null)
{
for (int x = 0; x < lbDevices.Items.Count; x++)
{
VDevice d = lbDevices.Items[x] as VDevice;
if (d.Device.DevicePath == dev.DevicePath)
{
lbDevices.SelectedIndex = x;
break;
}
}
}
}
开发者ID:coolsula,项目名称:vidplaycorder,代码行数:16,代码来源:DeviceForm.cs
示例11: PropertyPageHelper
public PropertyPageHelper(DsDevice dev)
{
try
{
object source;
var id = typeof(IBaseFilter).GUID;
dev.Mon.BindToObject(null, null, ref id, out source);
if (source != null)
{
var filter = (IBaseFilter)source;
m_specifyPropertyPages = filter as ISpecifyPropertyPages;
}
}
catch
{
MessageBox.Show(NO_PROPERTY_PAGE_FOUND);
}
}
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:18,代码来源:PropertyPageHelper.cs
示例12: AnalogCamera
public AnalogCamera(DsDevice device, Device d3dDevice)
{
this.d3dDevice = d3dDevice;
texture = new Texture(d3dDevice, 720, 576, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default);
var desc = texture.GetLevelDescription(0);
DataRectangle dr = texture.LockRectangle(0, LockFlags.Discard);
int rowPitch = dr.Pitch;
texture.UnlockRectangle(0);
try
{
BuildGraph(device);
}
catch
{
Dispose();
throw;
}
}
开发者ID:vizual54,项目名称:OculusFPV,代码行数:19,代码来源:AnalogCamera.cs
示例13: DirectShowPropertyPage
/// <summary> Constructor </summary>
/// <param name="dev"> Shows the PropertyPages of a specific DsDevice </param>
public DirectShowPropertyPage(DsDevice dev)
{
try
{
object l_Source = null;
Guid l_Iid = typeof (IBaseFilter).GUID;
dev.Mon.BindToObject(null, null, ref l_Iid, out l_Source);
if (l_Source != null)
{
Name = dev.Name;
IBaseFilter filter = (IBaseFilter)l_Source;
SupportsPersisting = false;
this.specifyPropertyPages = filter as ISpecifyPropertyPages;
}
}
catch
{
MessageBox.Show("This filter has no property page!");
}
}
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:22,代码来源:DirectShowPropertyPage.cs
示例14: TvCardDvbB2C2
/// <summary>
/// Initializes a new instance of the <see cref="TvCardDvbB2C2"/> class.
/// </summary>
/// <param name="device">The device.</param>
public TvCardDvbB2C2(DsDevice device, DeviceInfo deviceInfo)
: base(device)
{
_deviceInfo = deviceInfo;
_devicePath = deviceInfo.DevicePath;
_name = deviceInfo.Name;
GetPreloadBitAndCardId();
_useDISEqCMotor = false;
TvBusinessLayer layer = new TvBusinessLayer();
Card card = layer.GetCardByDevicePath(_devicePath);
if (card != null)
{
Setting setting = layer.GetSetting("dvbs" + card.IdCard + "motorEnabled", "no");
if (setting.Value == "yes")
_useDISEqCMotor = true;
}
_conditionalAccess = new ConditionalAccess(null, null, null, this);
_ptrDisEqc = Marshal.AllocCoTaskMem(20);
_disEqcMotor = new DiSEqCMotor(this);
GetTunerCapabilities();
}
开发者ID:hkjensen,项目名称:MediaPortal-1,代码行数:26,代码来源:TvCardDvbB2C2.cs
示例15: WebCamera
public WebCamera(DsDevice device, Device d3dDevice)
{
//bitmapWindow = new Test();
//bitmapWindow.Show();
this.d3dDevice = d3dDevice;
texture = new Texture(d3dDevice, 1280, 720, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default);
//texture = Texture.FromFile(d3dDevice, ".\\Images\\checkerboard.jpg", D3DX.DefaultNonPowerOf2, D3DX.DefaultNonPowerOf2, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default, Filter.None, Filter.None, 0);
var desc = texture.GetLevelDescription(0);
DataRectangle dr = texture.LockRectangle(0, LockFlags.Discard);
int rowPitch = dr.Pitch;
texture.UnlockRectangle(0);
try
{
BuildGraph(device);
}
catch
{
Dispose();
throw;
}
}
开发者ID:vizual54,项目名称:OculusFPV,代码行数:23,代码来源:Camera.cs
示例16: SetupGraph
/// <summary> build the capture graph for grabber. </summary>
private void SetupGraph(DsDevice dev, int iFrameRate, int iWidth, int iHeight)
{
int hr;
ISampleGrabber sampGrabber = null;
IBaseFilter capFilter = null;
ICaptureGraphBuilder2 capGraph = null;
// Get the graphbuilder object
m_FilterGraph = (IFilterGraph2) new FilterGraph();
m_mediaCtrl = m_FilterGraph as IMediaControl;
try
{
// Get the ICaptureGraphBuilder2
capGraph = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();
// Get the SampleGrabber interface
sampGrabber = (ISampleGrabber) new SampleGrabber();
// Start building the graph
hr = capGraph.SetFiltergraph( m_FilterGraph );
DsError.ThrowExceptionForHR( hr );
// Add the video device
hr = m_FilterGraph.AddSourceFilterForMoniker(dev.Mon, null, "Video input", out capFilter);
DsError.ThrowExceptionForHR( hr );
IBaseFilter baseGrabFlt = (IBaseFilter) sampGrabber;
ConfigureSampleGrabber(sampGrabber);
// Add the frame grabber to the graph
hr = m_FilterGraph.AddFilter( baseGrabFlt, "Ds.NET Grabber" );
DsError.ThrowExceptionForHR( hr );
// If any of the default config items are set
if (iFrameRate + iHeight + iWidth > 0)
{
SetConfigParms(capGraph, capFilter, iFrameRate, iWidth, iHeight);
}
hr = capGraph.RenderStream( PinCategory.Capture, MediaType.Video, capFilter, null, baseGrabFlt );
DsError.ThrowExceptionForHR( hr );
SaveSizeInfo(sampGrabber);
}
finally
{
if (capFilter != null)
{
Marshal.ReleaseComObject(capFilter);
capFilter = null;
}
if (sampGrabber != null)
{
Marshal.ReleaseComObject(sampGrabber);
sampGrabber = null;
}
if (capGraph != null)
{
Marshal.ReleaseComObject(capGraph);
capGraph = null;
}
}
}
开发者ID:eaglezhao,项目名称:tracnghiemweb,代码行数:65,代码来源:Capture.cs
示例17: SetupGraph
/// <summary> build the capture graph for grabber. </summary>
private void SetupGraph(DsDevice dev, AMMediaType media)
{
int hr;
ISampleGrabber sampGrabber = null;
IBaseFilter capFilter = null;
ICaptureGraphBuilder2 capGraph = null;
// Get the graphbuilder object
m_FilterGraph = (IFilterGraph2) new FilterGraph();
m_mediaCtrl = m_FilterGraph as IMediaControl;
try
{
// Get the ICaptureGraphBuilder2
capGraph = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();
// Get the SampleGrabber interface
sampGrabber = (ISampleGrabber) new SampleGrabber();
// Start building the graph
hr = capGraph.SetFiltergraph( m_FilterGraph );
DsError.ThrowExceptionForHR( hr );
// Add the video device
hr = m_FilterGraph.AddSourceFilterForMoniker(dev.Mon, null, "Video input", out capFilter);
DsError.ThrowExceptionForHR( hr );
// add video crossbar
// thanks to Andrew Fernie - this is to get tv tuner cards working
IAMCrossbar crossbar = null;
object o;
hr = capGraph.FindInterface(PinCategory.Capture, MediaType.Video, capFilter, typeof(IAMCrossbar).GUID, out o);
if (hr >= 0)
{
crossbar = (IAMCrossbar)o;
int oPin, iPin;
int ovLink, ivLink;
ovLink = ivLink = 0;
crossbar.get_PinCounts(out oPin, out iPin);
int pIdxRel;
PhysicalConnectorType tp;
for (int i = 0; i < iPin; i++)
{
crossbar.get_CrossbarPinInfo(true, i, out pIdxRel, out tp);
if (tp == PhysicalConnectorType.Video_Composite) ivLink = i;
}
for (int i = 0; i < oPin; i++)
{
crossbar.get_CrossbarPinInfo(false, i, out pIdxRel, out tp);
if (tp == PhysicalConnectorType.Video_VideoDecoder) ovLink = i;
}
try
{
crossbar.Route(ovLink, ivLink);
o = null;
}
catch
{
throw new Exception("Failed to get IAMCrossbar");
}
}
//add AVI Decompressor
IBaseFilter pAVIDecompressor = (IBaseFilter)new AVIDec();
hr = m_FilterGraph.AddFilter(pAVIDecompressor, "AVI Decompressor");
DsError.ThrowExceptionForHR(hr);
//
IBaseFilter baseGrabFlt = (IBaseFilter) sampGrabber;
ConfigureSampleGrabber(sampGrabber);
// Add the frame grabber to the graph
hr = m_FilterGraph.AddFilter( baseGrabFlt, "Ds.NET Grabber" );
DsError.ThrowExceptionForHR( hr );
SetConfigParms(capGraph, capFilter, media);
hr = capGraph.RenderStream(PinCategory.Capture, MediaType.Video, capFilter, pAVIDecompressor, baseGrabFlt);
if (hr < 0)
{
hr = capGraph.RenderStream(PinCategory.Capture, MediaType.Video, capFilter, null, baseGrabFlt);
}
DsError.ThrowExceptionForHR( hr );
SaveSizeInfo(sampGrabber);
}
finally
{
if (capFilter != null)
{
Marshal.ReleaseComObject(capFilter);
capFilter = null;
}
//.........这里部分代码省略.........
开发者ID:kaldpils,项目名称:ardupilotone,代码行数:101,代码来源:Capture.cs
示例18: SetupGraph
/// <summary> build the capture graph for grabber. </summary>
private void SetupGraph(DsDevice dev, int iWidth, int iHeight, short iBPP, Control hControl)
{
int hr;
ISampleGrabber sampGrabber = null;
IBaseFilter capFilter = null;
IPin pCaptureOut = null;
IPin pSampleIn = null;
IPin pRenderIn = null;
// Get the graphbuilder object
m_FilterGraph = new FilterGraph() as IFilterGraph2;
try
{
#if DEBUG
m_rot = new DsROTEntry(m_FilterGraph);
#endif
// add the video input device
hr = m_FilterGraph.AddSourceFilterForMoniker(dev.Mon, null, dev.Name, out capFilter);
DsError.ThrowExceptionForHR(hr);
// Find the still pin
m_pinStill = DsFindPin.ByCategory(capFilter, PinCategory.Still, 0);
// Didn't find one. Is there a preview pin?
if (m_pinStill == null)
{
m_pinStill = DsFindPin.ByCategory(capFilter, PinCategory.Preview, 0);
}
// Still haven't found one. Need to put a splitter in so we have
// one stream to capture the bitmap from, and one to display. Ok, we
// don't *have* to do it that way, but we are going to anyway.
if (m_pinStill == null)
{
IPin pRaw = null;
IPin pSmart = null;
// There is no still pin
m_VidControl = null;
// Add a splitter
IBaseFilter iSmartTee = (IBaseFilter)new SmartTee();
try
{
hr = m_FilterGraph.AddFilter(iSmartTee, "SmartTee");
DsError.ThrowExceptionForHR(hr);
// Find the find the capture pin from the video device and the
// input pin for the splitter, and connnect them
pRaw = DsFindPin.ByCategory(capFilter, PinCategory.Capture, 0);
pSmart = DsFindPin.ByDirection(iSmartTee, PinDirection.Input, 0);
hr = m_FilterGraph.Connect(pRaw, pSmart);
DsError.ThrowExceptionForHR(hr);
// Now set the capture and still pins (from the splitter)
m_pinStill = DsFindPin.ByName(iSmartTee, "Preview");
pCaptureOut = DsFindPin.ByName(iSmartTee, "Capture");
// If any of the default config items are set, perform the config
// on the actual video device (rather than the splitter)
if (iHeight + iWidth + iBPP > 0)
{
SetConfigParms(pRaw, iWidth, iHeight, iBPP);
}
}
finally
{
if (pRaw != null)
{
Marshal.ReleaseComObject(pRaw);
}
if (pRaw != pSmart)
{
Marshal.ReleaseComObject(pSmart);
}
if (pRaw != iSmartTee)
{
Marshal.ReleaseComObject(iSmartTee);
}
}
}
else
{
// Get a control pointer (used in Click())
m_VidControl = capFilter as IAMVideoControl;
pCaptureOut = DsFindPin.ByCategory(capFilter, PinCategory.Capture, 0);
// If any of the default config items are set
if (iHeight + iWidth + iBPP > 0)
{
SetConfigParms(m_pinStill, iWidth, iHeight, iBPP);
}
}
//.........这里部分代码省略.........
开发者ID:SaintLoong,项目名称:RemoteControl_Server,代码行数:101,代码来源:Capture.cs
示例19: OnCameraPlugged
private void OnCameraPlugged(DsDevice device)
{
CameraCapture camera = new CameraCapture(device, WindowHandle);
_camerasAll.Add(camera);
_freeCameras.Add(camera);
if (CameraPlugged != null)
CameraPlugged(this, new CameraEventArgs()
{
Camera = camera,
Available = true
});
}
开发者ID:KFlaga,项目名称:Cam3D,代码行数:12,代码来源:CameraCaptureManager.cs
示例20: Caps
/// <summary>
/// Returns the <see cref="CameraInfo"/> for the given <see cref="DsDevice"/>.
/// </summary>
/// <param name="dev">A <see cref="DsDevice"/> to parse name and capabilities for.</param>
/// <returns>The <see cref="CameraInfo"/> for the given device.</returns>
private CameraInfo Caps(DsDevice dev)
{
var camerainfo = new CameraInfo();
// Get the graphbuilder object
var graphBuilder = (IFilterGraph2)new FilterGraph();
// Get the ICaptureGraphBuilder2
var capGraph = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();
IBaseFilter capFilter = null;
try
{
int hr = capGraph.SetFiltergraph(graphBuilder);
DsError.ThrowExceptionForHR(hr);
// Add the video device
hr = graphBuilder.AddSourceFilterForMoniker(dev.Mon, null, "Video input", out capFilter);
// DsError.ThrowExceptionForHR(hr);
if (hr != 0)
{
Console.WriteLine("Error in m_graphBuilder.AddSourceFilterForMoniker(). Could not add source filter. Message: " + DsError.GetErrorText(hr));
return null;
}
//hr = m_graphBuilder.AddFilter(capFilter, "Ds.NET Video Capture Device");
//DsError.ThrowExceptionForHR(hr);
object o = null;
DsGuid cat = PinCategory.Capture;
DsGuid type = MediaType.Interleaved;
DsGuid iid = typeof(IAMStreamConfig).GUID;
// Check if Video capture filter is in use
hr = capGraph.RenderStream(cat, MediaType.Video, capFilter, null, null);
if (hr != 0)
{
return null;
}
//hr = capGraph.FindInterface(PinCategory.Capture, MediaType.Interleaved, capFilter, typeof(IAMStreamConfig).GUID, out o);
//if (hr != 0)
//{
hr = capGraph.FindInterface(PinCategory.Capture, MediaType.Video, capFilter,
typeof(IAMStreamConfig).GUID, out o);
DsError.ThrowExceptionForHR(hr);
//}
var videoStreamConfig = o as IAMStreamConfig;
int iCount = 0;
int iSize = 0;
try
{
if (videoStreamConfig != null) videoStreamConfig.GetNumberOfCapabilities(out iCount, out iSize);
}
catch (Exception)
{
//ErrorLogger.ProcessException(ex, false);
return null;
}
pscc = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(VideoStreamConfigCaps)));
camerainfo.Name = dev.Name;
camerainfo.DirectshowDevice = dev;
for (int i = 0; i < iCount; i++)
{
VideoStreamConfigCaps scc;
try
{
AMMediaType curMedType;
if (videoStreamConfig != null) hr = videoStreamConfig.GetStreamCaps(i, out curMedType, pscc);
Marshal.ThrowExceptionForHR(hr);
scc = (VideoStreamConfigCaps)Marshal.PtrToStructure(pscc, typeof(VideoStreamConfigCaps));
var CSF = new CamSizeFPS();
CSF.FPS = (int)(10000000 / scc.MinFrameInterval);
CSF.Height = scc.InputSize.Height;
CSF.Width = scc.InputSize.Width;
if (!InSizeFpsList(camerainfo.SupportedSizesAndFPS, CSF))
if (ParametersOK(CSF))
camerainfo.SupportedSizesAndFPS.Add(CSF);
}
catch (Exception)
{
//ErrorLogger.ProcessException(ex, false);
}
//.........这里部分代码省略.........
开发者ID:DeSciL,项目名称:Ogama,代码行数:101,代码来源:DirectShowDevices.cs
注:本文中的DsDevice类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论