2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H_
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H_
14 #include "webrtc/base/constructormagic.h"
15 #include "webrtc/modules/interface/module_common_types.h"
16 #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
22 static RtpPacketizer* Create(RtpVideoCodecTypes type, size_t max_payload_len);
24 virtual ~RtpPacketizer() {}
26 virtual void SetPayloadData(const uint8_t* payload_data,
28 const RTPFragmentationHeader* fragmentation) = 0;
30 // Get the next payload with payload header.
31 // buffer is a pointer to where the output will be written.
32 // bytes_to_send is an output variable that will contain number of bytes
33 // written to buffer. The parameter last_packet is true for the last packet of
34 // the frame, false otherwise (i.e., call the function again to get the
36 // Returns true on success or false if there was no payload to packetize.
37 virtual bool NextPacket(uint8_t* buffer,
38 size_t* bytes_to_send,
39 bool* last_packet) = 0;
42 class RtpDepacketizer {
44 static RtpDepacketizer* Create(RtpVideoCodecTypes type,
45 RtpData* const callback);
47 virtual ~RtpDepacketizer() {}
49 virtual bool Parse(WebRtcRTPHeader* rtp_header,
50 const uint8_t* payload_data,
51 size_t payload_data_length) = 0;
54 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H_