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
64c5fbd7
Commit
64c5fbd7
authored
Dec 10, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/select: remove deprecated and unused poll_frame() callback
Simplify.
parent
26db6535
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
62 deletions
+3
-62
vf_select.c
libavfilter/vf_select.c
+3
-62
No files found.
libavfilter/vf_select.c
View file @
64c5fbd7
...
...
@@ -113,8 +113,6 @@ enum var_name {
VAR_VARS_NB
};
#define FIFO_SIZE 8
typedef
struct
{
AVExpr
*
expr
;
double
var_values
[
VAR_VARS_NB
];
...
...
@@ -126,8 +124,6 @@ typedef struct {
#endif
AVFilterBufferRef
*
prev_picref
;
///< previous frame (scene detect only)
double
select
;
int
cache_frames
;
AVFifoBuffer
*
pending_frames
;
///< FIFO buffer of video frames
}
SelectContext
;
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
...
...
@@ -141,12 +137,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
return
ret
;
}
select
->
pending_frames
=
av_fifo_alloc
(
FIFO_SIZE
*
sizeof
(
AVFilterBufferRef
*
));
if
(
!
select
->
pending_frames
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Failed to allocate pending frames buffer.
\n
"
);
return
AVERROR
(
ENOMEM
);
}
select
->
do_scene_detect
=
args
&&
strstr
(
args
,
"scene"
);
if
(
select
->
do_scene_detect
&&
!
CONFIG_AVCODEC
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Scene detection is not available without libavcodec.
\n
"
);
...
...
@@ -294,20 +284,8 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
SelectContext
*
select
=
inlink
->
dst
->
priv
;
select
->
select
=
select_frame
(
inlink
->
dst
,
frame
);
if
(
select
->
select
)
{
/* frame was requested through poll_frame */
if
(
select
->
cache_frames
)
{
if
(
!
av_fifo_space
(
select
->
pending_frames
))
{
av_log
(
inlink
->
dst
,
AV_LOG_ERROR
,
"Buffering limit reached, cannot cache more frames
\n
"
);
avfilter_unref_bufferp
(
&
frame
);
}
else
av_fifo_generic_write
(
select
->
pending_frames
,
&
frame
,
sizeof
(
frame
),
NULL
);
return
0
;
}
if
(
select
->
select
)
return
ff_filter_frame
(
inlink
->
dst
->
outputs
[
0
],
frame
);
}
avfilter_unref_bufferp
(
&
frame
);
return
0
;
...
...
@@ -320,58 +298,22 @@ static int request_frame(AVFilterLink *outlink)
AVFilterLink
*
inlink
=
outlink
->
src
->
inputs
[
0
];
select
->
select
=
0
;
if
(
av_fifo_size
(
select
->
pending_frames
))
{
AVFilterBufferRef
*
picref
;
av_fifo_generic_read
(
select
->
pending_frames
,
&
picref
,
sizeof
(
picref
),
NULL
);
return
ff_filter_frame
(
outlink
,
picref
);
}
while
(
!
select
->
select
)
{
do
{
int
ret
=
ff_request_frame
(
inlink
);
if
(
ret
<
0
)
return
ret
;
}
}
while
(
!
select
->
select
);
return
0
;
}
static
int
poll_frame
(
AVFilterLink
*
outlink
)
{
SelectContext
*
select
=
outlink
->
src
->
priv
;
AVFilterLink
*
inlink
=
outlink
->
src
->
inputs
[
0
];
int
count
,
ret
;
if
(
!
av_fifo_size
(
select
->
pending_frames
))
{
if
((
count
=
ff_poll_frame
(
inlink
))
<=
0
)
return
count
;
/* request frame from input, and apply select condition to it */
select
->
cache_frames
=
1
;
while
(
count
--
&&
av_fifo_space
(
select
->
pending_frames
))
{
ret
=
ff_request_frame
(
inlink
);
if
(
ret
<
0
)
break
;
}
select
->
cache_frames
=
0
;
}
return
av_fifo_size
(
select
->
pending_frames
)
/
sizeof
(
AVFilterBufferRef
*
);
}
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
{
SelectContext
*
select
=
ctx
->
priv
;
AVFilterBufferRef
*
picref
;
av_expr_free
(
select
->
expr
);
select
->
expr
=
NULL
;
while
(
select
->
pending_frames
&&
av_fifo_generic_read
(
select
->
pending_frames
,
&
picref
,
sizeof
(
picref
),
NULL
)
==
sizeof
(
picref
))
avfilter_unref_buffer
(
picref
);
av_fifo_free
(
select
->
pending_frames
);
select
->
pending_frames
=
NULL
;
if
(
select
->
do_scene_detect
)
{
avfilter_unref_bufferp
(
&
select
->
prev_picref
);
if
(
select
->
avctx
)
{
...
...
@@ -413,7 +355,6 @@ static const AVFilterPad avfilter_vf_select_outputs[] = {
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
poll_frame
=
poll_frame
,
.
request_frame
=
request_frame
,
},
{
NULL
}
...
...
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