Commit d6254fcb authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- AVI Splitter implementation.

- Add new debugging function wine_dbstr_longlong.
parent 84540b4d
...@@ -7,6 +7,8 @@ IMPORTS = ole32 oleaut32 advapi32 kernel32 user32 ...@@ -7,6 +7,8 @@ IMPORTS = ole32 oleaut32 advapi32 kernel32 user32
EXTRALIBS = $(LIBUUID) $(LIBUNICODE) EXTRALIBS = $(LIBUUID) $(LIBUNICODE)
C_SRCS = \ C_SRCS = \
avisplit.c \
control.c \
enummedia.c \ enummedia.c \
enummoniker.c \ enummoniker.c \
enumpins.c \ enumpins.c \
......
/*
* Filter Seeking and Control Interfaces
*
* Copyright 2003 Robert Shearman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* FIXME: critical sections */
#include "quartz_private.h"
#include "control_private.h"
#include "uuids.h"
#include "wine/debug.h"
#include <assert.h>
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
HRESULT MediaSeekingImpl_Init(LPVOID pUserData, CHANGEPROC fnChangeStop, CHANGEPROC fnChangeStart, CHANGEPROC fnChangeRate, MediaSeekingImpl * pSeeking)
{
assert(fnChangeStop && fnChangeStart && fnChangeRate);
pSeeking->refCount = 1;
pSeeking->pUserData = pUserData;
pSeeking->fnChangeRate = fnChangeRate;
pSeeking->fnChangeStop = fnChangeStop;
pSeeking->fnChangeStart = fnChangeStart;
pSeeking->dwCapabilities = AM_SEEKING_CanSeekForwards |
AM_SEEKING_CanSeekBackwards |
AM_SEEKING_CanSeekAbsolute |
AM_SEEKING_CanGetStopPos |
AM_SEEKING_CanGetDuration;
pSeeking->llStart = 0;
pSeeking->llStop = 0x8000000000000000;
pSeeking->llDuration = pSeeking->llStop - pSeeking->llStart;
pSeeking->dRate = 1.0;
return S_OK;
}
HRESULT WINAPI MediaSeekingImpl_GetCapabilities(IMediaSeeking * iface, DWORD * pCapabilities)
{
ICOM_THIS(MediaSeekingImpl, iface);
TRACE("(%p)\n", pCapabilities);
*pCapabilities = This->dwCapabilities;
return S_OK;
}
HRESULT WINAPI MediaSeekingImpl_CheckCapabilities(IMediaSeeking * iface, DWORD * pCapabilities)
{
ICOM_THIS(MediaSeekingImpl, iface);
HRESULT hr;
DWORD dwCommonCaps;
TRACE("(%p)\n", pCapabilities);
dwCommonCaps = *pCapabilities & This->dwCapabilities;
if (!dwCommonCaps)
hr = E_FAIL;
else
hr = (*pCapabilities == dwCommonCaps) ? S_OK : S_FALSE;
*pCapabilities = dwCommonCaps;
return hr;
}
HRESULT WINAPI MediaSeekingImpl_IsFormatSupported(IMediaSeeking * iface, const GUID * pFormat)
{
TRACE("(%s)\n", qzdebugstr_guid(pFormat));
return (IsEqualIID(pFormat, &TIME_FORMAT_MEDIA_TIME) ? S_OK : S_FALSE);
}
HRESULT WINAPI MediaSeekingImpl_QueryPreferredFormat(IMediaSeeking * iface, GUID * pFormat)
{
TRACE("(%s)\n", qzdebugstr_guid(pFormat));
*pFormat = TIME_FORMAT_MEDIA_TIME;
return S_OK;
}
HRESULT WINAPI MediaSeekingImpl_GetTimeFormat(IMediaSeeking * iface, GUID * pFormat)
{
TRACE("(%s)\n", qzdebugstr_guid(pFormat));
*pFormat = TIME_FORMAT_MEDIA_TIME;
return S_OK;
}
HRESULT WINAPI MediaSeekingImpl_IsUsingTimeFormat(IMediaSeeking * iface, const GUID * pFormat)
{
TRACE("(%s)\n", qzdebugstr_guid(pFormat));
return (IsEqualIID(pFormat, &TIME_FORMAT_MEDIA_TIME) ? S_OK : S_FALSE);
}
HRESULT WINAPI MediaSeekingImpl_SetTimeFormat(IMediaSeeking * iface, const GUID * pFormat)
{
TRACE("(%s)\n", qzdebugstr_guid(pFormat));
return (IsEqualIID(pFormat, &TIME_FORMAT_MEDIA_TIME) ? S_OK : S_FALSE);
}
HRESULT WINAPI MediaSeekingImpl_GetDuration(IMediaSeeking * iface, LONGLONG * pDuration)
{
ICOM_THIS(MediaSeekingImpl, iface);
TRACE("(%p)\n", pDuration);
*pDuration = This->llDuration;
return S_OK;
}
HRESULT WINAPI MediaSeekingImpl_GetStopPosition(IMediaSeeking * iface, LONGLONG * pStop)
{
ICOM_THIS(MediaSeekingImpl, iface);
TRACE("(%p)\n", pStop);
*pStop = This->llStop;
return S_OK;
}
HRESULT WINAPI MediaSeekingImpl_GetCurrentPosition(IMediaSeeking * iface, LONGLONG * pCurrent)
{
ICOM_THIS(MediaSeekingImpl, iface);
TRACE("(%p)\n", pCurrent);
*pCurrent = This->llStart;
return S_OK;
}
HRESULT WINAPI MediaSeekingImpl_ConvertTimeFormat(IMediaSeeking * iface, LONGLONG * pTarget, const GUID * pTargetFormat, LONGLONG Source, const GUID * pSourceFormat)
{
if (IsEqualIID(pTargetFormat, &TIME_FORMAT_MEDIA_TIME) && IsEqualIID(pSourceFormat, &TIME_FORMAT_MEDIA_TIME))
{
*pTarget = Source;
return S_OK;
}
/* FIXME: clear pTarget? */
return E_INVALIDARG;
}
__inline LONGLONG Adjust(LONGLONG value, LONGLONG * pModifier, DWORD dwFlags)
{
switch (dwFlags & AM_SEEKING_PositioningBitsMask)
{
case AM_SEEKING_NoPositioning:
return value;
case AM_SEEKING_AbsolutePositioning:
return *pModifier;
case AM_SEEKING_RelativePositioning:
case AM_SEEKING_IncrementalPositioning:
return value + *pModifier;
default:
assert(FALSE);
return 0;
}
}
HRESULT WINAPI MediaSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG * pCurrent, DWORD dwCurrentFlags, LONGLONG * pStop, DWORD dwStopFlags)
{
ICOM_THIS(MediaSeekingImpl, iface);
BOOL bChangeStart = FALSE, bChangeStop = FALSE;
LONGLONG llNewStart, llNewStop;
TRACE("(%p, %lx, %p, %lx)\n", pCurrent, dwCurrentFlags, pStop, dwStopFlags);
llNewStart = Adjust(This->llStart, pCurrent, dwCurrentFlags);
llNewStop = Adjust(This->llStop, pStop, dwStopFlags);
if (llNewStart != This->llStart)
bChangeStart = TRUE;
if (llNewStop != This->llStop)
bChangeStop = TRUE;
This->llStart = llNewStart;
This->llStop = llNewStop;
if (dwCurrentFlags & AM_SEEKING_ReturnTime)
*pCurrent = llNewStart;
if (dwStopFlags & AM_SEEKING_ReturnTime)
*pStop = llNewStop;
if (bChangeStart)
This->fnChangeStart(This->pUserData);
if (bChangeStop)
This->fnChangeStop(This->pUserData);
return S_OK;
}
HRESULT WINAPI MediaSeekingImpl_GetPositions(IMediaSeeking * iface, LONGLONG * pCurrent, LONGLONG * pStop)
{
ICOM_THIS(MediaSeekingImpl, iface);
TRACE("(%p, %p)\n", pCurrent, pStop);
*pCurrent = This->llStart;
*pStop = This->llStop;
return S_OK;
}
HRESULT WINAPI MediaSeekingImpl_GetAvailable(IMediaSeeking * iface, LONGLONG * pEarliest, LONGLONG * pLatest)
{
ICOM_THIS(MediaSeekingImpl, iface);
TRACE("(%p, %p)\n", pEarliest, pLatest);
*pEarliest = 0;
*pLatest = This->llDuration;
return S_OK;
}
HRESULT WINAPI MediaSeekingImpl_SetRate(IMediaSeeking * iface, double dRate)
{
ICOM_THIS(MediaSeekingImpl, iface);
BOOL bChangeRate = (dRate != This->dRate);
TRACE("(%e)\n", dRate);
This->dRate = dRate;
if (bChangeRate)
return This->fnChangeRate(This->pUserData);
else
return S_OK;
}
HRESULT WINAPI MediaSeekingImpl_GetRate(IMediaSeeking * iface, double * dRate)
{
ICOM_THIS(MediaSeekingImpl, iface);
TRACE("(%p)\n", dRate);
*dRate = This->dRate;
return S_OK;
}
HRESULT WINAPI MediaSeekingImpl_GetPreroll(IMediaSeeking * iface, LONGLONG * pPreroll)
{
TRACE("(%p)\n", pPreroll);
*pPreroll = 0;
return S_OK;
}
/*
* Filter Seeking and Control Interfaces
*
* Copyright 2003 Robert Shearman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
typedef HRESULT (* CHANGEPROC)(LPVOID pUserData);
typedef struct MediaSeekingImpl
{
const IMediaSeekingVtbl * lpVtbl;
ULONG refCount;
LPVOID pUserData;
CHANGEPROC fnChangeStop;
CHANGEPROC fnChangeStart;
CHANGEPROC fnChangeRate;
DWORD dwCapabilities;
double dRate;
LONGLONG llStart;
LONGLONG llStop;
LONGLONG llDuration; /* FIXME: needed? */
} MediaSeekingImpl;
HRESULT MediaSeekingImpl_Init(LPVOID pUserData, CHANGEPROC fnChangeStop, CHANGEPROC fnChangeStart, CHANGEPROC fnChangeRate, MediaSeekingImpl * pSeeking);
HRESULT WINAPI MediaSeekingImpl_GetCapabilities(IMediaSeeking * iface, DWORD * pCapabilities);
HRESULT WINAPI MediaSeekingImpl_CheckCapabilities(IMediaSeeking * iface, DWORD * pCapabilities);
HRESULT WINAPI MediaSeekingImpl_IsFormatSupported(IMediaSeeking * iface, const GUID * pFormat);
HRESULT WINAPI MediaSeekingImpl_QueryPreferredFormat(IMediaSeeking * iface, GUID * pFormat);
HRESULT WINAPI MediaSeekingImpl_GetTimeFormat(IMediaSeeking * iface, GUID * pFormat);
HRESULT WINAPI MediaSeekingImpl_IsUsingTimeFormat(IMediaSeeking * iface, const GUID * pFormat);
HRESULT WINAPI MediaSeekingImpl_SetTimeFormat(IMediaSeeking * iface, const GUID * pFormat);
HRESULT WINAPI MediaSeekingImpl_GetDuration(IMediaSeeking * iface, LONGLONG * pDuration);
HRESULT WINAPI MediaSeekingImpl_GetStopPosition(IMediaSeeking * iface, LONGLONG * pStop);
HRESULT WINAPI MediaSeekingImpl_GetCurrentPosition(IMediaSeeking * iface, LONGLONG * pCurrent);
HRESULT WINAPI MediaSeekingImpl_ConvertTimeFormat(IMediaSeeking * iface, LONGLONG * pTarget, const GUID * pTargetFormat, LONGLONG Source, const GUID * pSourceFormat);
HRESULT WINAPI MediaSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG * pCurrent, DWORD dwCurrentFlags, LONGLONG * pStop, DWORD dwStopFlags);
HRESULT WINAPI MediaSeekingImpl_GetPositions(IMediaSeeking * iface, LONGLONG * pCurrent, LONGLONG * pStop);
HRESULT WINAPI MediaSeekingImpl_GetAvailable(IMediaSeeking * iface, LONGLONG * pEarliest, LONGLONG * pLatest);
HRESULT WINAPI MediaSeekingImpl_SetRate(IMediaSeeking * iface, double dRate);
HRESULT WINAPI MediaSeekingImpl_GetRate(IMediaSeeking * iface, double * dRate);
HRESULT WINAPI MediaSeekingImpl_GetPreroll(IMediaSeeking * iface, LONGLONG * pPreroll);
/*
* Common FOURCC
*
* Copyright 2003 Robert Shearman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define FromHex(n) (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0'))
#define StreamFromFOURCC(fcc) ((WORD) ((FromHex(LOBYTE(LOWORD(fcc))) << 4) + (FromHex(HIBYTE(LOWORD(fcc))))))
#define TWOCCFromFOURCC(fcc) HIWORD(fcc)
#ifndef aviTWOCC
#define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
#endif
/* FIXME: endianess? */
#define aviFCC(ch0, ch1, ch2, ch3) ((DWORD)(BYTE)(ch3) << 24 | (DWORD)(BYTE)(ch2) << 16 | (DWORD)(BYTE)(ch1) << 8 | ((DWORD)(BYTE)(ch0)))
/* four character codes used in AVI files */
#define ckidAVI aviFCC('A','V','I',' ')
#define ckidRIFF aviFCC('R','I','F','F')
#define ckidLIST aviFCC('L','I','S','T')
#define ckidJUNK aviFCC('J','U','N','K')
#define ckidHEADERLIST aviFCC('h','d','r','l')
#define ckidAVIMOVIE aviFCC('m','o','v','i')
#define ckidSTREAMNAME aviFCC('s','t','r','n')
#define ckidSTREAMHANDLERDATA aviFCC('s','t','r','d')
#ifndef ckidMAINAVIHEADER
# define ckidMAINAVIHEADER aviFCC('a','v','i','h')
# define ckidODML aviFCC('o','d','m','l')
# define ckidAVIEXTHEADER aviFCC('d','m','l','h')
# define ckidSTREAMLIST aviFCC('s','t','r','l')
# define ckidSTREAMHEADER aviFCC('s','t','r','h')
# define ckidSTREAMFORMAT aviFCC('s','t','r','f')
# define ckidAVIOLDINDEX aviFCC('i','d','x','1')
# define ckidAVISUPERINDEX aviFCC('i','n','d','x')
#endif
#ifndef streamtypeVIDEO
#define streamtypeVIDEO aviFCC('v','i','d','s')
#define streamtypeAUDIO aviFCC('a','u','d','s')
#define streamtypeMIDI aviFCC('m','i','d','s')
#define streamtypeTEXT aviFCC('t','x','t','s')
#endif
#define cktypeDIBbits aviTWOCC('d','b')
#define cktypeDIBcompressed aviTWOCC('d','c')
#define cktypePALchange aviTWOCC('p','c')
#define cktypeWAVEbytes aviTWOCC('w','b')
...@@ -65,6 +65,7 @@ static const struct object_creation_info object_creation[] = ...@@ -65,6 +65,7 @@ static const struct object_creation_info object_creation[] =
{ &CLSID_FilterMapper2, FilterMapper2_create }, { &CLSID_FilterMapper2, FilterMapper2_create },
{ &CLSID_AsyncReader, AsyncReader_create }, { &CLSID_AsyncReader, AsyncReader_create },
{ &CLSID_MemoryAllocator, StdMemAllocator_create }, { &CLSID_MemoryAllocator, StdMemAllocator_create },
{ &CLSID_AviSplitter, AVISplitter_create },
}; };
static HRESULT WINAPI static HRESULT WINAPI
......
...@@ -135,6 +135,8 @@ HRESULT InputPin_Construct(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LP ...@@ -135,6 +135,8 @@ HRESULT InputPin_Construct(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LP
/* Note that we don't init the vtables here (like C++ constructor) */ /* Note that we don't init the vtables here (like C++ constructor) */
HRESULT InputPin_Init(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, InputPin * pPinImpl) HRESULT InputPin_Init(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, InputPin * pPinImpl)
{ {
TRACE("\n");
/* Common attributes */ /* Common attributes */
pPinImpl->pin.refCount = 1; pPinImpl->pin.refCount = 1;
pPinImpl->pin.pConnectedTo = NULL; pPinImpl->pin.pConnectedTo = NULL;
...@@ -155,6 +157,8 @@ HRESULT InputPin_Init(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID ...@@ -155,6 +157,8 @@ HRESULT InputPin_Init(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID
HRESULT OutputPin_Init(const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES * props, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, OutputPin * pPinImpl) HRESULT OutputPin_Init(const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES * props, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, LPCRITICAL_SECTION pCritSec, OutputPin * pPinImpl)
{ {
TRACE("\n");
/* Common attributes */ /* Common attributes */
pPinImpl->pin.lpVtbl = &OutputPin_Vtbl; pPinImpl->pin.lpVtbl = &OutputPin_Vtbl;
pPinImpl->pin.refCount = 1; pPinImpl->pin.refCount = 1;
......
...@@ -41,6 +41,7 @@ HRESULT FILTERGRAPH_create(IUnknown *pUnkOuter, LPVOID *ppObj) ; ...@@ -41,6 +41,7 @@ HRESULT FILTERGRAPH_create(IUnknown *pUnkOuter, LPVOID *ppObj) ;
HRESULT FilterMapper2_create(IUnknown *pUnkOuter, LPVOID *ppObj); HRESULT FilterMapper2_create(IUnknown *pUnkOuter, LPVOID *ppObj);
HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv); HRESULT AsyncReader_create(IUnknown * pUnkOuter, LPVOID * ppv);
HRESULT StdMemAllocator_create(IUnknown * pUnkOuter, LPVOID * ppv); HRESULT StdMemAllocator_create(IUnknown * pUnkOuter, LPVOID * ppv);
HRESULT AVISplitter_create(IUnknown * pUnkOuter, LPVOID * ppv);
HRESULT EnumMonikerImpl_Create(IMoniker ** ppMoniker, ULONG nMonikerCount, IEnumMoniker ** ppEnum); HRESULT EnumMonikerImpl_Create(IMoniker ** ppMoniker, ULONG nMonikerCount, IEnumMoniker ** ppEnum);
......
...@@ -174,6 +174,12 @@ static inline const char *wine_dbgstr_rect( const RECT *rect ) ...@@ -174,6 +174,12 @@ static inline const char *wine_dbgstr_rect( const RECT *rect )
return wine_dbg_sprintf( "(%ld,%ld)-(%ld,%ld)", rect->left, rect->top, rect->right, rect->bottom ); return wine_dbg_sprintf( "(%ld,%ld)-(%ld,%ld)", rect->left, rect->top, rect->right, rect->bottom );
} }
static inline const char *wine_dbgstr_longlong( ULONGLONG ll )
{
if (ll >> 32) return wine_dbg_sprintf( "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll );
else return wine_dbg_sprintf( "%lx", (unsigned long)ll );
}
#ifndef WINE_TRACE #ifndef WINE_TRACE
#define WINE_TRACE __WINE_DPRINTF(_TRACE,__wine_dbch___default) #define WINE_TRACE __WINE_DPRINTF(_TRACE,__wine_dbch___default)
#define WINE_TRACE_(ch) __WINE_DPRINTF(_TRACE,__wine_dbch_##ch) #define WINE_TRACE_(ch) __WINE_DPRINTF(_TRACE,__wine_dbch_##ch)
......
Markdown is supported
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