blob: 9a852d07cd9fee33f61852be193129f988d5adf2 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
leozwang@webrtc.org2559cbf2012-02-27 19:18:25 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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// This file implements a class that writes a stream of RTP and RTCP packets
12// to a file according to the format specified by rtpplay. See
13// http://www.cs.columbia.edu/irt/software/rtptools/.
14// Notes: supported platforms are Windows, Linux and Mac OSX
15
16#ifndef WEBRTC_MODULES_UTILITY_INTERFACE_RTP_DUMP_H_
17#define WEBRTC_MODULES_UTILITY_INTERFACE_RTP_DUMP_H_
18
19#include "typedefs.h"
20#include "file_wrapper.h"
21
22namespace webrtc {
23class RtpDump
24{
25public:
26 // Factory method.
27 static RtpDump* CreateRtpDump();
28
29 // Delete function. Destructor disabled.
30 static void DestroyRtpDump(RtpDump* object);
31
32 // Open the file fileNameUTF8 for writing RTP/RTCP packets.
33 // Note: this API also adds the rtpplay header.
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000034 virtual int32_t Start(const char* fileNameUTF8) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000035
36 // Close the existing file. No more packets will be recorded.
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000037 virtual int32_t Stop() = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000038
39 // Return true if a file is open for recording RTP/RTCP packets.
40 virtual bool IsActive() const = 0;
41
42 // Writes the RTP/RTCP packet in packet with length packetLength in bytes.
43 // Note: packet should contain the RTP/RTCP part of the packet. I.e. the
44 // first bytes of packet should be the RTP/RTCP header.
pbos@webrtc.orgc75102e2013-04-09 13:32:55 +000045 virtual int32_t DumpPacket(const uint8_t* packet,
46 uint16_t packetLength) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000047
48protected:
49 virtual ~RtpDump();
50};
51} // namespace webrtc
52#endif // WEBRTC_MODULES_UTILITY_INTERFACE_RTP_DUMP_H_