diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-05-27 23:47:05 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-05-27 23:48:22 +0200 |
commit | 8381ab143779d25611a1bb05d674bc39fe940f77 (patch) | |
tree | 74773be2c947475433dcc47898aec49a0c4b198b /libavformat/rawdec.c | |
parent | b8773e44d56667edea2d68d067d0c156522ca304 (diff) | |
parent | 79aeade6f6f8fbd7ce1da619fdd475e5db88ae24 (diff) | |
download | ffmpeg-8381ab143779d25611a1bb05d674bc39fe940f77.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (29 commits)
ARM: disable ff_vector_fmul_vfp on VFPv3 systems
ARM: check for VFPv3
swscale: Remove unused variables in x86 code.
doc: Drop DJGPP section, Libav now compiles out-of-the-box on FreeDOS.
x86: Add appropriate ifdefs around certain AVX functions.
cmdutils: use sws_freeContext() instead of av_freep().
swscale: delay allocation of formatConvBuffer().
swscale: fix build with --disable-swscale-alpha.
movenc: Deprecate the global RTP hinting flag, use a private AVOption instead
movenc: Add an AVClass for setting muxer specific options
swscale: fix non-bitexact yuv2yuv[X2]() MMX/MMX2 functions.
configure: report yasm/nasm presence properly
tcp: make connect() timeout properly
rawdec: factor video demuxer definitions into a macro.
rtspdec: add initial_pause private option.
lavf: deprecate AVFormatParameters.width/height.
tty: add video_size private option.
rawdec: add video_size private option.
x11grab: add video_size private option.
x11grab: factorize returning error codes.
...
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rawdec.c')
-rw-r--r-- | libavformat/rawdec.c | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index daacae0c24..a1617f00c4 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -24,6 +24,7 @@ #include "avio_internal.h" #include "rawdec.h" #include "libavutil/opt.h" +#include "libavutil/parseutils.h" /* raw input */ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) @@ -66,17 +67,34 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) av_set_pts_info(st, 64, 1, st->codec->sample_rate); break; } - case AVMEDIA_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: { + FFRawVideoDemuxerContext *s1 = s->priv_data; + int width = 0, height = 0, ret; if(ap->time_base.num) av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den); else av_set_pts_info(st, 64, 1, 25); - st->codec->width = ap->width; - st->codec->height = ap->height; + if (s1->video_size) { + ret = av_parse_video_size(&width, &height, s1->video_size); + av_freep(&s1->video_size); + if (ret < 0) { + av_log(s, AV_LOG_ERROR, "Couldn't parse video size.\n"); + return ret; + } + } +#if FF_API_FORMAT_PARAMETERS + if (ap->width > 0) + width = ap->width; + if (ap->height > 0) + height = ap->height; +#endif + st->codec->width = width; + st->codec->height = height; st->codec->pix_fmt = ap->pix_fmt; if(st->codec->pix_fmt == PIX_FMT_NONE) st->codec->pix_fmt= PIX_FMT_YUV420P; break; + } default: return -1; } @@ -166,6 +184,22 @@ const AVClass ff_rawaudio_demuxer_class = { .version = LIBAVUTIL_VERSION_INT, }; +#define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x) +#define DEC AV_OPT_FLAG_DECODING_PARAM +static const AVOption video_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 }, + { NULL }, +}; +#undef OFFSET +#undef DEC + +const AVClass ff_rawvideo_demuxer_class = { + .class_name = "rawvideo demuxer", + .item_name = av_default_item_name, + .option = video_options, + .version = LIBAVUTIL_VERSION_INT, +}; + #if CONFIG_G722_DEMUXER AVInputFormat ff_g722_demuxer = { "g722", @@ -196,17 +230,7 @@ AVInputFormat ff_gsm_demuxer = { #endif #if CONFIG_MJPEG_DEMUXER -AVInputFormat ff_mjpeg_demuxer = { - "mjpeg", - NULL_IF_CONFIG_SMALL("raw MJPEG video"), - 0, - NULL, - ff_raw_video_read_header, - ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "mjpg,mjpeg", - .value = CODEC_ID_MJPEG, -}; +FF_DEF_RAWVIDEO_DEMUXER(mjpeg, "raw MJPEG video", NULL, "mjpg,mjpeg", CODEC_ID_MJPEG) #endif #if CONFIG_MLP_DEMUXER @@ -252,14 +276,5 @@ AVInputFormat ff_shorten_demuxer = { #endif #if CONFIG_VC1_DEMUXER -AVInputFormat ff_vc1_demuxer = { - "vc1", - NULL_IF_CONFIG_SMALL("raw VC-1"), - 0, - NULL /* vc1_probe */, - ff_raw_video_read_header, - ff_raw_read_partial_packet, - .extensions = "vc1", - .value = CODEC_ID_VC1, -}; +FF_DEF_RAWVIDEO_DEMUXER(vc1, "raw VC-1", NULL, "vc1", CODEC_ID_VC1) #endif |