Revision f96b17c5

View differences:

libavformat/yuv4mpeg.c
49 49
    }
50 50

  
51 51
    switch(st->codec.pix_fmt) {
52
    case PIX_FMT_GRAY8:
53
        colorspace = " Cmono";
54
        break;
52 55
    case PIX_FMT_YUV411P:
53 56
        colorspace = " C411 XYSCSS=411";
54 57
        break;
......
115 118
        ptr += picture->linesize[0];
116 119
    }
117 120

  
121
    if (st->codec.pix_fmt != PIX_FMT_GRAY8){
118 122
    // Adjust for smaller Cb and Cr planes
119 123
    avcodec_get_chroma_sub_sample(st->codec.pix_fmt, &h_chroma_shift, &v_chroma_shift);
120 124
    width >>= h_chroma_shift;
......
130 134
        put_buffer(pb, ptr2, width);
131 135
            ptr2 += picture->linesize[2];
132 136
    }
137
    }
133 138
    put_flush_packet(pb);
134 139
    return 0;
135 140
}
......
146 151
    } 
147 152
    else if ((s->streams[0]->codec.pix_fmt != PIX_FMT_YUV420P) && 
148 153
             (s->streams[0]->codec.pix_fmt != PIX_FMT_YUV422P) && 
154
             (s->streams[0]->codec.pix_fmt != PIX_FMT_GRAY8) && 
149 155
             (s->streams[0]->codec.pix_fmt != PIX_FMT_YUV444P)) {
150
        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");
156
        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");
151 157
	return AVERROR_IO;
152 158
    }
153 159
    
......
229 235
            } else if (strncmp("444", tokstart, 3)==0)
230 236
                pix_fmt = PIX_FMT_YUV444P;
231 237
            else if (strncmp("mono",tokstart, 4)==0) {
232
                av_log(s, AV_LOG_ERROR, "Cannot handle luma only YUV4MPEG stream.\n");
233
                return -1;
238
                pix_fmt = PIX_FMT_GRAY8;
234 239
            } else {
235 240
                av_log(s, AV_LOG_ERROR, "YUV4MPEG stream contains an unknown pixel format.\n");
236 241
                return -1;

Also available in: Unified diff