Author: remi
Date: 2009-03-28 12:31:48 +0100 (Sat, 28 Mar 2009)
New Revision: 4234
Added:
software_suite_v2/tuxware/tuxdroidserver/trunk/util/system/
software_suite_v2/tuxware/tuxdroidserver/trunk/util/system/Device.py
software_suite_v2/tuxware/tuxdroidserver/trunk/util/system/__init__.py
Modified:
software_suite_v2/tuxware/tuxdroidserver/trunk/util/player/mplayer/Mplayer.py
Log:
* moved the method to retrieve the Tux Droid audio device to a new module.
Modified:
software_suite_v2/tuxware/tuxdroidserver/trunk/util/player/mplayer/Mplayer.py
===================================================================
---
software_suite_v2/tuxware/tuxdroidserver/trunk/util/player/mplayer/Mplayer.py
2009-03-28 10:58:24 UTC (rev 4233)
+++
software_suite_v2/tuxware/tuxdroidserver/trunk/util/player/mplayer/Mplayer.py
2009-03-28 11:31:48 UTC (rev 4234)
@@ -8,6 +8,7 @@
import threading
import time
+from util.system.Device import Device
from Commands import *
#
------------------------------------------------------------------------------
@@ -31,33 +32,9 @@
self.__runMutex = threading.Lock()
self.__run = False
self.__process = None
- self.__device = self.__getTuxDroidSoundDevice()
+ self.__device = Device.getTuxDroidSoundDevice()
#
--------------------------------------------------------------------------
- # Get the sound device of Tux Droid.
- #
--------------------------------------------------------------------------
- def __getTuxDroidSoundDevice(self):
- """Get the sound device of Tux Droid.
- @return: A string.
- """
- if os.name == 'nt':
- from ctypes import windll
- winmm = windll.winmm
- wvcps = ' ' * 52
- cardsCount = winmm.waveOutGetNumDevs()
- for i in range(cardsCount):
- try:
- if winmm.waveOutGetDevCapsA(i, wvcps,len(wvcps)) == 0:
- if wvcps[8:].split("\0")[0].find("TuxDroid-Audio") ==
0:
- idx = i + 1
- return "dsound:device=%d" % idx
- except:
- pass
- return "dsound:device=1"
- else:
- return "alsa:device=plughw=TuxDroid,0"
-
- #
--------------------------------------------------------------------------
# Start mplayer.
#
--------------------------------------------------------------------------
def start(self, media, async = False):
Added: software_suite_v2/tuxware/tuxdroidserver/trunk/util/system/Device.py
===================================================================
--- software_suite_v2/tuxware/tuxdroidserver/trunk/util/system/Device.py
(rev 0)
+++ software_suite_v2/tuxware/tuxdroidserver/trunk/util/system/Device.py
2009-03-28 11:31:48 UTC (rev 4234)
@@ -0,0 +1,37 @@
+# Copyright (C) 2009 C2ME Sa
+# Remi Jocaille <[email protected]>
+# Distributed under the terms of the GNU General Public License
+# http://www.gnu.org/copyleft/gpl.html
+
+#
------------------------------------------------------------------------------
+# Class to get some information about smart-compagnon audio/video devices.
+#
------------------------------------------------------------------------------
+class Device(object):
+ """Class to get some information about smart-compagnon audio/video devices.
+ """
+
+ #
--------------------------------------------------------------------------
+ # Get the sound device of Tux Droid.
+ #
--------------------------------------------------------------------------
+ def getTuxDroidSoundDevice():
+ """Get the sound device of Tux Droid.
+ @return: A string.
+ """
+ if os.name == 'nt':
+ from ctypes import windll
+ winmm = windll.winmm
+ wvcps = ' ' * 52
+ cardsCount = winmm.waveOutGetNumDevs()
+ for i in range(cardsCount):
+ try:
+ if winmm.waveOutGetDevCapsA(i, wvcps,len(wvcps)) == 0:
+ if wvcps[8:].split("\0")[0].find("TuxDroid-Audio") ==
0:
+ idx = i + 1
+ return "dsound:device=%d" % idx
+ except:
+ pass
+ return "dsound:device=1"
+ else:
+ return "alsa:device=plughw=TuxDroid,0"
+
+ getTuxDroidSoundDevice = staticmethod(getTuxDroidSoundDevice)
Property changes on:
software_suite_v2/tuxware/tuxdroidserver/trunk/util/system/Device.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v2/tuxware/tuxdroidserver/trunk/util/system/__init__.py
===================================================================
Property changes on:
software_suite_v2/tuxware/tuxdroidserver/trunk/util/system/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
------------------------------------------------------------------------------
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn