From 85d982f1e2c3efb8d5622caea162cede3f6c0e21 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 14 Sep 2011 14:03:55 +0200 Subject: rawdec: refactor private option for raw video demuxers pixel_format/video_size only apply to 'rawvideo' (==uncompressed) demuxer and make no sense for the other raw (== containerless) demuxers. Keep only the framerate option for those. Also use unique classes for all raw video demuxers --- libavformat/rawvideodec.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'libavformat/rawvideodec.c') diff --git a/libavformat/rawvideodec.c b/libavformat/rawvideodec.c index e1c52abb0a..7b9d34e38c 100644 --- a/libavformat/rawvideodec.c +++ b/libavformat/rawvideodec.c @@ -44,6 +44,22 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } +#define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x) +#define DEC AV_OPT_FLAG_DECODING_PARAM +static const AVOption rawvideo_options[] = { + { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, + { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = "yuv420p"}, 0, 0, DEC }, + { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, + { NULL }, +}; + +static const AVClass rawvideo_demuxer_class = { + .class_name = "rawvideo demuxer", + .item_name = av_default_item_name, + .option = rawvideo_options, + .version = LIBAVUTIL_VERSION_INT, +}; + AVInputFormat ff_rawvideo_demuxer = { .name = "rawvideo", .long_name = NULL_IF_CONFIG_SMALL("raw video format"), @@ -53,5 +69,5 @@ AVInputFormat ff_rawvideo_demuxer = { .flags= AVFMT_GENERIC_INDEX, .extensions = "yuv,cif,qcif,rgb", .value = CODEC_ID_RAWVIDEO, - .priv_class = &ff_rawvideo_demuxer_class, + .priv_class = &rawvideo_demuxer_class, }; -- cgit v1.2.3