Unified · Split
| @@ -47,8 +47,7 @@ static av_cold int write_header(AVFormatContext *s1) · 46 unmodified lines | ||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | if (s1->nb_streams != 1 || |
| 50 | − s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO || | |
| 51 | − s1->streams[0]->codecpar->codec_id != AV_CODEC_ID_RAWVIDEO) { | |
| 50 | + s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) { | |
| 52 | 51 | av_log(s1, AV_LOG_ERROR, |
| 53 | 52 | "V4L2 output device supports only a single raw video stream\n"); |
| 54 | 53 | return AVERROR(EINVAL); |
| @@ -56,7 +55,12 @@ static av_cold int write_header(AVFormatContext *s1) · 1 unmodified line | ||
| 56 | 55 | |
| 57 | 56 | par = s1->streams[0]->codecpar; |
| 58 | 57 | |
| 59 | − v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO); | |
| 58 | + if(par->codec_id == AV_CODEC_ID_RAWVIDEO) { | |
| 59 | + v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO); | |
| 60 | + } else { | |
| 61 | + v4l2_pixfmt = ff_fmt_ff2v4l(AV_PIX_FMT_NONE, par->codec_id); | |
| 62 | + } | |
| 63 | + | |
| 60 | 64 | if (!v4l2_pixfmt) { // XXX: try to force them one by one? |
| 61 | 65 | av_log(s1, AV_LOG_ERROR, "Unknown V4L2 pixel format equivalent for %s\n", |
| 62 | 66 | av_get_pix_fmt_name(par->format)); |