Re: [FFmpeg-devel] [PATCH v1 1/6] fftools/ffmpeg: use local variable with same contents directly

2020-05-05 Thread lance . lmwang
On Sun, Apr 26, 2020 at 05:49:17PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  fftools/ffmpeg.c | 31 ++-
>  1 file changed, 18 insertions(+), 13 deletions(-)
> 
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index d896b14..d2b0e71 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -501,32 +501,37 @@ static void ffmpeg_cleanup(int ret)
>  FilterGraph *fg = filtergraphs[i];
>  avfilter_graph_free(>graph);
>  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;
> -av_fifo_generic_read(fg->inputs[j]->frame_queue, ,
> +av_fifo_generic_read(ifilter->frame_queue, ,
>   sizeof(frame), NULL);
>  av_frame_free();
>  }
> -av_fifo_freep(>inputs[j]->frame_queue);
> -if (fg->inputs[j]->ist->sub2video.sub_queue) {
> -while 
> (av_fifo_size(fg->inputs[j]->ist->sub2video.sub_queue)) {
> +av_fifo_freep(>frame_queue);
> +if (ist->sub2video.sub_queue) {
> +while (av_fifo_size(ist->sub2video.sub_queue)) {
>  AVSubtitle sub;
> -
> av_fifo_generic_read(fg->inputs[j]->ist->sub2video.sub_queue,
> +av_fifo_generic_read(ist->sub2video.sub_queue,
>   , sizeof(sub), NULL);
>  avsubtitle_free();
>  }
> -av_fifo_freep(>inputs[j]->ist->sub2video.sub_queue);
> +av_fifo_freep(>sub2video.sub_queue);
>  }
> -av_buffer_unref(>inputs[j]->hw_frames_ctx);
> -av_freep(>inputs[j]->name);
> +av_buffer_unref(>hw_frames_ctx);
> +av_freep(>name);
>  av_freep(>inputs[j]);
>  }
>  av_freep(>inputs);
>  for (j = 0; j < fg->nb_outputs; j++) {
> -av_freep(>outputs[j]->name);
> -av_freep(>outputs[j]->formats);
> -av_freep(>outputs[j]->channel_layouts);
> -av_freep(>outputs[j]->sample_rates);
> +OutputFilter *ofilter = fg->outputs[j];
> +
> +av_freep(>name);
> +av_freep(>formats);
> +av_freep(>channel_layouts);
> +av_freep(>sample_rates);
>  av_freep(>outputs[j]);
>  }
>  av_freep(>outputs);
> -- 
> 1.8.3.1
> 

will apply patchset #1,#5,#6 tomorrow if no comments.

-- 
Thanks,
Limin Wang
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v1 1/6] fftools/ffmpeg: use local variable with same contents directly

2020-04-26 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 fftools/ffmpeg.c | 31 ++-
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index d896b14..d2b0e71 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -501,32 +501,37 @@ static void ffmpeg_cleanup(int ret)
 FilterGraph *fg = filtergraphs[i];
 avfilter_graph_free(>graph);
 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;
-av_fifo_generic_read(fg->inputs[j]->frame_queue, ,
+av_fifo_generic_read(ifilter->frame_queue, ,
  sizeof(frame), NULL);
 av_frame_free();
 }
-av_fifo_freep(>inputs[j]->frame_queue);
-if (fg->inputs[j]->ist->sub2video.sub_queue) {
-while (av_fifo_size(fg->inputs[j]->ist->sub2video.sub_queue)) {
+av_fifo_freep(>frame_queue);
+if (ist->sub2video.sub_queue) {
+while (av_fifo_size(ist->sub2video.sub_queue)) {
 AVSubtitle sub;
-
av_fifo_generic_read(fg->inputs[j]->ist->sub2video.sub_queue,
+av_fifo_generic_read(ist->sub2video.sub_queue,
  , sizeof(sub), NULL);
 avsubtitle_free();
 }
-av_fifo_freep(>inputs[j]->ist->sub2video.sub_queue);
+av_fifo_freep(>sub2video.sub_queue);
 }
-av_buffer_unref(>inputs[j]->hw_frames_ctx);
-av_freep(>inputs[j]->name);
+av_buffer_unref(>hw_frames_ctx);
+av_freep(>name);
 av_freep(>inputs[j]);
 }
 av_freep(>inputs);
 for (j = 0; j < fg->nb_outputs; j++) {
-av_freep(>outputs[j]->name);
-av_freep(>outputs[j]->formats);
-av_freep(>outputs[j]->channel_layouts);
-av_freep(>outputs[j]->sample_rates);
+OutputFilter *ofilter = fg->outputs[j];
+
+av_freep(>name);
+av_freep(>formats);
+av_freep(>channel_layouts);
+av_freep(>sample_rates);
 av_freep(>outputs[j]);
 }
 av_freep(>outputs);
-- 
1.8.3.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".