Click here to Skip to main content
15,885,546 members
Articles / Programming Languages / C#

Laser Gesture Recognition

Rate me:
Please Sign up or sign in to vote.
4.93/5 (84 votes)
9 Jan 20073 min read 321.7K   7.2K   177  
A quick article on setting up a simple, real-time laser gesture recognition application and using it to control Windows Media Player.
namespace dshow.Core
{
	using System;
	using System.Runtime.InteropServices;

	// IPin interface
	//
	// The IPin interface represents a single, unidirectional
	// connection point on a filter
	//
	[ComImport,
	Guid("56A86891-0AD4-11CE-B03A-0020AF0BA770"),
	InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	public interface IPin
	{
		// Connects the pin to another pin
		[PreserveSig]
		int Connect(
			[In] IPin pReceivePin,
			[In, MarshalAs(UnmanagedType.LPStruct)] AMMediaType	pmt);

		// Accepts a connection from another pin
		[PreserveSig]
		int ReceiveConnection(
			[In] IPin pReceivePin,
			[In, MarshalAs(UnmanagedType.LPStruct)] AMMediaType	pmt);

		// Breaks the current pin connection
		[PreserveSig]
		int Disconnect();

		// Retrieves the pin connected to this pin
		[PreserveSig]
		int ConnectedTo(
			[Out] out IPin ppPin);

		// Retrieves the media type for the current pin connection
		[PreserveSig]
		int ConnectionMediaType(
			[Out, MarshalAs(UnmanagedType.LPStruct)] AMMediaType pmt);

		// Retrieves information about the pin, such as the name,
		// the owning filter, and the direction
		[PreserveSig]
		int QueryPinInfo(
			[Out, MarshalAs(UnmanagedType.LPStruct)] PinInfo pInfo);

		// Retrieves the direction of the pin (input or output)
		[PreserveSig]
		int QueryDirection(
			out PinDirection pPinDir);

		// Retrieves the pin identifier
		[PreserveSig]
		int QueryId(
			[Out, MarshalAs(UnmanagedType.LPWStr)] out string Id);

		// Determines whether the pin accepts a specified media type
		[PreserveSig]
		int QueryAccept(
			[In, MarshalAs(UnmanagedType.LPStruct)] AMMediaType	pmt);

		// Enumerates the pin's preferred media types
		[PreserveSig]
		int EnumMediaTypes(
			IntPtr ppEnum);

		// Retrieves the pins that are connected
		// internally to this pin (within the filter)
		[PreserveSig]
		int QueryInternalConnections(
			IntPtr apPin,
			[In, Out] ref int nPin);

		// Notifies the pin that no additional data is expected
		[PreserveSig]
		int EndOfStream();

		// Begins a flush operation
		[PreserveSig]
		int BeginFlush();

		// Ends a flush operation
		[PreserveSig]
		int EndFlush();

		// Notifies the pin that media samples received after
		// this call are grouped as a segment
		[PreserveSig]
		int NewSegment(
			long tStart,
			long tStop,
			double dRate);
	}
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
India India

Comments and Discussions