Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
7821264c
Commit
7821264c
authored
Apr 14, 2012
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: simplify audio_open, rename parameters to more explanatory names
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
73420379
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
ffplay.c
ffplay.c
+12
-12
No files found.
ffplay.c
View file @
7821264c
...
...
@@ -2242,18 +2242,18 @@ static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
is
->
audio_current_pts_drift
=
is
->
audio_current_pts
-
audio_callback_time
/
1000000
.
0
;
}
static
int
audio_open
(
void
*
opaque
,
int64_t
channel_layout
,
int
channels
,
int
sample_rate
,
struct
AudioParams
*
audio
)
static
int
audio_open
(
void
*
opaque
,
int64_t
wanted_channel_layout
,
int
wanted_nb_channels
,
int
wanted_sample_rate
,
struct
AudioParams
*
audio_hw_params
)
{
SDL_AudioSpec
wanted_spec
,
spec
;
const
char
*
env
;
int64_t
wanted_channel_layout
=
0
;
int
wanted_nb_channels
;
env
=
SDL_getenv
(
"SDL_AUDIO_CHANNELS"
);
if
(
env
)
wanted_channel_layout
=
av_get_default_channel_layout
(
SDL_atoi
(
env
));
if
(
!
wanted_channel_layout
)
{
wanted_channel_layout
=
(
channel_layout
&&
channels
==
av_get_channel_layout_nb_channels
(
channel_layout
))
?
channel_layout
:
av_get_default_channel_layout
(
channels
);
if
(
env
)
{
wanted_nb_channels
=
SDL_atoi
(
env
);
wanted_channel_layout
=
av_get_default_channel_layout
(
wanted_nb_channels
);
}
if
(
!
wanted_channel_layout
||
wanted_nb_channels
!=
av_get_channel_layout_nb_channels
(
wanted_channel_layout
))
{
wanted_channel_layout
=
av_get_default_channel_layout
(
wanted_nb_channels
);
wanted_channel_layout
&=
~
AV_CH_LAYOUT_STEREO_DOWNMIX
;
wanted_nb_channels
=
av_get_channel_layout_nb_channels
(
wanted_channel_layout
);
/* SDL only supports 1, 2, 4 or 6 channels at the moment, so we have to make sure not to request anything else. */
...
...
@@ -2263,7 +2263,7 @@ static int audio_open(void *opaque, int64_t channel_layout, int channels, int sa
}
}
wanted_spec
.
channels
=
av_get_channel_layout_nb_channels
(
wanted_channel_layout
);
wanted_spec
.
freq
=
sample_rate
;
wanted_spec
.
freq
=
wanted_
sample_rate
;
if
(
wanted_spec
.
freq
<=
0
||
wanted_spec
.
channels
<=
0
)
{
fprintf
(
stderr
,
"Invalid sample rate or channel count!
\n
"
);
return
-
1
;
...
...
@@ -2289,10 +2289,10 @@ static int audio_open(void *opaque, int64_t channel_layout, int channels, int sa
}
}
audio
->
fmt
=
AV_SAMPLE_FMT_S16
;
audio
->
freq
=
spec
.
freq
;
audio
->
channel_layout
=
wanted_channel_layout
;
audio
->
channels
=
spec
.
channels
;
audio
_hw_params
->
fmt
=
AV_SAMPLE_FMT_S16
;
audio
_hw_params
->
freq
=
spec
.
freq
;
audio
_hw_params
->
channel_layout
=
wanted_channel_layout
;
audio
_hw_params
->
channels
=
spec
.
channels
;
return
spec
.
size
;
}
...
...
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