struct video_tuner tuner;
struct video_audio audio;
struct video_picture pict;
- const char *video_device;
int j;
if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
st = av_new_stream(s1, 0);
if (!st)
- return -ENOMEM;
+ return AVERROR(ENOMEM);
av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
s->width = width;
s->frame_rate = frame_rate;
s->frame_rate_base = frame_rate_base;
- video_device = ap->device;
- if (!video_device)
- video_device = "/dev/video";
- video_fd = open(video_device, O_RDWR);
+ video_fd = open(s1->filename, O_RDWR);
if (video_fd < 0) {
- perror(video_device);
+ perror(s1->filename);
goto fail;
}
if (ap->pix_fmt == PIX_FMT_YUV420P) {
desired_palette = VIDEO_PALETTE_YUV420P;
desired_depth = 12;
- } else if (ap->pix_fmt == PIX_FMT_YUV422) {
+ } else if (ap->pix_fmt == PIX_FMT_YUYV422) {
desired_palette = VIDEO_PALETTE_YUV422;
desired_depth = 16;
} else if (ap->pix_fmt == PIX_FMT_BGR24) {
pict.palette=VIDEO_PALETTE_RGB24;
pict.depth=24;
ret = ioctl(video_fd, VIDIOCSPICT, &pict);
- if (ret < 0)
+ if (ret < 0) {
pict.palette=VIDEO_PALETTE_GREY;
pict.depth=8;
ret = ioctl(video_fd, VIDIOCSPICT, &pict);
if (ret < 0)
goto fail1;
+ }
}
}
}
break;
case VIDEO_PALETTE_YUV422:
frame_size = width * height * 2;
- st->codec->pix_fmt = PIX_FMT_YUV422;
+ st->codec->pix_fmt = PIX_FMT_YUYV422;
break;
case VIDEO_PALETTE_RGB24:
frame_size = width * height * 3;
return 0;
}
-AVInputFormat video_grab_device_demuxer = {
+AVInputFormat video_grab_v4l_demuxer = {
"video4linux",
"video grab",
sizeof(VideoData),