Commit a39480c5 authored by smorlat's avatar smorlat
Browse files

new directshow grabber plugin

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@391 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent ad86e08f
No related merge requests found
Showing with 1941 additions and 0 deletions
/* HornetsEye - Computer Vision with Ruby
Copyright (C) 2006, 2007 Jan Wedekind
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef HORNETSEYE_COMPTR_HH
#define HORNETSEYE_COMPTR_HH
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef WIN32
#include <cassert>
#include <objbase.h>
#include "error.hh"
namespace Hornetseye {
template< class I >
class ComPtr
{
public:
ComPtr(void): m_i(NULL) {}
ComPtr( const ComPtr< I > &ptr ): m_i(ptr.get()) {
if ( m_i != NULL ) m_i->AddRef();
}
~ComPtr(void) { reset(); }
ComPtr< I > &operator=( const ComPtr< I > &other ) {
reset();
m_i = other.get();
if ( m_i != NULL ) m_i->AddRef();
return *this;
};
I **operator&(void) {
reset();
return &m_i;
}
void coCreateInstance( REFCLSID clsid, REFIID iid, const char *errorText )
throw (Error) {
reset();
COERRORMACRO( CoCreateInstance( clsid, NULL, CLSCTX_INPROC, iid,
(void **)&m_i ), Error, , errorText );
}
I *get(void) const { return m_i; }
I &operator*(void) {
assert( m_i != NULL );
return *m_i;
}
I *operator->(void) {
assert( m_i != NULL );
return m_i;
}
void reset(void) { if ( m_i != NULL ) { m_i->Release(); m_i = NULL; } }
protected:
I *m_i;
};
};
#endif
#endif
This diff is collapsed.
/* HornetsEye - Computer Vision with Ruby
Copyright (C) 2006, 2007 Jan Wedekind
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "error.hh"
using namespace std;
namespace Hornetseye {
string Error::temp;
};
/* HornetsEye - Computer Vision with Ruby
Copyright (C) 2006, 2007 Jan Wedekind
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef HORNETSEYE_ERROR_HH
#define HORNETSEYE_ERROR_HH
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <exception>
#include <sstream>
#include <string>
#ifdef WIN32
#include <stdio.h>
#include <windef.h>
#include <wchar.h>
#include <winsock.h>
#endif
namespace Hornetseye {
/** Exception class deriving from std::exception.
This class provides a syntax similar to output-streams for convenience.
For compability with other libraries it is inheriting the class
\c std::exception.
Here is an example how to use an instance of this class in C++:
\include exceptiontest/exceptiontest.cc
Exception-handling also can be done using the macro \c ERRORMACRO:
\include exceptiontest/macrotest.cc
Mind that the macro uses a variable with the name \c _e. Make sure, that
you don't use this variable-name in any of the macro-arguments!
Ruby already comes with exception classes:
\include exceptiontest/exceptiontest.rb
@date Mon Aug 23 14:37:05 UTC 2004 */
class Error: public std::exception
{
public:
/// Constructor.
Error(void) {}
/// Copy constructor.
Error( Error &e ): std::exception( e )
{ m_message << e.m_message.str(); }
/// Destructor.
virtual ~Error(void) throw() {}
///
template< typename T >
std::ostream &operator<<( const T &t )
{ m_message << t; return m_message; }
/** Interface for manipulators.
Manipulators such as \c std::endl and \c std::hex use these
functions in constructs like "Error e; e << std::endl".
For more information, see the iomanip header. */
std::ostream &operator<<( std::ostream& (*__pf)( std::ostream&) )
{ (*__pf)( m_message ); return m_message; }
/// Returns error message (not thread safe).
virtual const char* what(void) const throw() {
temp = m_message.str();
return temp.c_str();
return NULL;
}
protected:
/// Memory-stream containing the error message.
std::ostringstream m_message;
/** Temporary to do null-termination.
The method \c what() requires a null-terminated string. */
static std::string temp;
};
};
#define ERRORMACRO( condition, class, params, message ) \
if ( !( condition ) ) { \
class _e params; \
_e << message; \
throw _e; \
};
#ifdef WIN32
#define COERRORMACRO( condition, class, params, message ) \
{ \
HRESULT _hr = condition; \
if ( FAILED( _hr ) ) { \
class _e params; \
_e << message; \
TCHAR *_msg; \
if ( FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | \
FORMAT_MESSAGE_FROM_SYSTEM, 0, _hr, 0, \
(LPTSTR)&_msg, 0, NULL ) != 0 ) { \
_e << ": " << _msg; \
LocalFree( _msg ); \
}; \
throw _e; \
}; \
};
#define W32ERRORMACRO( condition, class, params, message ) \
{ \
if ( !( condition ) ) { \
class _e params; \
_e << message; \
TCHAR *_msg; \
DWORD _errCode = GetLastError(); \
if ( FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | \
FORMAT_MESSAGE_FROM_SYSTEM, 0, _errCode, 0, \
(LPTSTR)&_msg, 0, NULL ) != 0 ) { \
_e << ": " << _msg; \
LocalFree( _msg ); \
}; \
throw _e; \
}; \
};
#endif
#endif
[Project]
FileName=libmsdscap.dev
Name=libmsdscap
UnitCount=4
PchHead=-1
PchSource=-1
Ver=3
IsCpp=1
ProfilesCount=2
ProfileIndex=0
Folders=
[Unit1]
FileName=error.hh
CompileCpp=1
Folder=libmsdscap
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit2]
FileName=comptr.hh
CompileCpp=1
Folder=libmsdscap
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit3]
FileName=mdscap.cc
CompileCpp=1
Folder=libmsdscap
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit4]
FileName=error.cc
CompileCpp=1
Folder=libmsdscap
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNrOnRebuild=0
AutoIncBuildNrOnCompile=0
[Profile1]
ProfileName=MingW 3.4.2
Type=3
ObjFiles=
Includes=../../include;../../../oRTP/include
Libs=../../build/win32native/;../../../oRTP/build/win32native
ResourceIncludes=
MakeIncludes=
Compiler=-DBUILDING_DLL=1_@@_-DORTP_INET6_@@_
CppCompiler=-DBUILDING_DLL=1_@@_
Linker=--no-export-all-symbols_@@_--add-stdcall-alias_@@_-lole32_@@_-loleaut32_@@_-lwinmm_@@_-luuid_@@_-lmediastreamer2_@@_-lortp_@@_
PreprocDefines=
CompilerSettings=0000000001001000000000
Icon=
ExeOutput=
ObjectOutput=Output\MingW
OverrideOutput=0
OverrideOutputName=libmsdscap.dll
HostApplication=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
compilerType=0
[Profile2]
ProfileName=Visual C++ 2005
Type=3
ObjFiles=
Includes=
Libs=
ResourceIncludes=
MakeIncludes=
Compiler=/DBUILDING_DLL=1
CppCompiler=/DBUILDING_DLL=1
Linker=
PreprocDefines=
CompilerSettings=000000000000010000000000000000000000
Icon=
ExeOutput=Output\Visual C++ 2005
ObjectOutput=Objects\Visual C++ 2005
OverrideOutput=0
OverrideOutputName=
HostApplication=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=1
compilerType=1
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment