diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-05-29 02:55:19 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-05-29 03:34:35 +0200 |
commit | b8a43bc1b50f409414493a05f6c4b7895ca4ddf9 (patch) | |
tree | 95dda1b7289aac9bdb1f457417baf9515aa4383a /libavformat/rawdec.c | |
parent | 39d607e5bbc25ad9629683702b510e865434ef21 (diff) | |
parent | 90da52f01f8b6c22af22a002eb226989b1cf7ef8 (diff) | |
download | ffmpeg-b8a43bc1b50f409414493a05f6c4b7895ca4ddf9.tar.gz |
Merge remote-tracking branch 'qatar/master' into master
* qatar/master: (27 commits)
ac3enc: fix LOCAL_ALIGNED usage in count_mantissa_bits()
ac3dsp: do not use the ff_* prefix when referencing ff_ac3_bap_bits.
ac3dsp: fix loop condition in ac3_update_bap_counts_c()
ARM: unbreak build
ac3enc: modify mantissa bit counting to keep bap counts for all values of bap instead of just 0 to 4.
ac3enc: split mantissa bit counting into a separate function.
ac3enc: store per-block/channel bap pointers by reference block in a 2D array rather than in the AC3Block struct.
get_bits: add av_unused tag to cache variable
sws: replace all long with int.
ARM: aacdec: fix constraints on inline asm
ARM: remove unnecessary volatile from inline asm
ARM: add "cc" clobbers to inline asm where needed
ARM: improve FASTDIV asm
ac3enc: use LOCAL_ALIGNED macro
APIchanges: fill in git hash for av_get_pix_fmt_name (0420bd7).
lavu: add av_get_pix_fmt_name() convenience function
cmdutils: remove OPT_FUNC2
swscale: fix crash in bilinear scaling.
vpxenc: add VP8E_SET_STATIC_THRESHOLD mapping
webm: support stereo videos in matroska/webm muxer
...
Conflicts:
Changelog
cmdutils.c
cmdutils.h
doc/APIchanges
doc/muxers.texi
ffmpeg.c
ffplay.c
libavcodec/ac3enc.c
libavcodec/ac3enc_float.c
libavcodec/avcodec.h
libavcodec/get_bits.h
libavcodec/libvpxenc.c
libavcodec/version.h
libavdevice/libdc1394.c
libavformat/matroskaenc.c
libavutil/avutil.h
libswscale/rgb2rgb.c
libswscale/swscale.c
libswscale/swscale_template.c
libswscale/x86/swscale_template.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rawdec.c')
-rw-r--r-- | libavformat/rawdec.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index a1617f00c4..fa25c6ba0e 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -25,6 +25,7 @@ #include "rawdec.h" #include "libavutil/opt.h" #include "libavutil/parseutils.h" +#include "libavutil/pixdesc.h" /* raw input */ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) @@ -70,30 +71,37 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) case AVMEDIA_TYPE_VIDEO: { FFRawVideoDemuxerContext *s1 = s->priv_data; int width = 0, height = 0, ret; + enum PixelFormat pix_fmt; + 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); - 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 (s1->video_size && (ret = av_parse_video_size(&width, &height, s1->video_size)) < 0) { + av_log(s, AV_LOG_ERROR, "Couldn't parse video size.\n"); + goto fail; + } + if ((pix_fmt = av_get_pix_fmt(s1->pixel_format)) == PIX_FMT_NONE) { + av_log(s, AV_LOG_ERROR, "No such pixel format: %s.\n", s1->pixel_format); + ret = AVERROR(EINVAL); + goto fail; } #if FF_API_FORMAT_PARAMETERS if (ap->width > 0) width = ap->width; if (ap->height > 0) height = ap->height; + if (ap->pix_fmt) + pix_fmt = ap->pix_fmt; #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; + st->codec->pix_fmt = pix_fmt; break; +fail: + av_freep(&s1->video_size); + av_freep(&s1->pixel_format); + return ret; } default: return -1; @@ -188,6 +196,7 @@ const AVClass ff_rawaudio_demuxer_class = { #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 }, + { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = "yuv420p"}, 0, 0, DEC }, { NULL }, }; #undef OFFSET |