avcodec/codec_internal: Constify AVPacket in decode_sub cb

No subtitle decoder ever modifies the AVPacket given to it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
release/5.1
Andreas Rheinhardt 3 years ago
parent 4243da4ff4
commit 6ed0d95fa2
  1. 2
      libavcodec/assdec.c
  2. 2
      libavcodec/ccaption_dec.c
  3. 2
      libavcodec/codec_internal.h
  4. 2
      libavcodec/dvbsubdec.c
  5. 2
      libavcodec/dvdsubdec.c
  6. 2
      libavcodec/jacosubdec.c
  7. 2
      libavcodec/libaribb24.c
  8. 2
      libavcodec/libzvbi-teletextdec.c
  9. 2
      libavcodec/microdvddec.c
  10. 2
      libavcodec/movtextdec.c
  11. 2
      libavcodec/mpl2dec.c
  12. 2
      libavcodec/pgssubdec.c
  13. 2
      libavcodec/realtextdec.c
  14. 2
      libavcodec/samidec.c
  15. 2
      libavcodec/srtdec.c
  16. 2
      libavcodec/subviewerdec.c
  17. 2
      libavcodec/textdec.c
  18. 2
      libavcodec/webvttdec.c
  19. 2
      libavcodec/xsubdec.c

@ -41,7 +41,7 @@ static av_cold int ass_decode_init(AVCodecContext *avctx)
} }
static int ass_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, 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) if (avpkt->size <= 0)
return avpkt->size; return avpkt->size;

@ -839,7 +839,7 @@ static int process_cc608(CCaptionSubContext *ctx, uint8_t hi, uint8_t lo)
} }
static int decode(AVCodecContext *avctx, AVSubtitle *sub, static int decode(AVCodecContext *avctx, AVSubtitle *sub,
int *got_sub, AVPacket *avpkt) int *got_sub, const AVPacket *avpkt)
{ {
CCaptionSubContext *ctx = avctx->priv_data; CCaptionSubContext *ctx = avctx->priv_data;
int64_t in_time = sub->pts; int64_t in_time = sub->pts;

@ -184,7 +184,7 @@ typedef struct FFCodec {
* Apart from that this is like the decode callback. * Apart from that this is like the decode callback.
*/ */
int (*decode_sub)(struct AVCodecContext *avctx, struct AVSubtitle *sub, 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. * Decode API with decoupled packet/frame dataflow.
* cb is in this state if cb_type is FF_CODEC_CB_TYPE_RECEIVE_FRAME. * cb is in this state if cb_type is FF_CODEC_CB_TYPE_RECEIVE_FRAME.

@ -1608,7 +1608,7 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
} }
static int dvbsub_decode(AVCodecContext *avctx, AVSubtitle *sub, 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; const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size; int buf_size = avpkt->size;

@ -549,7 +549,7 @@ static int append_to_cached_buf(AVCodecContext *avctx,
} }
static int dvdsub_decode(AVCodecContext *avctx, AVSubtitle *sub, static int dvdsub_decode(AVCodecContext *avctx, AVSubtitle *sub,
int *data_size, AVPacket *avpkt) int *data_size, const AVPacket *avpkt)
{ {
DVDSubContext *ctx = avctx->priv_data; DVDSubContext *ctx = avctx->priv_data;
const uint8_t *buf = avpkt->data; const uint8_t *buf = avpkt->data;

@ -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, static int jacosub_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
int *got_sub_ptr, AVPacket *avpkt) int *got_sub_ptr, const AVPacket *avpkt)
{ {
int ret; int ret;
const char *ptr = avpkt->data; const char *ptr = avpkt->data;

@ -284,7 +284,7 @@ next_region:
} }
static int libaribb24_decode(AVCodecContext *avctx, AVSubtitle *sub, 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; Libaribb24Context *b24 = avctx->priv_data;
size_t parsed_data_size = 0; size_t parsed_data_size = 0;

@ -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, 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; TeletextContext *ctx = avctx->priv_data;
int ret = 0; int ret = 0;

@ -275,7 +275,7 @@ static void microdvd_close_no_persistent_tags(AVBPrint *new_line,
} }
static int microdvd_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, 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; AVBPrint new_line;
char *line = avpkt->data; char *line = avpkt->data;

@ -473,7 +473,7 @@ static int mov_text_init(AVCodecContext *avctx) {
} }
static int mov_text_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, 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; MovTextContext *m = avctx->priv_data;
int ret; int ret;

@ -64,7 +64,7 @@ static int mpl2_event_to_ass(AVBPrint *buf, const char *p)
} }
static int mpl2_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, 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; int ret = 0;
AVBPrint buf; AVBPrint buf;

@ -590,7 +590,7 @@ static int display_end_segment(AVCodecContext *avctx, AVSubtitle *sub,
} }
static int decode(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; const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size; int buf_size = avpkt->size;

@ -57,7 +57,7 @@ static int rt_event_to_ass(AVBPrint *buf, const char *p)
} }
static int realtext_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, 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; int ret = 0;
const char *ptr = avpkt->data; const char *ptr = avpkt->data;

@ -133,7 +133,7 @@ end:
} }
static int sami_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, 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; const char *ptr = avpkt->data;
SAMIContext *sami = avctx->priv_data; SAMIContext *sami = avctx->priv_data;

@ -56,7 +56,7 @@ static int srt_to_ass(AVCodecContext *avctx, AVBPrint *dst,
} }
static int srt_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, static int srt_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
int *got_sub_ptr, AVPacket *avpkt) int *got_sub_ptr, const AVPacket *avpkt)
{ {
AVBPrint buffer; AVBPrint buffer;
int x1 = -1, y1 = -1, x2 = -1, y2 = -1; int x1 = -1, y1 = -1, x2 = -1, y2 = -1;

@ -48,7 +48,7 @@ static int subviewer_event_to_ass(AVBPrint *buf, const char *p)
} }
static int subviewer_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, 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; int ret = 0;
const char *ptr = avpkt->data; const char *ptr = avpkt->data;

@ -46,7 +46,7 @@ static const AVOption options[] = {
}; };
static int text_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, 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; int ret = 0;
AVBPrint buf; AVBPrint buf;

@ -81,7 +81,7 @@ static int webvtt_event_to_ass(AVBPrint *buf, const char *p)
} }
static int webvtt_decode_frame(AVCodecContext *avctx, AVSubtitle *sub, 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; int ret = 0;
const char *ptr = avpkt->data; const char *ptr = avpkt->data;

@ -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, 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; const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size; int buf_size = avpkt->size;

Loading…
Cancel
Save