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
c9c770e7
Commit
c9c770e7
authored
Mar 03, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: untested support for 7.1
parent
119c3fc9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
2 deletions
+59
-2
modules/audio_output/alsa.c
modules/audio_output/alsa.c
+59
-2
No files found.
modules/audio_output/alsa.c
View file @
c9c770e7
...
...
@@ -43,6 +43,7 @@
struct
aout_sys_t
{
snd_pcm_t
*
pcm
;
void
(
*
reorder
)
(
void
*
,
size_t
,
unsigned
);
};
#define A52_FRAME_NB 1536
...
...
@@ -68,11 +69,11 @@ static const char *const devices_text[] = {
"This parameter is ignored when digital pass-through is active.")
static
const
int
channels
[]
=
{
AOUT_CHAN_CENTER
,
AOUT_CHANS_STEREO
,
AOUT_CHANS_4_0
,
AOUT_CHANS_4_1
,
AOUT_CHANS_5_0
,
AOUT_CHANS_5_1
,
AOUT_CHANS_5_0
,
AOUT_CHANS_5_1
,
AOUT_CHANS_7_1
,
};
static
const
char
*
const
channels_text
[]
=
{
N_
(
"Mono"
),
N_
(
"Stereo"
),
N_
(
"Surround 4.0"
),
N_
(
"Surround 4.1"
),
N_
(
"Surround 5.0"
),
N_
(
"Surround 5.1"
),
N_
(
"Surround 5.0"
),
N_
(
"Surround 5.1"
),
N_
(
"Surround 7.1"
),
};
vlc_module_begin
()
...
...
@@ -169,6 +170,7 @@ static void Play (audio_output_t *, block_t *);
static
void
Pause
(
audio_output_t
*
,
bool
,
mtime_t
);
static
void
PauseDummy
(
audio_output_t
*
,
bool
,
mtime_t
);
static
void
Flush
(
audio_output_t
*
,
bool
);
static
void
Reorder71
(
void
*
,
size_t
,
unsigned
);
/** Initializes an ALSA playback stream */
static
int
Open
(
vlc_object_t
*
obj
)
...
...
@@ -504,6 +506,15 @@ static int Open (vlc_object_t *obj)
{
aout
->
format
.
i_original_channels
=
aout
->
format
.
i_physical_channels
=
map
;
switch
(
popcount
(
map
))
{
case
8
:
sys
->
reorder
=
Reorder71
;
break
;
default:
sys
->
reorder
=
NULL
;
}
aout_VolumeSoftInit
(
aout
);
}
...
...
@@ -534,6 +545,11 @@ error:
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
,
aout
->
format
.
i_bitspersample
/
8
);
snd_pcm_t
*
pcm
=
sys
->
pcm
;
snd_pcm_sframes_t
frames
;
snd_pcm_state_t
state
=
snd_pcm_state
(
pcm
);
...
...
@@ -650,6 +666,47 @@ static void Close (vlc_object_t *obj)
free
(
sys
);
}
/**
* 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
)
{
switch
(
size
)
{
case
4
:
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
:
for
(
uint32_t
*
ptr
=
p
;
n
>
0
;
ptr
+=
4
,
n
--
)
{
uint32_t
middle
=
ptr
[
1
],
c_lfe
=
ptr
[
2
],
rear
=
ptr
[
3
];
ptr
[
1
]
=
c_lfe
;
ptr
[
2
]
=
rear
;
ptr
[
3
]
=
middle
;
}
break
;
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
;
}
break
;
}
}
/*****************************************************************************
* config variable callback
*****************************************************************************/
...
...
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