1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

fftools/ffmpeg: use local variable with same contents directly

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
Limin Wang 2020-04-26 17:49:17 +08:00
parent 3a822717bd
commit 683e421bcf

View File

@ -501,32 +501,37 @@ static void ffmpeg_cleanup(int ret)
FilterGraph *fg = filtergraphs[i]; FilterGraph *fg = filtergraphs[i];
avfilter_graph_free(&fg->graph); avfilter_graph_free(&fg->graph);
for (j = 0; j < fg->nb_inputs; j++) { for (j = 0; j < fg->nb_inputs; j++) {
while (av_fifo_size(fg->inputs[j]->frame_queue)) { InputFilter *ifilter = fg->inputs[j];
struct InputStream *ist = ifilter->ist;
while (av_fifo_size(ifilter->frame_queue)) {
AVFrame *frame; AVFrame *frame;
av_fifo_generic_read(fg->inputs[j]->frame_queue, &frame, av_fifo_generic_read(ifilter->frame_queue, &frame,
sizeof(frame), NULL); sizeof(frame), NULL);
av_frame_free(&frame); av_frame_free(&frame);
} }
av_fifo_freep(&fg->inputs[j]->frame_queue); av_fifo_freep(&ifilter->frame_queue);
if (fg->inputs[j]->ist->sub2video.sub_queue) { if (ist->sub2video.sub_queue) {
while (av_fifo_size(fg->inputs[j]->ist->sub2video.sub_queue)) { while (av_fifo_size(ist->sub2video.sub_queue)) {
AVSubtitle sub; AVSubtitle sub;
av_fifo_generic_read(fg->inputs[j]->ist->sub2video.sub_queue, av_fifo_generic_read(ist->sub2video.sub_queue,
&sub, sizeof(sub), NULL); &sub, sizeof(sub), NULL);
avsubtitle_free(&sub); avsubtitle_free(&sub);
} }
av_fifo_freep(&fg->inputs[j]->ist->sub2video.sub_queue); av_fifo_freep(&ist->sub2video.sub_queue);
} }
av_buffer_unref(&fg->inputs[j]->hw_frames_ctx); av_buffer_unref(&ifilter->hw_frames_ctx);
av_freep(&fg->inputs[j]->name); av_freep(&ifilter->name);
av_freep(&fg->inputs[j]); av_freep(&fg->inputs[j]);
} }
av_freep(&fg->inputs); av_freep(&fg->inputs);
for (j = 0; j < fg->nb_outputs; j++) { for (j = 0; j < fg->nb_outputs; j++) {
av_freep(&fg->outputs[j]->name); OutputFilter *ofilter = fg->outputs[j];
av_freep(&fg->outputs[j]->formats);
av_freep(&fg->outputs[j]->channel_layouts); av_freep(&ofilter->name);
av_freep(&fg->outputs[j]->sample_rates); av_freep(&ofilter->formats);
av_freep(&ofilter->channel_layouts);
av_freep(&ofilter->sample_rates);
av_freep(&fg->outputs[j]); av_freep(&fg->outputs[j]);
} }
av_freep(&fg->outputs); av_freep(&fg->outputs);