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
431dcc49
Commit
431dcc49
authored
Dec 11, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swr: make realloc_audio() available outside swresample.c
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
5a5d7074
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
swresample.c
libswresample/swresample.c
+11
-11
swresample_internal.h
libswresample/swresample_internal.h
+1
-0
No files found.
libswresample/swresample.c
View file @
431dcc49
...
...
@@ -369,7 +369,7 @@ av_assert0(s->out.ch_count);
return
0
;
}
static
int
realloc_audio
(
AudioData
*
a
,
int
count
){
int
swri_
realloc_audio
(
AudioData
*
a
,
int
count
){
int
i
,
countb
;
AudioData
old
;
...
...
@@ -509,7 +509,7 @@ static int resample(SwrContext *s, AudioData *out_param, int out_count,
copy
(
&
s
->
in_buffer
,
&
tmp
,
s
->
in_buffer_count
);
s
->
in_buffer_index
=
0
;
}
else
if
((
ret
=
realloc_audio
(
&
s
->
in_buffer
,
size
))
<
0
)
if
((
ret
=
swri_
realloc_audio
(
&
s
->
in_buffer
,
size
))
<
0
)
return
ret
;
if
(
in_count
){
...
...
@@ -549,18 +549,18 @@ static int swr_convert_internal(struct SwrContext *s, AudioData *out, int out_co
// in_max= out_count*(int64_t)s->in_sample_rate / s->out_sample_rate + resample_filter_taps;
// in_count= FFMIN(in_count, in_in + 2 - s->hist_buffer_count);
if
((
ret
=
realloc_audio
(
&
s
->
postin
,
in_count
))
<
0
)
if
((
ret
=
swri_
realloc_audio
(
&
s
->
postin
,
in_count
))
<
0
)
return
ret
;
if
(
s
->
resample_first
){
av_assert0
(
s
->
midbuf
.
ch_count
==
s
->
used_ch_count
);
if
((
ret
=
realloc_audio
(
&
s
->
midbuf
,
out_count
))
<
0
)
if
((
ret
=
swri_
realloc_audio
(
&
s
->
midbuf
,
out_count
))
<
0
)
return
ret
;
}
else
{
av_assert0
(
s
->
midbuf
.
ch_count
==
s
->
out
.
ch_count
);
if
((
ret
=
realloc_audio
(
&
s
->
midbuf
,
in_count
))
<
0
)
if
((
ret
=
swri_
realloc_audio
(
&
s
->
midbuf
,
in_count
))
<
0
)
return
ret
;
}
if
((
ret
=
realloc_audio
(
&
s
->
preout
,
out_count
))
<
0
)
if
((
ret
=
swri_
realloc_audio
(
&
s
->
preout
,
out_count
))
<
0
)
return
ret
;
postin
=
&
s
->
postin
;
...
...
@@ -613,7 +613,7 @@ static int swr_convert_internal(struct SwrContext *s, AudioData *out, int out_co
int
dither_count
=
FFMAX
(
out_count
,
1
<<
16
);
av_assert0
(
preout
!=
in
);
if
((
ret
=
realloc_audio
(
&
s
->
dither
,
dither_count
))
<
0
)
if
((
ret
=
swri_
realloc_audio
(
&
s
->
dither
,
dither_count
))
<
0
)
return
ret
;
if
(
ret
)
for
(
ch
=
0
;
ch
<
s
->
dither
.
ch_count
;
ch
++
)
...
...
@@ -645,7 +645,7 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
uint8_t
*
tmp_arg
[
SWR_CH_MAX
];
tmp
.
count
=
0
;
tmp
.
data
=
NULL
;
if
((
ret
=
realloc_audio
(
&
tmp
,
s
->
drop_output
))
<
0
)
if
((
ret
=
swri_
realloc_audio
(
&
tmp
,
s
->
drop_output
))
<
0
)
return
ret
;
reversefill_audiodata
(
&
tmp
,
tmp_arg
);
...
...
@@ -666,7 +666,7 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
if
(
s
->
resample
&&
!
s
->
flushed
)
{
AudioData
*
a
=
&
s
->
in_buffer
;
int
i
,
j
,
ret
;
if
((
ret
=
realloc_audio
(
a
,
s
->
in_buffer_index
+
2
*
s
->
in_buffer_count
))
<
0
)
if
((
ret
=
swri_
realloc_audio
(
a
,
s
->
in_buffer_index
+
2
*
s
->
in_buffer_count
))
<
0
)
return
ret
;
av_assert0
(
a
->
planar
);
for
(
i
=
0
;
i
<
a
->
ch_count
;
i
++
){
...
...
@@ -721,7 +721,7 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
copy
(
&
s
->
in_buffer
,
&
tmp
,
s
->
in_buffer_count
);
s
->
in_buffer_index
=
0
;
}
else
if
((
ret
=
realloc_audio
(
&
s
->
in_buffer
,
size
))
<
0
)
if
((
ret
=
swri_
realloc_audio
(
&
s
->
in_buffer
,
size
))
<
0
)
return
ret
;
}
...
...
@@ -766,7 +766,7 @@ int swr_inject_silence(struct SwrContext *s, int count){
silence
.
count
=
0
;
silence
.
data
=
NULL
;
if
((
ret
=
realloc_audio
(
&
silence
,
count
))
<
0
)
if
((
ret
=
swri_
realloc_audio
(
&
silence
,
count
))
<
0
)
return
ret
;
if
(
silence
.
planar
)
for
(
i
=
0
;
i
<
silence
.
ch_count
;
i
++
)
{
...
...
libswresample/swresample_internal.h
View file @
431dcc49
...
...
@@ -141,6 +141,7 @@ struct Resampler {
extern
struct
Resampler
const
swri_resampler
;
int
swri_realloc_audio
(
AudioData
*
a
,
int
count
);
int
swri_resample_int16
(
struct
ResampleContext
*
c
,
int16_t
*
dst
,
const
int16_t
*
src
,
int
*
consumed
,
int
src_size
,
int
dst_size
,
int
update_ctx
);
int
swri_resample_int32
(
struct
ResampleContext
*
c
,
int32_t
*
dst
,
const
int32_t
*
src
,
int
*
consumed
,
int
src_size
,
int
dst_size
,
int
update_ctx
);
int
swri_resample_float
(
struct
ResampleContext
*
c
,
float
*
dst
,
const
float
*
src
,
int
*
consumed
,
int
src_size
,
int
dst_size
,
int
update_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