Click here to Skip to main content
15,886,678 members
Articles / Desktop Programming / MFC

Preview and Record with MPEG2 Capture device

Rate me:
Please Sign up or sign in to vote.
4.39/5 (16 votes)
11 Jun 20048 min read 219.9K   9.7K   94  
This article shows how to work with MPEG2 capture devices such as Preview, Record. Works with all video renderers. Grab picture and configure MPEG2 Demux.
// Mpeg2Handler.h: interface for the CMpeg2Handler class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MPEG2HANDLER_H__7607A2C6_10CE_4454_B36B_568889296533__INCLUDED_)
#define AFX_MPEG2HANDLER_H__7607A2C6_10CE_4454_B36B_568889296533__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#include <objbase.h>
#include <uuids.h>
#include <control.h>
#include <atlbase.h>
#include <strmif.h>
#include "DirectShowGraph.h"
 

class CMPEG2CaptureAppDlg; 
class CDirectShowGraph; 



class CMPEG2Handler  
{
public:
	CMPEG2Handler(CMPEG2CaptureAppDlg    *dlg);
	virtual ~CMPEG2Handler();

	HRESULT Record(char *FileName);
	HRESULT Preview();
	HRESULT Run() ;
	HRESULT Stop() ;
	HRESULT Pause();
    HRESULT Play(); 

	HRESULT SetBrightness(int value);
	HRESULT SetHue(int value);
	HRESULT SetChromeSaturation(int value);
	HRESULT SetContrast(int value);


	HRESULT EnumFilters(IEnumMoniker *pEnumCat); 
	HRESULT GetAnalogVideoInterface();
	HRESULT GetCrossbarInterface();
	HRESULT Route(int in , int out); 


    BOOL    IsRunning();
    BOOL    IsPaused();
    BOOL    IsStopped();

		
	HWND pWindow; 
	void SetVideoWindow(HWND  hwnd) 
	{
		pWindow = hwnd; 

	}
	CDirectShowGraph      *dsGraph;

	CMPEG2CaptureAppDlg   *m_dlg; 


    HRESULT RunMedia(){return E_FAIL;}
    HRESULT StopMedia(){return E_FAIL;}

	 


	eGraphState   graph_mode; 

	IPin  *AInPin;
	IPin  *AOutPin;
	IPin  *VInPin;
	IPin  *VOutPin;


	IPin  *AInPin1;
	IPin  *AOutPin1;
	IPin  *VInPin1;
	IPin  *VOutPin1;


};

#endif // !defined(AFX_MPEG2HANDLER_H__7607A2C6_10CE_4454_B36B_568889296533__INCLUDED_)

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
Web Developer
Israel Israel
Enjoy from Cabelim.com

Comments and Discussions