1 /* 2 * Copyright (C) 2007 The Android Open Source Project 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 express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __DRM_CONTENT_H__ 18 #define __DRM_CONTENT_H__ 19 20 #include <Drm2CommonTypes.h> 21 #include <dcf/DrmDcfContainer.h> 22 23 /////////////raw content 24 class DrmRawContent 25 { 26 public: 27 /** 28 * constructor for DrmRawContent, used to parse DCF 29 * \param inRawData input stream of raw data. 30 */ 31 DrmRawContent(istream& inRawData); 32 33 /** Destructor for DrmRawContent */ 34 ~DrmRawContent(); 35 36 /** 37 * get DCF container 38 * \param none 39 * \return 40 * the DCF container 41 */ 42 vector<DcfContainer*> getContents(void) const; 43 44 /** 45 * get the length of DCF hash 46 * \param none 47 * \return 48 * the length of DCF hash 49 */ 50 uint32_t getDcfHashLen() const; 51 52 /** 53 * get DCF hash 54 * \param outDcfHash the buffer to store DCF hash 55 * \return 56 * none 57 */ 58 void getDcfHash(uint8_t* outDcfHash) const; 59 60 PRIVATE: 61 static const uint32_t DCF_HASH_LEN = 20; 62 static const uint32_t FIX_HEADER_LEN = 20; 63 static const uint32_t MAX_PIECE_LEN = (100 * 1024); 64 65 uint8_t mDcfHash[DCF_HASH_LEN]; 66 vector<DcfContainer*> mContainer; 67 68 PRIVATE: 69 bool parseDcfHeader(const uint8_t* dcfHead); 70 DrmRawContent(const DrmRawContent& rawContent){} 71 DrmRawContent& operator=(const DrmRawContent& other){return *this;} 72 }; 73 74 #endif 75