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 PVMF_SM_FSP_BASE_METADATA_H_INCLUDED 19 #define PVMF_SM_FSP_BASE_METADATA_H_INCLUDED 20 21 #ifndef COMMONINFO_H 22 #include "common_info.h" 23 #endif 24 25 // Number of metadata keys supported in this node. 26 #define PVMFSTREAMINGMGRNODE_NUM_METADATAKEYS 16 27 // Constant character strings for metadata keys 28 //Common to all streaming sessions 29 static const char PVMFSTREAMINGMGRNODE_ALBUM_KEY[] = "album"; 30 static const char PVMFSTREAMINGMGRNODE_AUTHOR_KEY[] = "author"; 31 static const char PVMFSTREAMINGMGRNODE_ARTIST_KEY[] = "artist"; 32 static const char PVMFSTREAMINGMGRNODE_TITLE_KEY[] = "title"; 33 static const char PVMFSTREAMINGMGRNODE_DESCRIPTION_KEY[] = "description"; 34 static const char PVMFSTREAMINGMGRNODE_RATING_KEY[] = "rating"; 35 static const char PVMFSTREAMINGMGRNODE_COPYRIGHT_KEY[] = "copyright"; 36 static const char PVMFSTREAMINGMGRNODE_GENRE_KEY[] = "genre"; 37 static const char PVMFSTREAMINGMGRNODE_LYRICS_KEY[] = "lyrics"; 38 static const char PVMFSTREAMINGMGRNODE_CLASSIFICATION_KEY[] = "classification"; 39 static const char PVMFSTREAMINGMGRNODE_KEYWORDS_KEY[] = "keywords"; 40 static const char PVMFSTREAMINGMGRNODE_LOCATION_KEY[] = "location;format=3GPP_LOCATION"; 41 static const char PVMFSTREAMINGMGRNODE_DURATION_KEY[] = "duration"; 42 static const char PVMFSTREAMINGMGRNODE_NUMTRACKS_KEY[] = "num-tracks"; 43 static const char PVMFSTREAMINGMGRNODE_RANDOM_ACCESS_DENIED_KEY[] = "random-access-denied"; 44 static const char PVMFSTREAMINGMGRNODE_YEAR_KEY[] = "year"; 45 static const char PVMFSTREAMINGMGRNODE_NUM_GRAPHICS_KEY[] = "graphic/num-frames;format=APIC"; 46 static const char PVMFSTREAMINGMGRNODE_GRAPHICS_KEY[] = "graphic;format=APIC"; 47 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_TYPE_KEY[] = "track-info/type"; 48 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_DURATION_KEY[] = "track-info/duration"; 49 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_SELECTED_KEY[] = "track-info/selected"; 50 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_WIDTH_KEY[] = "track-info/video/width"; 51 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_HEIGHT_KEY[] = "track-info/video/height"; 52 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_SAMPLERATE_KEY[] = "track-info/sample-rate"; 53 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_NUMCHANNELS_KEY[] = "track-info/audio/channels"; 54 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_AUDIO_BITS_PER_SAMPLE_KEY[] = "track-info/audio/bits-per-sample"; 55 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_TRACKID_KEY[] = "track-info/track-id"; 56 57 static const char PVMFSTREAMINGMGRNODE_CLIP_TYPE_KEY[] = "clip-type"; 58 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_FRAME_RATE_KEY[] = "track-info/frame-rate"; 59 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_CODEC_NAME_KEY[] = "track-info/codec-name"; 60 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_CODEC_DESCRIPTION_KEY[] = "track-info/codec-description"; 61 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_CODEC_DATA_KEY[] = "track-info/codec-specific-info"; 62 63 //PVMF_DRM_INFO_IS_PROTECTED_QUERY 64 65 //Extended metadata [FF specific] 66 67 //Streaming specific metadata keys 68 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_BITRATE_KEY[] = "track-info/bit-rate"; //RTSP Specific 69 static const char PVMFSTREAMINGMGRNODE_PAUSE_DENIED_KEY[] = "pause-denied"; //RTSP Unicast Specific 70 static const char PVMFSTREAMINGMGRNODE_TRACKINFO_MAX_BITRATE_KEY[] = "track-info/max-bitrate"; //HTTP streaming Specific 71 72 /////////////////////////////////////////////////////////////////////////////// 73 static const char PVMFSTREAMINGMGRNODE_SEMICOLON[] = ";"; 74 static const char PVMFSTREAMINGMGRNODE_TIMESCALE[] = "timescale="; 75 static const char PVMFSTREAMINGMGRNODE_INDEX[] = "index="; 76 static const char PVMFSTREAMINGMGRNODE_MAXSIZE[] = "maxsize="; 77 static const char PVMFSTREAMINGMGRNODE_REQSIZE[] = "reqsize="; 78 static const char PVMFSTREAMINGMGRNODE_TRUNCATE_FLAG[] = "truncate="; 79 80 static const unsigned int RELIABLE_BURST_PVSS_VER = 5; /* It was found that only PVSS version 5 does reliable burst streaming */ 81 82 /////////////////////////////////////////////////////////////////////////////// 83 //Datastructures to store metadata info 84 /////////////////////////////////////////////////////////////////////////////// 85 class PVMFSMTrackMetaDataInfo 86 { 87 public: 88 PVMFSMTrackMetaDataInfo() 89 { 90 iTrackDurationAvailable = false; 91 iTrackDuration = 0; 92 iTrackDurationTimeScale = 0; 93 iTrackBitRate = 0; 94 iTrackMaxBitRate = 0; 95 iTrackSelected = false; 96 iTrackID = iTrackID; 97 iCodecName = NULL; 98 iCodecDescription = NULL; 99 iTrackWidth = 0; 100 iTrackHeight = 0; 101 iVideoFrameRate = 0; 102 iAudioSampleRate = 0; 103 iAudioNumChannels = 0; 104 iAudioBitsPerSample = 0; 105 }; 106 107 PVMFSMTrackMetaDataInfo(const PVMFSMTrackMetaDataInfo& a) 108 { 109 iTrackDurationAvailable = a.iTrackDurationAvailable; 110 iTrackDuration = a.iTrackDuration; 111 iTrackDurationTimeScale = a.iTrackDurationTimeScale; 112 iMimeType = a.iMimeType; 113 iTrackBitRate = a.iTrackBitRate; 114 iTrackMaxBitRate = a.iTrackMaxBitRate; 115 iTrackSelected = a.iTrackSelected; 116 iTrackID = a.iTrackID; 117 iCodecName = a.iCodecName; 118 iCodecDescription = a.iCodecDescription; 119 iCodecSpecificInfo = a.iCodecSpecificInfo; 120 iTrackWidth = a.iTrackWidth; 121 iTrackHeight = a.iTrackHeight; 122 iVideoFrameRate = a.iVideoFrameRate; 123 iAudioSampleRate = a.iAudioSampleRate; 124 iAudioNumChannels = a.iAudioNumChannels; 125 iAudioBitsPerSample = a.iAudioBitsPerSample; 126 }; 127 128 PVMFSMTrackMetaDataInfo& operator=(const PVMFSMTrackMetaDataInfo& a) 129 { 130 if (&a != this) 131 { 132 iTrackDurationAvailable = a.iTrackDurationAvailable; 133 iTrackDuration = a.iTrackDuration; 134 iTrackDurationTimeScale = a.iTrackDurationTimeScale; 135 iMimeType = a.iMimeType; 136 iTrackBitRate = a.iTrackBitRate; 137 iTrackMaxBitRate = a.iTrackMaxBitRate; 138 iTrackSelected = a.iTrackSelected; 139 iTrackID = a.iTrackID; 140 iCodecName = a.iCodecName; 141 iCodecDescription = a.iCodecDescription; 142 iCodecSpecificInfo = a.iCodecSpecificInfo; 143 iTrackWidth = a.iTrackWidth; 144 iTrackHeight = a.iTrackHeight; 145 iVideoFrameRate = a.iVideoFrameRate; 146 iAudioSampleRate = a.iAudioSampleRate; 147 iAudioNumChannels = a.iAudioNumChannels; 148 iAudioBitsPerSample = a.iAudioBitsPerSample; 149 } 150 return (*this); 151 }; 152 153 bool iTrackDurationAvailable; 154 uint64 iTrackDuration; 155 uint64 iTrackDurationTimeScale; 156 OSCL_HeapString<OsclMemAllocator> iMimeType; 157 uint32 iTrackBitRate; 158 uint32 iTrackMaxBitRate; 159 bool iTrackSelected; 160 uint32 iTrackID; 161 OSCL_wHeapString<OsclMemAllocator> iCodecName; 162 OSCL_wHeapString<OsclMemAllocator> iCodecDescription; 163 uint32 iTrackWidth; 164 uint32 iTrackHeight; 165 uint32 iVideoFrameRate; 166 uint32 iAudioSampleRate; 167 uint32 iAudioNumChannels; 168 uint32 iAudioBitsPerSample; 169 OsclRefCounterMemFrag iCodecSpecificInfo; 170 }; 171 172 class PVMFSMSessionMetaDataInfo 173 { 174 public: 175 PVMFSMSessionMetaDataInfo() 176 { 177 Reset(); 178 }; 179 180 void Reset() 181 { 182 iMetadataAvailable = false; 183 iTitlePresent = false; 184 iDescriptionPresent = false; 185 iCopyRightPresent = false; 186 iPerformerPresent = false; 187 iAuthorPresent = false; 188 iGenrePresent = false; 189 iRatingPresent = false; 190 iClassificationPresent = false; 191 iKeyWordsPresent = false; 192 iLocationPresent = false; 193 iLyricsPresent = false; 194 iWMPicturePresent = false; 195 iAlbumPresent = false; 196 197 iIsTitleUnicode = false; 198 iIsDescriptionUnicode = false; 199 iIsCopyRightUnicode = false; 200 iIsPerformerUnicode = false; 201 iIsAuthorUnicode = false; 202 iIsGenreUnicode = false; 203 iIsRatingUnicode = false; 204 iIsClassificationUnicode = false; 205 iIsKeyWordsUnicode = false; 206 iIsLocationUnicode = false; 207 iIsLyricsUnicode = false; 208 iIsAlbumUnicode = false; 209 210 iSessionDurationAvailable = false; 211 iSessionDuration = 0; 212 iSessionDurationTimeScale = 0; 213 iNumTracks = 0; 214 iRandomAccessDenied = false; 215 iNumWMPicture = 0; 216 217 iExtendedMetaDataDescriptorCount = 0; 218 iExtendedMetaDataNameVec.clear(); 219 iExtendedMetaDataValueTypeVec.clear(); 220 iExtendedMetaDataValueLenVec.clear(); 221 iExtendedMetaDataIndexVec.clear(); 222 223 iTrackMetaDataInfoVec.clear(); 224 225 iNumKeyWords = 0; 226 iYear = 0; 227 }; 228 229 PVMFSMTrackMetaDataInfo* getTrackMetaDataInfo(uint32 aId) 230 { 231 Oscl_Vector<PVMFSMTrackMetaDataInfo, OsclMemAllocator>::iterator it; 232 for (it = iTrackMetaDataInfoVec.begin(); it != iTrackMetaDataInfoVec.end(); it++) 233 { 234 if (it->iTrackID == aId) 235 { 236 return (it); 237 } 238 } 239 return NULL; 240 }; 241 242 bool iTitlePresent; 243 bool iDescriptionPresent; 244 bool iCopyRightPresent; 245 bool iPerformerPresent; 246 bool iAuthorPresent; 247 bool iGenrePresent; 248 bool iRatingPresent; 249 bool iClassificationPresent; 250 bool iKeyWordsPresent; 251 bool iLocationPresent; 252 bool iLyricsPresent; 253 bool iWMPicturePresent; 254 bool iAlbumPresent; 255 256 bool iIsTitleUnicode; 257 bool iIsDescriptionUnicode; 258 bool iIsCopyRightUnicode; 259 bool iIsPerformerUnicode; 260 bool iIsAuthorUnicode; 261 bool iIsGenreUnicode; 262 bool iIsRatingUnicode; 263 bool iIsClassificationUnicode; 264 bool iIsKeyWordsUnicode; 265 bool iIsLocationUnicode; 266 bool iIsLyricsUnicode; 267 bool iIsAlbumUnicode; 268 uint32 iNumWMPicture; 269 270 OSCL_HeapString<OsclMemAllocator> iTitle; 271 OSCL_HeapString<OsclMemAllocator> iDescription; 272 OSCL_HeapString<OsclMemAllocator> iCopyright; 273 OSCL_HeapString<OsclMemAllocator> iPerformer; 274 OSCL_HeapString<OsclMemAllocator> iAuthor; 275 OSCL_HeapString<OsclMemAllocator> iGenre; 276 OSCL_HeapString<OsclMemAllocator> iRating; 277 OSCL_HeapString<OsclMemAllocator> iClassification; 278 uint32 iNumKeyWords; 279 OSCL_HeapString<OsclMemAllocator> iKeyWords[MAX_ASSET_INFO_KEYWORDS]; 280 OSCL_HeapString<OsclMemAllocator> iLyrics; 281 OSCL_HeapString<OsclMemAllocator> iAlbum; 282 283 OSCL_wHeapString<OsclMemAllocator> iTitleUnicode; 284 OSCL_wHeapString<OsclMemAllocator> iDescriptionUnicode; 285 OSCL_wHeapString<OsclMemAllocator> iCopyrightUnicode; 286 OSCL_wHeapString<OsclMemAllocator> iPerformerUnicode; 287 OSCL_wHeapString<OsclMemAllocator> iAuthorUnicode; 288 OSCL_wHeapString<OsclMemAllocator> iGenreUnicode; 289 OSCL_wHeapString<OsclMemAllocator> iRatingUnicode; 290 OSCL_wHeapString<OsclMemAllocator> iClassificationUnicode; 291 OSCL_wHeapString<OsclMemAllocator> iKeyWordUnicode[MAX_ASSET_INFO_KEYWORDS]; 292 OSCL_wHeapString<OsclMemAllocator> iLyricsUnicode; 293 OSCL_wHeapString<OsclMemAllocator> iAlbumUnicode; 294 295 uint32 iYear; 296 bool iSessionDurationAvailable; 297 uint64 iSessionDuration; 298 uint64 iSessionDurationTimeScale; 299 uint32 iNumTracks; 300 bool iRandomAccessDenied; 301 PvmfAssetInfo3GPPLocationStruct iLocationStruct; 302 303 Oscl_Vector<PVMFSMTrackMetaDataInfo, OsclMemAllocator> iTrackMetaDataInfoVec; 304 305 uint32 iExtendedMetaDataDescriptorCount; 306 Oscl_Vector<OSCL_HeapString<OsclMemAllocator>, OsclMemAllocator> iExtendedMetaDataNameVec; 307 Oscl_Vector<uint16, OsclMemAllocator> iExtendedMetaDataValueTypeVec; 308 Oscl_Vector<uint32, OsclMemAllocator> iExtendedMetaDataValueLenVec; 309 Oscl_Vector<uint32, OsclMemAllocator> iExtendedMetaDataIndexVec; 310 Oscl_Vector<uint32, OsclMemAllocator> iWMPictureIndexVec; 311 312 bool iMetadataAvailable; 313 }; 314 /////////////////////////////////////////////////////////////////////////////// 315 /////////////////////////////////////////////////////////////////////////////// 316 317 #endif 318