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 #ifndef ASF_MEDIAINFO_H 19 #define ASF_MEDIAINFO_H 20 21 #include "sdp_memory.h" 22 #include "media_info.h" 23 24 // NOTE.... this information really needs to exist for only one media object... 25 // i.e., there is no reason to have arrays of these fields, since we have one of these 26 // mediaInfo elements for each media object... the trick is how to get these from the SDP 27 // file into each of the media elements... 28 29 class asf_mediaInfo : public mediaInfo 30 { 31 private: 32 33 //int profileLevelID; 34 OSCL_HeapString<SDPParserAlloc> lang; 35 unsigned char *asfHeaderPtr; 36 int asfHeaderSize; 37 38 //for both audio and video 39 unsigned char *decoderSpecificInfo; 40 int decoderSpecificInfoSize; 41 //unsigned char *VOLHeaderPtr; 42 //int VOLHeaderSize; 43 int streamID; 44 int streamBitrate; 45 //int numSampleEntries; 46 47 public: asf_mediaInfo()48 asf_mediaInfo() 49 { 50 lang = NULL; 51 asfHeaderSize = 0; 52 asfHeaderPtr = NULL; 53 decoderSpecificInfoSize = 0; 54 decoderSpecificInfo = NULL; 55 //VOLHeaderSize = 0; 56 //VOLHeaderPtr = NULL; 57 streamBitrate = 0; 58 //profileLevelID = -1; 59 }; asf_mediaInfo(const asf_mediaInfo & pSource)60 asf_mediaInfo(const asf_mediaInfo & pSource) : mediaInfo(pSource) 61 { 62 setLang(pSource.lang); 63 //setProfileLevelID(pSource.profileLevelID); 64 asfHeaderSize = pSource.asfHeaderSize; 65 decoderSpecificInfoSize = pSource.decoderSpecificInfoSize; 66 //VOLHeaderSize = pSource.VOLHeaderSize; 67 68 }; 69 ~asf_mediaInfo()70 ~asf_mediaInfo() 71 { 72 if (asfHeaderPtr != NULL) 73 { 74 oscl_free(asfHeaderPtr); 75 asfHeaderPtr = NULL; 76 } 77 if (decoderSpecificInfo != NULL) 78 { 79 // oscl_free(decoderSpecificInfo); //added 80 decoderSpecificInfo = NULL; 81 } 82 /* 83 if(VOLHeaderPtr!=NULL) { 84 oscl_free(VOLHeaderPtr); 85 VOLHeaderPtr = NULL; 86 } 87 */ 88 }; setLang(char * language)89 inline void setLang(char* language) 90 { 91 lang = language; 92 }; setLang(const OSCL_HeapString<SDPParserAlloc> & language)93 inline void setLang(const OSCL_HeapString<SDPParserAlloc>& language) 94 { 95 lang = language; 96 }; 97 /* 98 inline void setProfileLevelID(int pID) 99 { 100 profileLevelID = pID; 101 }; 102 */ setStreamID(int ID)103 inline void setStreamID(int ID) 104 { 105 streamID = ID; 106 }; setStreamBitrate(int bitrate)107 inline void setStreamBitrate(int bitrate) 108 { 109 streamBitrate = bitrate; 110 }; setAsfHeader(unsigned char * ASCPtr,int ASCLen)111 inline void setAsfHeader(unsigned char* ASCPtr, int ASCLen) 112 { 113 asfHeaderPtr = ASCPtr; 114 asfHeaderSize = ASCLen; 115 }; 116 setDecoderSpecificInfo(unsigned char * ASCPtr,int ASCLen)117 inline void setDecoderSpecificInfo(unsigned char* ASCPtr, int ASCLen) 118 { 119 decoderSpecificInfo = ASCPtr; 120 decoderSpecificInfoSize = ASCLen; 121 }; 122 123 /* 124 inline void setVOLHeader(unsigned char* ASCPtr, int ASCLen) 125 { 126 VOLHeaderPtr = ASCPtr; 127 VOLHeaderSize = ASCLen; 128 }; 129 */ GetTotalStringLength()130 inline int GetTotalStringLength() 131 { 132 int size = 0; 133 size += mediaInfo::GetTotalStringLength(); 134 if (lang.get_size() > 0) 135 { 136 size += oscl_strlen("a=lang:") + lang.get_size() + SDP_CR_LF; 137 } 138 return size; 139 } getLang()140 inline const char *getLang() 141 { 142 return lang.get_cstr(); 143 }; 144 // inline int getProfileLevelID(){return profileLevelID;}; 145 getAsfHeader(int * size)146 inline const unsigned char *getAsfHeader(int*size) 147 { 148 return 0; 149 }; 150 getVOLLength()151 inline int getVOLLength() 152 { 153 // return VOLHeaderSize; 154 return decoderSpecificInfoSize; 155 }; 156 getVOLHeader()157 inline unsigned char *getVOLHeader() 158 { 159 return decoderSpecificInfo; 160 //return VOLHeaderPtr; 161 }; 162 getAudioSpecificConfig(int * size)163 inline const unsigned char *getAudioSpecificConfig(int*size) 164 { 165 *size = decoderSpecificInfoSize; 166 return decoderSpecificInfo; 167 }; 168 getStreamID()169 inline int getStreamID() 170 { 171 return streamID; 172 }; getStreamBitrate()173 inline int getStreamBitrate() 174 { 175 return streamBitrate; 176 }; 177 }; 178 #endif 179