diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-07-06 11:32:48 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-07-17 23:18:50 +0200 |
commit | f6d1b18b3d58cd8f06eea653c4a6e22e4b9245e6 (patch) | |
tree | e9a30637682f6f1c265fbdaebd4df79fd823e453 /libavformat/rawdec.c | |
parent | 827faa18cfd08eed49ffff9129ef4378b8ccf5a5 (diff) | |
download | ffmpeg-f6d1b18b3d58cd8f06eea653c4a6e22e4b9245e6.tar.gz |
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 <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/rawdec.c')
-rw-r--r-- | libavformat/rawdec.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index c602e539f5..59b49e3f77 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -34,9 +34,10 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) { + FFRawDemuxerContext *raw = s->priv_data; int ret, size; - size = RAW_PACKET_SIZE; + size = raw->raw_packet_size; if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM); @@ -119,10 +120,17 @@ int ff_raw_data_read_header(AVFormatContext *s) #define DEC AV_OPT_FLAG_DECODING_PARAM const AVOption ff_rawvideo_options[] = { { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC}, + { "raw_packet_size", "", OFFSET(raw_packet_size), AV_OPT_TYPE_INT, {.i64 = RAW_PACKET_SIZE }, 1, INT_MAX, DEC}, + { NULL }, +}; +const AVOption ff_raw_options[] = { + { "raw_packet_size", "", OFFSET(raw_packet_size), AV_OPT_TYPE_INT, {.i64 = RAW_PACKET_SIZE }, 1, INT_MAX, DEC}, { NULL }, }; #if CONFIG_DATA_DEMUXER +FF_RAW_DEMUXER_CLASS(raw_data) + AVInputFormat ff_data_demuxer = { .name = "data", .long_name = NULL_IF_CONFIG_SMALL("raw data"), @@ -130,6 +138,8 @@ AVInputFormat ff_data_demuxer = { .read_packet = ff_raw_read_partial_packet, .raw_codec_id = AV_CODEC_ID_NONE, .flags = AVFMT_NOTIMESTAMPS, + .priv_data_size = sizeof(FFRawDemuxerContext),\ + .priv_class = &raw_data_demuxer_class,\ }; #endif |