diff options
Diffstat (limited to 'Swiften/Elements/RTPPayloadType.h')
-rw-r--r-- | Swiften/Elements/RTPPayloadType.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Swiften/Elements/RTPPayloadType.h b/Swiften/Elements/RTPPayloadType.h new file mode 100644 index 0000000..e61f921 --- /dev/null +++ b/Swiften/Elements/RTPPayloadType.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2011 Yoann Blein + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> +#include <boost/cstdint.hpp> + +#include <string> +#include <map> + +namespace Swift { + +class RTPPayloadType : public Payload { +public: + typedef boost::shared_ptr<RTPPayloadType> ref; + typedef std::map<std::string, std::string> ParameterMap; + +public: + RTPPayloadType(boost::uint8_t id = 0, const std::string& name = "", boost::uint32_t clockrate = 0, + boost::uint8_t channels = 1, boost::uint32_t ptime = 0, boost::uint32_t maxptime = 0) : + m_id(id), m_name(name), m_clockrate(clockrate), m_channels(channels), m_ptime(ptime), m_maxptime(maxptime) {} + + void setChannels(boost::uint32_t channels) { m_channels = channels; } + boost::uint32_t getChannels() const { return m_channels; } + + void setClockrate(boost::uint32_t clockrate) { m_clockrate = clockrate; } + boost::uint32_t getClockrate() const { return m_clockrate; } + + void setID(boost::uint8_t id) { m_id = id; } + boost::uint8_t getID() const { return m_id; } + + void setMaxptime(boost::uint32_t maxptime) { m_maxptime = maxptime; } + boost::uint32_t getMaxptime() const { return m_maxptime; } + + void setName(const std::string& name) { m_name = name; } + const std::string& getName() const { return m_name; } + + void setPTime(boost::uint32_t ptime) { m_ptime = ptime; } + boost::uint32_t getPTime() const { return m_ptime; } + + bool addParameter(const std::string& name, const std::string& value) { + return parameters.insert(std::make_pair(name, value)).second; + } + + const ParameterMap& getParameters() const { return parameters; } + +private: + boost::uint8_t m_id; + std::string m_name; + boost::uint32_t m_clockrate; + boost::uint8_t m_channels; + boost::uint32_t m_ptime; + boost::uint32_t m_maxptime; + ParameterMap parameters; +}; + +} |