[FFmpeg-cvslog] avfilter/fade: use inlink->frame_count.
Clément Bœsch
git at videolan.org
Sun Nov 10 19:17:48 CET 2013
ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sun Nov 10 19:12:36 2013 +0100| [461e810cfce95092a0e4c346d8ca44f8d2494012] | committer: Clément Bœsch
avfilter/fade: use inlink->frame_count.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=461e810cfce95092a0e4c346d8ca44f8d2494012
---
libavfilter/vf_fade.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c
index 242ebb0..0422f1c 100644
--- a/libavfilter/vf_fade.c
+++ b/libavfilter/vf_fade.c
@@ -54,7 +54,6 @@ typedef struct {
int type;
int factor, fade_per_frame;
int start_frame, nb_frames;
- unsigned int frame_index;
int hsub, vsub, bpp;
unsigned int black_level, black_level_scaled;
uint8_t is_packed_rgb;
@@ -278,7 +277,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
if (s->fade_state == VF_FADE_WAITING) {
s->factor=0;
if ((frame_timestamp >= (s->start_time/(double)AV_TIME_BASE))
- && (s->frame_index >= s->start_frame)) {
+ && (inlink->frame_count >= s->start_frame)) {
// Time to start fading
s->fade_state = VF_FADE_FADING;
@@ -289,15 +288,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
// Save start frame in case we are starting based on time and fading based on frames
if ((s->start_time != 0) && (s->start_frame == 0)) {
- s->start_frame = s->frame_index;
+ s->start_frame = inlink->frame_count;
}
}
}
if (s->fade_state == VF_FADE_FADING) {
if (s->duration == 0) {
// Fading based on frame count
- s->factor = (s->frame_index - s->start_frame) * s->fade_per_frame;
- if (s->frame_index > (s->start_frame + s->nb_frames)) {
+ s->factor = (inlink->frame_count - s->start_frame) * s->fade_per_frame;
+ if (inlink->frame_count > (s->start_frame + s->nb_frames)) {
s->fade_state = VF_FADE_DONE;
}
@@ -342,8 +341,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
}
}
- s->frame_index++;
-
return ff_filter_frame(inlink->dst->outputs[0], frame);
}
More information about the ffmpeg-cvslog
mailing list