include: Update aviriff header.

This commit is contained in:
Maarten Lankhorst 2008-04-10 15:45:32 -07:00 committed by Alexandre Julliard
parent 1281b74956
commit 0b32692451
4 changed files with 181 additions and 84 deletions

View file

@ -28,12 +28,11 @@
#include "pin.h"
#include "uuids.h"
#include "vfw.h"
#include "aviriff.h"
#include "vfwmsgs.h"
#include "amvideo.h"
#include "fourcc.h"
#include "wine/unicode.h"
#include "wine/debug.h"
@ -42,6 +41,12 @@
#include "parser.h"
#define TWOCCFromFOURCC(fcc) HIWORD(fcc)
/* four character codes used in AVI files */
#define ckidINFO mmioFOURCC('I','N','F','O')
#define ckidREC mmioFOURCC('R','E','C',' ')
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
typedef struct StreamData
@ -140,15 +145,15 @@ static HRESULT AVISplitter_Sample(LPVOID iface, IMediaSample * pSample)
switch (This->CurrentChunk.fcc)
{
case ckidJUNK:
case aviFCC('i','d','x','1'): /* Index is not handled */
case ckidAVIPADDING:
case ckidAVIOLDINDEX: /* Index is not handled */
/* silently ignore */
if (S_FALSE == AVISplitter_NextChunk(&This->CurrentChunkOffset, &This->CurrentChunk, &tStart, &tStop, pbSrcStream, FALSE))
bMoreData = FALSE;
continue;
case ckidLIST:
case FOURCC_LIST:
/* We only handle the 'rec ' list which contains the stream data */
if ((*(DWORD*)(pbSrcStream + BYTES_FROM_MEDIATIME(This->CurrentChunkOffset-tStart) + sizeof(RIFFCHUNK))) == aviFCC('r','e','c',' '))
if ((*(DWORD*)(pbSrcStream + BYTES_FROM_MEDIATIME(This->CurrentChunkOffset-tStart) + sizeof(RIFFCHUNK))) == ckidREC)
{
/* FIXME: We only advanced to the first chunk inside the list without keeping track that we are in it.
* This is not clean and the parser should be improved for that but it is enough for most AVI files. */
@ -194,7 +199,7 @@ static HRESULT AVISplitter_Sample(LPVOID iface, IMediaSample * pSample)
if (streamId > This->Parser.cStreams)
{
ERR("Corrupted AVI file (contains stream id %d, but supposed to only have %d streams)\n", streamId, This->Parser.cStreams);
ERR("Corrupted AVI file (contains stream id (%s) %d, but supposed to only have %d streams)\n", debugstr_an((char *)&This->CurrentChunk.fcc, 4), streamId, This->Parser.cStreams);
hr = E_FAIL;
break;
}
@ -448,7 +453,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
case ckidSTREAMHANDLERDATA:
FIXME("process stream handler data\n");
break;
case ckidJUNK:
case ckidAVIPADDING:
TRACE("JUNK chunk ignored\n");
break;
default:
@ -491,24 +496,24 @@ static HRESULT AVISplitter_InputPin_PreConnect(IPin * iface, IPin * pConnectPin)
hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list);
pos += sizeof(list);
if (list.fcc != ckidRIFF)
if (list.fcc != FOURCC_RIFF)
{
ERR("Input stream not a RIFF file\n");
return E_FAIL;
}
if (list.fccListType != ckidAVI)
if (list.fccListType != formtypeAVI)
{
ERR("Input stream not an AVI RIFF file\n");
return E_FAIL;
}
hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list);
if (list.fcc != ckidLIST)
if (list.fcc != FOURCC_LIST)
{
ERR("Expected LIST chunk, but got %.04s\n", (LPSTR)&list.fcc);
return E_FAIL;
}
if (list.fccListType != ckidHEADERLIST)
if (list.fccListType != listtypeAVIHEADER)
{
ERR("Header list expected. Got: %.04s\n", (LPSTR)&list.fccListType);
return E_FAIL;
@ -529,7 +534,7 @@ static HRESULT AVISplitter_InputPin_PreConnect(IPin * iface, IPin * pConnectPin)
/* AVIMAINHEADER includes the structure that is pCurrentChunk at the moment */
memcpy(&pAviSplit->AviHeader, pCurrentChunk, sizeof(pAviSplit->AviHeader));
break;
case ckidLIST:
case FOURCC_LIST:
pList = (RIFFLIST *)pCurrentChunk;
switch (pList->fccListType)
{
@ -541,7 +546,7 @@ static HRESULT AVISplitter_InputPin_PreConnect(IPin * iface, IPin * pConnectPin)
break;
}
break;
case ckidJUNK:
case ckidAVIPADDING:
/* ignore */
break;
default:
@ -559,18 +564,18 @@ static HRESULT AVISplitter_InputPin_PreConnect(IPin * iface, IPin * pConnectPin)
pos += sizeof(RIFFCHUNK) + list.cb;
hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list);
while (list.fcc == ckidJUNK || (list.fcc == ckidLIST && list.fccListType == ckidINFO))
while (list.fcc == ckidAVIPADDING || (list.fcc == FOURCC_LIST && list.fccListType == ckidINFO))
{
pos += sizeof(RIFFCHUNK) + list.cb;
hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list);
}
if (list.fcc != ckidLIST)
if (list.fcc != FOURCC_LIST)
{
ERR("Expected LIST, but got %.04s\n", (LPSTR)&list.fcc);
return E_FAIL;
}
if (list.fccListType != ckidAVIMOVIE)
if (list.fccListType != listtypeAVIMOVIE)
{
ERR("Expected AVI movie list, but got %.04s\n", (LPSTR)&list.fccListType);
return E_FAIL;

View file

@ -1,61 +0,0 @@
/*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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 ckidINFO aviFCC('I','N','F','O')
#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')

View file

@ -27,8 +27,6 @@
#include "vfwmsgs.h"
#include "mmsystem.h"
#include "fourcc.h"
#include "wine/unicode.h"
#include "wine/debug.h"
@ -328,7 +326,7 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin)
hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list);
pos += sizeof(list);
if (list.fcc != ckidRIFF)
if (list.fcc != FOURCC_RIFF)
{
ERR("Input stream not a RIFF file\n");
return E_FAIL;

View file

@ -1,5 +1,6 @@
/*
* Copyright (C) 2003 Robert Shearman
* Copyright (C) 2008 Maarten Lankhorst
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -29,6 +30,10 @@ typedef struct _rifflist
FOURCC fccListType;
} RIFFLIST, * LPRIFFLIST;
#define FCC( ch0, ch1, ch2, ch3 ) \
( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
#define RIFFROUND(cb) ((cb) + ((cb)&1))
#define RIFFNEXT(pChunk) (LPRIFFCHUNK)((LPBYTE)(pChunk)+sizeof(RIFFCHUNK)+RIFFROUND(((LPRIFFCHUNK)pChunk)->cb))
@ -40,6 +45,7 @@ typedef struct _rifflist
#define AVIF_WASCAPTUREFILE 0x00010000
#define AVIF_COPYRIGHTED 0x00020000
#define ckidMAINAVIHEADER FCC('a','v','i','h')
typedef struct _avimainheader
{
FOURCC fcc;
@ -57,6 +63,8 @@ typedef struct _avimainheader
DWORD dwReserved[4];
} AVIMAINHEADER;
#define ckidODML FCC('o','d','m','l')
#define ckidAVIEXTHEADER FCC('d','m','l','h')
typedef struct _aviextheader
{
FOURCC fcc;
@ -65,11 +73,23 @@ typedef struct _aviextheader
DWORD dwFuture[61];
} AVIEXTHEADER;
#define ckidSTREAMLIST FCC('s','t','r','l')
/* flags for dwFlags member of AVISTREAMHEADER */
#define AVISF_DISABLED 0x00000001
#define AVISF_VIDEO_PALCHANGES 0x00010000
#ifndef ckidSTREAMHEADER
#define ckidSTREAMHEADER FCC('s','t','r','h')
#endif
#ifndef streamtypeVIDEO
#define streamtypeVIDEO FCC('v','i','d','s')
#define streamtypeAUDIO FCC('a','u','d','s')
#define streamtypeMIDI FCC('m','i','d','s')
#define streamtypeTEXT FCC('t','x','t','s')
#endif
typedef struct _avistreamheader
{
FOURCC fcc;
@ -96,6 +116,11 @@ typedef struct _avistreamheader
} rcFrame;
} AVISTREAMHEADER;
#ifndef ckidSTREAMFORMAT
#define ckidSTREAMFORMAT FCC('s','t','r','f')
#endif
#define ckidAVIOLDINDEX FCC('i','d','x','1')
/* flags for dwFlags member of _avioldindex_entry */
#define AVIIF_LIST 0x00000001
#define AVIIF_KEYFRAME 0x00000010
@ -112,7 +137,7 @@ typedef struct _avioldindex
DWORD dwFlags;
DWORD dwOffset;
DWORD dwSize;
} aIndex[0];
} aIndex[ANYSIZE_ARRAY];
} AVIOLDINDEX;
typedef union _timecode
@ -158,7 +183,137 @@ typedef struct _avimetaindex
DWORD nEntriesInUse;
DWORD dwChunkId;
DWORD dwReserved[3];
DWORD adwIndex[0];
DWORD adwIndex[ANYSIZE_ARRAY];
} AVIMETAINDEX;
/* FIXME: index structures missing */
#define ckidAVISUPERINDEX FCC('i','n','d','x')
typedef struct _avisuperindex {
FOURCC fcc;
UINT cb;
WORD wLongsPerEntry;
BYTE bIndexSubType;
BYTE bIndexType;
DWORD nEntriesInUse;
DWORD dwChunkId;
DWORD dwReserved[3];
struct _avisuperindex_entry {
DWORDLONG qwOffset;
DWORD dwSize;
DWORD dwDuration;
} aIndex[ANYSIZE_ARRAY];
} AVISUPERINDEX;
#define AVISTDINDEX_DELTAFRAME (0x80000000)
#define AVISTDINDEX_SIZEMASK (~0x80000000)
typedef struct _avistdindex_entry {
DWORD dwOffset;
DWORD dwSize;
} AVISTDINDEX_ENTRY;
typedef struct _avistdindex {
FOURCC fcc;
UINT cb;
WORD wLongsPerEntry;
BYTE bIndexSubType;
BYTE bIndexType;
DWORD nEntriesInUse;
DWORD dwChunkId;
DWORDLONG qwBaseOffset;
DWORD dwReserved_3;
AVISTDINDEX_ENTRY aIndex[ANYSIZE_ARRAY];
} AVISTDINDEX;
typedef struct _avitimedindex_entry {
DWORD dwOffset;
DWORD dwSize;
DWORD dwDuration;
} AVITIMEDINDEX_ENTRY;
typedef struct _avitimedindex {
FOURCC fcc;
UINT cb;
WORD wLongsPerEntry;
BYTE bIndexSubType;
BYTE bIndexType;
DWORD nEntriesInUse;
DWORD dwChunkId;
DWORDLONG qwBaseOffset;
DWORD dwReserved_3;
AVITIMEDINDEX_ENTRY aIndex[ANYSIZE_ARRAY];
/* DWORD adwTrailingFill[ANYSIZE_ARRAY]; */
} AVITIMEDINDEX;
typedef struct _avitimecodeindex {
FOURCC fcc;
UINT cb;
WORD wLongsPerEntry;
BYTE bIndexSubType;
BYTE bIndexType;
DWORD nEntriesInUse;
DWORD dwChunkId;
DWORD dwReserved[3];
TIMECODEDATA aIndex[ANYSIZE_ARRAY];
} AVITIMECODEINDEX;
typedef struct _avitcdlindex_entryA {
DWORD dwTick;
TIMECODE time;
DWORD dwSMPTEflags;
DWORD dwUser;
CHAR szReelId[12];
} AVITCDLINDEX_ENTRYA;
typedef struct _avitcdlindex_entryW {
DWORD dwTick;
TIMECODE time;
DWORD dwSMPTEflags;
DWORD dwUser;
WCHAR szReelId[12];
} AVITCDLINDEX_ENTRYW;
typedef struct _avitcdlindexA {
FOURCC fcc;
UINT cb;
WORD wLongsPerEntry;
BYTE bIndexSubType;
BYTE bIndexType;
DWORD nEntriesInUse;
DWORD dwChunkId;
DWORD dwReserved[3];
AVITCDLINDEX_ENTRYA aIndex[ANYSIZE_ARRAY];
/* DWORD adwTrailingFill[ANYSIZE_ARRAY]; */
} AVITCDLINDEXA;
typedef struct _avitcdlindexW {
FOURCC fcc;
UINT cb;
WORD wLongsPerEntry;
BYTE bIndexSubType;
BYTE bIndexType;
DWORD nEntriesInUse;
DWORD dwChunkId;
DWORD dwReserved[3];
AVITCDLINDEX_ENTRYW aIndex[ANYSIZE_ARRAY];
/* DWORD adwTrailingFill[ANYSIZE_ARRAY]; */
} AVITCDLINDEXW;
#define AVITCDLINDEX_ENTRY WINELIB_NAME_AW(AVITCDLINDEX_ENTRY)
#define AVITCDLINDEX WINELIB_NAME_AW(AVITCDLINDEX)
typedef struct _avifieldindex_chunk {
FOURCC fcc;
DWORD cb;
WORD wLongsPerEntry;
BYTE bIndexSubType;
BYTE bIndexType;
DWORD nEntriesInUse;
DWORD dwChunkId;
DWORDLONG qwBaseOffset;
DWORD dwReserved3;
struct _avifieldindex_entry {
DWORD dwOffset;
DWORD dwSize;
DWORD dwOffsetField2;
} aIndex[ANYSIZE_ARRAY];
} AVIFIELDINDEX, * PAVIFIELDINDEX;