Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-03-30 20:52:41 +0300
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-04-05 20:53:27 +0300
commitfb59a42ef977dd91085a602f10c9c82f88d072e5 (patch)
treee65c7b1e66eb0b07dbe51124e88fb3b918129b6f /libavcodec/dvdsubdec.c
parent1c3c29d07d7e0b7f5bec13cb0214f90e26604aee (diff)
avcodec/codec_internal: Add FFCodec.decode_sub
This increases type-safety by avoiding conversions from/through void*. It also avoids the boilerplate "AVSubtitle *sub = data;" line for subtitle decoders. Its only downside is that it increases sizeof(FFCodec), yet this can be more than offset lateron. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/dvdsubdec.c')
-rw-r--r--libavcodec/dvdsubdec.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 734a387223..713170cdc2 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -548,14 +548,12 @@ static int append_to_cached_buf(AVCodecContext *avctx,
return 0;
}
-static int dvdsub_decode(AVCodecContext *avctx,
- void *data, int *data_size,
- AVPacket *avpkt)
+static int dvdsub_decode(AVCodecContext *avctx, AVSubtitle *sub,
+ int *data_size, AVPacket *avpkt)
{
DVDSubContext *ctx = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
- AVSubtitle *sub = data;
int appended = 0;
int is_menu;
@@ -762,7 +760,7 @@ const FFCodec ff_dvdsub_decoder = {
.p.id = AV_CODEC_ID_DVD_SUBTITLE,
.priv_data_size = sizeof(DVDSubContext),
.init = dvdsub_init,
- .decode = dvdsub_decode,
+ .decode_sub = dvdsub_decode,
.flush = dvdsub_flush,
.p.priv_class = &dvdsub_class,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,