summaryrefslogtreecommitdiffstats
blob: b06b29d3cbb291489423f00c73346224a3eabf01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * Copyright (c) 2012 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) :
			id(id), name(name), clockrate(clockrate), channels(channels), ptime(ptime), maxptime(maxptime) {}

		void setChannels(boost::uint32_t channels) { this->channels = channels; }
		boost::uint32_t getChannels() const { return this->channels; }

		void setClockrate(boost::uint32_t clockrate) { this->clockrate = clockrate; }
		boost::uint32_t getClockrate() const { return this->clockrate; }

		void setID(boost::uint8_t id) { this->id = id; }
		boost::uint8_t getID() const { return this->id; }

		void setMaxptime(boost::uint32_t maxptime) { this->maxptime = maxptime; }
		boost::uint32_t getMaxptime() const { return this->maxptime; }

		void setName(const std::string& name) { this->name = name; }
		const std::string& getName() const { return this->name; }

		void setPTime(boost::uint32_t ptime) { this->ptime = ptime; }
		boost::uint32_t getPTime() const { return this->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 id;
		std::string name;
		boost::uint32_t clockrate;
		boost::uint8_t channels;
		boost::uint32_t ptime;
		boost::uint32_t maxptime;
		ParameterMap parameters;
	};

}