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
68f8b53d
Commit
68f8b53d
authored
Nov 17, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Jan 26, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Use an array for the audio decoder input types.
parent
c65703ea
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
24 deletions
+34
-24
aac_decoder.c
dlls/winegstreamer/aac_decoder.c
+34
-24
No files found.
dlls/winegstreamer/aac_decoder.c
View file @
68f8b53d
...
@@ -32,21 +32,7 @@
...
@@ -32,21 +32,7 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
mfplat
);
WINE_DEFAULT_DEBUG_CHANNEL
(
mfplat
);
WINE_DECLARE_DEBUG_CHANNEL
(
winediag
);
WINE_DECLARE_DEBUG_CHANNEL
(
winediag
);
static
HEAACWAVEINFO
aac_decoder_input_types
[]
=
#define NEXT_WAVEFORMATEXTENSIBLE(format) (WAVEFORMATEXTENSIBLE *)((BYTE *)(&(format)->Format + 1) + (format)->Format.cbSize)
{
#define MAKE_HEAACWAVEINFO(format, payload) \
{.wfx = {.wFormatTag = format, .nChannels = 6, .nSamplesPerSec = 48000, .nAvgBytesPerSec = 1152000, \
.nBlockAlign = 24, .wBitsPerSample = 32, .cbSize = sizeof(HEAACWAVEINFO) - sizeof(WAVEFORMATEX)}, \
.wPayloadType = payload}
MAKE_HEAACWAVEINFO
(
WAVE_FORMAT_MPEG_HEAAC
,
0
),
MAKE_HEAACWAVEINFO
(
WAVE_FORMAT_RAW_AAC1
,
0
),
MAKE_HEAACWAVEINFO
(
WAVE_FORMAT_MPEG_HEAAC
,
1
),
MAKE_HEAACWAVEINFO
(
WAVE_FORMAT_MPEG_HEAAC
,
3
),
MAKE_HEAACWAVEINFO
(
WAVE_FORMAT_MPEG_ADTS_AAC
,
0
),
#undef MAKE_HEAACWAVEINFO
};
static
WAVEFORMATEXTENSIBLE
const
aac_decoder_output_types
[]
=
static
WAVEFORMATEXTENSIBLE
const
aac_decoder_output_types
[]
=
{
{
...
@@ -69,6 +55,10 @@ struct aac_decoder
...
@@ -69,6 +55,10 @@ struct aac_decoder
{
{
IMFTransform
IMFTransform_iface
;
IMFTransform
IMFTransform_iface
;
LONG
refcount
;
LONG
refcount
;
UINT
input_type_count
;
WAVEFORMATEXTENSIBLE
*
input_types
;
IMFMediaType
*
input_type
;
IMFMediaType
*
input_type
;
IMFMediaType
*
output_type
;
IMFMediaType
*
output_type
;
...
@@ -238,14 +228,18 @@ static HRESULT WINAPI transform_AddInputStreams(IMFTransform *iface, DWORD strea
...
@@ -238,14 +228,18 @@ static HRESULT WINAPI transform_AddInputStreams(IMFTransform *iface, DWORD strea
static
HRESULT
WINAPI
transform_GetInputAvailableType
(
IMFTransform
*
iface
,
DWORD
id
,
DWORD
index
,
static
HRESULT
WINAPI
transform_GetInputAvailableType
(
IMFTransform
*
iface
,
DWORD
id
,
DWORD
index
,
IMFMediaType
**
type
)
IMFMediaType
**
type
)
{
{
struct
aac_decoder
*
decoder
=
impl_from_IMFTransform
(
iface
);
const
WAVEFORMATEXTENSIBLE
*
format
=
decoder
->
input_types
;
UINT
count
=
decoder
->
input_type_count
;
TRACE
(
"iface %p, id %#lx, index %#lx, type %p.
\n
"
,
iface
,
id
,
index
,
type
);
TRACE
(
"iface %p, id %#lx, index %#lx, type %p.
\n
"
,
iface
,
id
,
index
,
type
);
*
type
=
NULL
;
*
type
=
NULL
;
if
(
id
)
if
(
id
)
return
MF_E_INVALIDSTREAMNUMBER
;
return
MF_E_INVALIDSTREAMNUMBER
;
if
(
index
>=
ARRAY_SIZE
(
aac_decoder_input_types
)
)
for
(
format
=
decoder
->
input_types
;
index
>
0
&&
count
>
0
;
index
--
,
count
--
)
return
MF_E_NO_MORE_TYPES
;
format
=
NEXT_WAVEFORMATEXTENSIBLE
(
format
)
;
return
MFCreateAudioMediaType
(
&
aac_decoder_input_types
[
index
].
wfx
,
(
IMFAudioMediaType
**
)
type
)
;
return
count
?
MFCreateAudioMediaType
(
&
format
->
Format
,
(
IMFAudioMediaType
**
)
type
)
:
MF_E_NO_MORE_TYPES
;
}
}
static
HRESULT
WINAPI
transform_GetOutputAvailableType
(
IMFTransform
*
iface
,
DWORD
id
,
DWORD
index
,
static
HRESULT
WINAPI
transform_GetOutputAvailableType
(
IMFTransform
*
iface
,
DWORD
id
,
DWORD
index
,
...
@@ -328,10 +322,9 @@ static BOOL matches_format(const WAVEFORMATEXTENSIBLE *a, const WAVEFORMATEXTENS
...
@@ -328,10 +322,9 @@ static BOOL matches_format(const WAVEFORMATEXTENSIBLE *a, const WAVEFORMATEXTENS
static
HRESULT
WINAPI
transform_SetInputType
(
IMFTransform
*
iface
,
DWORD
id
,
IMFMediaType
*
type
,
DWORD
flags
)
static
HRESULT
WINAPI
transform_SetInputType
(
IMFTransform
*
iface
,
DWORD
id
,
IMFMediaType
*
type
,
DWORD
flags
)
{
{
struct
aac_decoder
*
decoder
=
impl_from_IMFTransform
(
iface
);
struct
aac_decoder
*
decoder
=
impl_from_IMFTransform
(
iface
);
UINT32
size
,
count
=
decoder
->
input_type_count
;
WAVEFORMATEXTENSIBLE
*
format
,
wfx
;
WAVEFORMATEXTENSIBLE
*
format
,
wfx
;
UINT32
size
;
HRESULT
hr
;
HRESULT
hr
;
ULONG
i
;
TRACE
(
"iface %p, id %#lx, type %p, flags %#lx.
\n
"
,
iface
,
id
,
type
,
flags
);
TRACE
(
"iface %p, id %#lx, type %p, flags %#lx.
\n
"
,
iface
,
id
,
type
,
flags
);
...
@@ -344,10 +337,9 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM
...
@@ -344,10 +337,9 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM
wfx
=
*
format
;
wfx
=
*
format
;
CoTaskMemFree
(
format
);
CoTaskMemFree
(
format
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
aac_decoder_input_types
);
++
i
)
for
(
format
=
decoder
->
input_types
;
count
>
0
&&
!
matches_format
(
format
,
&
wfx
);
count
--
)
if
(
matches_format
((
WAVEFORMATEXTENSIBLE
*
)
&
aac_decoder_input_types
[
i
],
&
wfx
))
format
=
NEXT_WAVEFORMATEXTENSIBLE
(
format
);
break
;
if
(
!
count
)
if
(
i
==
ARRAY_SIZE
(
aac_decoder_input_types
))
return
MF_E_INVALIDMEDIATYPE
;
return
MF_E_INVALIDMEDIATYPE
;
if
(
wfx
.
Format
.
nChannels
>=
ARRAY_SIZE
(
default_channel_mask
)
||
!
wfx
.
Format
.
nSamplesPerSec
||
!
wfx
.
Format
.
cbSize
)
if
(
wfx
.
Format
.
nChannels
>=
ARRAY_SIZE
(
default_channel_mask
)
||
!
wfx
.
Format
.
nSamplesPerSec
||
!
wfx
.
Format
.
cbSize
)
...
@@ -574,6 +566,22 @@ static const IMFTransformVtbl transform_vtbl =
...
@@ -574,6 +566,22 @@ static const IMFTransformVtbl transform_vtbl =
transform_ProcessOutput
,
transform_ProcessOutput
,
};
};
static
HEAACWAVEINFO
aac_decoder_input_types
[]
=
{
#define MAKE_HEAACWAVEINFO(format, payload) \
{.wfx = {.wFormatTag = format, .nChannels = 6, .nSamplesPerSec = 48000, .nAvgBytesPerSec = 1152000, \
.nBlockAlign = 24, .wBitsPerSample = 32, .cbSize = sizeof(HEAACWAVEINFO) - sizeof(WAVEFORMATEX)}, \
.wPayloadType = payload}
MAKE_HEAACWAVEINFO
(
WAVE_FORMAT_MPEG_HEAAC
,
0
),
MAKE_HEAACWAVEINFO
(
WAVE_FORMAT_RAW_AAC1
,
0
),
MAKE_HEAACWAVEINFO
(
WAVE_FORMAT_MPEG_HEAAC
,
1
),
MAKE_HEAACWAVEINFO
(
WAVE_FORMAT_MPEG_HEAAC
,
3
),
MAKE_HEAACWAVEINFO
(
WAVE_FORMAT_MPEG_ADTS_AAC
,
0
),
#undef MAKE_HEAACWAVEINFO
};
HRESULT
aac_decoder_create
(
REFIID
riid
,
void
**
ret
)
HRESULT
aac_decoder_create
(
REFIID
riid
,
void
**
ret
)
{
{
static
const
struct
wg_format
output_format
=
static
const
struct
wg_format
output_format
=
...
@@ -604,6 +612,8 @@ HRESULT aac_decoder_create(REFIID riid, void **ret)
...
@@ -604,6 +612,8 @@ HRESULT aac_decoder_create(REFIID riid, void **ret)
if
(
!
(
decoder
=
calloc
(
1
,
sizeof
(
*
decoder
))))
if
(
!
(
decoder
=
calloc
(
1
,
sizeof
(
*
decoder
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
decoder
->
input_types
=
(
WAVEFORMATEXTENSIBLE
*
)
aac_decoder_input_types
;
decoder
->
input_type_count
=
ARRAY_SIZE
(
aac_decoder_input_types
);
if
(
FAILED
(
hr
=
wg_sample_queue_create
(
&
decoder
->
wg_sample_queue
)))
if
(
FAILED
(
hr
=
wg_sample_queue_create
(
&
decoder
->
wg_sample_queue
)))
{
{
...
...
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