Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
31be8a19
Commit
31be8a19
authored
Jan 11, 2012
by
Vincent Povirk
Committed by
Alexandre Julliard
Jan 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Implement IWICMetadataWriter::GetEnumerator.
parent
60e66535
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
190 additions
and
3 deletions
+190
-3
metadatahandler.c
dlls/windowscodecs/metadatahandler.c
+189
-2
metadata.c
dlls/windowscodecs/tests/metadata.c
+1
-1
No files found.
dlls/windowscodecs/metadatahandler.c
View file @
31be8a19
...
@@ -68,6 +68,9 @@ static void MetadataHandler_FreeItems(MetadataHandler *This)
...
@@ -68,6 +68,9 @@ static void MetadataHandler_FreeItems(MetadataHandler *This)
HeapFree
(
GetProcessHeap
(),
0
,
This
->
items
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
items
);
}
}
static
HRESULT
MetadataHandlerEnum_Create
(
MetadataHandler
*
parent
,
DWORD
index
,
IWICEnumMetadataItem
**
ppIEnumMetadataItem
);
static
HRESULT
WINAPI
MetadataHandler_QueryInterface
(
IWICMetadataWriter
*
iface
,
REFIID
iid
,
static
HRESULT
WINAPI
MetadataHandler_QueryInterface
(
IWICMetadataWriter
*
iface
,
REFIID
iid
,
void
**
ppv
)
void
**
ppv
)
{
{
...
@@ -164,8 +167,9 @@ static HRESULT WINAPI MetadataHandler_GetValue(IWICMetadataWriter *iface,
...
@@ -164,8 +167,9 @@ static HRESULT WINAPI MetadataHandler_GetValue(IWICMetadataWriter *iface,
static
HRESULT
WINAPI
MetadataHandler_GetEnumerator
(
IWICMetadataWriter
*
iface
,
static
HRESULT
WINAPI
MetadataHandler_GetEnumerator
(
IWICMetadataWriter
*
iface
,
IWICEnumMetadataItem
**
ppIEnumMetadata
)
IWICEnumMetadataItem
**
ppIEnumMetadata
)
{
{
FIXME
(
"(%p,%p): stub
\n
"
,
iface
,
ppIEnumMetadata
);
MetadataHandler
*
This
=
impl_from_IWICMetadataWriter
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"(%p,%p)
\n
"
,
iface
,
ppIEnumMetadata
);
return
MetadataHandlerEnum_Create
(
This
,
0
,
ppIEnumMetadata
);
}
}
static
HRESULT
WINAPI
MetadataHandler_SetValue
(
IWICMetadataWriter
*
iface
,
static
HRESULT
WINAPI
MetadataHandler_SetValue
(
IWICMetadataWriter
*
iface
,
...
@@ -343,6 +347,189 @@ HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, IUnknown *pUnkO
...
@@ -343,6 +347,189 @@ HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, IUnknown *pUnkO
return
hr
;
return
hr
;
}
}
typedef
struct
MetadataHandlerEnum
{
IWICEnumMetadataItem
IWICEnumMetadataItem_iface
;
LONG
ref
;
MetadataHandler
*
parent
;
DWORD
index
;
}
MetadataHandlerEnum
;
static
inline
MetadataHandlerEnum
*
impl_from_IWICEnumMetadataItem
(
IWICEnumMetadataItem
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
MetadataHandlerEnum
,
IWICEnumMetadataItem_iface
);
}
static
HRESULT
WINAPI
MetadataHandlerEnum_QueryInterface
(
IWICEnumMetadataItem
*
iface
,
REFIID
iid
,
void
**
ppv
)
{
MetadataHandlerEnum
*
This
=
impl_from_IWICEnumMetadataItem
(
iface
);
TRACE
(
"(%p,%s,%p)
\n
"
,
iface
,
debugstr_guid
(
iid
),
ppv
);
if
(
!
ppv
)
return
E_INVALIDARG
;
if
(
IsEqualIID
(
&
IID_IUnknown
,
iid
)
||
IsEqualIID
(
&
IID_IWICEnumMetadataItem
,
iid
))
{
*
ppv
=
&
This
->
IWICEnumMetadataItem_iface
;
}
else
{
*
ppv
=
NULL
;
return
E_NOINTERFACE
;
}
IUnknown_AddRef
((
IUnknown
*
)
*
ppv
);
return
S_OK
;
}
static
ULONG
WINAPI
MetadataHandlerEnum_AddRef
(
IWICEnumMetadataItem
*
iface
)
{
MetadataHandlerEnum
*
This
=
impl_from_IWICEnumMetadataItem
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p) refcount=%u
\n
"
,
iface
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
MetadataHandlerEnum_Release
(
IWICEnumMetadataItem
*
iface
)
{
MetadataHandlerEnum
*
This
=
impl_from_IWICEnumMetadataItem
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p) refcount=%u
\n
"
,
iface
,
ref
);
if
(
ref
==
0
)
{
IWICMetadataWriter_Release
(
&
This
->
parent
->
IWICMetadataWriter_iface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
}
static
HRESULT
WINAPI
MetadataHandlerEnum_Next
(
IWICEnumMetadataItem
*
iface
,
ULONG
celt
,
PROPVARIANT
*
rgeltSchema
,
PROPVARIANT
*
rgeltId
,
PROPVARIANT
*
rgeltValue
,
ULONG
*
pceltFetched
)
{
MetadataHandlerEnum
*
This
=
impl_from_IWICEnumMetadataItem
(
iface
);
ULONG
new_index
;
HRESULT
hr
=
S_FALSE
;
int
i
;
TRACE
(
"(%p,%i)
\n
"
,
iface
,
celt
);
EnterCriticalSection
(
&
This
->
parent
->
lock
);
if
(
This
->
index
>=
This
->
parent
->
item_count
)
{
*
pceltFetched
=
0
;
LeaveCriticalSection
(
&
This
->
parent
->
lock
);
return
S_FALSE
;
}
new_index
=
min
(
This
->
parent
->
item_count
,
This
->
index
+
celt
);
*
pceltFetched
=
new_index
-
This
->
index
;
if
(
rgeltSchema
)
{
for
(
i
=
0
;
SUCCEEDED
(
hr
)
&&
i
<
*
pceltFetched
;
i
++
)
hr
=
PropVariantCopy
(
&
rgeltSchema
[
i
],
&
This
->
parent
->
items
[
i
+
This
->
index
].
schema
);
}
for
(
i
=
0
;
SUCCEEDED
(
hr
)
&&
i
<
*
pceltFetched
;
i
++
)
hr
=
PropVariantCopy
(
&
rgeltId
[
i
],
&
This
->
parent
->
items
[
i
+
This
->
index
].
id
);
if
(
rgeltValue
)
{
for
(
i
=
0
;
SUCCEEDED
(
hr
)
&&
i
<
*
pceltFetched
;
i
++
)
hr
=
PropVariantCopy
(
&
rgeltValue
[
i
],
&
This
->
parent
->
items
[
i
+
This
->
index
].
value
);
}
if
(
SUCCEEDED
(
hr
))
{
This
->
index
=
new_index
;
}
LeaveCriticalSection
(
&
This
->
parent
->
lock
);
return
hr
;
}
static
HRESULT
WINAPI
MetadataHandlerEnum_Skip
(
IWICEnumMetadataItem
*
iface
,
ULONG
celt
)
{
MetadataHandlerEnum
*
This
=
impl_from_IWICEnumMetadataItem
(
iface
);
EnterCriticalSection
(
&
This
->
parent
->
lock
);
This
->
index
+=
celt
;
LeaveCriticalSection
(
&
This
->
parent
->
lock
);
return
S_OK
;
}
static
HRESULT
WINAPI
MetadataHandlerEnum_Reset
(
IWICEnumMetadataItem
*
iface
)
{
MetadataHandlerEnum
*
This
=
impl_from_IWICEnumMetadataItem
(
iface
);
EnterCriticalSection
(
&
This
->
parent
->
lock
);
This
->
index
=
0
;
LeaveCriticalSection
(
&
This
->
parent
->
lock
);
return
S_OK
;
}
static
HRESULT
WINAPI
MetadataHandlerEnum_Clone
(
IWICEnumMetadataItem
*
iface
,
IWICEnumMetadataItem
**
ppIEnumMetadataItem
)
{
MetadataHandlerEnum
*
This
=
impl_from_IWICEnumMetadataItem
(
iface
);
HRESULT
hr
;
EnterCriticalSection
(
&
This
->
parent
->
lock
);
hr
=
MetadataHandlerEnum_Create
(
This
->
parent
,
This
->
index
,
ppIEnumMetadataItem
);
LeaveCriticalSection
(
&
This
->
parent
->
lock
);
return
hr
;
}
static
const
IWICEnumMetadataItemVtbl
MetadataHandlerEnum_Vtbl
=
{
MetadataHandlerEnum_QueryInterface
,
MetadataHandlerEnum_AddRef
,
MetadataHandlerEnum_Release
,
MetadataHandlerEnum_Next
,
MetadataHandlerEnum_Skip
,
MetadataHandlerEnum_Reset
,
MetadataHandlerEnum_Clone
};
static
HRESULT
MetadataHandlerEnum_Create
(
MetadataHandler
*
parent
,
DWORD
index
,
IWICEnumMetadataItem
**
ppIEnumMetadataItem
)
{
MetadataHandlerEnum
*
This
;
*
ppIEnumMetadataItem
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
MetadataHandlerEnum
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
IWICMetadataWriter_AddRef
(
&
parent
->
IWICMetadataWriter_iface
);
This
->
IWICEnumMetadataItem_iface
.
lpVtbl
=
&
MetadataHandlerEnum_Vtbl
;
This
->
ref
=
1
;
This
->
parent
=
parent
;
This
->
index
=
index
;
*
ppIEnumMetadataItem
=
&
This
->
IWICEnumMetadataItem_iface
;
return
S_OK
;
}
static
HRESULT
LoadUnknownMetadata
(
IStream
*
input
,
const
GUID
*
preferred_vendor
,
static
HRESULT
LoadUnknownMetadata
(
IStream
*
input
,
const
GUID
*
preferred_vendor
,
DWORD
persist_options
,
MetadataItem
**
items
,
DWORD
*
item_count
)
DWORD
persist_options
,
MetadataItem
**
items
,
DWORD
*
item_count
)
{
{
...
...
dlls/windowscodecs/tests/metadata.c
View file @
31be8a19
...
@@ -124,7 +124,7 @@ static void test_metadata_unknown(void)
...
@@ -124,7 +124,7 @@ static void test_metadata_unknown(void)
load_stream
((
IUnknown
*
)
reader
,
metadata_unknown
,
sizeof
(
metadata_unknown
));
load_stream
((
IUnknown
*
)
reader
,
metadata_unknown
,
sizeof
(
metadata_unknown
));
hr
=
IWICMetadataReader_GetEnumerator
(
reader
,
&
enumerator
);
hr
=
IWICMetadataReader_GetEnumerator
(
reader
,
&
enumerator
);
todo_wine
ok
(
hr
==
S_OK
,
"GetEnumerator failed, hr=%x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"GetEnumerator failed, hr=%x
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment