aboutsummaryrefslogtreecommitdiffstats
path: root/libavdevice
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2011-11-21 17:03:46 +0100
committerLuca Barbato <lu_zero@gentoo.org>2012-01-04 13:10:20 +0100
commitaf7123b2ad1f5eea8111d0165b64271a9a096265 (patch)
tree8e1707f649cfe835b15d92df915f00d4a2201e5b /libavdevice
parenta2d1d216291fd8c1f4a8b3bad4f0b50c084ba96d (diff)
downloadffmpeg-af7123b2ad1f5eea8111d0165b64271a9a096265.tar.gz
v4l2: do not force interlaced mode
Video4linux2 supports both interlaced and non-interlaced mode, do not ask for interlaced if not necessary.
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/v4l2.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index eb16171c31..a9e32bbfb4 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -64,6 +64,7 @@ struct video_data {
enum io_method io_method;
int width, height;
int frame_size;
+ int interlaced;
int top_field_first;
int buffers;
@@ -162,7 +163,7 @@ static int device_init(AVFormatContext *ctx, int *width, int *height, uint32_t p
fmt.fmt.pix.width = *width;
fmt.fmt.pix.height = *height;
fmt.fmt.pix.pixelformat = pix_fmt;
- fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
+ fmt.fmt.pix.field = V4L2_FIELD_ANY;
res = ioctl(fd, VIDIOC_S_FMT, &fmt);
if ((*width != fmt.fmt.pix.width) || (*height != fmt.fmt.pix.height)) {
av_log(ctx, AV_LOG_INFO, "The V4L2 driver changed the video from %dx%d to %dx%d\n", *width, *height, fmt.fmt.pix.width, fmt.fmt.pix.height);
@@ -175,6 +176,11 @@ static int device_init(AVFormatContext *ctx, int *width, int *height, uint32_t p
res = -1;
}
+ if (fmt.fmt.pix.field == V4L2_FIELD_INTERLACED) {
+ av_log(ctx, AV_LOG_DEBUG, "The V4L2 driver using the interlaced mode");
+ s->interlaced = 1;
+ }
+
return res;
}
@@ -686,7 +692,7 @@ static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt)
return res;
}
- if (s1->streams[0]->codec->coded_frame) {
+ if (s1->streams[0]->codec->coded_frame && s->interlaced) {
s1->streams[0]->codec->coded_frame->interlaced_frame = 1;
s1->streams[0]->codec->coded_frame->top_field_first = s->top_field_first;
}