Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
b05a4450
Commit
b05a4450
authored
Nov 29, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alsa: keep only useful values, not whole audio format
parent
4e57bd05
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
19 deletions
+21
-19
modules/audio_output/alsa.c
modules/audio_output/alsa.c
+21
-19
No files found.
modules/audio_output/alsa.c
View file @
b05a4450
...
...
@@ -44,9 +44,10 @@ struct aout_sys_t
{
snd_pcm_t
*
pcm
;
void
(
*
reorder
)
(
void
*
,
size_t
,
unsigned
);
float
soft_gain
;
unsigned
rate
;
/**< Sample rate */
uint8_t
bits
;
/**< Bits per sample per channel */
bool
soft_mute
;
audio_sample_format_t
format
;
float
soft_gain
;
};
#include "volume.h"
...
...
@@ -468,6 +469,7 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
/* Setup audio_output_t */
fmt
->
i_format
=
fourcc
;
fmt
->
i_rate
=
rate
;
sys
->
rate
=
rate
;
sys
->
reorder
=
NULL
;
if
(
spdif
)
{
...
...
@@ -484,8 +486,9 @@ static int Start (audio_output_t *aout, audio_sample_format_t *restrict fmt)
sys
->
reorder
=
Reorder71
;
break
;
}
aout_FormatPrepare
(
fmt
);
sys
->
bits
=
fmt
->
i_bitspersample
;
}
sys
->
format
=
*
fmt
;
aout
->
time_get
=
TimeGet
;
aout
->
play
=
Play
;
...
...
@@ -531,7 +534,7 @@ static int TimeGet (audio_output_t *aout, mtime_t *restrict delay)
msg_Err
(
aout
,
"cannot estimate delay: %s"
,
snd_strerror
(
val
));
return
-
1
;
}
*
delay
=
frames
*
CLOCK_FREQ
/
sys
->
format
.
i_
rate
;
*
delay
=
frames
*
CLOCK_FREQ
/
sys
->
rate
;
return
0
;
}
...
...
@@ -543,8 +546,7 @@ static void Play (audio_output_t *aout, block_t *block)
aout_sys_t
*
sys
=
aout
->
sys
;
if
(
sys
->
reorder
!=
NULL
)
sys
->
reorder
(
block
->
p_buffer
,
block
->
i_nb_samples
,
sys
->
format
.
i_bitspersample
/
8
);
sys
->
reorder
(
block
->
p_buffer
,
block
->
i_nb_samples
,
sys
->
bits
);
snd_pcm_t
*
pcm
=
sys
->
pcm
;
...
...
@@ -638,18 +640,18 @@ static void Stop (audio_output_t *aout)
* Converts from VLC to ALSA order for 7.1.
* VLC has middle channels in position 2 and 3, ALSA in position 6 and 7.
*/
static
void
Reorder71
(
void
*
p
,
size_t
n
,
unsigned
size
)
static
void
Reorder71
(
void
*
p
,
size_t
n
,
unsigned
bits
)
{
switch
(
size
)
switch
(
bits
)
{
case
4
:
case
32
:
for
(
uint64_t
*
ptr
=
p
;
n
>
0
;
ptr
+=
4
,
n
--
)
{
uint64_t
middle
=
ptr
[
1
],
c_lfe
=
ptr
[
2
],
rear
=
ptr
[
3
];
ptr
[
1
]
=
c_lfe
;
ptr
[
2
]
=
rear
;
ptr
[
3
]
=
middle
;
}
break
;
case
2
:
case
16
:
for
(
uint32_t
*
ptr
=
p
;
n
>
0
;
ptr
+=
4
,
n
--
)
{
uint32_t
middle
=
ptr
[
1
],
c_lfe
=
ptr
[
2
],
rear
=
ptr
[
3
];
...
...
@@ -660,15 +662,15 @@ static void Reorder71 (void *p, size_t n, unsigned size)
default:
for
(
uint16_t
*
ptr
=
p
;
n
>
0
;
n
--
)
{
uint16_t
middle
[
size
];
memcpy
(
middle
,
ptr
+
size
,
size
*
2
);
ptr
+=
size
;
memcpy
(
ptr
,
ptr
+
size
,
size
*
2
);
ptr
+=
size
;
memcpy
(
ptr
,
ptr
+
size
,
size
*
2
);
ptr
+=
size
;
memcpy
(
ptr
,
middle
,
size
*
2
);
ptr
+=
size
;
uint16_t
middle
[
bits
/
8
];
memcpy
(
middle
,
ptr
+
(
bits
/
8
),
bits
/
4
);
ptr
+=
bits
/
4
;
memcpy
(
ptr
,
ptr
+
(
bits
/
8
),
bits
/
4
);
ptr
+=
bits
/
4
;
memcpy
(
ptr
,
ptr
+
(
bits
/
8
),
bits
/
4
);
ptr
+=
bits
/
4
;
memcpy
(
ptr
,
middle
,
bits
/
4
);
ptr
+=
bits
/
4
;
}
break
;
}
...
...
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