History

avdevice/v4l2enc: Allow writing non-rawvideos to v4l2.

David Manouchehri committed 9 years ago

Commit d0705ec1 parent d0bd00c1 file · +7 −3Browse files

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t