Commit 693ed867 authored by IOhannes m zmölnig's avatar IOhannes m zmölnig
Browse files

re-run astyle, this time with the options from doc/astyle.rc

parent 33d0efee
......@@ -107,7 +107,8 @@ void filmAVI :: close(void)
// open the file
//
/////////////////////////////////////////////////////////
bool filmAVI :: open(const std::string&filename, const gem::Properties&wantProps)
bool filmAVI :: open(const std::string&filename,
const gem::Properties&wantProps)
{
AVISTREAMINFO streaminfo;
long lSize = 0; // in bytes
......@@ -117,27 +118,34 @@ bool filmAVI :: open(const std::string&filename, const gem::Properties&wantProps
m_wantedFormat=d;
}
if (AVIStreamOpenFromFile(&m_streamVid, filename.c_str(), streamtypeVIDEO, 0, OF_READ, NULL)) {
if (AVIStreamOpenFromFile(&m_streamVid, filename.c_str(), streamtypeVIDEO,
0, OF_READ, NULL)) {
verbose(0, "[GEM:filmAVI] Unable to open file: %s", filename.c_str());
goto unsupported;
}
if( AVIStreamInfo( m_streamVid, &streaminfo, sizeof(streaminfo)) ||
AVIStreamReadFormat(m_streamVid, AVIStreamStart(m_streamVid), NULL, &lSize)) {
verbose(0, "[GEM:filmAVI] Unable to read file format: %s", filename.c_str());
AVIStreamReadFormat(m_streamVid, AVIStreamStart(m_streamVid), NULL,
&lSize)) {
verbose(0, "[GEM:filmAVI] Unable to read file format: %s",
filename.c_str());
goto unsupported;
}
m_pbmihRaw = (BITMAPINFOHEADER*) new char[lSize];
if(AVIStreamReadFormat(m_streamVid, AVIStreamStart(m_streamVid), m_pbmihRaw, &lSize)) {
verbose(0, "[GEM:filmAVI] Unable to read file format: %s", filename.c_str());
if(AVIStreamReadFormat(m_streamVid, AVIStreamStart(m_streamVid),
m_pbmihRaw, &lSize)) {
verbose(0, "[GEM:filmAVI] Unable to read file format: %s",
filename.c_str());
goto unsupported;
}
if ((8 == m_pbmihRaw->biBitCount)
|| ((40 == m_pbmihRaw->biBitCount) && (mmioFOURCC('c','v','i','d') == m_pbmihRaw->biCompression))) {
|| ((40 == m_pbmihRaw->biBitCount)
&& (mmioFOURCC('c','v','i','d') == m_pbmihRaw->biCompression))) {
// HACK: attempt to decompress 8 bit films or BW cinepak films to greyscale
m_pbmihDst = (BITMAPINFOHEADER*) new char[sizeof(BITMAPINFOHEADER) + 256*3];
m_pbmihDst = (BITMAPINFOHEADER*) new char[sizeof(BITMAPINFOHEADER) +
256*3];
verbose(0, "[GEM:filmAVI] Loading as greyscale");
*m_pbmihDst = *m_pbmihRaw;
......@@ -179,8 +187,10 @@ bool filmAVI :: open(const std::string&filename, const gem::Properties&wantProps
m_image.image.setCsizeByFormat(m_wantedFormat);
m_image.image.reallocate();
if (!(m_hic = ICLocate(ICTYPE_VIDEO, 0, m_pbmihRaw, m_pbmihDst, ICMODE_DECOMPRESS))) {
verbose(0, "[GEM:filmAVI] Could not find decompressor: %s", filename.c_str());
if (!(m_hic = ICLocate(ICTYPE_VIDEO, 0, m_pbmihRaw, m_pbmihDst,
ICMODE_DECOMPRESS))) {
verbose(0, "[GEM:filmAVI] Could not find decompressor: %s",
filename.c_str());
goto unsupported;
}
if (m_format==GL_LUMINANCE) {
......@@ -190,13 +200,15 @@ bool filmAVI :: open(const std::string&filename, const gem::Properties&wantProps
}
if (ICERR_OK != ICDecompressBegin(m_hic, m_pbmihRaw, m_pbmihDst)) {
verbose(0, "[GEM:filmAVI] Could not begin decompression: %s", filename.c_str());
verbose(0, "[GEM:filmAVI] Could not begin decompression: %s",
filename.c_str());
goto unsupported;
}
//if (!m_pbmihRaw->biSizeImage)
// m_pbmihRaw->biSizeImage = m_xsize * m_ysize * m_csize;
//m_nRawBuffSize = MIN(streaminfo.dwSuggestedBufferSize, m_pbmihRaw->biSizeImage);
m_nRawBuffSize = MAX(static_cast<int>(streaminfo.dwSuggestedBufferSize), static_cast<int>(m_pbmihRaw->biSizeImage));
m_nRawBuffSize = MAX(static_cast<int>(streaminfo.dwSuggestedBufferSize),
static_cast<int>(m_pbmihRaw->biSizeImage));
if(!m_nRawBuffSize) {
m_nRawBuffSize = m_image.image.xsize * m_image.image.ysize * 3;
}
......
......@@ -71,7 +71,8 @@ public:
}
// Property handling
virtual bool enumProperties(gem::Properties&readable,gem::Properties&writeable);
virtual bool enumProperties(gem::Properties&readable,
gem::Properties&writeable);
virtual void setProperties(gem::Properties&props);
virtual void getProperties(gem::Properties&props);
......
......@@ -74,7 +74,8 @@ void filmAVIPLAY :: close(void)
// open the file
//
/////////////////////////////////////////////////////////
bool filmAVIPLAY :: open(const std::string&filename, const gem::Properties&wantProps)
bool filmAVIPLAY :: open(const std::string&filename,
const gem::Properties&wantProps)
{
double d;
if(wantProps.get("colorspace", d) && d>0) {
......@@ -101,7 +102,8 @@ bool filmAVIPLAY :: open(const std::string&filename, const gem::Properties&wantP
m_curTrack = 0;
}
try {
m_avistream=(*m_avifile).GetStream(m_curTrack, avm::IStream::StreamType(1));
m_avistream=(*m_avifile).GetStream(m_curTrack,
avm::IStream::StreamType(1));
} catch (const char* string) {
m_avistream = 0;
}
......@@ -150,7 +152,8 @@ pixBlock* filmAVIPLAY :: getFrame()
/* for MPEGs ReadFrame() will return 0 only when errors occur
* other formats return 0 all the time (and -1 on file end)
*/
m_aviimage = (*m_avistream).GetFrame(true); // this might crash sometimes...
m_aviimage = (*m_avistream).GetFrame(
true); // this might crash sometimes...
if (m_aviimage) {
int format = (*m_aviimage).Format();
m_rawdata=(*m_aviimage).Data();
......
......@@ -95,7 +95,8 @@ public:
}
// Property handling
virtual bool enumProperties(gem::Properties&readable,gem::Properties&writeable);
virtual bool enumProperties(gem::Properties&readable,
gem::Properties&writeable);
virtual void setProperties(gem::Properties&props);
virtual void getProperties(gem::Properties&props);
......
......@@ -50,8 +50,10 @@ REGISTER_FILMFACTORY("DirectShow", filmDS);
#include <strsafe.h>
HRESULT filmGetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir, IPin **ppPin);
HRESULT filmConnectFilters(IGraphBuilder *pGraph, IBaseFilter *pFirst, IBaseFilter *pSecond);
HRESULT filmGetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir,
IPin **ppPin);
HRESULT filmConnectFilters(IGraphBuilder *pGraph, IBaseFilter *pFirst,
IBaseFilter *pSecond);
HRESULT filmAddGraphToRot(IUnknown *pUnkGraph, DWORD *pdwRegister) ;
void filmRemoveGraphFromRot(DWORD pdwRegister);
/////////////////////////////////////////////////////////
......@@ -94,7 +96,8 @@ filmDS :: filmDS(void) :
CoInitialize(NULL);
// Create the base object of a filter graph
RetVal = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
RetVal = CoCreateInstance(CLSID_FilterGraph, NULL,
CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&FilterGraph);
if (RetVal != S_OK || NULL == FilterGraph) {
......@@ -103,7 +106,8 @@ filmDS :: filmDS(void) :
}
// Get the IMediaControl interface for Run, Stop, Pause and keeps control states
RetVal = FilterGraph->QueryInterface(IID_IMediaControl, (void **)&MediaControl);
RetVal = FilterGraph->QueryInterface(IID_IMediaControl,
(void **)&MediaControl);
if (RetVal != S_OK || NULL == MediaControl) {
throwCtorError("Unable to create MediaControl interface %d", RetVal);
......@@ -112,7 +116,8 @@ filmDS :: filmDS(void) :
// Get the IMediaSeeking interface for rewinding video at loop point
// and set time format to frames
RetVal = FilterGraph->QueryInterface(IID_IMediaSeeking, (void **)&MediaSeeking);
RetVal = FilterGraph->QueryInterface(IID_IMediaSeeking,
(void **)&MediaSeeking);
if (RetVal != S_OK || NULL == MediaSeeking) {
throwCtorError("Unable to create MediaSeeking interface %d", RetVal);
......@@ -120,7 +125,8 @@ filmDS :: filmDS(void) :
}
// Get the IMediaPosition interface for getting the current position of the clip
RetVal = FilterGraph->QueryInterface(IID_IMediaPosition, (void **)&MediaPosition);
RetVal = FilterGraph->QueryInterface(IID_IMediaPosition,
(void **)&MediaPosition);
if (RetVal != S_OK || NULL == MediaPosition) {
throwCtorError("Unable to create MediaPosition interface %d", RetVal);
......@@ -230,7 +236,8 @@ void filmDS :: close(void)
// open the file
//
/////////////////////////////////////////////////////////
bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
bool filmDS :: open(const std::string&filename,
const gem::Properties&wantProps)
{
WCHAR WideFileName[MAXPDSTRING];
HRESULT RetVal;
......@@ -242,14 +249,16 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
// Convert c-string to Wide string.
memset(&WideFileName, 0, MAXPDSTRING * 2);
if (0 == MultiByteToWideChar(CP_ACP, 0, filename.c_str(), filename.length(), WideFileName,
if (0 == MultiByteToWideChar(CP_ACP, 0, filename.c_str(),
filename.length(), WideFileName,
MAXPDSTRING)) {
verbose(0, "[GEM:filmDS] Unable to load %s", filename.c_str());
return false;
}
// Add a file source filter to the filter graph.
RetVal = FilterGraph->AddSourceFilter(WideFileName, L"SOURCE", &VideoFilter);
RetVal = FilterGraph->AddSourceFilter(WideFileName, L"SOURCE",
&VideoFilter);
if (RetVal != S_OK || NULL == VideoFilter) {
verbose(0, "[GEM:filmDS] Unable to render %s", filename.c_str());
......@@ -258,11 +267,13 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
// Create an instance of the sample grabber filter. The filter allows frames to be
// buffered from a video source.
RetVal = CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER,
RetVal = CoCreateInstance(CLSID_SampleGrabber, NULL,
CLSCTX_INPROC_SERVER,
IID_IBaseFilter, (void**)&SampleFilter);
if (RetVal != S_OK || NULL == SampleFilter) {
verbose(0, "[GEM:filmDS] Unable to create SampleFilter interface %d", RetVal);
verbose(0, "[GEM:filmDS] Unable to create SampleFilter interface %d",
RetVal);
return false;
}
......@@ -278,10 +289,12 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
// SampleGrabber allows frames to be grabbed from the filter. SetBufferSamples(TRUE)
// tells the SampleGrabber to buffer the frames. SetOneShot(FALSE) tells the
// SampleGrabber to continuously grab frames. has GetCurrentBuffer() method
RetVal = SampleFilter->QueryInterface(IID_ISampleGrabber, (void **)&SampleGrabber);
RetVal = SampleFilter->QueryInterface(IID_ISampleGrabber,
(void **)&SampleGrabber);
if (RetVal != S_OK || NULL == SampleGrabber) {
verbose(0, "[GEM:filmDS] Unable to create SampleGrabber interface %d", RetVal);
verbose(0, "[GEM:filmDS] Unable to create SampleGrabber interface %d",
RetVal);
return false;
}
......@@ -295,7 +308,8 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
//MediaType.subtype = MEDIASUBTYPE_RGB24;
//MediaType.subtype = MEDIASUBTYPE_UYVY;
MediaType.formattype = GUID_NULL;
RetVal = SampleGrabber->SetMediaType(&MediaType);
RetVal =
SampleGrabber->SetMediaType(&MediaType);
// Set the SampleGrabber to return continuous frames
RetVal = SampleGrabber->SetOneShot(FALSE);
......@@ -316,11 +330,13 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
// Create the Null Renderer interface. The Null Renderer is used to disable rendering of a
// video stream to a window.
RetVal = CoCreateInstance(CLSID_NullRenderer, NULL, CLSCTX_INPROC_SERVER,
RetVal = CoCreateInstance(CLSID_NullRenderer, NULL,
CLSCTX_INPROC_SERVER,
IID_IBaseFilter, (void**)&NullFilter);
if (RetVal != S_OK || NULL == NullFilter) {
verbose(0, "[GEM:filmDS] Unable to create NullFilter interface %d", RetVal);
verbose(0, "[GEM:filmDS] Unable to create NullFilter interface %d",
RetVal);
return false;
}
......@@ -407,7 +423,8 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
}
// The SampleGrabber will only return video of the the 'FORMAT_VideoInfo' type.
if (FORMAT_VideoInfo == MediaType.formattype && MediaType.pbFormat != NULL) {
if (FORMAT_VideoInfo == MediaType.formattype
&& MediaType.pbFormat != NULL) {
// Format returned is specific to the formattype.
VIDEOINFOHEADER *VideoInfo = (VIDEOINFOHEADER *)MediaType.pbFormat;
......@@ -419,7 +436,8 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
}
else {
verbose(0, "[GEM:filmDS] Invalid media type returned %s", filename.c_str());
verbose(0, "[GEM:filmDS] Invalid media type returned %s",
filename.c_str());
return false;
}
......@@ -432,7 +450,9 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
m_frame = new BYTE[m_xsize * m_ysize * m_csize];
if (NULL == m_frame) {
verbose(0, "[GEM:filmDS] Unable to allocate memory for the video buffer %s", filename.c_str());
verbose(0,
"[GEM:filmDS] Unable to allocate memory for the video buffer %s",
filename.c_str());
return false;
}
}
......@@ -443,7 +463,8 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
IBaseFilter *DVFilter;
// If DV video is used, set the quality to 720 x 480.
RetVal = FilterGraph->FindFilterByName(L"DV Video Decoder", &DVFilter);
RetVal = FilterGraph->FindFilterByName(L"DV Video Decoder",
&DVFilter);
if (S_OK == RetVal && DVFilter != NULL) {
IIPDVDec *IPDVDec;
......@@ -513,7 +534,8 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
#ifdef REGISTER_FILTERGRAPH
if (FAILED(RetVal = filmAddGraphToRot(FilterGraph, &m_GraphRegister))) {
verbose(0, "[GEM:filmDS] failed to register filter graph with ROT! hr=0x%X", RetVal);
verbose(0,
"[GEM:filmDS] failed to register filter graph with ROT! hr=0x%X", RetVal);
m_GraphRegister = 0;
}
#endif
......@@ -585,7 +607,8 @@ pixBlock* filmDS :: getFrame()
// If the video image has changed, copy it to the pixBlock buffer.
if (TRUE == m_image.newimage) {
RetVal = SampleGrabber->GetCurrentBuffer(&frameSize, (long *)m_frame);
RetVal = SampleGrabber->GetCurrentBuffer(&frameSize,
(long *)m_frame);
if (RetVal != S_OK) {
m_image.image.data = NULL;
......@@ -658,7 +681,8 @@ film::errCode filmDS :: changeImage(int imgNum, int trackNum)
///////////////////////////////
// Properties
bool filmDS::enumProperties(gem::Properties&readable, gem::Properties&writeable)
bool filmDS::enumProperties(gem::Properties&readable,
gem::Properties&writeable)
{
readable.clear();
writeable.clear();
......@@ -718,7 +742,8 @@ void filmDS::getProperties(gem::Properties&props)
HRESULT filmGetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir, IPin **ppPin)
HRESULT filmGetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir,
IPin **ppPin)
{
IEnumPins *pEnum;
IPin *pPin;
......@@ -760,7 +785,8 @@ HRESULT filmGetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir, IPin **ppPin)
return E_FAIL;
}
HRESULT filmConnectFilters(IGraphBuilder *pGraph, IBaseFilter *pFirst, IBaseFilter *pSecond)
HRESULT filmConnectFilters(IGraphBuilder *pGraph, IBaseFilter *pFirst,
IBaseFilter *pSecond)
{
IPin *pOut = NULL;
IPin *pIn = NULL;
......@@ -818,7 +844,8 @@ HRESULT filmAddGraphToRot(IUnknown *pUnkGraph, DWORD *pdwRegister)
}
WCHAR wsz[128];
StringCchPrintfW(wsz, 128, L"FilterGraph %08x pid %08x", (DWORD_PTR)pUnkGraph,
StringCchPrintfW(wsz, 128, L"FilterGraph %08x pid %08x",
(DWORD_PTR)pUnkGraph,
GetCurrentProcessId());
HRESULT hr = CreateItemMoniker(L"!", wsz, &pMoniker);
......
......@@ -76,7 +76,8 @@ public:
}
// Property handling
virtual bool enumProperties(gem::Properties&readable,gem::Properties&writeable);
virtual bool enumProperties(gem::Properties&readable,
gem::Properties&writeable);
virtual void setProperties(gem::Properties&props);
virtual void getProperties(gem::Properties&props);
......@@ -97,15 +98,24 @@ protected:
private:
IBaseFilter *VideoFilter; // Base Filter for video
IBaseFilter *SampleFilter; // Sample filter
IBaseFilter *NullFilter; // Null render base Filter for video
ISampleGrabber *SampleGrabber; // Sample grabber
IGraphBuilder *FilterGraph; // Filter Graph for movie playback
IMediaControl *MediaControl; // MediaControl interface
IMediaSeeking *MediaSeeking; // MediaSeeking interface
IMediaPosition *MediaPosition; // MediaPosition interface
LONGLONG m_Duration; // Duration of video
IBaseFilter
*VideoFilter; // Base Filter for video
IBaseFilter
*SampleFilter; // Sample filter
IBaseFilter
*NullFilter; // Null render base Filter for video
ISampleGrabber
*SampleGrabber; // Sample grabber
IGraphBuilder
*FilterGraph; // Filter Graph for movie playback
IMediaControl
*MediaControl; // MediaControl interface
IMediaSeeking
*MediaSeeking; // MediaSeeking interface
IMediaPosition
*MediaPosition; // MediaPosition interface
LONGLONG
m_Duration; // Duration of video
LONGLONG m_LastFrame; // Last frame
unsigned long m_GraphRegister;
......
......@@ -15,8 +15,10 @@ interface
:
public IUnknown
{
virtual STDMETHODIMP SampleCB( double SampleTime, IMediaSample *pSample ) = 0;
virtual STDMETHODIMP BufferCB( double SampleTime, BYTE *pBuffer, long BufferLen ) = 0;
virtual STDMETHODIMP SampleCB( double SampleTime,
IMediaSample *pSample ) = 0;
virtual STDMETHODIMP BufferCB( double SampleTime, BYTE *pBuffer,
long BufferLen ) = 0;
};
///////////////////////////////////////////////////////////////////////////////////
......@@ -33,12 +35,17 @@ interface
public IUnknown
{
virtual HRESULT STDMETHODCALLTYPE SetOneShot( BOOL OneShot ) = 0;
virtual HRESULT STDMETHODCALLTYPE SetMediaType( const AM_MEDIA_TYPE *pType ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetConnectedMediaType( AM_MEDIA_TYPE *pType ) = 0;
virtual HRESULT STDMETHODCALLTYPE SetMediaType( const AM_MEDIA_TYPE
*pType ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetConnectedMediaType(
AM_MEDIA_TYPE *pType ) = 0;
virtual HRESULT STDMETHODCALLTYPE SetBufferSamples( BOOL BufferThem ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetCurrentBuffer( long *pBufferSize, long *pBuffer ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetCurrentSample( IMediaSample **ppSample ) = 0;
virtual HRESULT STDMETHODCALLTYPE SetCallback( ISampleGrabberCB *pCallback, long WhichMethodToCallback ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetCurrentBuffer( long *pBufferSize,
long *pBuffer ) = 0;
virtual HRESULT STDMETHODCALLTYPE GetCurrentSample( IMediaSample
**ppSample ) = 0;
virtual HRESULT STDMETHODCALLTYPE SetCallback( ISampleGrabberCB *pCallback,
long WhichMethodToCallback ) = 0;
};
///////////////////////////////////////////////////////////////////////////////////
......
......@@ -50,8 +50,10 @@ REGISTER_FILMFACTORY("DirectShow", filmDS);
#include <strsafe.h>
HRESULT filmGetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir, IPin **ppPin);
HRESULT filmConnectFilters(IGraphBuilder *pGraph, IBaseFilter *pFirst, IBaseFilter *pSecond);
HRESULT filmGetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir,
IPin **ppPin);
HRESULT filmConnectFilters(IGraphBuilder *pGraph, IBaseFilter *pFirst,
IBaseFilter *pSecond);
HRESULT filmAddGraphToRot(IUnknown *pUnkGraph, DWORD *pdwRegister) ;
void filmRemoveGraphFromRot(DWORD pdwRegister);
/////////////////////////////////////////////////////////
......@@ -94,7 +96,8 @@ filmDS :: filmDS(void) :
CoInitialize(NULL);
// Create the base object of a filter graph
RetVal = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
RetVal = CoCreateInstance(CLSID_FilterGraph, NULL,
CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&FilterGraph);
if (RetVal != S_OK || NULL == FilterGraph) {
......@@ -103,7 +106,8 @@ filmDS :: filmDS(void) :
}
// Get the IMediaControl interface for Run, Stop, Pause and keeps control states
RetVal = FilterGraph->QueryInterface(IID_IMediaControl, (void **)&MediaControl);
RetVal = FilterGraph->QueryInterface(IID_IMediaControl,
(void **)&MediaControl);
if (RetVal != S_OK || NULL == MediaControl) {
throwCtorError("Unable to create MediaControl interface %d", RetVal);
......@@ -112,7 +116,8 @@ filmDS :: filmDS(void) :
// Get the IMediaSeeking interface for rewinding video at loop point
// and set time format to frames
RetVal = FilterGraph->QueryInterface(IID_IMediaSeeking, (void **)&MediaSeeking);
RetVal = FilterGraph->QueryInterface(IID_IMediaSeeking,
(void **)&MediaSeeking);
if (RetVal != S_OK || NULL == MediaSeeking) {
throwCtorError("Unable to create MediaSeeking interface %d", RetVal);
......@@ -120,7 +125,8 @@ filmDS :: filmDS(void) :
}
// Get the IMediaPosition interface for getting the current position of the clip
RetVal = FilterGraph->QueryInterface(IID_IMediaPosition, (void **)&MediaPosition);
RetVal = FilterGraph->QueryInterface(IID_IMediaPosition,
(void **)&MediaPosition);
if (RetVal != S_OK || NULL == MediaPosition) {
throwCtorError("Unable to create MediaPosition interface %d", RetVal);
......@@ -230,7 +236,8 @@ void filmDS :: close(void)
// open the file
//
/////////////////////////////////////////////////////////
bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
bool filmDS :: open(const std::string&filename,
const gem::Properties&wantProps)
{
WCHAR WideFileName[MAXPDSTRING];
HRESULT RetVal;
......@@ -243,14 +250,16 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
// Convert c-string to Wide string.
memset(&WideFileName, 0, MAXPDSTRING * 2);
if (0 == MultiByteToWideChar(CP_ACP, 0, filename.c_str(), filename.length(), WideFileName,
if (0 == MultiByteToWideChar(CP_ACP, 0, filename.c_str(),
filename.length(), WideFileName,
MAXPDSTRING)) {
verbose(0, "[GEM:filmDS:legacy]Unable to load %s", filename.c_str());
return false;
}
// Add a file source filter to the filter graph.
RetVal = FilterGraph->AddSourceFilter(WideFileName, L"SOURCE", &VideoFilter);
RetVal = FilterGraph->AddSourceFilter(WideFileName, L"SOURCE",
&VideoFilter);
if (RetVal != S_OK || NULL == VideoFilter) {
verbose(0, "[GEM:filmDS:legacy]Unable to render %s", filename.c_str());
......@@ -259,11 +268,13 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
// Create an instance of the sample grabber filter. The filter allows frames to be
// buffered from a video source.
RetVal = CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER,
RetVal = CoCreateInstance(CLSID_SampleGrabber, NULL,
CLSCTX_INPROC_SERVER,
IID_IBaseFilter, (void**)&SampleFilter);
if (RetVal != S_OK || NULL == SampleFilter) {
verbose(0, "[GEM:filmDS:legacy]Unable to create SampleFilter interface %d", RetVal);
verbose(0, "[GEM:filmDS:legacy]Unable to create SampleFilter interface %d",
RetVal);
return false;
}
......@@ -279,10 +290,12 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
// SampleGrabber allows frames to be grabbed from the filter. SetBufferSamples(TRUE)
// tells the SampleGrabber to buffer the frames. SetOneShot(FALSE) tells the
// SampleGrabber to continuously grab frames. has GetCurrentBuffer() method
RetVal = SampleFilter->QueryInterface(IID_ISampleGrabber, (void **)&SampleGrabber);
RetVal = SampleFilter->QueryInterface(IID_ISampleGrabber,
(void **)&SampleGrabber);
if (RetVal != S_OK || NULL == SampleGrabber) {
verbose(0, "[GEM:filmDS:legacy]Unable to create SampleGrabber interface %d", RetVal);
verbose(0,
"[GEM:filmDS:legacy]Unable to create SampleGrabber interface %d", RetVal);
return false;
}
......@@ -296,7 +309,8 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
//MediaType.subtype = MEDIASUBTYPE_RGB24;
//MediaType.subtype = MEDIASUBTYPE_UYVY;
MediaType.formattype = GUID_NULL;
RetVal = SampleGrabber->SetMediaType(&MediaType);
RetVal =
SampleGrabber->SetMediaType(&MediaType);
// Set the SampleGrabber to return continuous frames
RetVal = SampleGrabber->SetOneShot(FALSE);
......@@ -317,11 +331,13 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
// Create the Null Renderer interface. The Null Renderer is used to disable rendering of a
// video stream to a window.
RetVal = CoCreateInstance(CLSID_NullRenderer, NULL, CLSCTX_INPROC_SERVER,
RetVal = CoCreateInstance(CLSID_NullRenderer, NULL,
CLSCTX_INPROC_SERVER,
IID_IBaseFilter, (void**)&NullFilter);
if (RetVal != S_OK || NULL == NullFilter) {
verbose(0, "[GEM:filmDS:legacy]Unable to create NullFilter interface %d", RetVal);
verbose(0, "[GEM:filmDS:legacy]Unable to create NullFilter interface %d",
RetVal);
return false;
}
......@@ -367,7 +383,8 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
RetVal = MediaSeeking->SetTimeFormat(&Guid);
if (RetVal != S_OK) {
verbose(0, "[GEM:filmDS:legacy]Unable to set video time format %d", RetVal);
verbose(0, "[GEM:filmDS:legacy]Unable to set video time format %d",
RetVal);
return false;
}
}
......@@ -408,7 +425,8 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
}
// The SampleGrabber will only return video of the the 'FORMAT_VideoInfo' type.
if (FORMAT_VideoInfo == MediaType.formattype && MediaType.pbFormat != NULL) {
if (FORMAT_VideoInfo == MediaType.formattype
&& MediaType.pbFormat != NULL) {
// Format returned is specific to the formattype.
VIDEOINFOHEADER *VideoInfo = (VIDEOINFOHEADER *)MediaType.pbFormat;
......@@ -420,7 +438,8 @@ bool filmDS :: open(const std::string&filename, const gem::Properties&wantProps)
}
else {
verbose(0, "[GEM:filmDS:legacy]Invalid media type returned %s", filename.c_str());