本文整理汇总了C#中AForge.Video.DirectShow.VideoCaptureDevice.CheckIfCrossbarAvailable方法的典型用法代码示例。如果您正苦于以下问题:C# VideoCaptureDevice.CheckIfCrossbarAvailable方法的具体用法?C# VideoCaptureDevice.CheckIfCrossbarAvailable怎么用?C# VideoCaptureDevice.CheckIfCrossbarAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AForge.Video.DirectShow.VideoCaptureDevice
的用法示例。
在下文中一共展示了VideoCaptureDevice.CheckIfCrossbarAvailable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Enable
public void Enable()
{
_processing = true;
switch (Camobject.settings.sourceindex)
{
case 0:
var jpegSource = new JPEGStream(Camobject.settings.videosourcestring);
if (Camobject.settings.frameinterval != 0)
jpegSource.FrameInterval = Camobject.settings.frameinterval;
if (Camobject.settings.login != "")
{
jpegSource.Login = Camobject.settings.login;
jpegSource.Password = Camobject.settings.password;
}
//jpegSource.SeparateConnectionGroup = true;
jpegSource.RequestTimeout = iSpyServer.Default.IPCameraTimeout;
OpenVideoSource(jpegSource, false);
break;
case 1:
var mjpegSource = new MJPEGStream(Camobject.settings.videosourcestring)
{
Login = Camobject.settings.login,
Password = Camobject.settings.password,
RequestTimeout = iSpyServer.Default.IPCameraTimeout,
HttpUserAgent = Camobject.settings.useragent
};
//mjpegSource.SeparateConnectionGroup = true;
OpenVideoSource(mjpegSource, false);
break;
case 2:
//var fileSource = new AVIFileVideoSource(Camobject.settings.videosourcestring);
//OpenVideoSource(fileSource, true);
break;
case 3:
string moniker = Camobject.settings.videosourcestring;
var videoSource = new VideoCaptureDevice(moniker);
string[] wh = Camobject.resolution.Split('x');
var sz = new Size(Convert.ToInt32(wh[0]), Convert.ToInt32(wh[1]));
var vc = videoSource.VideoCapabilities.Where(p => p.FrameSize == sz).ToList();
if (vc.Count>0)
{
var vc2 = vc.FirstOrDefault(p => p.AverageFrameRate == Camobject.settings.framerate) ??
vc.FirstOrDefault();
videoSource.VideoResolution = vc2;
}
if (Camobject.settings.crossbarindex!=-1 && videoSource.CheckIfCrossbarAvailable())
{
var cbi =
videoSource.AvailableCrossbarVideoInputs.FirstOrDefault(
p => p.Index == Camobject.settings.crossbarindex);
if (cbi!=null)
{
videoSource.CrossbarVideoInput = cbi;
}
}
OpenVideoSource(videoSource, true);
break;
case 4:
Rectangle area = Rectangle.Empty;
if (!String.IsNullOrEmpty(Camobject.settings.desktoparea))
{
var i = Array.ConvertAll(Camobject.settings.desktoparea.Split(','), int.Parse);
area = new Rectangle(i[0],i[1],i[2],i[3]);
}
var desktopSource = new DesktopStream(Convert.ToInt32(Camobject.settings.videosourcestring), area)
{MousePointer = Camobject.settings.desktopmouse};
if (Camobject.settings.frameinterval != 0)
desktopSource.FrameInterval = Camobject.settings.frameinterval;
OpenVideoSource(desktopSource, false);
break;
case 5:
var ks = new KinectStream(Nv("UniqueKinectId"), Convert.ToBoolean(Nv("KinectSkeleton")));
OpenVideoSource(ks, true);
break;
}
if (Camera != null)
{
if (!Camera.IsRunning)
{
Camera.Start();
}
Camobject.settings.active = true;
if (File.Exists(Camobject.settings.maskimage))
{
Camera.Mask = Image.FromFile(Camobject.settings.maskimage);
}
}
_frameCount = 0;
VideoSourceErrorState = false;
VideoSourceErrorMessage = "";
Camobject.ftp.ready = true;
MainForm.NeedsSync = true;
//.........这里部分代码省略.........
示例2: Enable
public void Enable()
{
if (IsEnabled)
return;
if (InvokeRequired)
{
Invoke(new SwitchDelegate(Enable));
return;
}
_processing = true;
if (Camera != null && Camera.IsRunning)
{
Disable();
}
IsEnabled = true;
string ckies;
switch (Camobject.settings.sourceindex)
{
case 0:
ckies = Camobject.settings.cookies ?? "";
ckies = ckies.Replace("[USERNAME]", Camobject.settings.login);
ckies = ckies.Replace("[PASSWORD]", Camobject.settings.password);
ckies = ckies.Replace("[CHANNEL]", Camobject.settings.ptzchannel);
var jpegSource = new JPEGStream2(Camobject.settings.videosourcestring)
{
Login = Camobject.settings.login,
Password = Camobject.settings.password,
ForceBasicAuthentication = Camobject.settings.forcebasic,
RequestTimeout = MainForm.Conf.IPCameraTimeout,
UseHTTP10 = Camobject.settings.usehttp10,
HttpUserAgent = Camobject.settings.useragent,
Cookies = ckies
};
OpenVideoSource(jpegSource, true);
if (Camobject.settings.frameinterval != 0)
jpegSource.FrameInterval = Camobject.settings.frameinterval;
break;
case 1:
ckies = Camobject.settings.cookies ?? "";
ckies = ckies.Replace("[USERNAME]", Camobject.settings.login);
ckies = ckies.Replace("[PASSWORD]", Camobject.settings.password);
ckies = ckies.Replace("[CHANNEL]", Camobject.settings.ptzchannel);
var mjpegSource = new MJPEGStream2(Camobject.settings.videosourcestring)
{
Login = Camobject.settings.login,
Password = Camobject.settings.password,
ForceBasicAuthentication = Camobject.settings.forcebasic,
RequestTimeout = MainForm.Conf.IPCameraTimeout,
HttpUserAgent = Camobject.settings.useragent,
DecodeKey = Camobject.decodekey,
Cookies = ckies
};
OpenVideoSource(mjpegSource, true);
break;
case 2:
string url = Camobject.settings.videosourcestring;
var ffmpegSource = new FFMPEGStream(url);
OpenVideoSource(ffmpegSource, true);
break;
case 3:
string moniker = Camobject.settings.videosourcestring;
var videoSource = new VideoCaptureDevice(moniker);
string[] wh = Camobject.resolution.Split('x');
var sz = new Size(Convert.ToInt32(wh[0]), Convert.ToInt32(wh[1]));
var vc = videoSource.VideoCapabilities.Where(p => p.FrameSize == sz).ToList();
if (vc.Count>0)
{
var vc2 = vc.FirstOrDefault(p => p.AverageFrameRate == Camobject.settings.framerate) ??
vc.FirstOrDefault();
videoSource.VideoResolution = vc2;
}
if (Camobject.settings.crossbarindex!=-1 && videoSource.CheckIfCrossbarAvailable())
{
var cbi =
videoSource.AvailableCrossbarVideoInputs.FirstOrDefault(
p => p.Index == Camobject.settings.crossbarindex);
if (cbi!=null)
{
videoSource.CrossbarVideoInput = cbi;
}
}
OpenVideoSource(videoSource, true);
break;
case 4:
Rectangle area = Rectangle.Empty;
if (!String.IsNullOrEmpty(Camobject.settings.desktoparea))
{
var i = Array.ConvertAll(Camobject.settings.desktoparea.Split(','), int.Parse);
area = new Rectangle(i[0],i[1],i[2],i[3]);
}
//.........这里部分代码省略.........
示例3: Enable
//.........这里部分代码省略.........
Math.Abs(capabilty.FrameSize.Height), capabilty.AverageFrameRate, capabilty.BitCount);
if (precfg == item)
{
videoSource.VideoResolution = capabilty;
found = true;
break;
}
}
}
if (!found)
{
var vc = videoSource.VideoCapabilities.Where(p => p.FrameSize == sz).ToList();
if (vc.Count > 0)
{
var vc2 = vc.FirstOrDefault(p => p.AverageFrameRate == Camobject.settings.framerate) ??
vc.FirstOrDefault();
videoSource.VideoResolution = vc2;
found = true;
}
if (!found)
{
//first available
var vcf = videoSource.VideoCapabilities.FirstOrDefault();
if (vcf != null)
videoSource.VideoResolution = vcf;
//else
//{
// dont do this, not having an entry is ok for some video providers
// throw new Exception("Unable to find a video format for the capture device");
//}
}
}
if (Camobject.settings.crossbarindex != -1 && videoSource.CheckIfCrossbarAvailable())
{
var cbi =
videoSource.AvailableCrossbarVideoInputs.FirstOrDefault(
p => p.Index == Camobject.settings.crossbarindex);
if (cbi != null)
{
videoSource.CrossbarVideoInput = cbi;
}
}
OpenVideoSource(videoSource, true);
break;
case 4:
Rectangle area = Rectangle.Empty;
if (!String.IsNullOrEmpty(Camobject.settings.desktoparea))
{
var i = System.Array.ConvertAll(Camobject.settings.desktoparea.Split(','), int.Parse);
area = new Rectangle(i[0], i[1], i[2], i[3]);
}
var desktopSource = new DesktopStream(Convert.ToInt32(Camobject.settings.videosourcestring),
area) {MousePointer = Camobject.settings.desktopmouse};
if (Camobject.settings.frameinterval != 0)
desktopSource.FrameInterval = Camobject.settings.frameinterval;
OpenVideoSource(desktopSource, true);
break;
case 5:
List<String> inargs = Camobject.settings.vlcargs.Split(Environment.NewLine.ToCharArray(),
StringSplitOptions.RemoveEmptyEntries)
.
ToList();