- Reestructuración de ficheros y directorios general

- merge v0.01 --> Añadido fileselector
- Añadidas fuentes de Gem y Pure Data
- pix2jpg incluído en Gem. Archivos de construcción de Gem modificados.
- Añadido fichero ompiling.txt con instrucciones de compilación
This commit is contained in:
Santi Noreña 2013-02-04 18:00:17 +01:00
parent c9adfd020b
commit e85d191b46
3100 changed files with 775434 additions and 3073 deletions

View file

@ -0,0 +1,2 @@
#N canvas 8 49 505 112 10;
#X text 89 47 Nothing special about this backend...;

View file

@ -0,0 +1,671 @@
//------------------------------------------------------------------------------
// File: Grabber.cpp
//
// Desc: DirectShow sample code - Implementation file for the SampleGrabber
// example filter
//
// Copyright (c) 1997-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_DIRECTSHOW
#include <streams.h> // Active Movie (includes windows.h)
#include <initguid.h> // declares DEFINE_GUID to declare an EXTERN_C const.
#include "qedit.h"
#include "DSgrabber.h"
#pragma warning(disable: 4800)
// Local helper functions
IPin * GetInPin( IBaseFilter * pFilter, int PinNum );
IPin * GetOutPin( IBaseFilter * pFilter, int PinNum );
// Setup data - allows the self-registration to work.
const AMOVIESETUP_MEDIATYPE sudPinTypes =
{ &MEDIATYPE_NULL // clsMajorType
, &MEDIASUBTYPE_NULL }; // clsMinorType
const AMOVIESETUP_PIN psudSampleGrabberPins[] =
{ { L"Input" // strName
, FALSE // bRendered
, FALSE // bOutput
, FALSE // bZero
, FALSE // bMany
, &CLSID_NULL // clsConnectsToFilter
, L"" // strConnectsToPin
, 1 // nTypes
, &sudPinTypes // lpTypes
}
, { L"Output" // strName
, FALSE // bRendered
, TRUE // bOutput
, FALSE // bZero
, FALSE // bMany
, &CLSID_NULL // clsConnectsToFilter
, L"" // strConnectsToPin
, 1 // nTypes
, &sudPinTypes // lpTypes
}
};
const AMOVIESETUP_FILTER sudSampleGrabber =
{ &CLSID_GrabberSample // clsID
, L"SampleGrabber Example" // strName
, MERIT_DO_NOT_USE // dwMerit
, 2 // nPins
, psudSampleGrabberPins }; // lpPin
// Needed for the CreateInstance mechanism
CFactoryTemplate g_Templates[]=
{
{ L"Sample Grabber Example"
, &CLSID_GrabberSample
, CSampleGrabber::CreateInstance
, NULL
, &sudSampleGrabber }
};
int g_cTemplates = sizeof(g_Templates)/sizeof(g_Templates[0]);
/******************************Public*Routine******************************\
*
* Exported entry points for registration and unregistration (in this case
* they only call through to default implmentations).
*
*\**************************************************************************/
STDAPI
DllRegisterServer() {
return AMovieDllRegisterServer2(TRUE);
}
STDAPI
DllUnregisterServer() {
return AMovieDllRegisterServer2(FALSE);
}
//
// CreateInstance
//
// Provide the way for COM to create a CSampleGrabber object
//
CUnknown * WINAPI CSampleGrabber::CreateInstance(LPUNKNOWN punk, HRESULT *phr)
{
// assuming we don't want to modify the data
CSampleGrabber *pNewObject = new CSampleGrabber(punk, phr, FALSE);
if(pNewObject == NULL) {
*phr = E_OUTOFMEMORY;
}
return pNewObject;
} // CreateInstance
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
CSampleGrabber::CSampleGrabber( IUnknown * pOuter, HRESULT * phr, BOOL ModifiesData )
: CTransInPlaceFilter( TEXT("SampleGrabber"), (IUnknown*) pOuter,
CLSID_GrabberSample, phr, (BOOL)ModifiesData )
, m_callback( NULL )
{
// this is used to override the input pin with our own
m_pInput = (CTransInPlaceInputPin*) new CSampleGrabberInPin( this, phr );
if( !m_pInput )
{
*phr = E_OUTOFMEMORY;
}
}
STDMETHODIMP CSampleGrabber::NonDelegatingQueryInterface( REFIID riid, void ** ppv)
{
if(riid == IID_IGrabberSample) {
return GetInterface((IGrabberSample *) this, ppv);
}
else {
return CTransInPlaceFilter::NonDelegatingQueryInterface(riid, ppv);
}
}
//----------------------------------------------------------------------------
// this is where you force the sample grabber to connect with one type
// or the other. What you do here is crucial to what type of data your
// app will be dealing with in the sample grabber's callback. For instance,
// if you don't enforce right-side-up video in this call, you may not get
// right-side-up video in your callback. It all depends on what you do here.
//----------------------------------------------------------------------------
HRESULT CSampleGrabber::CheckInputType( const CMediaType * pmt )
{
CAutoLock lock( &m_Lock );
// if the major type's not set, then accept any old thing
GUID g;
g = *m_mtAccept.Type( );
if( g == GUID_NULL )
{
return NOERROR;
}
// if the major type is set, don't accept anything else
if( g != *pmt->Type( ) )
{
return VFW_E_INVALID_MEDIA_TYPE;
}
// subtypes must match, if set. if not set, accept anything
g = *m_mtAccept.Subtype( );
if( g == GUID_NULL )
{
return NOERROR;
}
if( g != *pmt->Subtype( ) )
{
return VFW_E_INVALID_MEDIA_TYPE;
}
// format types must match, if one is set
g = *m_mtAccept.FormatType( );
if( g == GUID_NULL )
{
return NOERROR;
}
if( g != *pmt->FormatType( ) )
{
return VFW_E_INVALID_MEDIA_TYPE;
}
// at this point, for this sample code, this is good enough,
// but you may want to make it more strict
return NOERROR;
}
//----------------------------------------------------------------------------
// this bit is almost straight out of the base classes.
// We override this so we can handle Transform( )'s error
// result differently.
//----------------------------------------------------------------------------
HRESULT CSampleGrabber::Receive( IMediaSample * pms )
{
AM_SAMPLE2_PROPERTIES * const pProps = m_pInput->SampleProps();
if (pProps->dwStreamId != AM_STREAM_MEDIA)
{
if( m_pOutput->IsConnected() )
return m_pOutput->Deliver(pms);
else
return NOERROR;
}
HRESULT hr;
if (UsingDifferentAllocators())
{
// We have to copy the data.
pms = Copy(pms);
if (pms==NULL)
{
return E_UNEXPECTED;
}
}
// have the derived class transform the data
hr = Transform(pms);
if (FAILED(hr))
{
DbgLog((LOG_TRACE, 1, TEXT("Error from TransInPlace")));
if (UsingDifferentAllocators())
{
pms->Release();
}
return hr;
}
if (hr == NOERROR)
{
hr = m_pOutput->Deliver(pms);
}
// release the output buffer. If the connected pin still needs it,
// it will have addrefed it itself.
if (UsingDifferentAllocators())
{
pms->Release();
}
return hr;
}
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
HRESULT CSampleGrabber::Transform( IMediaSample * pms )
{
CAutoLock lock( &m_Lock );
if( m_callback )
{
REFERENCE_TIME StartTime, StopTime;
pms->GetTime( &StartTime, &StopTime);
StartTime += m_pInput->CurrentStartTime( );
StopTime += m_pInput->CurrentStartTime( );
BOOL * pTypeChanged = &((CSampleGrabberInPin*)m_pInput)->m_bMediaTypeChanged;
HRESULT hr = m_callback( m_pUser, pms, &StartTime, &StopTime, *pTypeChanged );
*pTypeChanged = FALSE; // now that we notified user, we can clear it
return hr;
}
return NOERROR;
}
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
HRESULT CSampleGrabber::SetAcceptedMediaType( const CMediaType * pmt )
{
CAutoLock lock( &m_Lock );
if( !pmt )
{
m_mtAccept = CMediaType( );
return NOERROR;
}
HRESULT hr;
hr = CopyMediaType( &m_mtAccept, pmt );
return hr;
}
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
HRESULT CSampleGrabber::GetConnectedMediaType( CMediaType * pmt )
{
CAutoLock lock( &m_Lock );
HRESULT hr;
hr = CopyMediaType( pmt, &InputPin( )->CurrentMediaType() );
return hr;
}
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
HRESULT CSampleGrabber::SetCallback( SAMPLECALLBACK Callback, void* pUser )
{
CAutoLock lock( &m_Lock );
m_callback = Callback;
m_pUser = pUser;
return NOERROR;
}
//----------------------------------------------------------------------------
// inform the input pin of the allocator buffer we wish to use. See the
// input pin's SetDeliverBuffer method for comments.
//----------------------------------------------------------------------------
HRESULT CSampleGrabber::SetDeliveryBuffer( ALLOCATOR_PROPERTIES props, BYTE * m_pBuffer )
{
// they can't be connected if we're going to be changing delivery buffers
//
if( InputPin( )->IsConnected( ) || OutputPin( )->IsConnected( ) )
{
return E_INVALIDARG;
}
return ((CSampleGrabberInPin*)m_pInput)->SetDeliveryBuffer( props, m_pBuffer );
}
//----------------------------------------------------------------------------
// used to help speed input pin connection times. We return a partially
// specified media type - only the main type is specified. If we return
// anything BUT a major type, some codecs written improperly will crash
//----------------------------------------------------------------------------
HRESULT CSampleGrabberInPin::GetMediaType( int iPosition, CMediaType * pMediaType )
{
if (iPosition < 0) {
return E_INVALIDARG;
}
if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
*pMediaType = CMediaType( );
pMediaType->SetType( ((CSampleGrabber*)m_pFilter)->m_mtAccept.Type( ) );
return S_OK;
}
//----------------------------------------------------------------------------
// override the CTransInPlaceInputPin's method, and return a new enumerator
// if the input pin is disconnected. This will allow GetMediaType to be
// called. If we didn't do this, EnumMediaTypes returns a failure code
// and GetMediaType is never called.
//----------------------------------------------------------------------------
STDMETHODIMP CSampleGrabberInPin::EnumMediaTypes( IEnumMediaTypes **ppEnum )
{
CheckPointer(ppEnum,E_POINTER);
ValidateReadWritePtr(ppEnum,sizeof(IEnumMediaTypes *));
// if the output pin isn't connected yet, offer the possibly
// partially specified media type that has been set by the user
if( !((CSampleGrabber*)m_pTIPFilter)->OutputPin( )->IsConnected() )
{
/* Create a new ref counted enumerator */
*ppEnum = new CEnumMediaTypes( this, NULL );
return (*ppEnum) ? NOERROR : E_OUTOFMEMORY;
}
// if the output pin is connected, offer it's fully qualified media type
return ((CSampleGrabber*)m_pTIPFilter)->OutputPin( )->GetConnected()->EnumMediaTypes( ppEnum );
}
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
STDMETHODIMP CSampleGrabberInPin::NotifyAllocator( IMemAllocator *pAllocator, BOOL bReadOnly )
{
if( m_pPrivateAllocator )
{
if( pAllocator != m_pPrivateAllocator )
{
return E_FAIL;
}
else
{
// if the upstream guy wants to be read only and we don't, then that's bad
// if the upstream guy doesn't request read only, but we do, that's okay
if( bReadOnly && !SampleGrabber( )->IsReadOnly( ) )
{
return E_FAIL;
}
}
}
return CTransInPlaceInputPin::NotifyAllocator( pAllocator, bReadOnly );
}
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
STDMETHODIMP CSampleGrabberInPin::GetAllocator( IMemAllocator **ppAllocator )
{
if( m_pPrivateAllocator )
{
*ppAllocator = m_pPrivateAllocator;
m_pPrivateAllocator->AddRef( );
return NOERROR;
}
else
{
return CTransInPlaceInputPin::GetAllocator( ppAllocator );
}
}
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
HRESULT CSampleGrabberInPin::SetDeliveryBuffer( ALLOCATOR_PROPERTIES props, BYTE * pBuffer )
{
// don't allow more than one buffer
if( props.cBuffers != 1 )
{
return E_INVALIDARG;
}
if( !pBuffer )
{
return E_POINTER;
}
m_allocprops = props;
m_pBuffer = pBuffer;
HRESULT hr = 0;
m_pPrivateAllocator = new CSampleGrabberAllocator( this, &hr );
if( !m_pPrivateAllocator )
{
return E_OUTOFMEMORY;
}
m_pPrivateAllocator->AddRef( );
return hr;
}
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
HRESULT CSampleGrabberInPin::SetMediaType( const CMediaType *pmt )
{
m_bMediaTypeChanged = TRUE;
return CTransInPlaceInputPin::SetMediaType( pmt );
}
//----------------------------------------------------------------------------
// ask for the allocator props. this can hardly go wrong
//----------------------------------------------------------------------------
HRESULT CSampleGrabberAllocator::GetAllocatorRequirements( ALLOCATOR_PROPERTIES *pProps )
{
*pProps = m_pPin->m_allocprops;
return NOERROR;
}
//----------------------------------------------------------------------------
// don't allocate the memory, just use the buffer the app set up
//----------------------------------------------------------------------------
HRESULT CSampleGrabberAllocator::Alloc( )
{
// look at the base class code to see where this came from!
CAutoLock lck(this);
/* Check he has called SetProperties */
HRESULT hr = CBaseAllocator::Alloc();
if (FAILED(hr)) {
return hr;
}
/* If the requirements haven't changed then don't reallocate */
if (hr == S_FALSE) {
ASSERT(m_pBuffer);
return NOERROR;
}
ASSERT(hr == S_OK); // we use this fact in the loop below
/* Free the old resources */
if (m_pBuffer) {
ReallyFree();
}
/* Compute the aligned size */
LONG lAlignedSize = m_lSize + m_lPrefix;
if (m_lAlignment > 1) {
LONG lRemainder = lAlignedSize % m_lAlignment;
if (lRemainder != 0) {
lAlignedSize += (m_lAlignment - lRemainder);
}
}
/* Create the contiguous memory block for the samples
making sure it's properly aligned (64K should be enough!)
*/
ASSERT(lAlignedSize % m_lAlignment == 0);
// don't create the buffer - use what was passed to us
//
m_pBuffer = m_pPin->m_pBuffer;
if (m_pBuffer == NULL) {
return E_OUTOFMEMORY;
}
LPBYTE pNext = m_pBuffer;
CMediaSample *pSample;
ASSERT(m_lAllocated == 0);
// Create the new samples - we have allocated m_lSize bytes for each sample
// plus m_lPrefix bytes per sample as a prefix. We set the pointer to
// the memory after the prefix - so that GetPointer() will return a pointer
// to m_lSize bytes.
for (; m_lAllocated < m_lCount; m_lAllocated++, pNext += lAlignedSize) {
pSample = new CMediaSample(
NAME("Sample Grabber memory media sample"),
this,
&hr,
pNext + m_lPrefix, // GetPointer() value
m_lSize); // not including prefix
ASSERT(SUCCEEDED(hr));
if (pSample == NULL) {
return E_OUTOFMEMORY;
}
// This CANNOT fail
m_lFree.Add(pSample);
}
m_bChanged = FALSE;
return NOERROR;
}
//----------------------------------------------------------------------------
// don't really free the memory
//----------------------------------------------------------------------------
void CSampleGrabberAllocator::ReallyFree()
{
// look at the base class code to see where this came from!
/* Should never be deleting this unless all buffers are freed */
ASSERT(m_lAllocated == m_lFree.GetCount());
/* Free up all the CMediaSamples */
CMediaSample *pSample;
for (;;) {
pSample = m_lFree.RemoveHead();
if (pSample != NULL) {
delete pSample;
} else {
break;
}
}
m_lAllocated = 0;
// don't free the buffer - let the app do it
}
IPin * GetInPin( IBaseFilter * pFilter, int PinNum )
{
IEnumPins * pEnum = 0;
HRESULT hr = pFilter->EnumPins( &pEnum );
pEnum->Reset( );
ULONG Fetched;
do
{
Fetched = 0;
IPin * pPin = 0;
pEnum->Next( 1, &pPin, &Fetched );
if( Fetched )
{
PIN_DIRECTION pd;
pPin->QueryDirection( &pd);
pPin->Release( );
if( pd == PINDIR_INPUT )
{
if( PinNum == 0 )
{
pEnum->Release( );
return pPin;
}
PinNum--;
}
}
}
while( Fetched );
pEnum->Release( );
return NULL;
}
IPin * GetOutPin( IBaseFilter * pFilter, int PinNum )
{
IEnumPins * pEnum = 0;
HRESULT hr = pFilter->EnumPins( &pEnum );
pEnum->Reset( );
ULONG Fetched;
do
{
Fetched = 0;
IPin * pPin = 0;
pEnum->Next( 1, &pPin, &Fetched );
if( Fetched )
{
PIN_DIRECTION pd;
pPin->QueryDirection( &pd);
pPin->Release( );
if( pd == PINDIR_OUTPUT )
{
if( PinNum == 0 )
{
pEnum->Release( );
return pPin;
}
PinNum--;
}
}
}
while( Fetched );
pEnum->Release( );
return NULL;
}
#endif //HAVE_DIRECTSHOW

View file

@ -0,0 +1,218 @@
//------------------------------------------------------------------------------
// File: Grabber.h
//
// Desc: DirectShow sample code - Header file for the SampleGrabber
// example filter
//
// Copyright (c) 1997-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Define GUID for the sample grabber example so that it does NOT
// conflict with the official DirectX SampleGrabber filter
//------------------------------------------------------------------------------
// {2FA4F053-6D60-4cb0-9503-8E89234F3F73}
DEFINE_GUID(CLSID_GrabberSample,
0x2fa4f053, 0x6d60, 0x4cb0, 0x95, 0x3, 0x8e, 0x89, 0x23, 0x4f, 0x3f, 0x73);
// we define a callback typedef for this example.
// Normally, you would make the SampleGrabber
// support a COM interface, and in one of it's methods
// you would pass in a pointer to a COM interface
// for calling back. See the
// DX8 documentation for the SampleGrabber
typedef HRESULT (*SAMPLECALLBACK) (
void* pUser,
IMediaSample * pSample,
REFERENCE_TIME * StartTime,
REFERENCE_TIME * StopTime,
BOOL TypeChanged );
DEFINE_GUID(IID_IGrabberSample,
0x6b652fff, 0x11fe, 0x4fce, 0x92, 0xad, 0x02, 0x66, 0xb5, 0xd7, 0xc7, 0x8f);
// we define the interface the app can use to program us
MIDL_INTERFACE("6B652FFF-11FE-4fce-92AD-0266B5D7C78F")
IGrabberSample : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE SetAcceptedMediaType(
const CMediaType *pType) = 0;
virtual HRESULT STDMETHODCALLTYPE GetConnectedMediaType(
CMediaType * pmt) = 0;
virtual HRESULT STDMETHODCALLTYPE SetCallback(
SAMPLECALLBACK Callback, void* pUser) = 0;
virtual HRESULT STDMETHODCALLTYPE SetDeliveryBuffer(
ALLOCATOR_PROPERTIES props,
BYTE *pBuffer) = 0;
};
class CSampleGrabberInPin;
class CSampleGrabber;
//----------------------------------------------------------------------------
// this is a special allocator that KNOWS the person who is creating it
// will only create one of them. It allocates CMediaSamples that only
// reference the buffer location that is set in the pin's renderer's
// data variable
//----------------------------------------------------------------------------
class CSampleGrabberAllocator : public CMemAllocator
{
friend class CSampleGrabberInPin;
friend class CSampleGrabber;
protected:
// our pin who created us
//
CSampleGrabberInPin * m_pPin;
public:
CSampleGrabberAllocator( CSampleGrabberInPin * pParent, HRESULT *phr )
: CMemAllocator( TEXT("SampleGrabberAllocator"), NULL, phr )
, m_pPin( pParent )
{
};
~CSampleGrabberAllocator(void)
{
// wipe out m_pBuffer before we try to delete it. It's not an allocated
// buffer, and the default destructor will try to free it!
m_pBuffer = NULL;
}
// we override this to tell whoever's upstream of us what kind of
// properties we're going to demand to have
//
HRESULT GetAllocatorRequirements( ALLOCATOR_PROPERTIES *pProps );
HRESULT Alloc(void);
void ReallyFree(void);
};
//----------------------------------------------------------------------------
// we override the input pin class so we can provide a media type
// to speed up connection times. When you try to connect a filesourceasync
// to a transform filter, DirectShow will insert a splitter and then
// start trying codecs, both audio and video, video codecs first. If
// your sample grabber's set to connect to audio, unless we do this, it
// will try all the video codecs first. Connection times are sped up x10
// for audio with just this minor modification!
//----------------------------------------------------------------------------
class CSampleGrabberInPin : public CTransInPlaceInputPin
{
friend class CSampleGrabberAllocator;
friend class CSampleGrabber;
CSampleGrabberAllocator * m_pPrivateAllocator;
ALLOCATOR_PROPERTIES m_allocprops;
BYTE * m_pBuffer;
BOOL m_bMediaTypeChanged;
protected:
CSampleGrabber * SampleGrabber(void) { return (CSampleGrabber*) m_pFilter; }
HRESULT SetDeliveryBuffer( ALLOCATOR_PROPERTIES props, BYTE * m_pBuffer );
public:
CSampleGrabberInPin( CTransInPlaceFilter * pFilter, HRESULT * pHr )
: CTransInPlaceInputPin( TEXT("SampleGrabberInputPin"), pFilter, pHr, L"Input" )
, m_pPrivateAllocator( NULL )
, m_pBuffer( NULL )
, m_bMediaTypeChanged( FALSE )
{
memset( &m_allocprops, 0, sizeof( m_allocprops ) );
}
~CSampleGrabberInPin(void)
{
if( m_pPrivateAllocator ) delete m_pPrivateAllocator;
}
// override to provide major media type for fast connects
HRESULT GetMediaType( int iPosition, CMediaType *pMediaType );
// override this or GetMediaType is never called
STDMETHODIMP EnumMediaTypes( IEnumMediaTypes **ppEnum );
// override this to refuse any allocators besides
// the one the user wants, if this is set
STDMETHODIMP NotifyAllocator( IMemAllocator *pAllocator, BOOL bReadOnly );
// override this so we always return the special allocator, if necessary
STDMETHODIMP GetAllocator( IMemAllocator **ppAllocator );
HRESULT SetMediaType( const CMediaType *pmt );
};
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
class CSampleGrabber : public CTransInPlaceFilter
{
friend class CSampleGrabberInPin;
friend class CSampleGrabberAllocator;
protected:
void* m_pUser;
CMediaType m_mtAccept;
SAMPLECALLBACK m_callback;
CCritSec m_Lock; // serialize access to our data
BOOL IsReadOnly(void) { return !m_bModifiesData; }
// PURE, override this to ensure we get
// connected with the right media type
HRESULT CheckInputType( const CMediaType * pmt );
// PURE, override this to callback
// the user when a sample is received
HRESULT Transform( IMediaSample * pms );
// override this so we can return S_FALSE directly.
// The base class CTransInPlace
// Transform( ) method is called by it's
// Receive( ) method. There is no way
// to get Transform( ) to return an S_FALSE value
// (which means "stop giving me data"),
// to Receive( ) and get Receive( ) to return S_FALSE as well.
HRESULT Receive( IMediaSample * pms );
public:
static CUnknown *WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr);
// Expose ISampleGrabber
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
DECLARE_IUNKNOWN;
CSampleGrabber( IUnknown * pOuter, HRESULT * pHr, BOOL ModifiesData );
// IGrabberSample
HRESULT SetAcceptedMediaType( const CMediaType * pmt );
HRESULT GetConnectedMediaType( CMediaType * pmt );
HRESULT SetCallback( SAMPLECALLBACK Callback, void* pUser );
HRESULT SetDeliveryBuffer( ALLOCATOR_PROPERTIES props, BYTE * m_pBuffer );
};

View file

@ -0,0 +1,41 @@
ACLOCAL_AMFLAGS = -I $(top_srcdir)/m4
AM_CPPFLAGS = -I$(top_srcdir)/src @GEM_EXTERNAL_CPPFLAGS@
EXTRA_DIST =
EXTRA_DIST += win-vs2003/videoDS.sln win-vs2003/videoDS.vcproj
EXTRA_DIST += win-vs2008/videoDS.sln win-vs2008/videoDS.vcproj
pkglib_LTLIBRARIES=
gemhelpdir=$(pkglibdir)
dist_gemhelp_DATA =
if WINDOWS
pkglib_LTLIBRARIES+= gem_videoDS.la
dist_gemhelp_DATA +=DS-videoplugin.pd
endif
gem_videoDS_la_CXXFLAGS =
gem_videoDS_la_LDFLAGS = -module -avoid-version -shared
if WINDOWS
gem_videoDS_la_LDFLAGS += -no-undefined
endif
gem_videoDS_la_LIBADD =
# RTE
gem_videoDS_la_CXXFLAGS += @GEM_RTE_CFLAGS@ @GEM_ARCH_CXXFLAGS@
gem_videoDS_la_LDFLAGS += @GEM_RTE_LIBS@ @GEM_ARCH_LDFLAGS@
# flags for building Gem externals
gem_videoDS_la_CXXFLAGS += @GEM_EXTERNAL_CFLAGS@
gem_videoDS_la_LIBADD += -L$(top_builddir) @GEM_EXTERNAL_LIBS@
# gem_videoDS_la @MOREFLAGS@
# Dependencies
## none
# convenience symlinks
include $(srcdir)/../symlink_ltlib.mk
### SOURCES
gem_videoDS_la_SOURCES= videoDS.cpp videoDS.h DSgrabber.cpp DSgrabber.h

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,120 @@
/*-----------------------------------------------------------------
GEM - Graphics Environment for Multimedia
Copyright (c) 2003 Daniel Heckenberg
Copyright (c) 2010-2011 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.at
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
-----------------------------------------------------------------*/
#ifndef _INCLUDE_GEMPLUGIN__VIDEODS_VIDEODS_H_
#define _INCLUDE_GEMPLUGIN__VIDEODS_VIDEODS_H_
#include "plugins/videoBase.h"
#ifdef HAVE_DIRECTSHOW
# include <dshow.h>
# include <qedit.h>
#endif
/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
pix_video
captures a video on Apple machines
KEYWORDS
pix
-----------------------------------------------------------------*/
namespace gem { namespace plugins {
class GEM_EXPORT videoDS : public videoBase {
public:
//////////
// Constructor
videoDS(void);
//////////
// Destructor
virtual ~videoDS(void);
#ifdef HAVE_DIRECTSHOW
////////
// open the video-device
virtual bool openDevice(gem::Properties&props);
// and close the video-device
virtual void closeDevice(void);
//////////
// Start up the video device
// [out] int - returns 0 if bad
virtual bool startTransfer(void);
//////////
// Stop the video device
// [out] int - returns 0 if bad
virtual bool stopTransfer(void);
//////////
// get the next frame
virtual pixBlock* getFrame(void);
virtual void releaseFrame(void);
//////////
// Set the video dimensions
virtual bool setDimen(int x, int y, int leftmargin, int rightmargin, int topmargin, int bottommargin);
virtual bool setColor(int d);
virtual bool dialog(std::vector<std::string>);
virtual std::vector<std::string>dialogs(void);
virtual std::vector<std::string>videoDS :: enumerate(void);
protected:
//-----------------------------------
// GROUP: Video data
//-----------------------------------
//////////
// The pixBlocks for the captured and rendered image
void copyBuffer(void);
pixBlock m_pixBlockBuf[3];
int m_nPixDataSize[3];
// Index to read latest image.
int m_readIdx;
int m_lastreadIdx;
int m_writeIdx;
int m_lastwriteIdx;
int m_format;
#ifdef USE_RECORDING
bool m_recording;
char m_filename[MAXPDSTRING];
#endif
// DirectShow Interfaces that we may need
IGraphBuilder* m_pGB;
IMediaControl* m_pMC;
IMediaEvent* m_pME;
IMediaFilter* m_pMF;
IMediaSeeking* m_pMS;
IMediaPosition* m_pMP;
IBaseFilter *SampleFilter; // Sample filter
IBaseFilter *NullFilter; // Null render base Filter for video
IBaseFilter *FileFilter; // File filter for writing video
ISampleGrabber *SampleGrabber; // Sample grabber
#ifdef DIRECTSHOW_LOGGING
HFILE LogFileHandle;
#endif
IBaseFilter* m_pCDbase;
ICaptureGraphBuilder2*m_pCG;
unsigned long m_GraphRegister;
#endif /*HAVE_DIRECTSHOW */
};
};};
#endif // for header file

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "videoDS", "videoDS.vcproj", "{FF21A158-2BDE-483F-85C3-80C9DF0A0ABC}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Release = Release
ReleaseDummy = ReleaseDummy
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{FF21A158-2BDE-483F-85C3-80C9DF0A0ABC}.Release.ActiveCfg = Release|Win32
{FF21A158-2BDE-483F-85C3-80C9DF0A0ABC}.Release.Build.0 = Release|Win32
{FF21A158-2BDE-483F-85C3-80C9DF0A0ABC}.ReleaseDummy.ActiveCfg = ReleaseDummy|Win32
{FF21A158-2BDE-483F-85C3-80C9DF0A0ABC}.ReleaseDummy.Build.0 = ReleaseDummy|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="videoDS"
ProjectGUID="{FF21A158-2BDE-483F-85C3-80C9DF0A0ABC}"
RootNamespace="gem"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)"
IntermediateDirectory="$(ProjectDir)/$(ConfigurationName)"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="2"
FavorSizeOrSpeed="1"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\..\..\src&quot;;&quot;$(ProjectDir)\..\..\src&quot;;&quot;$(ProjectDir)\..\..\..\..\pd\src&quot;;&quot;$(ProgramFiles)\pd\src&quot;;&quot;C:\DXSDK\samples\C++\DirectShow\BaseClasses&quot;"
PreprocessorDefinitions="NT;WIN32;_WINDOWS;__WIN32__;_LANGUAGE_C_PLUS_PLUS;WIN32_LEAN_AND_MEAN;HAVE_DIRECTSHOW"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
EnableEnhancedInstructionSet="0"
DefaultCharIsUnsigned="FALSE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="Gem.lib pd.lib ddraw.lib atls.lib strmiids.lib strmbase.lib OLDNAMES.lib libcpmt.lib msvcrt.lib msvcprt.lib winmm.lib comsupp.lib"
OutputFile="$(OutDir)/gem_$(ProjectName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(SolutionDir)&quot;;&quot;$(ProjectDir)\..\..\build\win-vs2003&quot;;&quot;$(ProjectDir)\..\..\..\..\pd\bin&quot;;&quot;$(ProgramFiles)\pd\bin&quot;;&quot;C:\DXSDK\samples\C++\DirectShow\BaseClasses\Release&quot;"
IgnoreAllDefaultLibraries="TRUE"
ProgramDatabaseFile="$(ProjectDir)/$(ProjectName).pdb"
ImportLibrary="$(ProjectDir)/$(TargetName).lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\./gem.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="ReleaseDummy|Win32"
OutputDirectory="$(SolutionDir)"
IntermediateDirectory="$(ProjectDir)/$(ConfigurationName)"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="2"
FavorSizeOrSpeed="1"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\..\..\src&quot;;&quot;$(ProjectDir)\..\..\src&quot;;&quot;$(ProjectDir)\..\..\..\..\pd\src&quot;;&quot;$(ProgramFiles)\pd\src&quot;"
PreprocessorDefinitions="NT;WIN32;_WINDOWS;__WIN32__;_LANGUAGE_C_PLUS_PLUS;WIN32_LEAN_AND_MEAN"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
EnableEnhancedInstructionSet="0"
DefaultCharIsUnsigned="FALSE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="Gem.lib pd.lib vfw32.lib OLDNAMES.lib"
OutputFile="$(OutDir)/gem_$(ProjectName).dll"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(SolutionDir)&quot;;&quot;$(ProjectDir)\..\..\build\win-vs2003&quot;;&quot;$(ProjectDir)\..\..\..\..\pd\bin&quot;;&quot;$(ProgramFiles)\pd\bin&quot;"
ProgramDatabaseFile="$(ProjectDir)/$(ProjectName).pdb"
ImportLibrary="$(ProjectDir)/$(TargetName).lib"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\./gem.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="..\DSgrabber.cpp">
</File>
<File
RelativePath="..\DSgrabber.h">
</File>
<File
RelativePath="..\videoDS.cpp">
</File>
<File
RelativePath="..\videoDS.h">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "videoDS", "videoDS.vcproj", "{FF21A158-2BDE-483F-85C3-80C9DF0A0ABC}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Release = Release
ReleaseDummy = ReleaseDummy
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{FF21A158-2BDE-483F-85C3-80C9DF0A0ABC}.Release.ActiveCfg = Release|Win32
{FF21A158-2BDE-483F-85C3-80C9DF0A0ABC}.Release.Build.0 = Release|Win32
{FF21A158-2BDE-483F-85C3-80C9DF0A0ABC}.ReleaseDummy.ActiveCfg = ReleaseDummy|Win32
{FF21A158-2BDE-483F-85C3-80C9DF0A0ABC}.ReleaseDummy.Build.0 = ReleaseDummy|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="videoDS"
ProjectGUID="{3B5EC55E-FC95-45EB-B9C1-ACDA01D49061}"
RootNamespace="gem"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\..\..\build\win-vs2008\plugin.vsprops;..\..\..\build\win-vs2008\DirectShow.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\./gem.tlb"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="winmm.lib"
AdditionalLibraryDirectories=""
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="ReleaseDummy|Win32"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\..\..\build\win-vs2008\plugin.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\./gem.tlb"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalLibraryDirectories=""
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="..\DSgrabber.cpp"
>
</File>
<File
RelativePath="..\DSgrabber.h"
>
</File>
<File
RelativePath="..\videoDS.cpp"
>
</File>
<File
RelativePath="..\videoDS.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>