diff options
author | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-01-02 20:34:48 +0000 |
---|---|---|
committer | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-01-02 20:34:48 +0000 |
commit | 1b3cb7845ad5b695cfbc468d705d86f793cb5838 (patch) | |
tree | df876170c7fa1b470bd19fa2b0e25000a1ca2b8a /libao2 | |
parent | f09d652df81c2f9b8ec5a258de3144614cd38399 (diff) |
when :card isn't specified by the user search the first available card
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25586 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r-- | libao2/ao_mpegpes.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libao2/ao_mpegpes.c b/libao2/ao_mpegpes.c index 59cba696ec..fe3924f4ca 100644 --- a/libao2/ao_mpegpes.c +++ b/libao2/ao_mpegpes.c @@ -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"); |