1 /* 2 * Copyright (C) 2022 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_STATUS_ 18 #define DRM_STATUS_ 19 20 #include <media/stagefright/foundation/ABase.h> 21 #include <media/stagefright/MediaErrors.h> 22 #include <utils/Errors.h> 23 24 #include <stdint.h> 25 #include <string> 26 27 namespace android { 28 29 struct DrmStatus { 30 public: 31 DrmStatus(status_t status, int32_t cdmErr = 0, int32_t oemErr = 0, 32 int32_t ctx = 0, std::string errMsg = "") mStatusDrmStatus33 : mStatus(status), mCdmErr(cdmErr), mOemErr(oemErr), 34 mCtx(ctx), mErrMsg(errMsg) {} 35 DrmStatus(status_t err, const char *msg); status_tDrmStatus36 operator status_t() const { return mStatus; } getCdmErrDrmStatus37 int32_t getCdmErr() const { return mCdmErr; } getOemErrDrmStatus38 int32_t getOemErr() const { return mOemErr; } getContextDrmStatus39 int32_t getContext() const { return mCtx; } getErrorMessageDrmStatus40 std::string getErrorMessage() const { return mErrMsg; } 41 bool operator==(status_t other) const { return mStatus == other; } 42 bool operator!=(status_t other) const { return mStatus != other; } 43 44 private: 45 status_t mStatus{}; 46 int32_t mCdmErr{}, mOemErr{}, mCtx{}; 47 std::string mErrMsg; 48 }; 49 50 } // namespace android 51 52 #endif // DRM_STATUS_ 53