avcodec: Make avcodec_decode_subtitle2 accept a const AVPacket*

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Andreas Rheinhardt
2023-01-27 15:05:58 +01:00
committed by Anton Khirnov
parent 0281e28c37
commit 868a31b42d
6 changed files with 13 additions and 12 deletions

View File

@ -14,6 +14,9 @@ libavutil: 2021-04-27
API changes, most recent first: API changes, most recent first:
2023-02-xx - xxxxxxxxxx - lavc 60.0.100 - avcodec.h
avcodec_decode_subtitle2() now accepts const AVPacket*.
2023-0x-xx - xxxxxxxxxx - lavc 59.63.100 2023-0x-xx - xxxxxxxxxx - lavc 59.63.100
Allow AV_CODEC_FLAG_COPY_OPAQUE to be used with decoders. Allow AV_CODEC_FLAG_COPY_OPAQUE to be used with decoders.

View File

@ -2512,8 +2512,8 @@ static int trigger_fix_sub_duration_heartbeat(OutputStream *ost, const AVPacket
return 0; return 0;
} }
static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output, static int transcode_subtitles(InputStream *ist, const AVPacket *pkt,
int *decode_failed) int *got_output, int *decode_failed)
{ {
AVSubtitle subtitle; AVSubtitle subtitle;
int ret = avcodec_decode_subtitle2(ist->dec_ctx, int ret = avcodec_decode_subtitle2(ist->dec_ctx,

View File

@ -2734,7 +2734,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
static av_always_inline int process_frame(WriterContext *w, static av_always_inline int process_frame(WriterContext *w,
InputFile *ifile, InputFile *ifile,
AVFrame *frame, AVPacket *pkt, AVFrame *frame, const AVPacket *pkt,
int *packet_new) int *packet_new)
{ {
AVFormatContext *fmt_ctx = ifile->fmt_ctx; AVFormatContext *fmt_ctx = ifile->fmt_ctx;

View File

@ -2615,8 +2615,7 @@ enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
* @param[in] avpkt The input AVPacket containing the input buffer. * @param[in] avpkt The input AVPacket containing the input buffer.
*/ */
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
int *got_sub_ptr, int *got_sub_ptr, const AVPacket *avpkt);
AVPacket *avpkt);
/** /**
* Supply raw packet data as input to a decoder. * Supply raw packet data as input to a decoder.

View File

@ -780,8 +780,8 @@ static void get_subtitle_defaults(AVSubtitle *sub)
} }
#define UTF8_MAX_BYTES 4 /* 5 and 6 bytes sequences should not be used */ #define UTF8_MAX_BYTES 4 /* 5 and 6 bytes sequences should not be used */
static int recode_subtitle(AVCodecContext *avctx, AVPacket **outpkt, static int recode_subtitle(AVCodecContext *avctx, const AVPacket **outpkt,
AVPacket *inpkt, AVPacket *buf_pkt) const AVPacket *inpkt, AVPacket *buf_pkt)
{ {
#if CONFIG_ICONV #if CONFIG_ICONV
iconv_t cd = (iconv_t)-1; iconv_t cd = (iconv_t)-1;
@ -861,8 +861,7 @@ static int utf8_check(const uint8_t *str)
} }
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
int *got_sub_ptr, int *got_sub_ptr, const AVPacket *avpkt)
AVPacket *avpkt)
{ {
int ret = 0; int ret = 0;
@ -882,7 +881,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
if ((avctx->codec->capabilities & AV_CODEC_CAP_DELAY) || avpkt->size) { if ((avctx->codec->capabilities & AV_CODEC_CAP_DELAY) || avpkt->size) {
AVCodecInternal *avci = avctx->internal; AVCodecInternal *avci = avctx->internal;
AVPacket *pkt; const AVPacket *pkt;
ret = recode_subtitle(avctx, &pkt, avpkt, avci->buffer_pkt); ret = recode_subtitle(avctx, &pkt, avpkt, avci->buffer_pkt);
if (ret < 0) if (ret < 0)

View File

@ -81,8 +81,8 @@ static const FFCodec *AVCodecInitialize(enum AVCodecID codec_id)
return ffcodec(res); return ffcodec(res);
} }
static int subtitle_handler(AVCodecContext *avctx, void *frame, static int subtitle_handler(AVCodecContext *avctx, AVFrame *unused,
int *got_sub_ptr, AVPacket *avpkt) int *got_sub_ptr, const AVPacket *avpkt)
{ {
AVSubtitle sub; AVSubtitle sub;
int ret = avcodec_decode_subtitle2(avctx, &sub, got_sub_ptr, avpkt); int ret = avcodec_decode_subtitle2(avctx, &sub, got_sub_ptr, avpkt);