diff options
author | Roine Gustafsson <roine@users.sourceforge.net> | 2005-01-19 12:27:48 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-01-19 12:27:48 +0000 |
commit | f96b17c5d6af21040ae620d136a9ee1f9f3ac5bc (patch) | |
tree | 0f6f1e7969f09cc89c01ca1dff84b4b3c4d9e258 | |
parent | 2c656386403bb3d0993c9c8d460aec4dc7b3e8ca (diff) | |
download | ffmpeg-f96b17c5d6af21040ae620d136a9ee1f9f3ac5bc.tar.gz |
add luma only support to yuv4mpeg patch by (Roine Gustafsson <roine users.sourceforge net>)
Originally committed as revision 3846 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/yuv4mpeg.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c index f5c85653dd..2d36d07eb7 100644 --- a/libavformat/yuv4mpeg.c +++ b/libavformat/yuv4mpeg.c @@ -49,6 +49,9 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf) } switch(st->codec.pix_fmt) { + case PIX_FMT_GRAY8: + colorspace = " Cmono"; + break; case PIX_FMT_YUV411P: colorspace = " C411 XYSCSS=411"; break; @@ -115,6 +118,7 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) ptr += picture->linesize[0]; } + if (st->codec.pix_fmt != PIX_FMT_GRAY8){ // Adjust for smaller Cb and Cr planes avcodec_get_chroma_sub_sample(st->codec.pix_fmt, &h_chroma_shift, &v_chroma_shift); width >>= h_chroma_shift; @@ -130,6 +134,7 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) put_buffer(pb, ptr2, width); ptr2 += picture->linesize[2]; } + } put_flush_packet(pb); return 0; } @@ -146,8 +151,9 @@ static int yuv4_write_header(AVFormatContext *s) } else if ((s->streams[0]->codec.pix_fmt != PIX_FMT_YUV420P) && (s->streams[0]->codec.pix_fmt != PIX_FMT_YUV422P) && + (s->streams[0]->codec.pix_fmt != PIX_FMT_GRAY8) && (s->streams[0]->codec.pix_fmt != PIX_FMT_YUV444P)) { - av_log(s, AV_LOG_ERROR, "ERROR: yuv4mpeg only handles 4:4:4, 4:2:2, 4:2:0 and 4:1:1 planar YUV data. Use -pix_fmt to select one.\n"); + av_log(s, AV_LOG_ERROR, "ERROR: yuv4mpeg only handles yuv444p, yuv422p, yuv420p, yuv411p and gray pixel formats. Use -pix_fmt to select one.\n"); return AVERROR_IO; } @@ -229,8 +235,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap) } else if (strncmp("444", tokstart, 3)==0) pix_fmt = PIX_FMT_YUV444P; else if (strncmp("mono",tokstart, 4)==0) { - av_log(s, AV_LOG_ERROR, "Cannot handle luma only YUV4MPEG stream.\n"); - return -1; + pix_fmt = PIX_FMT_GRAY8; } else { av_log(s, AV_LOG_ERROR, "YUV4MPEG stream contains an unknown pixel format.\n"); return -1; |