|
|
@ -84,14 +84,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AVFilterContext *ctx = inlink->dst; |
|
|
|
AVFilterContext *ctx = inlink->dst; |
|
|
|
ShuffleFramesContext *s = ctx->priv; |
|
|
|
ShuffleFramesContext *s = ctx->priv; |
|
|
|
int ret; |
|
|
|
int ret = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (s->in_frames < s->nb_frames) { |
|
|
|
if (s->in_frames < s->nb_frames) { |
|
|
|
s->frames[s->in_frames] = frame; |
|
|
|
s->frames[s->in_frames] = frame; |
|
|
|
s->pts[s->in_frames] = frame->pts; |
|
|
|
s->pts[s->in_frames] = frame->pts; |
|
|
|
s->in_frames++; |
|
|
|
s->in_frames++; |
|
|
|
ret = 0; |
|
|
|
} |
|
|
|
} else if (s->in_frames == s->nb_frames) { |
|
|
|
|
|
|
|
|
|
|
|
if (s->in_frames == s->nb_frames) { |
|
|
|
int n, x; |
|
|
|
int n, x; |
|
|
|
|
|
|
|
|
|
|
|
for (n = 0; n < s->nb_frames; n++) { |
|
|
|
for (n = 0; n < s->nb_frames; n++) { |
|
|
@ -108,8 +109,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
|
|
|
|
|
|
|
|
|
|
|
for (n = 0; n < s->nb_frames; n++) |
|
|
|
for (n = 0; n < s->nb_frames; n++) |
|
|
|
av_frame_free(&s->frames[n]); |
|
|
|
av_frame_free(&s->frames[n]); |
|
|
|
} else |
|
|
|
} |
|
|
|
av_assert0(0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
@ -118,6 +118,11 @@ static av_cold void uninit(AVFilterContext *ctx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ShuffleFramesContext *s = ctx->priv; |
|
|
|
ShuffleFramesContext *s = ctx->priv; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (s->in_frames > 0) { |
|
|
|
|
|
|
|
s->in_frames--; |
|
|
|
|
|
|
|
av_frame_free(&s->frames[s->in_frames]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
av_freep(&s->frames); |
|
|
|
av_freep(&s->frames); |
|
|
|
av_freep(&s->map); |
|
|
|
av_freep(&s->map); |
|
|
|
av_freep(&s->pts); |
|
|
|
av_freep(&s->pts); |
|
|
|