- scripts sub-containers loading

- better segments Load and ParseDescriptor behaviors
This commit is contained in:
Raphael Junqueira 2004-03-12 01:53:05 +00:00 committed by Alexandre Julliard
parent 5bec0d7ef8
commit 410bdd365f
4 changed files with 101 additions and 11 deletions

View File

@ -414,7 +414,7 @@ HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_ParseDescriptor (LPDI
TRACE_(dmfile)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); TRACE_(dmfile)(": %s chunk (size = 0x%04lx)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) { switch (Chunk.fccID) {
/* don't ask me why, but M$ puts INFO elements in UNFO list sometimes /* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
(though strings seem to be valid unicode) */ (though strings seem to be valid unicode) */
case mmioFOURCC('I','N','A','M'): case mmioFOURCC('I','N','A','M'):
case DMUS_FOURCC_UNAM_CHUNK: { case DMUS_FOURCC_UNAM_CHUNK: {
TRACE_(dmfile)(": name chunk\n"); TRACE_(dmfile)(": name chunk\n");
@ -461,11 +461,29 @@ HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_ParseDescriptor (LPDI
} while (ListCount[0] < ListSize[0]); } while (ListCount[0] < ListSize[0]);
break; break;
} }
default: { case DMUS_FOURCC_TRACK_LIST: {
TRACE_(dmfile)(": unknown (skipping)\n"); TRACE_(dmfile)(": TRACK list\n");
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC); do {
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL); IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
break; ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
} while (ListCount[0] < ListSize[0]);
break;
}
default: {
TRACE_(dmfile)(": unknown (skipping)\n");
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL);
break;
} }
} }
break; break;
@ -480,6 +498,10 @@ HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_ParseDescriptor (LPDI
TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize); TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize);
} while (StreamCount < StreamSize); } while (StreamCount < StreamSize);
break; break;
} else if (Chunk.fccID == mmioFOURCC('W','A','V','E')) {
TRACE_(dmfile)(": wave form, loading not yet implemented\n");
liMove.QuadPart = StreamSize;
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
} else { } else {
TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
liMove.QuadPart = StreamSize; liMove.QuadPart = StreamSize;
@ -540,7 +562,8 @@ HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_IsDirty (LPPERSISTSTREAM
HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) { HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
ICOM_THIS_MULTI(IDirectMusicSegment8Impl, PersistStreamVtbl, iface); ICOM_THIS_MULTI(IDirectMusicSegment8Impl, PersistStreamVtbl, iface);
FOURCC chunkID; FOURCC chunkID;
DWORD chunkSize, StreamSize, StreamCount, ListSize[3], ListCount[3]; DWORD chunkSize;
DWORD StreamSize, StreamCount, ListSize[3], ListCount[3];
LARGE_INTEGER liMove; /* used when skipping chunks */ LARGE_INTEGER liMove; /* used when skipping chunks */
FIXME("(%p, %p): Loading not implemented yet\n", This, pStm); FIXME("(%p, %p): Loading not implemented yet\n", This, pStm);
@ -595,7 +618,7 @@ HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_Load (LPPERSISTSTREAM ifa
TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize); TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize);
switch (chunkID) { switch (chunkID) {
/* don't ask me why, but M$ puts INFO elements in UNFO list sometimes /* don't ask me why, but M$ puts INFO elements in UNFO list sometimes
(though strings seem to be valid unicode) */ (though strings seem to be valid unicode) */
case mmioFOURCC('I','N','A','M'): case mmioFOURCC('I','N','A','M'):
case DMUS_FOURCC_UNAM_CHUNK: { case DMUS_FOURCC_UNAM_CHUNK: {
TRACE_(dmfile)(": name chunk\n"); TRACE_(dmfile)(": name chunk\n");
@ -642,6 +665,25 @@ HRESULT WINAPI IDirectMusicSegment8Impl_IPersistStream_Load (LPPERSISTSTREAM ifa
} while (ListCount[0] < ListSize[0]); } while (ListCount[0] < ListSize[0]);
break; break;
} }
case DMUS_FOURCC_TRACK_LIST: {
TRACE_(dmfile)(": TRACK list\n");
do {
IStream_Read (pStm, &chunkID, sizeof(FOURCC), NULL);
IStream_Read (pStm, &chunkSize, sizeof(FOURCC), NULL);
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + chunkSize;
TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (chunkID), chunkSize);
switch (chunkID) {
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = chunkSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]);
} while (ListCount[0] < ListSize[0]);
break;
}
default: { default: {
TRACE_(dmfile)(": unknown (skipping)\n"); TRACE_(dmfile)(": unknown (skipping)\n");
liMove.QuadPart = chunkSize - sizeof(FOURCC); liMove.QuadPart = chunkSize - sizeof(FOURCC);

View File

@ -361,7 +361,8 @@ ULONG WINAPI IDirectMusicContainerImpl_IPersistStream_Release (LPPERSISTSTREAM i
} }
HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) { HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
return E_NOTIMPL; *pClassID = CLSID_DirectMusicContainer;
return S_OK;
} }
HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface) { HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {

View File

@ -444,7 +444,7 @@ HRESULT WINAPI IDirectMusicLoader8Impl_GetObject (LPDIRECTMUSICLOADER8 iface, LP
IDirectMusicObject_SetDescriptor (pObject, &GotDesc); IDirectMusicObject_SetDescriptor (pObject, &GotDesc);
/* release all loading related stuff */ /* release all loading related stuff */
TRACE(": releasing all loading-related stuff\n"); TRACE(": releasing all loading-related stuff\n");
IStream_Release (pStream); IStream_Release (pStream);
IPersistStream_Release (pPersistStream); IPersistStream_Release (pPersistStream);
} else { } else {
return E_FAIL; return E_FAIL;

View File

@ -427,6 +427,8 @@ HRESULT WINAPI IDirectMusicScriptImpl_IPersistStream_Load (LPPERSISTSTREAM iface
DMUS_PRIVATE_CHUNK Chunk; DMUS_PRIVATE_CHUNK Chunk;
DWORD StreamSize, StreamCount, ListSize[3], ListCount[3]; DWORD StreamSize, StreamCount, ListSize[3], ListCount[3];
LARGE_INTEGER liMove; /* used when skipping chunks */ LARGE_INTEGER liMove; /* used when skipping chunks */
LPDIRECTMUSICGETLOADER pGetLoader = NULL;
LPDIRECTMUSICLOADER pLoader = NULL;
FIXME("(%p, %p): Loading not implemented yet\n", This, pStm); FIXME("(%p, %p): Loading not implemented yet\n", This, pStm);
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL); IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
@ -498,6 +500,51 @@ HRESULT WINAPI IDirectMusicScriptImpl_IPersistStream_Load (LPPERSISTSTREAM iface
IStream_Read (pStm, This->pDesc->wszCategory, Chunk.dwSize, NULL); IStream_Read (pStm, This->pDesc->wszCategory, Chunk.dwSize, NULL);
break; break;
} }
case FOURCC_RIFF: {
IDirectMusicObject* pObject = NULL;
DMUS_OBJECTDESC desc;
desc.dwValidData = DMUS_OBJ_STREAM | DMUS_OBJ_CLASS;
desc.guidClass = CLSID_DirectMusicContainer;
desc.pStream = NULL;
IStream_Clone (pStm, &desc.pStream);
liMove.QuadPart = 0;
liMove.QuadPart -= (sizeof(FOURCC) + sizeof(DWORD));
IStream_Seek (desc.pStream, liMove, STREAM_SEEK_CUR, NULL);
IStream_QueryInterface (pStm, &IID_IDirectMusicGetLoader, (LPVOID*)&pGetLoader);
IDirectMusicGetLoader_GetLoader (pGetLoader, &pLoader);
IDirectMusicGetLoader_Release (pGetLoader);
if (SUCCEEDED(IDirectMusicLoader_GetObject (pLoader, &desc, &IID_IDirectMusicObject, (LPVOID*) &pObject))) {
IDirectMusicObject_Release (pObject);
} else {
ERR_(dmfile)("Error on GetObject while trying to load Scrip SubContainer\n");
}
IDirectMusicLoader_Release (pLoader); pLoader = NULL; /* release loader */
IStream_Release(desc.pStream); desc.pStream = NULL; /* release cloned stream */
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
/*
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": RIFF chunk of type %s", debugstr_fourcc(Chunk.fccID));
ListSize[0] = Chunk.dwSize - sizeof(FOURCC);
ListCount[0] = 0;
switch (Chunk.fccID) {
default: {
TRACE_(dmfile)(": unknown (skipping)\n");
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
*/
break;
}
case FOURCC_LIST: { case FOURCC_LIST: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL); IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID)); TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
@ -549,7 +596,7 @@ HRESULT WINAPI IDirectMusicScriptImpl_IPersistStream_Load (LPPERSISTSTREAM iface
break; break;
} }
default: { default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n"); TRACE_(dmfile)(": unknown sub-chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize; liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break; break;