Click here to Skip to main content
15,897,187 members
Articles / Desktop Programming / Windows Forms

Versatile WebCam C# library

Rate me:
Please Sign up or sign in to vote.
4.96/5 (137 votes)
23 Feb 2015CPOL9 min read 1.1M   85K   444  
Easy to use C# WebCam library that's not plagued with weird DLL references or PInvoke calls
///////////////////////////////////////////////////////////////////////////////////
 
#ifndef __qedit_h__
#define __qedit_h__
 
///////////////////////////////////////////////////////////////////////////////////
 
#pragma once
 
///////////////////////////////////////////////////////////////////////////////////
 
interface
ISampleGrabberCB
:
public IUnknown
{
virtual STDMETHODIMP SampleCB( double SampleTime, IMediaSample *pSample ) = 0;
virtual STDMETHODIMP BufferCB( double SampleTime, BYTE *pBuffer, long BufferLen ) = 0;
};
 
///////////////////////////////////////////////////////////////////////////////////
 
static
const
IID IID_ISampleGrabberCB = { 0x0579154A, 0x2B53, 0x4994, { 0xB0, 0xD0, 0xE7, 0x73, 0x14, 0x8E, 0xFF, 0x85 } };
 
///////////////////////////////////////////////////////////////////////////////////
 
interface
ISampleGrabber
:
public IUnknown
{
virtual HRESULT STDMETHODCALLTYPE SetOneShot( BOOL OneShot ) = 0;
virtual HRESULT STDMETHODCALLTYPE SetMediaType( const AM_MEDIA_TYPE *pType ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetConnectedMediaType( AM_MEDIA_TYPE *pType ) = 0;
virtual HRESULT STDMETHODCALLTYPE SetBufferSamples( BOOL BufferThem ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetCurrentBuffer( long *pBufferSize, long *pBuffer ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetCurrentSample( IMediaSample **ppSample ) = 0;
virtual HRESULT STDMETHODCALLTYPE SetCallback( ISampleGrabberCB *pCallback, long WhichMethodToCallback ) = 0;
};
 
///////////////////////////////////////////////////////////////////////////////////
 
static
const
IID IID_ISampleGrabber = { 0x6B652FFF, 0x11FE, 0x4fce, { 0x92, 0xAD, 0x02, 0x66, 0xB5, 0xD7, 0xC7, 0x8F } };
 
///////////////////////////////////////////////////////////////////////////////////
 
static
const
CLSID CLSID_SampleGrabber = { 0xC1F400A0, 0x3F08, 0x11d3, { 0x9F, 0x0B, 0x00, 0x60, 0x08, 0x03, 0x9E, 0x37 } };
 
///////////////////////////////////////////////////////////////////////////////////
 
static
const
CLSID CLSID_NullRenderer = { 0xC1F400A4, 0x3F08, 0x11d3, { 0x9F, 0x0B, 0x00, 0x60, 0x08, 0x03, 0x9E, 0x37 } };
 
///////////////////////////////////////////////////////////////////////////////////
 
static
const
CLSID CLSID_VideoEffects1Category = { 0xcc7bfb42, 0xf175, 0x11d1, { 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59 } };
 
///////////////////////////////////////////////////////////////////////////////////
 
static
const
CLSID CLSID_VideoEffects2Category = { 0xcc7bfb43, 0xf175, 0x11d1, { 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59 } };
 
///////////////////////////////////////////////////////////////////////////////////
 
static
const
CLSID CLSID_AudioEffects1Category = { 0xcc7bfb44, 0xf175, 0x11d1, { 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59 } };
 
///////////////////////////////////////////////////////////////////////////////////
 
static
const
CLSID CLSID_AudioEffects2Category = { 0xcc7bfb45, 0xf175, 0x11d1, { 0xa3, 0x92, 0x0, 0xe0, 0x29, 0x1f, 0x39, 0x59 } };
 
///////////////////////////////////////////////////////////////////////////////////
 
#endif
 
///////////////////////////////////////////////////////////////////////////////////

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer
United States United States
If you liked this article, consider reading other articles by me. For republishing article on other websites, please contact me by leaving a comment.

Comments and Discussions