summaryrefslogtreecommitdiff
path: root/libavcodec/tests
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-03-30 19:52:41 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-04-05 19:53:27 +0200
commitfb59a42ef977dd91085a602f10c9c82f88d072e5 (patch)
treee65c7b1e66eb0b07dbe51124e88fb3b918129b6f /libavcodec/tests
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/tests')
-rw-r--r--libavcodec/tests/avcodec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/tests/avcodec.c b/libavcodec/tests/avcodec.c
index 075ad632c4..73c09d00a0 100644
--- a/libavcodec/tests/avcodec.c
+++ b/libavcodec/tests/avcodec.c
@@ -135,12 +135,13 @@ int main(void){
codec->capabilities & AV_CODEC_CAP_ENCODER_FLUSH)
ERR("Frame-threaded encoder %s claims to support flushing\n");
} else {
- if (codec->type == AVMEDIA_TYPE_SUBTITLE && !codec2->decode)
- ERR("Subtitle decoder %s does not implement decode callback\n");
+ if (codec->type == AVMEDIA_TYPE_SUBTITLE && !codec2->decode_sub)
+ ERR("Subtitle decoder %s does not implement decode_sub callback\n");
if (codec->type == AVMEDIA_TYPE_SUBTITLE && codec2->bsfs)
ERR("Automatic bitstream filtering unsupported for subtitles; "
"yet decoder %s has it set\n");
- if (!!codec2->decode + !!codec2->receive_frame != 1)
+ if ((codec->type != AVMEDIA_TYPE_SUBTITLE) !=
+ (!!codec2->decode + !!codec2->receive_frame))
ERR("Decoder %s does not implement exactly one decode API.\n");
if (codec->capabilities & (AV_CODEC_CAP_SMALL_LAST_FRAME |
AV_CODEC_CAP_VARIABLE_FRAME_SIZE |