diff mbox series

[FFmpeg-devel,02/21] fftools/ffmpeg_dec: simplify process_subtitle()

Message ID 20230614164908.28712-2-anton@khirnov.net
State Accepted
Commit df81fb46eefa6b23aa3ed1fae81b29dd5e3d7094
Headers show
Series [FFmpeg-devel,01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov June 14, 2023, 4:48 p.m. UTC
Its got_output argument always points to 1.
---
 fftools/ffmpeg.c     | 3 +--
 fftools/ffmpeg.h     | 2 +-
 fftools/ffmpeg_dec.c | 9 +++++----
 3 files changed, 7 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index d62ccc56c9..45e71ed626 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -731,7 +731,6 @@  cleanup:
 static int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts)
 {
     int ret = AVERROR_BUG;
-    int got_output = 1;
     AVSubtitle *prev_subtitle = &ist->prev_sub.subtitle;
     AVSubtitle subtitle;
 
@@ -744,7 +743,7 @@  static int fix_sub_duration_heartbeat(InputStream *ist, int64_t signal_pts)
 
     subtitle.pts = signal_pts;
 
-    return process_subtitle(ist, &subtitle, &got_output);
+    return process_subtitle(ist, &subtitle);
 }
 
 int trigger_fix_sub_duration_heartbeat(OutputStream *ost, const AVPacket *pkt)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 7b38812f74..7189629ad4 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -884,7 +884,7 @@  OutputStream *ost_iter(OutputStream *prev);
 
 void close_output_stream(OutputStream *ost);
 int trigger_fix_sub_duration_heartbeat(OutputStream *ost, const AVPacket *pkt);
-int process_subtitle(InputStream *ist, AVSubtitle *subtitle, int *got_output);
+int process_subtitle(InputStream *ist, AVSubtitle *subtitle);
 void update_benchmark(const char *fmt, ...);
 
 /**
diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index c0c242147f..6582917a39 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -328,8 +328,9 @@  static void sub2video_flush(InputStream *ist)
     }
 }
 
-int process_subtitle(InputStream *ist, AVSubtitle *subtitle, int *got_output)
+int process_subtitle(InputStream *ist, AVSubtitle *subtitle)
 {
+    int got_output = 1;
     int ret = 0;
 
     if (ist->fix_sub_duration) {
@@ -345,13 +346,13 @@  int process_subtitle(InputStream *ist, AVSubtitle *subtitle, int *got_output)
                 ist->prev_sub.subtitle.end_display_time = end;
             }
         }
-        FFSWAP(int,        *got_output, ist->prev_sub.got_output);
+        FFSWAP(int,         got_output, ist->prev_sub.got_output);
         FFSWAP(AVSubtitle, *subtitle,   ist->prev_sub.subtitle);
         if (end <= 0)
             goto out;
     }
 
-    if (!*got_output)
+    if (!got_output)
         return 0;
 
     for (int i = 0; i < ist->nb_filters; i++) {
@@ -402,7 +403,7 @@  static int transcode_subtitles(InputStream *ist, const AVPacket *pkt)
 
     ist->frames_decoded++;
 
-    return process_subtitle(ist, &subtitle, &got_output);
+    return process_subtitle(ist, &subtitle);
 }
 
 static int send_filter_eof(InputStream *ist)