Module: sems
Branch: rco/t38_relay
Commit: 99d5a52138d92dad29cae273980aa6e99eba29b4
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=99d5a52138d92dad29cae273980aa6e99eba29b4

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Mon Nov 26 13:02:47 2012 +0100

additional PayloadMask operations

adds set_all() and invert().

---

 core/AmRtpStream.cpp |   13 +++++++++++++
 core/AmRtpStream.h   |    6 ++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/core/AmRtpStream.cpp b/core/AmRtpStream.cpp
index 040c9cb..18f1d69 100644
--- a/core/AmRtpStream.cpp
+++ b/core/AmRtpStream.cpp
@@ -68,6 +68,19 @@ void PayloadMask::clear()
   memset(bits, 0, sizeof(bits));
 }
 
+void PayloadMask::set_all()
+{
+  memset(bits, 0xFF, sizeof(bits));
+}
+
+void PayloadMask::invert()
+{
+  // assumes that bits[] contains 128 bits
+  unsigned long long* ull = (unsigned long long*)bits;
+  ull[0] = ~ull[0];
+  ull[1] = ~ull[1];
+}
+
 PayloadMask::PayloadMask(const PayloadMask &src)
 {
   memcpy(bits, src.bits, sizeof(bits));
diff --git a/core/AmRtpStream.h b/core/AmRtpStream.h
index 1cbd1db..077b561 100644
--- a/core/AmRtpStream.h
+++ b/core/AmRtpStream.h
@@ -111,6 +111,12 @@ class PayloadMask
     // set given flag (TODO: once it shows to be working, change / and % to >> 
and &)
     void set(unsigned char payload_id) { if (payload_id < 128) bits[payload_id 
/ 8] |= 1 << (payload_id % 8); }
 
+    // set all flags to 'true'
+    void set_all();
+
+    // invert all flags
+    void invert();
+
     // get given flag
     bool get(unsigned char payload_id) { if (payload_id > 127) return false; 
return (bits[payload_id / 8] & (1 << (payload_id % 8))); }
     

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to