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
7b78684f
Commit
7b78684f
authored
Jan 27, 2023
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_random: set output frame duration
parent
a749e43c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
vf_random.c
libavfilter/vf_random.c
+6
-0
No files found.
libavfilter/vf_random.c
View file @
7b78684f
...
...
@@ -37,6 +37,7 @@ typedef struct RandomContext {
int
nb_frames_filled
;
AVFrame
*
frames
[
MAX_FRAMES
];
int64_t
pts
[
MAX_FRAMES
];
int64_t
duration
[
MAX_FRAMES
];
int
flush_idx
;
}
RandomContext
;
...
...
@@ -74,6 +75,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
if
(
s
->
nb_frames_filled
<
s
->
nb_frames
)
{
s
->
frames
[
s
->
nb_frames_filled
]
=
in
;
s
->
duration
[
s
->
nb_frames_filled
]
=
in
->
duration
;
s
->
pts
[
s
->
nb_frames_filled
++
]
=
in
->
pts
;
return
0
;
}
...
...
@@ -82,9 +84,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
out
=
s
->
frames
[
idx
];
out
->
pts
=
s
->
pts
[
0
];
out
->
duration
=
s
->
duration
[
0
];
memmove
(
&
s
->
pts
[
0
],
&
s
->
pts
[
1
],
(
s
->
nb_frames
-
1
)
*
sizeof
(
s
->
pts
[
0
]));
memmove
(
&
s
->
duration
[
0
],
&
s
->
duration
[
1
],
(
s
->
nb_frames
-
1
)
*
sizeof
(
s
->
duration
[
0
]));
s
->
frames
[
idx
]
=
in
;
s
->
pts
[
s
->
nb_frames
-
1
]
=
in
->
pts
;
s
->
duration
[
s
->
nb_frames
-
1
]
=
in
->
duration
;
return
ff_filter_frame
(
outlink
,
out
);
}
...
...
@@ -104,6 +109,7 @@ next:
s
->
nb_frames
--
;
goto
next
;
}
out
->
duration
=
s
->
duration
[
s
->
flush_idx
];
out
->
pts
=
s
->
pts
[
s
->
flush_idx
++
];
ret
=
ff_filter_frame
(
outlink
,
out
);
s
->
frames
[
s
->
nb_frames
-
1
]
=
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