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
c8e9c927
Commit
c8e9c927
authored
May 26, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/bbox: export bbox info to frame metadata
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
add8c63c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
vf_bbox.c
libavfilter/vf_bbox.c
+14
-0
No files found.
libavfilter/vf_bbox.c
View file @
c8e9c927
...
...
@@ -60,12 +60,17 @@ static int query_formats(AVFilterContext *ctx)
return
0
;
}
#define SET_META(key, value) \
snprintf(buf, sizeof(buf), "%d", value); \
av_dict_set(metadata, #key, buf, 0); \
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
frame
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
BBoxContext
*
bbox
=
ctx
->
priv
;
FFBoundingBox
box
;
int
has_bbox
,
w
,
h
;
char
buf
[
32
];
has_bbox
=
ff_calculate_bounding_box
(
&
box
,
...
...
@@ -79,6 +84,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
av_ts2str
(
frame
->
pts
),
av_ts2timestr
(
frame
->
pts
,
&
inlink
->
time_base
));
if
(
has_bbox
)
{
AVDictionary
**
metadata
=
avpriv_frame_get_metadatap
(
frame
);
SET_META
(
"lavfi.bbox.x1"
,
box
.
x1
)
SET_META
(
"lavfi.bbox.x2"
,
box
.
x2
)
SET_META
(
"lavfi.bbox.y1"
,
box
.
y1
)
SET_META
(
"lavfi.bbox.y2"
,
box
.
y2
)
SET_META
(
"lavfi.bbox.w"
,
w
)
SET_META
(
"lavfi.bbox.h"
,
h
)
av_log
(
ctx
,
AV_LOG_INFO
,
" x1:%d x2:%d y1:%d y2:%d w:%d h:%d"
" crop=%d:%d:%d:%d drawbox=%d:%d:%d:%d"
,
...
...
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