Mercurial > libavformat.hg
changeset 648:340f1911cd54 libavformat
add luma only support to yuv4mpeg patch by (Roine Gustafsson <roine users.sourceforge net>)
author | michael |
---|---|
date | Wed, 19 Jan 2005 12:27:48 +0000 |
parents | a4a5e6c39a68 |
children | 25825079f833 |
files | yuv4mpeg.c |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/yuv4mpeg.c Thu Jan 13 13:09:35 2005 +0000 +++ b/yuv4mpeg.c Wed Jan 19 12:27:48 2005 +0000 @@ -49,6 +49,9 @@ } 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 @@ 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 @@ put_buffer(pb, ptr2, width); ptr2 += picture->linesize[2]; } + } put_flush_packet(pb); return 0; } @@ -146,8 +151,9 @@ } 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 @@ } 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;