niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
leozwang@webrtc.org | 2559cbf | 2012-02-27 19:18:25 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
pbos@webrtc.org | 8b06200 | 2013-07-12 08:28:10 +0000 | [diff] [blame^] | 19 | #include "webrtc/system_wrappers/interface/file_wrapper.h" |
| 20 | #include "webrtc/typedefs.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
| 23 | class RtpDump |
| 24 | { |
| 25 | public: |
| 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.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 34 | virtual int32_t Start(const char* fileNameUTF8) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 35 | |
| 36 | // Close the existing file. No more packets will be recorded. |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 37 | virtual int32_t Stop() = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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. |
pbos@webrtc.org | c75102e | 2013-04-09 13:32:55 +0000 | [diff] [blame] | 45 | virtual int32_t DumpPacket(const uint8_t* packet, |
| 46 | uint16_t packetLength) = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 47 | |
| 48 | protected: |
| 49 | virtual ~RtpDump(); |
| 50 | }; |
pbos@webrtc.org | d900e8b | 2013-07-03 15:12:26 +0000 | [diff] [blame] | 51 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 52 | #endif // WEBRTC_MODULES_UTILITY_INTERFACE_RTP_DUMP_H_ |