Click here to Skip to main content
15,896,207 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.
#include <stdafx.h>

#include <fstream>

#include <wxdebug.h>

#include "ErrorLog.h"

namespace DESCombineLib {

/*
	=====================================================================
	=====================================================================
	ErrorLog
	=====================================================================
	=====================================================================
*/
/*
	=====================================================================
	=====================================================================
*/
ErrorLog::ErrorLog(TCHAR *name, LPUNKNOWN unknown, HRESULT *phr) 
: CUnknown( name, unknown, phr )
{ 
}
/*
	=====================================================================
	=====================================================================
*/
STDMETHODIMP ErrorLog::LogError(
	LONG Severity,          // Reserved. Do not use.
	BSTR ErrorString,       // Description.
	LONG ErrorCode,         // Error code.
	HRESULT hresult,        // HRESULT that caused the error.
	VARIANT *extraInfo		// Extra information about the error.
) {
	std::wostringstream os;
	os << std::endl;

	if( ErrorString )
		os << L"ErrorString = " << std::wstring( ErrorString ) << std::endl;
	os << L"ErrorCode = " << ErrorCode << std::endl;
	os << L"hresult = 0x" << std::hex << hresult;	// do not append 'std::endl';

	if( extraInfo ) {
		os << std::endl;

		if( VT_BSTR == extraInfo->vt ) 
			os << L"extra information = " << extraInfo->bstrVal;
		else 
			os << L"extraInfo #" << extraInfo->vt;
	}

	DbgLog( (LOG_ERROR, 5, os.str().c_str()) );
	::OutputDebugString( _T("\n") );
	::OutputDebugString( os.str().c_str() );
	::OutputDebugString( _T("\n\n") );
	ASSERT( !"better check this error" );
	return S_OK;
}
/*
	=====================================================================
	=====================================================================
*/
STDMETHODIMP ErrorLog::NonDelegatingQueryInterface( REFIID riid, void **ppv )
{
	if( IID_IAMErrorLog == riid )
        return GetInterface((IAMErrorLog*)this, ppv);

    return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}

} //namespace DESCombineLib {

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