资源简介
C# WinForm DirectShow视频采集及图片抓取实例DxSnap 抓拍 视频
代码片段和文件信息
/****************************************************************************
While the underlying libraries are covered by LGPL this sample is released
as public domain. It is distributed in the hope that it will be useful but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
*****************************************************************************/
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections;
using System.Runtime.InteropServices;
using System.Threading;
using System.Diagnostics;
using System.Windows.Forms;
using DirectShowLib;
namespace SnapShot
{
/// Summary description for MainForm.
internal class Capture : ISampleGrabberCB IDisposable
{
#region Member variables
/// graph builder interface.
private IFilterGraph2 m_FilterGraph = null;
// Used to snap picture on Still pin
private IAMVideoControl m_VidControl = null;
private IPin m_pinStill = null;
/// so we can wait for the async job to finish
private ManualResetEvent m_PictureReady = null;
private bool m_WantOne = false;
/// Dimensions of the image calculated once in constructor for perf.
private int m_videoWidth;
private int m_videoHeight;
private int m_stride;
/// buffer for bitmap data. Always release by caller
private IntPtr m_ipBuffer = IntPtr.Zero;
#if DEBUG
// Allow you to “Connect to remote graph“ from GraphEdit
DsROTEntry m_rot = null;
#endif
#endregion
#region APIs
[DllImport(“Kernel32.dll“ EntryPoint = “RtlMoveMemory“)]
private static extern void CopyMemory(IntPtr Destination IntPtr Source [MarshalAs(UnmanagedType.U4)] int Length);
#endregion
// Zero based device index and device params and output window
public Capture(int iDeviceNum int iWidth int iHeight short iBPP Control hControl)
{
DsDevice[] capDevices;
// Get the collection of video devices
capDevices = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice);
if (iDeviceNum + 1 > capDevices.Length)
{
throw new Exception(“No video capture devices found at that index!“);
}
try
{
// Set up the capture graph
SetupGraph(capDevices[iDeviceNum] iWidth iHeight iBPP hControl);
// tell the callback to ignore new images
m_PictureReady = new ManualResetEvent(false);
}
catch
{
Dispose();
throw;
}
}
/// release everyt
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 187 2019-04-29 23:06 DirectShowDxSnap\WindowsFormsApplication1\App.config
文件 312320 2016-07-08 20:24 DirectShowDxSnap\WindowsFormsApplication1\bin\Debug\DirectShowLib-2005.dll
文件 16896 2019-04-30 10:06 DirectShowDxSnap\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
文件 187 2019-04-29 23:06 DirectShowDxSnap\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe.config
文件 32256 2019-04-30 10:06 DirectShowDxSnap\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
文件 23168 2019-04-30 10:09 DirectShowDxSnap\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
文件 187 2019-04-29 23:06 DirectShowDxSnap\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.config
文件 490 2010-03-17 22:39 DirectShowDxSnap\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
文件 18864 2019-04-30 09:12 DirectShowDxSnap\WindowsFormsApplication1\Capture.cs
文件 3983 2019-04-29 23:13 DirectShowDxSnap\WindowsFormsApplication1\DirectShowDxSnap.csproj
文件 312320 2016-07-08 20:24 DirectShowDxSnap\WindowsFormsApplication1\DirectShowLib-2005.dll
文件 6899 2019-04-30 10:06 DirectShowDxSnap\WindowsFormsApplication1\Form1.cs
文件 4617 2019-04-30 09:15 DirectShowDxSnap\WindowsFormsApplication1\Form1.Designer.cs
文件 5817 2019-04-30 09:53 DirectShowDxSnap\WindowsFormsApplication1\Form1.resx
文件 865 2019-04-29 23:06 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7096 2019-04-30 09:03 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 879 2019-04-30 10:09 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\DirectShowDxSnap.csproj.FileListAbsolute.txt
文件 977 2019-04-30 10:06 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\DirectShowDxSnap.csproj.GenerateResource.Cache
文件 180 2019-04-30 10:06 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\SnapShot.Form1.resources
文件 0 2019-04-29 23:06 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2019-04-29 23:06 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2019-04-29 23:06 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
文件 1162 2019-04-30 09:02 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt
文件 977 2019-04-30 09:01 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csproj.GenerateResource.Cache
文件 6691 2019-04-29 23:13 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.csprojResolveAssemblyReference.cache
文件 16896 2019-04-30 10:06 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.exe
文件 32256 2019-04-30 10:06 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.pdb
文件 180 2019-04-30 10:06 DirectShowDxSnap\WindowsFormsApplication1\obj\Debug\WindowsFormsApplication1.Properties.Resources.resources
文件 520 2019-04-29 23:13 DirectShowDxSnap\WindowsFormsApplication1\Program.cs
文件 1372 2019-04-29 23:06 DirectShowDxSnap\WindowsFormsApplication1\Properties\AssemblyInfo.cs
............此处省略19个文件信息
- 上一篇:Echart使用demo
- 下一篇:C#手写识别源码
相关资源
- C#手写识别源码
- C#winform textbox 画边框和圆角
- C#控制系统声音大小
- 基于Mysql数据库的C#实现登录注册功能
- activemq 接收文件流 C#
- ACTIVEMQ C#下的
- 学生管理系统c#
- 微信 网页授权获取用户基本信息(
- C#基于VS2010写的简单串口上位机
- C#桌面倒计时软件源码
- C#MJPG协议视频传输上位机Demo
- C#示波器完整
- c#通过opc读写plc的程序代码
- C#编写的CRC校验软件
- C#开发大全(基础卷)源码
- C#垃圾代码生成器.rar
- 使用c#控制台应用程序写游戏—消消乐
- C#XPS 转为图片并保存
- HTML、C#以及SQL Server学生信息管理系统
- c#两个串口实现图片传输并且实现图片
- opc 客户端c#编写数据同时存入mysql数据
- C# Bitmap转RGB32(NI)
- 智能水表c##代码
- c#随机出题
- C#求矩阵运算代码,特征值特征向量
- C#斑马打印机源程序
- 绘制矢量图C#源码
- c# 自定义的数字键盘和字母键盘
- C#网络应用编程第三版马骏主编上机练
- 项目实战C#聊天工具包含服务器和客户
评论
共有 条评论