1/* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18/* */ 19/*********************************************************************************/ 20 21/* 22** File: rtcp_decoder.h 23** 24** Description: 25** This module defines the RTCP class. This class is used to encode and 26** decode RTCP packets. Please refer to the RTCP design document for 27** details. 28*/ 29 30#ifndef RTCP_DECODER_H 31#define RTCP_DECODER_H 32 33/* 34** Includes 35*/ 36#ifndef OSCL_TYPES_H_INCLUDED 37#include "oscl_types.h" 38#endif 39#ifndef OSCL_BIN_STREAM_H_INCLUDED 40#include "oscl_bin_stream.h" 41#endif 42#ifndef RTCP_H 43#include "rtcp.h" 44#endif 45 46/* 47** Constants 48*/ 49 50/* 51** Classes 52*/ 53 54 55/* 56** This class is used to encode and 57** decode RTCP packets. Please refer to the RTCP design document for 58** details. 59*/ 60class RTCP_Decoder : public RTCP_Base 61{ 62 public: 63 64 typedef enum 65 { 66 RTCP_SUCCESS, 67 FAIL, 68 UNSUPPORTED_RTCP_VERSION, 69 RTCP_PACKET_TYPE_MISMATCH, 70 RTCP_LENGTH_MISMATCH, 71 EOS_ON_READ, 72 UNSUPPORTED_RTCP_PVSS_APP 73 } Error_t; 74 75 OSCL_IMPORT_REF RTCP_Decoder(const uint8 version = DEFAULT_RTPRTCP_VERSION); 76 OSCL_IMPORT_REF ~RTCP_Decoder(); 77 78 79 /* 80 * The scan_compound_packet routine will process the compound packet 81 * and fill the array of packet types and MemoryFragments (up to 82 * the array_size specified). The caller provides the space for the 83 * arrays that are filled by this routine. 84 */ 85 OSCL_IMPORT_REF Error_t scan_compound_packet(OsclMemoryFragment& input_packet, 86 int32 max_array_size, int32& filled_size, 87 RTCPPacketType *array_of_packet_types, 88 OsclMemoryFragment *array_of_packets); 89 90 OSCL_IMPORT_REF Error_t DecodeRR(OsclMemoryFragment& input_packet, 91 RTCP_RR& rr_packet); 92 93 OSCL_IMPORT_REF Error_t DecodeSR(const OsclMemoryFragment& input_packet, 94 RTCP_SR& sr_packet); 95 96 OSCL_IMPORT_REF Error_t DecodeSDES(const OsclMemoryFragment& input_packet, 97 RTCP_SDES& sdes_packet); 98 99 100 OSCL_IMPORT_REF Error_t DecodeBYE(const OsclMemoryFragment& input_packet, 101 RTCP_BYE& bye_packet); 102 103 OSCL_IMPORT_REF Error_t DecodeAPP(const OsclMemoryFragment& input_packet, 104 RTCP_APP& bye_packet); 105 106 107 private: 108 109 Error_t DecodeReportBlock(/* Input stream reference */ 110 OsclBinIStreamBigEndian & inStream, 111 RTCP_ReportBlock* report 112 ); 113 114 Error_t DecodeSDESChunk(OsclBinIStreamBigEndian & inStream, 115 SDES_chunk* sdes_chunk, 116 OsclMemoryFragment& chunk_data); 117 118 119 120}; 121 122#endif 123