12ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org/*
22ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
32ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org *
42ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org *  Use of this source code is governed by a BSD-style license
52ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org *  that can be found in the LICENSE file in the root of the source
62ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org *  tree. An additional intellectual property rights grant can be found
72ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org *  in the file PATENTS.  All contributing project authors may
82ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
92ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org */
102ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org
112ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org#include "webrtc/modules/rtp_rtcp/source/rtp_format.h"
122ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org
132ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org#include "webrtc/modules/rtp_rtcp/source/rtp_format_h264.h"
14b5e6bfc76a32a588da2400636688d34a71a2f47dpbos@webrtc.org#include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h"
15b5e6bfc76a32a588da2400636688d34a71a2f47dpbos@webrtc.org#include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h"
16f38ea3caa39887c63e7d4862dcf420d4a35c1073asapersson#include "webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h"
172ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org
182ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.orgnamespace webrtc {
192ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.orgRtpPacketizer* RtpPacketizer::Create(RtpVideoCodecTypes type,
20b5e6bfc76a32a588da2400636688d34a71a2f47dpbos@webrtc.org                                     size_t max_payload_len,
21b5e6bfc76a32a588da2400636688d34a71a2f47dpbos@webrtc.org                                     const RTPVideoTypeHeader* rtp_type_header,
22b5e6bfc76a32a588da2400636688d34a71a2f47dpbos@webrtc.org                                     FrameType frame_type) {
232ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org  switch (type) {
242ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org    case kRtpVideoH264:
25b5e6bfc76a32a588da2400636688d34a71a2f47dpbos@webrtc.org      return new RtpPacketizerH264(frame_type, max_payload_len);
262ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org    case kRtpVideoVp8:
27b5e6bfc76a32a588da2400636688d34a71a2f47dpbos@webrtc.org      assert(rtp_type_header != NULL);
28b5e6bfc76a32a588da2400636688d34a71a2f47dpbos@webrtc.org      return new RtpPacketizerVp8(rtp_type_header->VP8, max_payload_len);
29f38ea3caa39887c63e7d4862dcf420d4a35c1073asapersson    case kRtpVideoVp9:
30f38ea3caa39887c63e7d4862dcf420d4a35c1073asapersson      assert(rtp_type_header != NULL);
31f38ea3caa39887c63e7d4862dcf420d4a35c1073asapersson      return new RtpPacketizerVp9(rtp_type_header->VP9, max_payload_len);
32b5e6bfc76a32a588da2400636688d34a71a2f47dpbos@webrtc.org    case kRtpVideoGeneric:
33b5e6bfc76a32a588da2400636688d34a71a2f47dpbos@webrtc.org      return new RtpPacketizerGeneric(frame_type, max_payload_len);
34b5e6bfc76a32a588da2400636688d34a71a2f47dpbos@webrtc.org    case kRtpVideoNone:
352ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org      assert(false);
362ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org  }
372ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org  return NULL;
382ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org}
392ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org
40730d2707713c4240070af17e56edd10d039bafd2pbos@webrtc.orgRtpDepacketizer* RtpDepacketizer::Create(RtpVideoCodecTypes type) {
412ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org  switch (type) {
422ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org    case kRtpVideoH264:
43730d2707713c4240070af17e56edd10d039bafd2pbos@webrtc.org      return new RtpDepacketizerH264();
442ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org    case kRtpVideoVp8:
45730d2707713c4240070af17e56edd10d039bafd2pbos@webrtc.org      return new RtpDepacketizerVp8();
46f38ea3caa39887c63e7d4862dcf420d4a35c1073asapersson    case kRtpVideoVp9:
47f38ea3caa39887c63e7d4862dcf420d4a35c1073asapersson      return new RtpDepacketizerVp9();
48b5e6bfc76a32a588da2400636688d34a71a2f47dpbos@webrtc.org    case kRtpVideoGeneric:
49730d2707713c4240070af17e56edd10d039bafd2pbos@webrtc.org      return new RtpDepacketizerGeneric();
50b5e6bfc76a32a588da2400636688d34a71a2f47dpbos@webrtc.org    case kRtpVideoNone:
512ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org      assert(false);
522ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org  }
532ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org  return NULL;
542ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org}
552ec560606be6519dc4e32a1e6855b0f362ca498dstefan@webrtc.org}  // namespace webrtc
56