ReactOS  0.4.14-dev-384-g5b37caa
dmobject.h
Go to the documentation of this file.
1 /*
2  * Base IDirectMusicObject Implementation
3  * Keep in sync with the master in dlls/dmusic/dmobject.h
4  *
5  * Copyright (C) 2014 Michael Stefaniuc
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 
22 #pragma once
23 
24 #include "wine/debug.h"
25 
26 /* RIFF stream parsing */
27 struct chunk_entry;
28 struct chunk_entry {
31  FOURCC type; /* valid only for LIST and RIFF chunks */
32  ULARGE_INTEGER offset; /* chunk offset from start of stream */
33  const struct chunk_entry *parent; /* enclosing RIFF or LIST chunk */
34 };
35 
39 
44 
46 {
48 
49  offset.QuadPart = chunk->offset.QuadPart + sizeof(FOURCC) + sizeof(DWORD);
50  if (chunk->id == FOURCC_RIFF || chunk->id == FOURCC_LIST)
51  offset.QuadPart += sizeof(FOURCC);
52 
53  return IStream_Seek(stream, offset, STREAM_SEEK_SET, NULL);
54 }
55 
57 {
59 
60  offset.QuadPart = chunk->offset.QuadPart;
61 
62  return IStream_Seek(stream, offset, STREAM_SEEK_SET, NULL);
63 }
64 
65 const char *debugstr_chunk(const struct chunk_entry *chunk) DECLSPEC_HIDDEN;
66 
67 
68 /* IDirectMusicObject base object */
69 struct dmobject {
70  IDirectMusicObject IDirectMusicObject_iface;
74 };
75 
76 void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk) DECLSPEC_HIDDEN;
77 
78 /* Generic IDirectMusicObject methods */
80  void **ret_iface) DECLSPEC_HIDDEN;
83 HRESULT WINAPI dmobj_IDirectMusicObject_GetDescriptor(IDirectMusicObject *iface,
85 HRESULT WINAPI dmobj_IDirectMusicObject_SetDescriptor(IDirectMusicObject *iface,
87 
88 /* Helper for IDirectMusicObject::ParseDescriptor */
91 /* Additional supported flags for dmobj_parsedescriptor.
92  DMUS_OBJ_NAME is 'UNAM' chunk in UNFO list */
93 #define DMUS_OBJ_NAME_INAM 0x1000 /* 'INAM' chunk in UNFO list */
94 #define DMUS_OBJ_NAME_INFO 0x2000 /* 'INAM' chunk in INFO list */
95 
96 /* Generic IPersistStream methods */
98  void **ret_iface) DECLSPEC_HIDDEN;
102 
103 /* IPersistStream methods not implemented in native */
105  CLSID *class) DECLSPEC_HIDDEN;
108  BOOL clear_dirty) DECLSPEC_HIDDEN;
HRESULT WINAPI dmobj_IDirectMusicObject_GetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *desc) DECLSPEC_HIDDEN
Definition: dmobject.c:200
#define REFIID
Definition: guiddef.h:118
REFIID riid
Definition: precomp.h:44
DWORD size
Definition: dmobject.h:30
uint64_t offset
Definition: btrfs_drv.h:557
GLintptr offset
Definition: glext.h:5920
static HRESULT stream_reset_chunk_data(IStream *stream, const struct chunk_entry *chunk)
Definition: dmobject.h:45
ULONG WINAPI dmobj_IPersistStream_AddRef(IPersistStream *iface) DECLSPEC_HIDDEN
Definition: dmobject.c:354
HRESULT WINAPI dmobj_IDirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid, void **ret_iface) DECLSPEC_HIDDEN
Definition: dmobject.c:181
ULONG WINAPI dmobj_IPersistStream_Release(IPersistStream *iface) DECLSPEC_HIDDEN
Definition: dmobject.c:360
HRESULT WINAPI unimpl_IPersistStream_GetClassID(IPersistStream *iface, CLSID *class) DECLSPEC_HIDDEN
Definition: dmobject.c:381
FOURCC id
Definition: dmobject.h:29
FOURCC type
Definition: dmobject.h:31
const char * debugstr_chunk(const struct chunk_entry *chunk) DECLSPEC_HIDDEN
Definition: dmobject.c:48
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG WINAPI dmobj_IDirectMusicObject_AddRef(IDirectMusicObject *iface) DECLSPEC_HIDDEN
Definition: dmobject.c:188
static const WCHAR desc[]
Definition: protectdata.c:36
HRESULT WINAPI unimpl_IPersistStream_IsDirty(IPersistStream *iface) DECLSPEC_HIDDEN
Definition: dmobject.c:387
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
IPersistStream IPersistStream_iface
Definition: dmobject.h:71
HRESULT stream_chunk_get_wstr(IStream *stream, const struct chunk_entry *chunk, WCHAR *str, ULONG size) DECLSPEC_HIDDEN
Definition: dmobject.c:155
DMUS_OBJECTDESC desc
Definition: dmobject.h:73
GLsizeiptr size
Definition: glext.h:5919
#define FOURCC_LIST
Definition: mmsystem.h:565
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
HRESULT stream_next_chunk(IStream *stream, struct chunk_entry *chunk) DECLSPEC_HIDDEN
Definition: dmobject.c:130
#define WINAPI
Definition: msvc.h:8
HRESULT WINAPI dmobj_IDirectMusicObject_SetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *desc) DECLSPEC_HIDDEN
Definition: dmobject.c:215
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT WINAPI dmobj_IPersistStream_GetClassID(IPersistStream *iface, CLSID *class) DECLSPEC_HIDDEN
Definition: dmobject.c:366
Definition: dmobject.h:28
HRESULT stream_skip_chunk(IStream *stream, struct chunk_entry *chunk) DECLSPEC_HIDDEN
Definition: dmobject.c:121
HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID riid, void **ret_iface) DECLSPEC_HIDDEN
Definition: dmobject.c:347
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
const struct chunk_entry * parent
Definition: dmobject.h:33
#define FOURCC_RIFF
Definition: mmsystem.h:564
Definition: parse.h:22
HRESULT WINAPI unimpl_IPersistStream_GetSizeMax(IPersistStream *iface, ULARGE_INTEGER *size) DECLSPEC_HIDDEN
Definition: dmobject.c:400
IDirectMusicObject IDirectMusicObject_iface
Definition: dmobject.h:70
HRESULT dmobj_parsedescriptor(IStream *stream, const struct chunk_entry *riff, DMUS_OBJECTDESC *desc, DWORD supported) DECLSPEC_HIDDEN
Definition: dmobject.c:296
DWORD FOURCC
Definition: dmdls.h:25
static HRESULT stream_reset_chunk_start(IStream *stream, const struct chunk_entry *chunk)
Definition: dmobject.h:56
#define DECLSPEC_HIDDEN
Definition: precomp.h:8
ULARGE_INTEGER offset
Definition: dmobject.h:32
HRESULT stream_get_chunk(IStream *stream, struct chunk_entry *chunk) DECLSPEC_HIDDEN
Definition: dmobject.c:76
ULONG WINAPI dmobj_IDirectMusicObject_Release(IDirectMusicObject *iface) DECLSPEC_HIDDEN
Definition: dmobject.c:194
HRESULT WINAPI unimpl_IPersistStream_Save(IPersistStream *iface, IStream *stream, BOOL clear_dirty) DECLSPEC_HIDDEN
Definition: dmobject.c:393
void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk) DECLSPEC_HIDDEN
Definition: dmobject.c:407
unsigned int ULONG
Definition: retypes.h:1
#define FOURCC(a, b, c, d)
Definition: memtrack.h:4
HRESULT stream_chunk_get_data(IStream *stream, const struct chunk_entry *chunk, void *data, ULONG size) DECLSPEC_HIDDEN
Definition: dmobject.c:143
IUnknown * outer_unk
Definition: dmobject.h:72