Home | History | Annotate | Download | only in include
      1 /*
      2  * Copyright (C) 2018 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 CLEARKEY_INIT_DATA_PARSER_H_
     18 #define CLEARKEY_INIT_DATA_PARSER_H_
     19 
     20 #include <android/hardware/drm/1.0/types.h>
     21 
     22 #include "ClearKeyTypes.h"
     23 
     24 namespace android {
     25 namespace hardware {
     26 namespace drm {
     27 namespace V1_2 {
     28 namespace clearkey {
     29 
     30 using ::android::hardware::drm::V1_0::Status;
     31 
     32 class InitDataParser {
     33 public:
     34     InitDataParser() {}
     35 
     36     Status parse(const std::vector<uint8_t>& initData,
     37             const std::string& mimeType,
     38             V1_0::KeyType keyType,
     39             std::vector<uint8_t>* licenseRequest);
     40 
     41 private:
     42     CLEARKEY_DISALLOW_COPY_AND_ASSIGN(InitDataParser);
     43 
     44     Status parsePssh(const std::vector<uint8_t>& initData,
     45             std::vector<const uint8_t*>* keyIds);
     46 
     47     std::string generateRequest(V1_0::KeyType keyType,
     48             const std::vector<const uint8_t*>& keyIds);
     49 };
     50 
     51 } // namespace clearkey
     52 } // namespace V1_2
     53 } // namespace drm
     54 } // namespace hardware
     55 } // namespace android
     56 
     57 #endif // CLEARKEY_INIT_DATA_PARSER_H_
     58