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
b12e61ac
Commit
b12e61ac
authored
Jun 29, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay: factorize expression in audio_decode_frame()
Possibly improve readability.
parent
6f5e7e86
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
ffplay.c
ffplay.c
+3
-3
No files found.
ffplay.c
View file @
b12e61ac
...
...
@@ -1985,6 +1985,7 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
if
(
is
->
swr_ctx
)
{
const
uint8_t
*
in
[]
=
{
is
->
frame
->
data
[
0
]
};
uint8_t
*
out
[]
=
{
is
->
audio_buf2
};
int
out_count
=
sizeof
(
is
->
audio_buf2
)
/
is
->
audio_tgt
.
channels
/
av_get_bytes_per_sample
(
is
->
audio_tgt
.
fmt
);
if
(
wanted_nb_samples
!=
is
->
frame
->
nb_samples
)
{
if
(
swr_set_compensation
(
is
->
swr_ctx
,
(
wanted_nb_samples
-
is
->
frame
->
nb_samples
)
*
is
->
audio_tgt
.
freq
/
dec
->
sample_rate
,
wanted_nb_samples
*
is
->
audio_tgt
.
freq
/
dec
->
sample_rate
)
<
0
)
{
...
...
@@ -1992,13 +1993,12 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
break
;
}
}
len2
=
swr_convert
(
is
->
swr_ctx
,
out
,
sizeof
(
is
->
audio_buf2
)
/
is
->
audio_tgt
.
channels
/
av_get_bytes_per_sample
(
is
->
audio_tgt
.
fmt
),
in
,
is
->
frame
->
nb_samples
);
len2
=
swr_convert
(
is
->
swr_ctx
,
out
,
out_count
,
in
,
is
->
frame
->
nb_samples
);
if
(
len2
<
0
)
{
fprintf
(
stderr
,
"swr_convert() failed
\n
"
);
break
;
}
if
(
len2
==
sizeof
(
is
->
audio_buf2
)
/
is
->
audio_tgt
.
channels
/
av_get_bytes_per_sample
(
is
->
audio_tgt
.
fmt
)
)
{
if
(
len2
==
out_count
)
{
fprintf
(
stderr
,
"warning: audio buffer is probably too small
\n
"
);
swr_init
(
is
->
swr_ctx
);
}
...
...
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