[Pkg-voip-commits] r7095 - in /qutecom/trunk/debian: changelog patches/generic/alsa-hw-mixer.patch patches/generic/fix-alsa-mixer.patch
cavedon-guest at alioth.debian.org
cavedon-guest at alioth.debian.org
Fri May 1 06:47:31 UTC 2009
Author: cavedon-guest
Date: Fri May 1 06:47:31 2009
New Revision: 7095
URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=7095
Log:
Improve generic/fix-alsa-mixer.patch
Added:
qutecom/trunk/debian/patches/generic/alsa-hw-mixer.patch
Modified:
qutecom/trunk/debian/changelog
qutecom/trunk/debian/patches/generic/fix-alsa-mixer.patch
Modified: qutecom/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-voip/qutecom/trunk/debian/changelog?rev=7095&op=diff
==============================================================================
--- qutecom/trunk/debian/changelog (original)
+++ qutecom/trunk/debian/changelog Fri May 1 06:47:31 2009
@@ -11,7 +11,7 @@
Closes: #526213.
* Allow DM upload.
- -- Ludovico Cavedon <ludovico.cavedon at gmail.com> Thu, 30 Apr 2009 17:31:19 -0700
+ -- Ludovico Cavedon <ludovico.cavedon at gmail.com> Thu, 30 Apr 2009 23:46:15 -0700
qutecom (2.2~rc3.dfsg1-5) unstable; urgency=low
Added: qutecom/trunk/debian/patches/generic/alsa-hw-mixer.patch
URL: http://svn.debian.org/wsvn/pkg-voip/qutecom/trunk/debian/patches/generic/alsa-hw-mixer.patch?rev=7095&op=file
==============================================================================
--- qutecom/trunk/debian/patches/generic/alsa-hw-mixer.patch (added)
+++ qutecom/trunk/debian/patches/generic/alsa-hw-mixer.patch Fri May 1 06:47:31 2009
@@ -1,0 +1,81 @@
+Choose the right device when opening mixer.
+http://trac.qutecom.org/ticket/40
+Index: qutecom-2.2~rc3.dfsg1/libs/sound/src/linux/LinuxVolumeControl.cpp
+===================================================================
+--- qutecom-2.2~rc3.dfsg1.orig/libs/sound/src/linux/LinuxVolumeControl.cpp 2009-04-29 00:14:19.000000000 -0700
++++ qutecom-2.2~rc3.dfsg1/libs/sound/src/linux/LinuxVolumeControl.cpp 2009-04-29 00:15:54.000000000 -0700
+@@ -28,17 +28,26 @@
+
+ #include <util/Logger.h>
+
+-LinuxVolumeControl::LinuxVolumeControl(const AudioDevice & audioDevice) {
+- _audioDevice = audioDevice;
+- _strDeviceName = audioDevice.getData()[1];
++#include <boost/regex.hpp>
++
++LinuxVolumeControl::LinuxVolumeControl(const AudioDevice & audioDevice) :
++ _audioDevice(audioDevice),
++ // Rewrite device names like "hw:0,1", "plughw:0", "dmix:0" to "hw:0" in order to be able to open the mixer
++ _strDeviceName(boost::regex_replace(audioDevice.getData()[1], boost::basic_regex<char>("^.*(dmix|hw):([^,:]+).*$"), "hw:\\2"))
++{
+
+ EnumDeviceType::DeviceType deviceType =
+ EnumDeviceType::toDeviceType(audioDevice.getData()[2]);
+
++ int level = 0;
+ switch (deviceType) {
+ case EnumDeviceType::DeviceTypeMicrophoneIn:
+ case EnumDeviceType::DeviceTypeWaveIn:
+ _deviceType = CAPTURE_VOLUME;
++ // if mixer "Capture" is not present, fall back to "Mic"
++ if(get_mixer_level(_strDeviceName.c_str(), _deviceType, &level) < 0) {
++ _deviceType = MIC_CAPTURE_VOLUME;
++ }
+ break;
+ case EnumDeviceType::DeviceTypeMasterVolume:
+ case EnumDeviceType::DeviceTypeWaveOut:
+Index: qutecom-2.2~rc3.dfsg1/libs/sound/CMakeLists.txt
+===================================================================
+--- qutecom-2.2~rc3.dfsg1.orig/libs/sound/CMakeLists.txt 2009-04-29 00:14:19.000000000 -0700
++++ qutecom-2.2~rc3.dfsg1/libs/sound/CMakeLists.txt 2009-04-29 00:14:37.000000000 -0700
+@@ -76,6 +76,7 @@
+ ow_use_private_libraries(
+ alsa
+ sndfile
++ boost
+ )
+ ow_add_sources(
+ src/linux/AudioDeviceManager.cpp
+Index: qutecom-2.2~rc3.dfsg1/libs/3rdparty/boost/CMakeLists.txt
+===================================================================
+--- qutecom-2.2~rc3.dfsg1.orig/libs/3rdparty/boost/CMakeLists.txt 2009-04-29 00:14:19.000000000 -0700
++++ qutecom-2.2~rc3.dfsg1/libs/3rdparty/boost/CMakeLists.txt 2009-04-29 00:14:37.000000000 -0700
+@@ -8,7 +8,7 @@
+ BOOST
+ )
+
+-if (NOT MSVC)
++if (NOT MSVC AND NOT LINUX)
+ set(boost_LIBRARIES
+ ${BOOST_PROGRAM_OPTIONS_LIBRARY}
+ ${BOOST_SERIALIZATION_LIBRARY}
+@@ -16,7 +16,18 @@
+ ${BOOST_THREAD_LIBRARY}
+ CACHE INTERNAL "${PROJECT_NAME} libraries"
+ )
+-endif (NOT MSVC)
++endif (NOT MSVC AND NOT LINUX)
++
++if (LINUX)
++ set(boost_LIBRARIES
++ ${BOOST_PROGRAM_OPTIONS_LIBRARY}
++ ${BOOST_SERIALIZATION_LIBRARY}
++ ${BOOST_SIGNALS_LIBRARY}
++ ${BOOST_THREAD_LIBRARY}
++ ${BOOST_REGEX_LIBRARY}
++ CACHE INTERNAL "${PROJECT_NAME} libraries"
++ )
++endif (LINUX)
+
+ ow_add_public_definitions(
+ -DBOOST_ALL_DYN_LINK
Modified: qutecom/trunk/debian/patches/generic/fix-alsa-mixer.patch
URL: http://svn.debian.org/wsvn/pkg-voip/qutecom/trunk/debian/patches/generic/fix-alsa-mixer.patch?rev=7095&op=diff
==============================================================================
--- qutecom/trunk/debian/patches/generic/fix-alsa-mixer.patch (original)
+++ qutecom/trunk/debian/patches/generic/fix-alsa-mixer.patch Fri May 1 06:47:31 2009
@@ -1,23 +1,51 @@
-Fix handling of ALSA miser devices
+Fix handling of ALSA mixer devices
http://trac.qutecom.org/ticket/40
Index: qutecom-2.2~rc3.dfsg1/libs/sound/src/linux/LinuxVolumeControl.cpp
===================================================================
---- qutecom-2.2~rc3.dfsg1.orig/libs/sound/src/linux/LinuxVolumeControl.cpp 2008-12-18 05:22:36.000000000 -0800
-+++ qutecom-2.2~rc3.dfsg1/libs/sound/src/linux/LinuxVolumeControl.cpp 2009-04-25 16:09:05.000000000 -0700
-@@ -30,6 +30,7 @@
+--- qutecom-2.2~rc3.dfsg1.orig/libs/sound/src/linux/LinuxVolumeControl.cpp 2009-04-30 23:41:15.000000000 -0700
++++ qutecom-2.2~rc3.dfsg1/libs/sound/src/linux/LinuxVolumeControl.cpp 2009-04-30 23:43:49.000000000 -0700
+@@ -28,8 +28,29 @@
- LinuxVolumeControl::LinuxVolumeControl(const AudioDevice & audioDevice) {
- _audioDevice = audioDevice;
-+ _strDeviceName = audioDevice.getData()[1];
+ #include <util/Logger.h>
+
+-LinuxVolumeControl::LinuxVolumeControl(const AudioDevice & audioDevice) {
+- _audioDevice = audioDevice;
++#include <string>
++
++std::string LinuxVolumeControl::mixerNameRewrite(const std::string &name) {
++ size_t pos;
++ if((pos = name.find("hw:")) != std::string::npos) {
++ pos += 3; // strlen("hw:")
++ } else if((pos = name.find("dmix:")) != std::string::npos) {
++ pos += 5; // strlen("dmix:")
++ } else {
++ // no rewrite needed
++ return name;
++ }
++ // get the first number
++ size_t endpos = name.find_first_not_of("0123456789", pos);
++ return std::string("hw:") + name.substr(pos, endpos-pos);
++}
++
++
++LinuxVolumeControl::LinuxVolumeControl(const AudioDevice & audioDevice) :
++ _audioDevice(audioDevice),
++ // Rewrite device names like "hw:0,1", "plughw:0", "dmix:0" to "hw:0" in order to be able to open the mixer
++ _strDeviceName(mixerNameRewrite(audioDevice.getData()[1]))
++{
EnumDeviceType::DeviceType deviceType =
EnumDeviceType::toDeviceType(audioDevice.getData()[2]);
-@@ -37,11 +38,11 @@
+@@ -37,11 +58,15 @@
switch (deviceType) {
case EnumDeviceType::DeviceTypeMicrophoneIn:
case EnumDeviceType::DeviceTypeWaveIn:
- _strDeviceType = "capture";
+ _deviceType = CAPTURE_VOLUME;
++ // if mixer "Capture" is not present, fall back to "Mic"
++ if(getLevel() < 0) {
++ _deviceType = MIC_CAPTURE_VOLUME;
++ }
break;
case EnumDeviceType::DeviceTypeMasterVolume:
case EnumDeviceType::DeviceTypeWaveOut:
@@ -26,7 +54,7 @@
break;
default:
LOG_FATAL("Unknown audio device type");
-@@ -50,26 +51,14 @@
+@@ -50,26 +75,14 @@
int LinuxVolumeControl::getLevel() {
int level;
@@ -59,8 +87,8 @@
bool LinuxVolumeControl::isMuted() {
Index: qutecom-2.2~rc3.dfsg1/libs/sound/src/linux/LinuxVolumeControl.h
===================================================================
---- qutecom-2.2~rc3.dfsg1.orig/libs/sound/src/linux/LinuxVolumeControl.h 2009-04-25 16:04:55.000000000 -0700
-+++ qutecom-2.2~rc3.dfsg1/libs/sound/src/linux/LinuxVolumeControl.h 2009-04-25 16:11:07.000000000 -0700
+--- qutecom-2.2~rc3.dfsg1.orig/libs/sound/src/linux/LinuxVolumeControl.h 2009-04-30 23:41:15.000000000 -0700
++++ qutecom-2.2~rc3.dfsg1/libs/sound/src/linux/LinuxVolumeControl.h 2009-04-30 23:43:49.000000000 -0700
@@ -25,6 +25,8 @@
#include <string>
@@ -70,12 +98,15 @@
/**
* Gets and change the volume of a Linux audio device.
*
-@@ -48,8 +50,8 @@
+@@ -47,9 +49,11 @@
+
private:
- AudioDevice _audioDevice;
--
+- AudioDevice _audioDevice;
++ static std::string mixerNameRewrite(const std::string &name);
+
- std::string _strDeviceType;
++ AudioDevice _audioDevice;
+ std::string _strDeviceName;
+ volume_t _deviceType;
};
@@ -83,8 +114,8 @@
#endif //LINUXVOLUMECONTROL_H
Index: qutecom-2.2~rc3.dfsg1/libs/sound/src/linux/alsa_mixer.cpp
===================================================================
---- qutecom-2.2~rc3.dfsg1.orig/libs/sound/src/linux/alsa_mixer.cpp 2009-04-25 16:09:23.000000000 -0700
-+++ qutecom-2.2~rc3.dfsg1/libs/sound/src/linux/alsa_mixer.cpp 2009-04-25 16:09:59.000000000 -0700
+--- qutecom-2.2~rc3.dfsg1.orig/libs/sound/src/linux/alsa_mixer.cpp 2009-04-30 23:41:15.000000000 -0700
++++ qutecom-2.2~rc3.dfsg1/libs/sound/src/linux/alsa_mixer.cpp 2009-04-30 23:43:10.000000000 -0700
@@ -262,7 +262,6 @@
int get_mixer_level(const char *sound_card, volume_t volume_type, int *level) {
More information about the Pkg-voip-commits
mailing list