blob: f954b1bfb7a759a20396a650f33a9c4e9132e7e7 [file] [log] [blame]
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +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#include <stdio.h>
12
henrik.lundin@webrtc.org83317142014-12-01 11:25:04 +000013#include "webrtc/base/checks.h"
14#include "webrtc/system_wrappers/interface/scoped_ptr.h"
15#include "webrtc/test/rtp_file_reader.h"
16#include "webrtc/test/rtp_file_writer.h"
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000017
henrik.lundin@webrtc.org83317142014-12-01 11:25:04 +000018using webrtc::scoped_ptr;
19using webrtc::test::RtpFileReader;
20using webrtc::test::RtpFileWriter;
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000021
22int main(int argc, char* argv[]) {
23 if (argc < 3) {
24 printf("Usage: RTPcat in1.rtp int2.rtp [...] out.rtp\n");
25 exit(1);
26 }
27
henrik.lundin@webrtc.org83317142014-12-01 11:25:04 +000028 scoped_ptr<RtpFileWriter> output(
29 RtpFileWriter::Create(RtpFileWriter::kRtpDump, argv[argc - 1]));
30 CHECK(output.get() != NULL) << "Cannot open output file.";
31 printf("Output RTP file: %s\n", argv[argc - 1]);
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000032
33 for (int i = 1; i < argc - 1; i++) {
henrik.lundin@webrtc.org83317142014-12-01 11:25:04 +000034 scoped_ptr<RtpFileReader> input(
35 RtpFileReader::Create(RtpFileReader::kRtpDump, argv[i]));
36 CHECK(input.get() != NULL) << "Cannot open input file " << argv[i];
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000037 printf("Input RTP file: %s\n", argv[i]);
38
henrik.lundin@webrtc.org83317142014-12-01 11:25:04 +000039 webrtc::test::RtpPacket packet;
40 while (input->NextPacket(&packet))
41 CHECK(output->WritePacket(&packet));
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000042 }
henrik.lundin@webrtc.orgd94659d2013-01-29 12:09:21 +000043 return 0;
44}