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
f284e2a5
Commit
f284e2a5
authored
Feb 22, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swresample: factorize clear_context() out
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
246eae98
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
26 deletions
+20
-26
swresample.c
libswresample/swresample.c
+20
-26
No files found.
libswresample/swresample.c
View file @
f284e2a5
...
...
@@ -218,33 +218,12 @@ static void free_temp(AudioData *a){
memset
(
a
,
0
,
sizeof
(
*
a
));
}
av_cold
void
swr_free
(
SwrContext
**
ss
){
SwrContext
*
s
=
*
ss
;
if
(
s
){
free_temp
(
&
s
->
postin
);
free_temp
(
&
s
->
midbuf
);
free_temp
(
&
s
->
preout
);
free_temp
(
&
s
->
in_buffer
);
free_temp
(
&
s
->
silence
);
free_temp
(
&
s
->
drop_temp
);
free_temp
(
&
s
->
dither
.
noise
);
free_temp
(
&
s
->
dither
.
temp
);
swri_audio_convert_free
(
&
s
->
in_convert
);
swri_audio_convert_free
(
&
s
->
out_convert
);
swri_audio_convert_free
(
&
s
->
full_convert
);
if
(
s
->
resampler
)
s
->
resampler
->
free
(
&
s
->
resample
);
swri_rematrix_free
(
s
);
}
av_freep
(
ss
);
}
av_cold
int
swr_init
(
struct
SwrContext
*
s
){
int
ret
;
static
void
clear_context
(
SwrContext
*
s
){
s
->
in_buffer_index
=
0
;
s
->
in_buffer_count
=
0
;
s
->
resample_in_constraint
=
0
;
memset
(
s
->
in
.
ch
,
0
,
sizeof
(
s
->
in
.
ch
));
memset
(
s
->
out
.
ch
,
0
,
sizeof
(
s
->
out
.
ch
));
free_temp
(
&
s
->
postin
);
free_temp
(
&
s
->
midbuf
);
free_temp
(
&
s
->
preout
);
...
...
@@ -253,14 +232,29 @@ av_cold int swr_init(struct SwrContext *s){
free_temp
(
&
s
->
drop_temp
);
free_temp
(
&
s
->
dither
.
noise
);
free_temp
(
&
s
->
dither
.
temp
);
memset
(
s
->
in
.
ch
,
0
,
sizeof
(
s
->
in
.
ch
));
memset
(
s
->
out
.
ch
,
0
,
sizeof
(
s
->
out
.
ch
));
swri_audio_convert_free
(
&
s
->
in_convert
);
swri_audio_convert_free
(
&
s
->
out_convert
);
swri_audio_convert_free
(
&
s
->
full_convert
);
swri_rematrix_free
(
s
);
s
->
flushed
=
0
;
}
av_cold
void
swr_free
(
SwrContext
**
ss
){
SwrContext
*
s
=
*
ss
;
if
(
s
){
clear_context
(
s
);
if
(
s
->
resampler
)
s
->
resampler
->
free
(
&
s
->
resample
);
}
av_freep
(
ss
);
}
av_cold
int
swr_init
(
struct
SwrContext
*
s
){
int
ret
;
clear_context
(
s
);
if
(
s
->
in_sample_fmt
>=
AV_SAMPLE_FMT_NB
){
av_log
(
s
,
AV_LOG_ERROR
,
"Requested input sample format %d is invalid
\n
"
,
s
->
in_sample_fmt
);
...
...
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