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
e1b4aa54
Commit
e1b4aa54
authored
May 13, 2018
by
Zebediah Figura
Committed by
Alexandre Julliard
May 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mp3dmod: Return timestamp and length from ProcessOutput().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
cae0e0b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
2 deletions
+36
-2
mp3dmod.c
dlls/mp3dmod/mp3dmod.c
+15
-0
mp3dmod.c
dlls/mp3dmod/tests/mp3dmod.c
+21
-2
No files found.
dlls/mp3dmod/mp3dmod.c
View file @
e1b4aa54
...
...
@@ -43,6 +43,7 @@ struct mp3_decoder {
mpg123_handle
*
mh
;
DMO_MEDIA_TYPE
outtype
;
IMediaBuffer
*
buffer
;
REFERENCE_TIME
timestamp
;
};
static
inline
struct
mp3_decoder
*
impl_from_IMediaObject
(
IMediaObject
*
iface
)
...
...
@@ -296,9 +297,16 @@ static DWORD get_framesize(DMO_MEDIA_TYPE *type)
return
1152
*
format
->
nBlockAlign
;
}
static
REFERENCE_TIME
get_frametime
(
DMO_MEDIA_TYPE
*
type
)
{
WAVEFORMATEX
*
format
=
(
WAVEFORMATEX
*
)
type
->
pbFormat
;
return
(
REFERENCE_TIME
)
10000000
*
1152
/
format
->
nSamplesPerSec
;
}
static
HRESULT
WINAPI
MediaObject_ProcessOutput
(
IMediaObject
*
iface
,
DWORD
flags
,
DWORD
count
,
DMO_OUTPUT_DATA_BUFFER
*
buffers
,
DWORD
*
status
)
{
struct
mp3_decoder
*
This
=
impl_from_IMediaObject
(
iface
);
REFERENCE_TIME
time
=
0
,
frametime
;
DWORD
len
,
maxlen
,
framesize
;
int
got_data
=
0
;
size_t
written
;
...
...
@@ -325,6 +333,7 @@ static HRESULT WINAPI MediaObject_ProcessOutput(IMediaObject *iface, DWORD flags
if
(
FAILED
(
hr
))
return
hr
;
framesize
=
get_framesize
(
&
This
->
outtype
);
frametime
=
get_frametime
(
&
This
->
outtype
);
while
(
1
)
{
...
...
@@ -353,10 +362,16 @@ static HRESULT WINAPI MediaObject_ProcessOutput(IMediaObject *iface, DWORD flags
len
+=
framesize
;
hr
=
IMediaBuffer_SetLength
(
buffers
[
0
].
pBuffer
,
len
);
if
(
FAILED
(
hr
))
return
hr
;
time
+=
frametime
;
}
if
(
got_data
)
{
buffers
[
0
].
dwStatus
|=
(
DMO_OUTPUT_DATA_BUFFERF_TIME
|
DMO_OUTPUT_DATA_BUFFERF_TIMELENGTH
);
buffers
[
0
].
rtTimelength
=
time
;
buffers
[
0
].
rtTimestamp
=
This
->
timestamp
;
This
->
timestamp
+=
time
;
return
S_OK
;
}
return
S_FALSE
;
...
...
dlls/mp3dmod/tests/mp3dmod.c
View file @
e1b4aa54
...
...
@@ -35,6 +35,11 @@ DEFINE_GUID(WMMEDIASUBTYPE_MP3, 0x00000055, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0x
#define O_TIMELENGTH DMO_OUTPUT_DATA_BUFFERF_TIMELENGTH
#define O_INCOMPLETE DMO_OUTPUT_DATA_BUFFERF_INCOMPLETE
static
REFERENCE_TIME
samplelen
(
DWORD
samples
,
int
rate
)
{
return
(
REFERENCE_TIME
)
10000000
*
samples
/
rate
;
}
struct
test_buffer
{
IMediaBuffer
IMediaBuffer_iface
;
BYTE
data
[
5000
];
...
...
@@ -149,10 +154,14 @@ static void test_convert(void)
outbuf
.
maxlen
=
sizeof
(
outbuf
.
data
);
output
.
pBuffer
=
&
outbuf
.
IMediaBuffer_iface
;
output
.
dwStatus
=
0xdeadbeef
;
output
.
rtTimestamp
=
0xdeadbeef
;
output
.
rtTimelength
=
0xdeadbeef
;
hr
=
IMediaObject_ProcessOutput
(
dmo
,
0
,
1
,
&
output
,
&
status
);
ok
(
hr
==
S_FALSE
,
"got %#x
\n
"
,
hr
);
ok
(
outbuf
.
len
==
0
,
"got %u
\n
"
,
outbuf
.
len
);
ok
(
output
.
dwStatus
==
0
,
"got %#x
\n
"
,
output
.
dwStatus
);
ok
(
output
.
rtTimestamp
==
0xdeadbeef
,
"got %s
\n
"
,
wine_dbgstr_longlong
(
output
.
rtTimestamp
));
ok
(
output
.
rtTimelength
==
0xdeadbeef
,
"got %s
\n
"
,
wine_dbgstr_longlong
(
output
.
rtTimelength
));
/* write several frames of mp3 data */
for
(
i
=
0
;
i
<
5
;
i
++
)
...
...
@@ -170,6 +179,8 @@ static void test_convert(void)
ok
(
hr
==
S_FALSE
,
"got %#x
\n
"
,
hr
);
ok
(
outbuf
.
len
==
0
,
"got %u
\n
"
,
outbuf
.
len
);
ok
(
output
.
dwStatus
==
(
O_SYNCPOINT
|
O_INCOMPLETE
),
"got %#x
\n
"
,
output
.
dwStatus
);
ok
(
output
.
rtTimestamp
==
0xdeadbeef
,
"got %s
\n
"
,
wine_dbgstr_longlong
(
output
.
rtTimestamp
));
ok
(
output
.
rtTimelength
==
0xdeadbeef
,
"got %s
\n
"
,
wine_dbgstr_longlong
(
output
.
rtTimelength
));
/* implementations are inconsistent, but should write at least one frame of data */
outbuf
.
len
=
0
;
...
...
@@ -178,14 +189,19 @@ static void test_convert(void)
ok
(
hr
==
S_OK
,
"got %#x
\n
"
,
hr
);
written
=
outbuf
.
len
;
ok
(
written
>
1152
&&
written
<=
5000
,
"got %u
\n
"
,
written
);
todo_wine
ok
(
output
.
dwStatus
==
(
O_SYNCPOINT
|
O_TIME
|
O_TIMELENGTH
|
O_INCOMPLETE
),
"got %#x
\n
"
,
output
.
dwStatus
);
ok
(
output
.
rtTimestamp
==
0
,
"got %s
\n
"
,
wine_dbgstr_longlong
(
output
.
rtTimestamp
));
ok
(
output
.
rtTimelength
==
samplelen
(
written
,
48000
),
"got %s
\n
"
,
wine_dbgstr_longlong
(
output
.
rtTimelength
));
hr
=
IMediaObject_ProcessOutput
(
dmo
,
0
,
1
,
&
output
,
&
status
);
ok
(
hr
==
S_FALSE
,
"got %#x
\n
"
,
hr
);
ok
(
outbuf
.
len
==
written
,
"expected %u, got %u
\n
"
,
written
,
outbuf
.
len
);
ok
(
output
.
dwStatus
==
(
O_SYNCPOINT
|
O_INCOMPLETE
),
"got %#x
\n
"
,
output
.
dwStatus
);
ok
(
output
.
rtTimestamp
==
0
,
"got %s
\n
"
,
wine_dbgstr_longlong
(
output
.
rtTimestamp
));
ok
(
output
.
rtTimelength
==
samplelen
(
written
,
48000
),
"got %s
\n
"
,
wine_dbgstr_longlong
(
output
.
rtTimelength
));
hr
=
IMediaObject_ProcessInput
(
dmo
,
0
,
&
inbuf
.
IMediaBuffer_iface
,
0
,
0
,
0
);
ok
(
hr
==
DMO_E_NOTACCEPTING
,
"got %#x
\n
"
,
hr
);
...
...
@@ -198,8 +214,11 @@ todo_wine
ok
(
written
+
outbuf
.
len
==
(
1152
*
5
)
||
broken
(
written
+
outbuf
.
len
==
(
1152
*
5
)
-
528
),
/* Win10 */
"got %u, total %u
\n
"
,
outbuf
.
len
,
written
+
outbuf
.
len
);
todo_wine
ok
(
output
.
dwStatus
==
(
O_SYNCPOINT
|
O_TIME
|
O_TIMELENGTH
),
"got %#x
\n
"
,
output
.
dwStatus
);
ok
(
output
.
rtTimestamp
==
samplelen
(
written
,
48000
),
"got %s
\n
"
,
wine_dbgstr_longlong
(
output
.
rtTimestamp
));
ok
(
output
.
rtTimelength
==
samplelen
(
outbuf
.
len
,
48000
),
"got %s
\n
"
,
wine_dbgstr_longlong
(
output
.
rtTimelength
));
hr
=
IMediaObject_ProcessOutput
(
dmo
,
0
,
1
,
&
output
,
&
status
);
ok
(
hr
==
S_FALSE
,
"got %#x
\n
"
,
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