Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
1ba2d089
Commit
1ba2d089
authored
Jun 01, 2024
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/asubprocess: maintain a list of unused buffers
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
dbed10fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
af_asubprocess.c
libavfilter/af_asubprocess.c
+14
-6
No files found.
libavfilter/af_asubprocess.c
View file @
1ba2d089
...
...
@@ -39,6 +39,7 @@ typedef struct SP
int
input_pipe
;
int
output_pipe
;
SPB
*
out_buffers
;
SPB
*
unused_buffers
;
int
pid
;
size_t
input_count
;
bool
done
;
...
...
@@ -68,10 +69,16 @@ typedef struct AndioWMarkContext {
FFFrameQueue
frame_queue
;
}
ASubProcessContext
;
// =============================================
static
SPB
*
spb_new
(
void
)
static
SPB
*
spb_new
(
AVFilterContext
*
ctx
)
{
SPB
*
spb
=
av_malloc
(
sizeof
(
SPB
));
ASubProcessContext
*
s
=
ctx
->
priv
;
SPB
*
spb
=
s
->
sp
->
unused_buffers
;
if
(
spb
)
{
s
->
sp
->
unused_buffers
=
spb
->
next
;
}
else
{
spb
=
av_malloc
(
sizeof
(
SPB
));
}
spb
->
next
=
NULL
;
spb
->
offset
=
0
;
...
...
@@ -178,7 +185,8 @@ sp_read(SP *sp, char *buffer, int count)
return
;
sp
->
out_buffers
=
spb
->
next
;
av_free
(
spb
);
spb
->
next
=
sp
->
unused_buffers
;
sp
->
unused_buffers
=
spb
;
spb
=
sp
->
out_buffers
;
}
}
...
...
@@ -306,14 +314,14 @@ sp_write(AVFilterContext *ctx, char *buffer, int count)
int
rc
,
ret
;
if
(
!
sp
->
out_buffers
)
sp
->
out_buffers
=
spb_new
();
sp
->
out_buffers
=
spb_new
(
ctx
);
last
=
sp
->
out_buffers
;
while
(
last
->
next
)
last
=
last
->
next
;
if
(
last
->
count
==
sizeof
(
last
->
data
))
{
last
->
next
=
spb_new
();
last
->
next
=
spb_new
(
ctx
);
last
=
last
->
next
;
}
rc
=
read
(
sp
->
output_pipe
,
last
->
data
+
last
->
count
,
sizeof
(
last
->
data
)
-
last
->
count
);
...
...
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