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
23237173
Commit
23237173
authored
Mar 18, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat: Add sample timestamp and duration methods.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
98500d8d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
12 deletions
+76
-12
buffer.c
dlls/mfplat/buffer.c
+53
-10
mfplat.c
dlls/mfplat/tests/mfplat.c
+23
-2
No files found.
dlls/mfplat/buffer.c
View file @
23237173
...
@@ -34,6 +34,12 @@ struct memory_buffer
...
@@ -34,6 +34,12 @@ struct memory_buffer
DWORD
current_length
;
DWORD
current_length
;
};
};
enum
sample_prop_flags
{
SAMPLE_PROP_HAS_DURATION
=
1
<<
0
,
SAMPLE_PROP_HAS_TIMESTAMP
=
1
<<
1
,
};
struct
sample
struct
sample
{
{
struct
attributes
attributes
;
struct
attributes
attributes
;
...
@@ -44,6 +50,9 @@ struct sample
...
@@ -44,6 +50,9 @@ struct sample
size_t
capacity
;
size_t
capacity
;
DWORD
flags
;
DWORD
flags
;
CRITICAL_SECTION
cs
;
CRITICAL_SECTION
cs
;
DWORD
prop_flags
;
LONGLONG
duration
;
LONGLONG
timestamp
;
};
};
static
inline
struct
memory_buffer
*
impl_from_IMFMediaBuffer
(
IMFMediaBuffer
*
iface
)
static
inline
struct
memory_buffer
*
impl_from_IMFMediaBuffer
(
IMFMediaBuffer
*
iface
)
...
@@ -487,32 +496,66 @@ static HRESULT WINAPI sample_SetSampleFlags(IMFSample *iface, DWORD flags)
...
@@ -487,32 +496,66 @@ static HRESULT WINAPI sample_SetSampleFlags(IMFSample *iface, DWORD flags)
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
WINAPI
sample_GetSampleTime
(
IMFSample
*
iface
,
LONGLONG
*
sampletime
)
static
HRESULT
WINAPI
sample_GetSampleTime
(
IMFSample
*
iface
,
LONGLONG
*
timestamp
)
{
{
FIXME
(
"%p, %p.
\n
"
,
iface
,
sampletime
);
struct
sample
*
sample
=
impl_from_IMFSample
(
iface
);
HRESULT
hr
=
S_OK
;
return
E_NOTIMPL
;
TRACE
(
"%p, %p.
\n
"
,
iface
,
timestamp
);
EnterCriticalSection
(
&
sample
->
cs
);
if
(
sample
->
prop_flags
&
SAMPLE_PROP_HAS_TIMESTAMP
)
*
timestamp
=
sample
->
timestamp
;
else
hr
=
MF_E_NO_SAMPLE_TIMESTAMP
;
LeaveCriticalSection
(
&
sample
->
cs
);
return
hr
;
}
}
static
HRESULT
WINAPI
sample_SetSampleTime
(
IMFSample
*
iface
,
LONGLONG
sampletime
)
static
HRESULT
WINAPI
sample_SetSampleTime
(
IMFSample
*
iface
,
LONGLONG
timestamp
)
{
{
FIXME
(
"%p, %s.
\n
"
,
iface
,
wine_dbgstr_longlong
(
sampletime
)
);
struct
sample
*
sample
=
impl_from_IMFSample
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"%p, %s.
\n
"
,
iface
,
wine_dbgstr_longlong
(
timestamp
));
EnterCriticalSection
(
&
sample
->
cs
);
sample
->
timestamp
=
timestamp
;
sample
->
prop_flags
|=
SAMPLE_PROP_HAS_TIMESTAMP
;
LeaveCriticalSection
(
&
sample
->
cs
);
return
S_OK
;
}
}
static
HRESULT
WINAPI
sample_GetSampleDuration
(
IMFSample
*
iface
,
LONGLONG
*
duration
)
static
HRESULT
WINAPI
sample_GetSampleDuration
(
IMFSample
*
iface
,
LONGLONG
*
duration
)
{
{
FIXME
(
"%p, %p.
\n
"
,
iface
,
duration
);
struct
sample
*
sample
=
impl_from_IMFSample
(
iface
);
HRESULT
hr
=
S_OK
;
return
E_NOTIMPL
;
TRACE
(
"%p, %p.
\n
"
,
iface
,
duration
);
EnterCriticalSection
(
&
sample
->
cs
);
if
(
sample
->
prop_flags
&
SAMPLE_PROP_HAS_DURATION
)
*
duration
=
sample
->
duration
;
else
hr
=
MF_E_NO_SAMPLE_DURATION
;
LeaveCriticalSection
(
&
sample
->
cs
);
return
hr
;
}
}
static
HRESULT
WINAPI
sample_SetSampleDuration
(
IMFSample
*
iface
,
LONGLONG
duration
)
static
HRESULT
WINAPI
sample_SetSampleDuration
(
IMFSample
*
iface
,
LONGLONG
duration
)
{
{
FIXME
(
"%p, %s.
\n
"
,
iface
,
wine_dbgstr_longlong
(
duration
)
);
struct
sample
*
sample
=
impl_from_IMFSample
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"%p, %s.
\n
"
,
iface
,
wine_dbgstr_longlong
(
duration
));
EnterCriticalSection
(
&
sample
->
cs
);
sample
->
duration
=
duration
;
sample
->
prop_flags
|=
SAMPLE_PROP_HAS_DURATION
;
LeaveCriticalSection
(
&
sample
->
cs
);
return
S_OK
;
}
}
static
HRESULT
WINAPI
sample_GetBufferCount
(
IMFSample
*
iface
,
DWORD
*
count
)
static
HRESULT
WINAPI
sample_GetBufferCount
(
IMFSample
*
iface
,
DWORD
*
count
)
...
...
dlls/mfplat/tests/mfplat.c
View file @
23237173
...
@@ -1280,6 +1280,7 @@ static void test_sample(void)
...
@@ -1280,6 +1280,7 @@ static void test_sample(void)
{
{
IMFMediaBuffer
*
buffer
,
*
buffer2
;
IMFMediaBuffer
*
buffer
,
*
buffer2
;
DWORD
count
,
flags
,
length
;
DWORD
count
,
flags
,
length
;
IMFAttributes
*
attributes
;
IMFSample
*
sample
;
IMFSample
*
sample
;
LONGLONG
time
;
LONGLONG
time
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -1287,6 +1288,11 @@ static void test_sample(void)
...
@@ -1287,6 +1288,11 @@ static void test_sample(void)
hr
=
MFCreateSample
(
&
sample
);
hr
=
MFCreateSample
(
&
sample
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IMFSample_QueryInterface
(
sample
,
&
IID_IMFAttributes
,
(
void
**
)
&
attributes
);
ok
(
hr
==
S_OK
,
"Failed to get attributes interface, hr %#x.
\n
"
,
hr
);
CHECK_ATTR_COUNT
(
attributes
,
0
);
hr
=
IMFSample_GetBufferCount
(
sample
,
NULL
);
hr
=
IMFSample_GetBufferCount
(
sample
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
...
@@ -1305,11 +1311,9 @@ static void test_sample(void)
...
@@ -1305,11 +1311,9 @@ static void test_sample(void)
ok
(
flags
==
0x123
,
"Unexpected flags %#x.
\n
"
,
flags
);
ok
(
flags
==
0x123
,
"Unexpected flags %#x.
\n
"
,
flags
);
hr
=
IMFSample_GetSampleTime
(
sample
,
&
time
);
hr
=
IMFSample_GetSampleTime
(
sample
,
&
time
);
todo_wine
ok
(
hr
==
MF_E_NO_SAMPLE_TIMESTAMP
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MF_E_NO_SAMPLE_TIMESTAMP
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFSample_GetSampleDuration
(
sample
,
&
time
);
hr
=
IMFSample_GetSampleDuration
(
sample
,
&
time
);
todo_wine
ok
(
hr
==
MF_E_NO_SAMPLE_DURATION
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
MF_E_NO_SAMPLE_DURATION
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFSample_GetBufferByIndex
(
sample
,
0
,
&
buffer
);
hr
=
IMFSample_GetBufferByIndex
(
sample
,
0
,
&
buffer
);
...
@@ -1363,6 +1367,23 @@ todo_wine
...
@@ -1363,6 +1367,23 @@ todo_wine
IMFMediaBuffer_Release
(
buffer
);
IMFMediaBuffer_Release
(
buffer
);
/* Duration */
hr
=
IMFSample_SetSampleDuration
(
sample
,
10
);
ok
(
hr
==
S_OK
,
"Failed to set duration, hr %#x.
\n
"
,
hr
);
CHECK_ATTR_COUNT
(
attributes
,
0
);
hr
=
IMFSample_GetSampleDuration
(
sample
,
&
time
);
ok
(
hr
==
S_OK
,
"Failed to get sample duration, hr %#x.
\n
"
,
hr
);
ok
(
time
==
10
,
"Unexpected duration.
\n
"
);
/* Timestamp */
hr
=
IMFSample_SetSampleTime
(
sample
,
1
);
ok
(
hr
==
S_OK
,
"Failed to set timestamp, hr %#x.
\n
"
,
hr
);
CHECK_ATTR_COUNT
(
attributes
,
0
);
hr
=
IMFSample_GetSampleTime
(
sample
,
&
time
);
ok
(
hr
==
S_OK
,
"Failed to get sample time, hr %#x.
\n
"
,
hr
);
ok
(
time
==
1
,
"Unexpected timestamp.
\n
"
);
IMFAttributes_Release
(
attributes
);
IMFSample_Release
(
sample
);
IMFSample_Release
(
sample
);
}
}
...
...
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