1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_RTP_PARSER_H_ 6 #define MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_RTP_PARSER_H_ 7 8 #include "media/cast/net/cast_net_defines.h" 9 #include "media/cast/rtp_receiver/rtp_receiver_defines.h" 10 11 namespace media { 12 namespace cast { 13 14 class RtpData; 15 16 struct RtpParserConfig { 17 RtpParserConfig() { 18 ssrc = 0; 19 payload_type = 0; 20 audio_channels = 0; 21 } 22 23 uint32 ssrc; 24 int payload_type; 25 AudioCodec audio_codec; 26 VideoCodec video_codec; 27 int audio_channels; 28 }; 29 30 class RtpParser { 31 public: 32 RtpParser(RtpData* incoming_payload_callback, 33 const RtpParserConfig parser_config); 34 35 ~RtpParser(); 36 37 bool ParsePacket(const uint8* packet, size_t length, 38 RtpCastHeader* rtp_header); 39 40 private: 41 bool ParseCommon(const uint8* packet, size_t length, 42 RtpCastHeader* rtp_header); 43 44 bool ParseCast(const uint8* packet, size_t length, 45 RtpCastHeader* rtp_header); 46 47 RtpData* data_callback_; 48 RtpParserConfig parser_config_; 49 FrameIdWrapHelper frame_id_wrap_helper_; 50 FrameIdWrapHelper reference_frame_id_wrap_helper_; 51 }; 52 53 } // namespace cast 54 } // namespace media 55 56 #endif // MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_RTP_PARSER_H_ 57