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>
This commit is contained in:
Andreas Rheinhardt 2022-03-30 23:42:44 +02:00
parent 4243da4ff4
commit 6ed0d95fa2
19 changed files with 19 additions and 19 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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.

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;