From patchwork Mon May 23 20:32:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 810042 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4NKWNZZ031061 for ; Mon, 23 May 2011 20:32:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932895Ab1EWUcW (ORCPT ); Mon, 23 May 2011 16:32:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46836 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756143Ab1EWUcV (ORCPT ); Mon, 23 May 2011 16:32:21 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4NKWJRb023170 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 23 May 2011 16:32:19 -0400 Received: from [10.11.8.14] (vpn-8-14.rdu.redhat.com [10.11.8.14]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p4NKWIQj013507; Mon, 23 May 2011 16:32:18 -0400 Message-ID: <4DDAC451.6000002@redhat.com> Date: Mon, 23 May 2011 17:32:17 -0300 From: Mauro Carvalho Chehab User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110419 Red Hat/3.1.10-1.el6_0 Thunderbird/3.1.10 MIME-Version: 1.0 To: Devin Heitmueller CC: Linux Media Mailing List Subject: Re: [ANNOUNCE] experimental alsa stream support at xawtv3 References: <4DDAC0C2.7090508@redhat.com> In-Reply-To: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 23 May 2011 20:32:24 +0000 (UTC) Em 23-05-2011 17:19, Devin Heitmueller escreveu: > On Mon, May 23, 2011 at 4:17 PM, Mauro Carvalho Chehab > wrote: >> Due to the alsa detection code that I've added at libv4l2util (at v4l2-utils) >> during the weekend, I decided to add alsa support also on xawtv3, basically >> to provide a real usecase example. Of course, for it to work, it needs the >> very latest v4l2-utils version from the git tree. >> >> I've basically added there the code that Devin wrote for tvtime, with a few >> small fixes and with the audio device auto-detection. > > If any of these fixes you made apply to the code in general, I will be > happy to merge them into our tvtime tree. Let me know. The code bellow will probably be more useful for you. It basically adds alsa device autodetection. The patch is against xawtv source code, but the code there is generic enough to be added on tvtime. Have fun! Mauro --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/x11/xt.c b/x11/xt.c index 81658a0..7cf7281 100644 --- a/x11/xt.c +++ b/x11/xt.c @@ -22,7 +22,9 @@ #include #include #include - +#ifdef HAVE_LIBV42LUTIL +# include +#endif #if defined(__linux__) # include #include @@ -58,6 +60,7 @@ #include "blit.h" #include "parseconfig.h" #include "event.h" +#include "alsa_stream.h" /* jwz */ #include "remote.h" @@ -1377,6 +1380,11 @@ grabber_init() { struct ng_video_fmt screen; void *base = NULL; +#if defined(HAVE_V4L2UTIL) && defined(HAVE_ALSA) + struct media_devices *md; + unsigned int size = 0; + char *alsa_cap, *alsa_out, *p; +#endif memset(&screen,0,sizeof(screen)); #ifdef HAVE_LIBXXF86DGA @@ -1417,6 +1425,22 @@ grabber_init() } f_drv = drv->capabilities(h_drv); add_attrs(drv->list_attrs(h_drv)); + +#if defined(HAVE_V4L2UTIL) && defined(HAVE_ALSA) + /* Start audio capture thread */ + md = discover_media_devices(&size); + p = strrchr(args.device, '/'); + if (!p) + p = args.device; + alsa_cap = get_first_alsa_cap_device(md, size, p + 1); + alsa_out = get_first_no_video_out_device(md, size); + + printf("Alsa devices: cap: %s (%s), out: %s\n", alsa_cap, args.device, alsa_out); + + if (alsa_cap && alsa_out) + alsa_thread_startup(alsa_out, alsa_cap); + free_media_devices(md, size); +#endif } void