blob: 5f51990be072593fbb6bec1f9fcd60e21604f6dd [file] [log] [blame]
niklase@google.com77ae29b2011-05-30 11:22:19 +00001/*
2 * Copyright (c) 2011 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// 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.
34 virtual WebRtc_Word32 Start(const WebRtc_Word8* fileNameUTF8) = 0;
35
36 // Close the existing file. No more packets will be recorded.
37 virtual WebRtc_Word32 Stop() = 0;
38
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.
45 virtual WebRtc_Word32 DumpPacket(const WebRtc_UWord8* packet,
46 WebRtc_UWord16 packetLength) = 0;
47
48protected:
49 virtual ~RtpDump();
50};
51} // namespace webrtc
52#endif // WEBRTC_MODULES_UTILITY_INTERFACE_RTP_DUMP_H_