From f6d1b18b3d58cd8f06eea653c4a6e22e4b9245e6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 6 Jul 2019 11:32:48 +0200 Subject: avformat/rawdec: Make the raw packet size configurable This allows testing parsers with a wider range of input packet sizes. Which is important and usefull for regression testing, some of our parsers in fact to not work if the packet size is changed from 1024 Signed-off-by: Michael Niedermayer --- libavformat/rawdec.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'libavformat/rawdec.h') diff --git a/libavformat/rawdec.h b/libavformat/rawdec.h index 3eb416b..85e0790 100644 --- a/libavformat/rawdec.h +++ b/libavformat/rawdec.h @@ -28,12 +28,19 @@ typedef struct FFRawVideoDemuxerContext { const AVClass *class; /**< Class for private options. */ + int raw_packet_size; char *video_size; /**< String describing video size, set by a private option. */ char *pixel_format; /**< Set by a private option. */ AVRational framerate; /**< AVRational describing framerate, set by a private option. */ } FFRawVideoDemuxerContext; +typedef struct FFRawDemuxerContext { + const AVClass *class; /**< Class for private options. */ + int raw_packet_size; +} FFRawDemuxerContext; + extern const AVOption ff_rawvideo_options[]; +extern const AVOption ff_raw_options[]; int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt); @@ -45,6 +52,14 @@ int ff_raw_subtitle_read_header(AVFormatContext *s); int ff_raw_data_read_header(AVFormatContext *s); +#define FF_RAW_DEMUXER_CLASS(name)\ +static const AVClass name ## _demuxer_class = {\ + .class_name = #name " demuxer",\ + .item_name = av_default_item_name,\ + .option = ff_raw_options,\ + .version = LIBAVUTIL_VERSION_INT,\ +}; + #define FF_RAWVIDEO_DEMUXER_CLASS(name)\ static const AVClass name ## _demuxer_class = {\ .class_name = #name " demuxer",\ @@ -75,7 +90,7 @@ FF_DEF_RAWVIDEO_DEMUXER2(shortname, longname, probe, ext, id, AVFMT_GENERIC_INDE static const AVClass name ## _demuxer_class = {\ .class_name = #name " demuxer",\ .item_name = av_default_item_name,\ - .option = NULL,\ + .option = ff_raw_options,\ .version = LIBAVUTIL_VERSION_INT,\ }; @@ -90,7 +105,7 @@ AVInputFormat ff_ ## shortname ## _demuxer = {\ .extensions = ext,\ .flags = flag,\ .raw_codec_id = id,\ - .priv_data_size = 0,\ + .priv_data_size = sizeof(FFRawDemuxerContext),\ .priv_class = &shortname ## _demuxer_class,\ }; -- cgit v1.1