NetBSD Problem Report #48399

From www@NetBSD.org  Sat Nov 23 04:26:54 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6B075A628D
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 23 Nov 2013 04:26:54 +0000 (UTC)
Message-Id: <20131123042652.9EE6CA6291@mollari.NetBSD.org>
Date: Sat, 23 Nov 2013 04:26:52 +0000 (UTC)
From: nathanialsloss@yahoo.com.au
Reply-To: nathanialsloss@yahoo.com.au
To: gnats-bugs@NetBSD.org
Subject: multimedia/ffmpeg cannot capture video from /dev/video*
X-Send-Pr-Version: www-1.0

>Number:         48399
>Category:       pkg
>Synopsis:       multimedia/ffmpeg cannot capture video from /dev/video*
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 23 04:30:00 +0000 2013
>Originator:     Nat Sloss
>Release:        pkgsrc-2013Q2
>Organization:
>Environment:
NetBSD beast 6.1.1_PATCH NetBSD 6.1.1_PATCH (PCIPAE) #22: Thu Nov 21 23:13:25 EST 2013  build@microrusty:/usr/src/sys/arch/i386/compile/obj/PCIPAE i386
>Description:
Ffmpeg cannot capture video from webcam as ioctl G_PARM is unsupported also if the webcam supplies an empty frame the encoding exits.
>How-To-Repeat:
Try the following:
ffmpeg -f v4l2 -s 640x480 -r 25 -i /dev/video0 test.avi

You will find that is exits with an error instead of capturing video.
>Fix:
Apply this patch:

$NetBSD$

--- libavdevice/v4l2.c.orig	2013-05-10 00:16:06.000000000 +0000
+++ libavdevice/v4l2.c
@@ -585,6 +585,13 @@ static int mmap_read_frame(AVFormatConte

     /* FIXME: Some special treatment might be needed in case of loss of signal... */
     while ((res = v4l2_ioctl(s->fd, VIDIOC_DQBUF, &buf)) < 0 && (errno == EINTR));
+
+    if (buf.bytesused == 0) {
+	if (buf.m.userptr)
+        	enqueue_buffer(s->fd, buf.index);
+	return AVERROR(EAGAIN);
+    }
+
     if (res < 0) {
         if (errno == EAGAIN)
             return AVERROR(EAGAIN);
@@ -771,6 +778,7 @@ static int v4l2_set_parameters(AVFormatC
         tpf = &streamparm.parm.capture.timeperframe;
     }

+#ifndef __NetBSD__
     streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
     if (v4l2_ioctl(s->fd, VIDIOC_G_PARM, &streamparm) < 0) {
         ret = AVERROR(errno);
@@ -806,6 +814,7 @@ static int v4l2_set_parameters(AVFormatC
                    "The driver does not allow to change time per frame\n");
         }
     }
+#endif
     s1->streams[0]->avg_frame_rate.num = tpf->denominator;
     s1->streams[0]->avg_frame_rate.den = tpf->numerator;
     s1->streams[0]->r_frame_rate = s1->streams[0]->avg_frame_rate;

Regards,

Nat.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.