Mercurial > mplayer.hg
diff libao2/ao_mpegpes.c @ 25558:634dfaa85718
when :card isn't specified by the user search the first available card
author | nicodvb |
---|---|
date | Wed, 02 Jan 2008 20:34:48 +0000 |
parents | 89bae6fd11fe |
children | afa125da85cf |
line wrap: on
line diff
--- a/libao2/ao_mpegpes.c Wed Jan 02 19:11:37 2008 +0000 +++ b/libao2/ao_mpegpes.c Wed Jan 02 20:34:48 2008 +0000 @@ -139,7 +139,7 @@ static int preinit(const char *arg) { - int card = 1; + int card = -1; char *ao_file = NULL; opt_t subopts[] = { @@ -153,6 +153,21 @@ 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");