Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mike Will
VLC
Commits
b04deb0a
Commit
b04deb0a
authored
7 years ago
by
Thomas Guillem
Browse files
Options
Downloads
Patches
Plain Diff
pulse: refactor pa_format_info initialisation
parent
359f0799
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/audio_output/pulse.c
+11
-19
11 additions, 19 deletions
modules/audio_output/pulse.c
with
11 additions
and
19 deletions
modules/audio_output/pulse.c
+
11
−
19
View file @
b04deb0a
...
...
@@ -695,8 +695,8 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
aout_sys_t
*
sys
=
aout
->
sys
;
/* Sample format specification */
struct
pa_sample_spec
ss
;
pa_encoding_t
encoding
=
PA_ENCODING_
INVALID
;
struct
pa_sample_spec
ss
=
{
.
format
=
PA_SAMPLE_INVALID
}
;
pa_encoding_t
encoding
=
PA_ENCODING_
PCM
;
switch
(
fmt
->
i_format
)
{
...
...
@@ -722,7 +722,6 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
fmt
->
i_physical_channels
=
AOUT_CHANS_2_0
;
fmt
->
i_channels
=
2
;
encoding
=
PA_ENCODING_AC3_IEC61937
;
ss
.
format
=
PA_SAMPLE_S16NE
;
break
;
case
VLC_CODEC_EAC3
:
fmt
->
i_format
=
VLC_CODEC_SPDIFL
;
...
...
@@ -731,12 +730,10 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
fmt
->
i_physical_channels
=
AOUT_CHANS_2_0
;
fmt
->
i_channels
=
2
;
encoding
=
PA_ENCODING_EAC3_IEC61937
;
ss
.
format
=
PA_SAMPLE_S16NE
;
break
;
/* case VLC_CODEC_MPGA:
fmt->i_format = VLC_CODEC_SPDIFL FIXME;
encoding = PA_ENCODING_MPEG_IEC61937;
ss.format = PA_SAMPLE_S16NE;
break;*/
case
VLC_CODEC_DTS
:
fmt
->
i_format
=
VLC_CODEC_SPDIFL
;
...
...
@@ -745,7 +742,6 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
fmt
->
i_physical_channels
=
AOUT_CHANS_2_0
;
fmt
->
i_channels
=
2
;
encoding
=
PA_ENCODING_DTS_IEC61937
;
ss
.
format
=
PA_SAMPLE_S16NE
;
break
;
default:
if
(
!
AOUT_FMT_LINEAR
(
fmt
)
||
aout_FormatNbChannels
(
fmt
)
==
0
)
...
...
@@ -800,13 +796,14 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
pa_cvolume_init
(
&
sys
->
cvolume
);
sys
->
first_pts
=
VLC_TS_INVALID
;
pa_format_info
*
formatv
;
pa_format_info
*
formatv
=
pa_format_info_new
();
formatv
->
encoding
=
encoding
;
pa_format_info_set_rate
(
formatv
,
ss
.
rate
);
if
(
ss
.
format
!=
PA_SAMPLE_INVALID
)
pa_format_info_set_sample_format
(
formatv
,
ss
.
format
);
/* Favor digital pass-through if available*/
if
(
encoding
!=
PA_ENCODING_INVALID
)
{
formatv
=
pa_format_info_new
();
formatv
->
encoding
=
encoding
;
pa_format_info_set_rate
(
formatv
,
ss
.
rate
);
if
(
encoding
!=
PA_ENCODING_PCM
)
{
pa_format_info_set_channels
(
formatv
,
ss
.
channels
);
/* FIX flags are only permitted for PCM, and there is no way to pass
...
...
@@ -860,11 +857,6 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
msg_Dbg
(
aout
,
"using %s channel map"
,
(
name
!=
NULL
)
?
name
:
"?"
);
}
/* PCM */
formatv
=
pa_format_info_new
();
formatv
->
encoding
=
PA_ENCODING_PCM
;
pa_format_info_set_sample_format
(
formatv
,
ss
.
format
);
pa_format_info_set_rate
(
formatv
,
ss
.
rate
);
pa_format_info_set_channels
(
formatv
,
ss
.
channels
);
pa_format_info_set_channel_map
(
formatv
,
&
map
);
}
...
...
@@ -923,7 +915,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
if
(
pa_stream_connect_playback
(
s
,
sys
->
sink_force
,
&
attr
,
flags
,
cvolume
,
NULL
)
<
0
||
stream_wait
(
s
,
sys
->
mainloop
))
{
if
(
encoding
!=
PA_ENCODING_
INVALID
)
if
(
encoding
!=
PA_ENCODING_
PCM
)
vlc_pa_error
(
aout
,
"digital pass-through stream connection failure"
,
sys
->
context
);
else
...
...
@@ -935,7 +927,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
free
(
sys
->
sink_force
);
sys
->
sink_force
=
NULL
;
if
(
encoding
==
PA_ENCODING_
INVALID
)
if
(
encoding
==
PA_ENCODING_
PCM
)
{
const
struct
pa_sample_spec
*
spec
=
pa_stream_get_sample_spec
(
s
);
fmt
->
i_rate
=
spec
->
rate
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment