[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/multimedia/phonon/mixer
From:       Matthias Kretz <kretz () kde ! org>
Date:       2008-03-01 0:21:26
Message-ID: 1204330886.198878.26411.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 780790 by mkretz:

seems I did some partial commit before that was not intended. So here's the rest: it \
adds a function telling whether a MixerControl is removable - in ALSA that maps to a \
user element

 M  +1 -1      alsaclasses.h  
 M  +1 -0      mixercontrol.h  
 M  +14 -0     mixercontrol_alsa.cpp  
 M  +2 -0      mixercontrol_p.h  


--- trunk/playground/multimedia/phonon/mixer/alsaclasses.h #780789:780790
@@ -305,7 +305,7 @@
         inline int addInt64Element(const AlsaElementId &id, unsigned int count, long \
long min, long long max, long long step) { return snd_ctl_elem_add_integer64(p, id, \
                count, min, max, step); }
         inline int addBoolElement(const AlsaElementId &id, unsigned int count) { \
                return snd_ctl_elem_add_boolean(p, id, count); }
         inline int addIec958Element(const AlsaElementId &id) { return \
                snd_ctl_elem_add_iec958(p, id); }
-        inline int removeElement(AlsaElementId *id) { return snd_ctl_elem_remove(p, \
*id); } +        inline int removeElement(AlsaElementId id) { return \
snd_ctl_elem_remove(p, id); }  
         AlsaTlv readTlv(const AlsaElementId &id) { AlsaTlv r; \
                snd_ctl_elem_tlv_read(p, id, r.data.data(), AlsaTlv::size()); return \
                r; }
         void writeTlv(const AlsaElementId &id, const AlsaTlv &tlv) { \
                snd_ctl_elem_tlv_write(p, id, tlv.data.data()); }
--- trunk/playground/multimedia/phonon/mixer/mixercontrol.h #780789:780790
@@ -61,6 +61,7 @@
         bool isValid() const;
         Type type() const;
         MixerControlSet parentSet() const;
+        bool isRemovable() const;
 
         QString extraInfo() const;
 
--- trunk/playground/multimedia/phonon/mixer/mixercontrol_alsa.cpp #780789:780790
@@ -202,6 +202,8 @@
         << "index" << info.index()
         << "m_index" << m_index;
     switch (m_type) {
+    case MixerControl::Invalid:
+        kFatal() << "invalid type";
     case MixerControl::Toggle:
         break;
     case MixerControl::Integer:
@@ -266,5 +268,17 @@
     }
 }
 
+bool MixerControl::isRemovable() const
+{
+    K_S(const MixerControl);
+    AlsaControl *ctl = s->m_mixer ? s->m_mixer->ctl() : 0;
+    if (!ctl) {
+        return false;
+    }
+    AlsaElementInfo info;
+    ctl->readElementInfo(&info, s->m_id);
+    return info.isUser();
+}
+
 } // namespace Mixer
 } // namespace Phonon
--- trunk/playground/multimedia/phonon/mixer/mixercontrol_p.h #780789:780790
@@ -43,6 +43,7 @@
     friend class MixerControl;
     friend class MixerControlPrivate;
     friend class MixerSharedData;
+    friend class Mixer;
     Q_OBJECT
     public:
         MixerControlSharedData(const MixerSharedData::Ptr &mixer, const \
AlsaElementId &id); @@ -71,6 +72,7 @@
 class MixerControlPrivate
 {
     friend class MixerSharedData;
+    friend class Mixer;
     Q_DECLARE_PUBLIC(MixerControl)
     K_DECLARE_SHARED(MixerControl)
     protected:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic