Click here to Skip to main content
15,891,184 members
Articles / Desktop Programming / MFC

DirectShow Editing Services (DES) and combining AVI files

Rate me:
Please Sign up or sign in to vote.
4.64/5 (4 votes)
9 Sep 2011CPOL5 min read 35.9K   5.8K   12  
A sample C++ project that uses DES to combine two or more AVI files.
#pragma once

#include "afxwin.h"
#include "afxcmn.h"

#ifndef _DEQUE_
#include <deque>
#endif

#ifndef c_DESCombine_h
#include <DESCombine.h>
#endif
#ifndef c_MyCallback_h
#include <MyCallback.h>
#endif

#ifndef c_EventCodeMap_h
#include <EventCodeMap.h>
#endif

/*
	=====================================================================
	=====================================================================
	CDESCombineTestDlg
	=====================================================================
	=====================================================================
*/
class CCombineFilesDLG : public CDialog
{
	DECLARE_DYNAMIC(CCombineFilesDLG)
	DECLARE_MESSAGE_MAP()

public:
	CCombineFilesDLG(CWnd* pParent = NULL);   // standard constructor
	virtual ~CCombineFilesDLG();

	enum { IDD = IDD_CombineFiles };

	void initializeForPreviewing( 
		const DESCombineLib::InputFiles& inputFiles, 
		bool showXML 
	);
	void initializeForWritingToAVI( 
		const DESCombineLib::InputFiles& inputFiles, 
		const CString& outputFilename,
		bool showXML 
	);

	// overrides
	virtual BOOL OnInitDialog();

	// event handlers
	afx_msg void OnBnClicked_Repeat();
	afx_msg void OnDestroy();
	afx_msg void OnLbnSelchange_StatusList();
	//
	afx_msg LRESULT OnGraphNotify( WPARAM wParam, LPARAM lParam );
	afx_msg LRESULT OnPercentCompleted( WPARAM wParam, LPARAM lParam );
	afx_msg LRESULT OnShowMessage( WPARAM wParam, LPARAM lParam );

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void OnOK();

private:
	void _cleanUp();
	static IBaseFilterPtr _getAudioCompressionFilter();
	static IBaseFilterPtr _getVideoCompressionFilter();
	void _initialize();
	void _showMessage( LPCTSTR msg );
	void _updateControls();
	void _updateProgress( const MyCallbackProgress& progress ) ;

private:
	CListBox c_MessageList;
	CEdit c_ElapsedTime;
	CEdit c_VideoBytes;
	CEdit c_MediaTime;
	CEdit c_AudioBytes;
	CProgressCtrl c_Progress;
	CButton c_Repeat;

	CString _elapsedTime;
	CString _mediaTime;
	CString _ctVideoFrames;
	CString _ctAudioBytes;

	DESCombineLib::InputFiles _inputFiles;
	CString _outputFilename;	// only used when writing to AVI file
	bool _showXML;
	bool _previewingFiles;
	DESCombineLib::DESCombine* _desCombine;
	MyCallbacks _myCallbacks;

	bool _running;
	CTime _startTime;
	long _frameCount;
	EventCodeMap _eventCodeMap;
	bool _scrollMessageList;

}; // CCombineFilesDLG

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
Retired
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions