summaryrefslogtreecommitdiffstats
blob: c56e754803c07c766289f3e1dd17caf4e50f5037 (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
/*
 * Copyright (c) 2012 Yoann Blein
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

#pragma once

#include <Swiften/Base/boost_bsignals.h>

#include <vector>
#include <stdint.h>

#include <boost/shared_ptr.hpp>

#include "vpx/vpx_encoder.h"

namespace Swift {
	class VP8RTPPacketizer {
		public:
			VP8RTPPacketizer();

			void packetizeFrame(const vpx_codec_cx_pkt_t* pkt);

			boost::signal<void (const std::vector<uint8_t>&, bool marker)> onNewPayloadReady;

		private:
			static const uint8_t SBit = 1 << 4;
			static const uint8_t HBit = 1 << 4;
			static const uint8_t Size0BitMask = 7;
			static const uint8_t Size0BitShift = 5;
			static const size_t MaxRTPPayloadSize = 1300; // Replace with JRTPLIB's one; TODO: fix the issue with maximum size

			std::vector<uint8_t> payloadBuffer;
	};
}