Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
4f16153d
Commit
4f16153d
authored
Mar 25, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swr: allow flushing in multiple steps if the output is too small.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
8bf95e8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
swresample.c
libswresample/swresample.c
+14
-11
swresample_internal.h
libswresample/swresample_internal.h
+1
-0
No files found.
libswresample/swresample.c
View file @
4f16153d
...
...
@@ -435,19 +435,22 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
if
(
!
in_arg
){
if
(
s
->
in_buffer_count
){
AudioData
*
a
=
&
s
->
in_buffer
;
int
i
,
j
,
ret
;
if
((
ret
=
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
++
){
for
(
j
=
0
;
j
<
s
->
in_buffer_count
;
j
++
){
memcpy
(
a
->
ch
[
i
]
+
(
s
->
in_buffer_index
+
s
->
in_buffer_count
+
j
)
*
a
->
bps
,
a
->
ch
[
i
]
+
(
s
->
in_buffer_index
+
s
->
in_buffer_count
-
j
-
1
)
*
a
->
bps
,
a
->
bps
);
if
(
!
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
)
return
ret
;
av_assert0
(
a
->
planar
);
for
(
i
=
0
;
i
<
a
->
ch_count
;
i
++
){
for
(
j
=
0
;
j
<
s
->
in_buffer_count
;
j
++
){
memcpy
(
a
->
ch
[
i
]
+
(
s
->
in_buffer_index
+
s
->
in_buffer_count
+
j
)
*
a
->
bps
,
a
->
ch
[
i
]
+
(
s
->
in_buffer_index
+
s
->
in_buffer_count
-
j
-
1
)
*
a
->
bps
,
a
->
bps
);
}
}
s
->
in_buffer_count
+=
(
s
->
in_buffer_count
+
1
)
/
2
;
s
->
resample_in_constraint
=
0
;
s
->
flushed
=
1
;
}
s
->
in_buffer_count
+=
(
s
->
in_buffer_count
+
1
)
/
2
;
s
->
resample_in_constraint
=
0
;
}
else
{
return
0
;
}
...
...
libswresample/swresample_internal.h
View file @
4f16153d
...
...
@@ -64,6 +64,7 @@ struct SwrContext {
int
in_buffer_index
;
///< cached buffer position
int
in_buffer_count
;
///< cached buffer length
int
resample_in_constraint
;
///< 1 if the input end was reach before the output end, 0 otherwise
int
flushed
;
///< 1 if data is to be flushed and no further input is expected
struct
AudioConvert
*
in_convert
;
///< input conversion context
struct
AudioConvert
*
out_convert
;
///< output conversion context
...
...
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