diff mbox series

[FFmpeg-devel,5/7] avcodec/codec_internal: Constify AVPacket in decode_sub cb

Message ID AS1PR01MB9564602F4AE24844D9F09D1D8F1F9@AS1PR01MB9564.eurprd01.prod.exchangelabs.com
State Accepted
Commit 6ed0d95fa207f587b3542f3e8349932118ad8d5d
Headers show
Series [FFmpeg-devel,1/7] avcodec/options: Fix AVClassCategory of decoders with .receive_frame | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Andreas Rheinhardt March 30, 2022, 10:49 p.m. UTC
No subtitle decoder ever modifies the AVPacket given to it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/assdec.c              | 2 +-
 libavcodec/ccaption_dec.c        | 2 +-
 libavcodec/codec_internal.h      | 2 +-
 libavcodec/dvbsubdec.c           | 2 +-
 libavcodec/dvdsubdec.c           | 2 +-
 libavcodec/jacosubdec.c          | 2 +-
 libavcodec/libaribb24.c          | 2 +-
 libavcodec/libzvbi-teletextdec.c | 2 +-
 libavcodec/microdvddec.c         | 2 +-
 libavcodec/movtextdec.c          | 2 +-
 libavcodec/mpl2dec.c             | 2 +-
 libavcodec/pgssubdec.c           | 2 +-
 libavcodec/realtextdec.c         | 2 +-
 libavcodec/samidec.c             | 2 +-
 libavcodec/srtdec.c              | 2 +-
 libavcodec/subviewerdec.c        | 2 +-
 libavcodec/textdec.c             | 2 +-
 libavcodec/webvttdec.c           | 2 +-
 libavcodec/xsubdec.c             | 2 +-
 19 files changed, 19 insertions(+), 19 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/assdec.c b/libavcodec/assdec.c
index b94629ea1d..f43b500aa7 100644
--- a/libavcodec/assdec.c
+++ b/libavcodec/assdec.c
@@ -41,7 +41,7 @@  static av_cold int ass_decode_init(AVCodecContext *avctx)
 }
 
 static int ass_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
-                            int *got_sub_ptr, AVPacket *avpkt)
+                            int *got_sub_ptr, const AVPacket *avpkt)
 {
     if (avpkt->size <= 0)
         return avpkt->size;
diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index e33fb36824..34f0513b1a 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -839,7 +839,7 @@  static int process_cc608(CCaptionSubContext *ctx, uint8_t hi, uint8_t lo)
 }
 
 static int decode(AVCodecContext *avctx, AVSubtitle *sub,
-                  int *got_sub, AVPacket *avpkt)
+                  int *got_sub, const AVPacket *avpkt)
 {
     CCaptionSubContext *ctx = avctx->priv_data;
     int64_t in_time = sub->pts;
diff --git a/libavcodec/codec_internal.h b/libavcodec/codec_internal.h
index a14f6592fe..5df286ce52 100644
--- a/libavcodec/codec_internal.h
+++ b/libavcodec/codec_internal.h
@@ -184,7 +184,7 @@  typedef struct FFCodec {
          * Apart from that this is like the decode callback.
          */
         int (*decode_sub)(struct AVCodecContext *avctx, struct AVSubtitle *sub,
-                          int *got_frame_ptr, struct AVPacket *avpkt);
+                          int *got_frame_ptr, const struct AVPacket *avpkt);
         /**
          * Decode API with decoupled packet/frame dataflow.
          * cb is in this state if cb_type is FF_CODEC_CB_TYPE_RECEIVE_FRAME.
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 58e18cfece..6e510d12c7 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -1608,7 +1608,7 @@  static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
 }
 
 static int dvbsub_decode(AVCodecContext *avctx, AVSubtitle *sub,
-                         int *got_sub_ptr, AVPacket *avpkt)
+                         int *got_sub_ptr, const AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 2951e74736..2aa6983490 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -549,7 +549,7 @@  static int append_to_cached_buf(AVCodecContext *avctx,
 }
 
 static int dvdsub_decode(AVCodecContext *avctx, AVSubtitle *sub,
-                         int *data_size, AVPacket *avpkt)
+                         int *data_size, const AVPacket *avpkt)
 {
     DVDSubContext *ctx = avctx->priv_data;
     const uint8_t *buf = avpkt->data;
diff --git a/libavcodec/jacosubdec.c b/libavcodec/jacosubdec.c
index 245ae22221..e3bf9f4226 100644
--- a/libavcodec/jacosubdec.c
+++ b/libavcodec/jacosubdec.c
@@ -163,7 +163,7 @@  static void jacosub_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *src
 }
 
 static int jacosub_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
-                                int *got_sub_ptr, AVPacket *avpkt)
+                                int *got_sub_ptr, const AVPacket *avpkt)
 {
     int ret;
     const char *ptr = avpkt->data;
diff --git a/libavcodec/libaribb24.c b/libavcodec/libaribb24.c
index e1a26e5659..9658e1d5ac 100644
--- a/libavcodec/libaribb24.c
+++ b/libavcodec/libaribb24.c
@@ -284,7 +284,7 @@  next_region:
 }
 
 static int libaribb24_decode(AVCodecContext *avctx, AVSubtitle *sub,
-                             int *got_sub_ptr, AVPacket *pkt)
+                             int *got_sub_ptr, const AVPacket *pkt)
 {
     Libaribb24Context *b24 = avctx->priv_data;
     size_t parsed_data_size = 0;
diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c
index 79a1237431..92466cc11e 100644
--- a/libavcodec/libzvbi-teletextdec.c
+++ b/libavcodec/libzvbi-teletextdec.c
@@ -638,7 +638,7 @@  static int slice_to_vbi_lines(TeletextContext *ctx, uint8_t* buf, int size)
 }
 
 static int teletext_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
-                                 int *got_sub_ptr, AVPacket *pkt)
+                                 int *got_sub_ptr, const AVPacket *pkt)
 {
     TeletextContext *ctx = avctx->priv_data;
     int             ret = 0;
diff --git a/libavcodec/microdvddec.c b/libavcodec/microdvddec.c
index 154fd3271b..f36ad51468 100644
--- a/libavcodec/microdvddec.c
+++ b/libavcodec/microdvddec.c
@@ -275,7 +275,7 @@  static void microdvd_close_no_persistent_tags(AVBPrint *new_line,
 }
 
 static int microdvd_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
-                                 int *got_sub_ptr, AVPacket *avpkt)
+                                 int *got_sub_ptr, const AVPacket *avpkt)
 {
     AVBPrint new_line;
     char *line = avpkt->data;
diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index 6a71537291..70162b4888 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -473,7 +473,7 @@  static int mov_text_init(AVCodecContext *avctx) {
 }
 
 static int mov_text_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
-                                 int *got_sub_ptr, AVPacket *avpkt)
+                                 int *got_sub_ptr, const AVPacket *avpkt)
 {
     MovTextContext *m = avctx->priv_data;
     int ret;
diff --git a/libavcodec/mpl2dec.c b/libavcodec/mpl2dec.c
index 7104670f4d..56f008b65c 100644
--- a/libavcodec/mpl2dec.c
+++ b/libavcodec/mpl2dec.c
@@ -64,7 +64,7 @@  static int mpl2_event_to_ass(AVBPrint *buf, const char *p)
 }
 
 static int mpl2_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
-                             int *got_sub_ptr, AVPacket *avpkt)
+                             int *got_sub_ptr, const AVPacket *avpkt)
 {
     int ret = 0;
     AVBPrint buf;
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 8441b88d27..e50c6766c5 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -590,7 +590,7 @@  static int display_end_segment(AVCodecContext *avctx, AVSubtitle *sub,
 }
 
 static int decode(AVCodecContext *avctx, AVSubtitle *sub,
-                  int *got_sub_ptr, AVPacket *avpkt)
+                  int *got_sub_ptr, const AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
diff --git a/libavcodec/realtextdec.c b/libavcodec/realtextdec.c
index e058b7494d..c3e138a7ba 100644
--- a/libavcodec/realtextdec.c
+++ b/libavcodec/realtextdec.c
@@ -57,7 +57,7 @@  static int rt_event_to_ass(AVBPrint *buf, const char *p)
 }
 
 static int realtext_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
-                                 int *got_sub_ptr, AVPacket *avpkt)
+                                 int *got_sub_ptr, const AVPacket *avpkt)
 {
     int ret = 0;
     const char *ptr = avpkt->data;
diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c
index b9f6128a3e..cf5dec955b 100644
--- a/libavcodec/samidec.c
+++ b/libavcodec/samidec.c
@@ -133,7 +133,7 @@  end:
 }
 
 static int sami_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
-                             int *got_sub_ptr, AVPacket *avpkt)
+                             int *got_sub_ptr, const AVPacket *avpkt)
 {
     const char *ptr = avpkt->data;
     SAMIContext *sami = avctx->priv_data;
diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c
index 705df007d6..b2df34474e 100644
--- a/libavcodec/srtdec.c
+++ b/libavcodec/srtdec.c
@@ -56,7 +56,7 @@  static int srt_to_ass(AVCodecContext *avctx, AVBPrint *dst,
 }
 
 static int srt_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
-                            int *got_sub_ptr, AVPacket *avpkt)
+                            int *got_sub_ptr, const AVPacket *avpkt)
 {
     AVBPrint buffer;
     int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
diff --git a/libavcodec/subviewerdec.c b/libavcodec/subviewerdec.c
index b6acea93f5..2bda5fa5c1 100644
--- a/libavcodec/subviewerdec.c
+++ b/libavcodec/subviewerdec.c
@@ -48,7 +48,7 @@  static int subviewer_event_to_ass(AVBPrint *buf, const char *p)
 }
 
 static int subviewer_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
-                                  int *got_sub_ptr, AVPacket *avpkt)
+                                  int *got_sub_ptr, const AVPacket *avpkt)
 {
     int ret = 0;
     const char *ptr = avpkt->data;
diff --git a/libavcodec/textdec.c b/libavcodec/textdec.c
index 09de0ad8fd..d509452391 100644
--- a/libavcodec/textdec.c
+++ b/libavcodec/textdec.c
@@ -46,7 +46,7 @@  static const AVOption options[] = {
 };
 
 static int text_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
-                             int *got_sub_ptr, AVPacket *avpkt)
+                             int *got_sub_ptr, const AVPacket *avpkt)
 {
     int ret = 0;
     AVBPrint buf;
diff --git a/libavcodec/webvttdec.c b/libavcodec/webvttdec.c
index 0179fc26d2..fcf1062d86 100644
--- a/libavcodec/webvttdec.c
+++ b/libavcodec/webvttdec.c
@@ -81,7 +81,7 @@  static int webvtt_event_to_ass(AVBPrint *buf, const char *p)
 }
 
 static int webvtt_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
-                               int *got_sub_ptr, AVPacket *avpkt)
+                               int *got_sub_ptr, const AVPacket *avpkt)
 {
     int ret = 0;
     const char *ptr = avpkt->data;
diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c
index f22c5cf3b3..d62fa164a5 100644
--- a/libavcodec/xsubdec.c
+++ b/libavcodec/xsubdec.c
@@ -48,7 +48,7 @@  static int64_t parse_timecode(const uint8_t *buf, int64_t packet_time) {
 }
 
 static int decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
-                        int *got_sub_ptr, AVPacket *avpkt)
+                        int *got_sub_ptr, const AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;