[MPlayer-cvslog] r25586 - in trunk: libao2/ao_mpegpes.c libvo/vo_mpegpes.c
nicodvb
subversion at mplayerhq.hu
Wed Jan 2 21:34:49 CET 2008
Author: nicodvb
Date: Wed Jan 2 21:34:48 2008
New Revision: 25586
Log:
when :card isn't specified by the user search the first available card
Modified:
trunk/libao2/ao_mpegpes.c
trunk/libvo/vo_mpegpes.c
Modified: trunk/libao2/ao_mpegpes.c
==============================================================================
--- trunk/libao2/ao_mpegpes.c (original)
+++ trunk/libao2/ao_mpegpes.c Wed Jan 2 21:34:48 2008
@@ -139,7 +139,7 @@ static int init_device(int card)
static int preinit(const char *arg)
{
- int card = 1;
+ int card = -1;
char *ao_file = NULL;
opt_t subopts[] = {
@@ -153,6 +153,21 @@ static int preinit(const char *arg)
mp_msg(MSGT_VO, MSGL_ERR, "AO_MPEGPES, Unrecognized options\n");
return -1;
}
+ if(card==-1)
+ {
+ //search the first usable card
+ int n;
+ char file[30];
+ for(n=0; n<4; n++)
+ {
+ sprintf(file, "/dev/dvb/adapter%d/audio0", n);
+ if(access(file, F_OK | W_OK)==0)
+ {
+ card = n+1;
+ break;
+ }
+ }
+ }
if((card < 1) || (card > 4))
{
mp_msg(MSGT_VO, MSGL_ERR, "DVB card number must be between 1 and 4\n");
Modified: trunk/libvo/vo_mpegpes.c
==============================================================================
--- trunk/libvo/vo_mpegpes.c (original)
+++ trunk/libvo/vo_mpegpes.c Wed Jan 2 21:34:48 2008
@@ -98,7 +98,7 @@ config(uint32_t s_width, uint32_t s_heig
static int preinit(const char *arg){
#ifdef HAVE_DVB
- int card = 0;
+ int card = -1;
char vo_file[30], ao_file[30], *tmp;
if(arg != NULL){
@@ -115,6 +115,21 @@ static int preinit(const char *arg){
if(!arg){
//|O_NONBLOCK
+ //search the first usable card
+ if(card==-1) {
+ int n;
+ for(n=0; n<4; n++) {
+ sprintf(vo_file, "/dev/dvb/adapter%d/video0", n);
+ if(access(vo_file, F_OK | W_OK)==0) {
+ card = n;
+ break;
+ }
+ }
+ }
+ if(card==-1) {
+ mp_msg(MSGT_VO,MSGL_INFO, "Couldn't find a usable dvb video device, exiting\n");
+ return -1;
+ }
#ifndef HAVE_DVB_HEAD
mp_msg(MSGT_VO,MSGL_INFO, "Opening /dev/ost/video+audio\n");
sprintf(vo_file, "/dev/ost/video");
More information about the MPlayer-cvslog
mailing list