Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
b549a2f6
Commit
b549a2f6
authored
Aug 30, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aout: robustify channel reordering
parent
468c9ea3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
30 deletions
+26
-30
include/vlc_aout.h
include/vlc_aout.h
+1
-1
src/audio_output/common.c
src/audio_output/common.c
+25
-29
No files found.
include/vlc_aout.h
View file @
b549a2f6
...
...
@@ -193,7 +193,7 @@ static const uint32_t pi_vlc_chan_order_wg4[] =
*/
VLC_API
unsigned
aout_CheckChannelReorder
(
const
uint32_t
*
,
const
uint32_t
*
,
uint32_t
mask
,
uint8_t
*
table
);
VLC_API
void
aout_ChannelReorder
(
void
*
,
size_t
,
u
nsigned
,
const
uint8_t
*
,
vlc_fourcc_t
);
VLC_API
void
aout_ChannelReorder
(
void
*
,
size_t
,
u
int8_t
,
const
uint8_t
*
,
vlc_fourcc_t
);
VLC_API
void
aout_Interleave
(
void
*
dst
,
const
void
*
const
*
planes
,
unsigned
samples
,
unsigned
channels
,
...
...
src/audio_output/common.c
View file @
b549a2f6
...
...
@@ -286,14 +286,14 @@ unsigned aout_CheckChannelReorder( const uint32_t *chans_in,
* \param fourcc sample format (must be a linear sample format)
* \note The samples must be naturally aligned in memory.
*/
void
aout_ChannelReorder
(
void
*
ptr
,
size_t
bytes
,
u
nsigned
channels
,
void
aout_ChannelReorder
(
void
*
ptr
,
size_t
bytes
,
u
int8_t
channels
,
const
uint8_t
*
restrict
chans_table
,
vlc_fourcc_t
fourcc
)
{
if
(
unlikely
(
bytes
==
0
)
)
return
;
assert
(
channels
!=
0
);
assert
(
channels
<=
AOUT_CHAN_MAX
);
if
(
channels
==
0
||
channels
>=
AOUT_CHAN_MAX
)
return
;
/* The audio formats supported in audio output are inlined. For other
* formats (used in demuxers and muxers), memcpy() is used to avoid
* breaking type punning. */
...
...
@@ -313,36 +313,32 @@ do { \
} \
} while(0)
switch
(
fourcc
)
if
(
likely
(
channels
<=
AOUT_CHAN_MAX
)
)
{
case
VLC_CODEC_U8
:
REORDER_TYPE
(
uint8_t
);
break
;
case
VLC_CODEC_S16N
:
REORDER_TYPE
(
int16_t
);
break
;
case
VLC_CODEC_FL32
:
REORDER_TYPE
(
float
);
break
;
case
VLC_CODEC_S32N
:
REORDER_TYPE
(
int32_t
);
break
;
case
VLC_CODEC_FL64
:
REORDER_TYPE
(
double
);
break
;
default:
switch
(
fourcc
)
{
unsigned
size
=
aout_BitsPerSample
(
fourcc
)
/
8
;
assert
(
size
!=
0
);
if
(
size
==
0
)
return
;
case
VLC_CODEC_U8
:
REORDER_TYPE
(
uint8_t
);
return
;
case
VLC_CODEC_S16N
:
REORDER_TYPE
(
int16_t
);
return
;
case
VLC_CODEC_FL32
:
REORDER_TYPE
(
float
);
return
;
case
VLC_CODEC_S32N
:
REORDER_TYPE
(
int32_t
);
return
;
case
VLC_CODEC_FL64
:
REORDER_TYPE
(
double
);
return
;
}
}
const
size_t
frames
=
bytes
/
(
size
*
channels
)
;
unsigned
char
*
buf
=
ptr
;
unsigned
size
=
aout_BitsPerSample
(
fourcc
)
/
8
;
assert
(
size
!=
0
&&
size
<=
8
)
;
assert
(
bytes
!=
0
);
for
(
size_t
i
=
0
;
i
<
frames
;
i
++
)
{
unsigned
char
tmp
[
AOUT_CHAN_MAX
*
size
];
const
size_t
frames
=
bytes
/
(
size
*
channels
);
unsigned
char
*
buf
=
ptr
;
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
memcpy
(
tmp
+
size
*
chans_table
[
j
],
buf
+
size
*
j
,
size
);
memcpy
(
buf
,
tmp
,
size
*
channels
);
buf
+=
size
*
channels
;
}
break
;
}
for
(
size_t
i
=
0
;
i
<
frames
;
i
++
)
{
unsigned
char
tmp
[
256
*
8
];
for
(
size_t
j
=
0
;
j
<
channels
;
j
++
)
memcpy
(
tmp
+
size
*
chans_table
[
j
],
buf
+
size
*
j
,
size
);
memcpy
(
buf
,
tmp
,
size
*
channels
);
buf
+=
size
*
channels
;
}
}
...
...
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