Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / modules / rtp_rtcp / source / rtp_format.h
1 /*
2  *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3  *
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.
9  */
10
11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H_
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H_
13
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"
17
18 namespace webrtc {
19
20 class RtpPacketizer {
21  public:
22   static RtpPacketizer* Create(RtpVideoCodecTypes type, size_t max_payload_len);
23
24   virtual ~RtpPacketizer() {}
25
26   virtual void SetPayloadData(const uint8_t* payload_data,
27                               size_t payload_size,
28                               const RTPFragmentationHeader* fragmentation) = 0;
29
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
35   // next packet).
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;
40 };
41
42 class RtpDepacketizer {
43  public:
44   static RtpDepacketizer* Create(RtpVideoCodecTypes type,
45                                  RtpData* const callback);
46
47   virtual ~RtpDepacketizer() {}
48
49   virtual bool Parse(WebRtcRTPHeader* rtp_header,
50                      const uint8_t* payload_data,
51                      size_t payload_data_length) = 0;
52 };
53 }  // namespace webrtc
54 #endif  // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_FORMAT_H_