blob: 11f8f78bc56eefa4c4e37b8f3183263c26f5c952 [file] [log] [blame]
aimitakeshid074e302010-07-29 10:12:27 +09001/*
2 * Copyright (C) 2010 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_RIGHTS_H__
18#define __DRM_RIGHTS_H__
19
20#include "drm_framework_common.h"
21
22namespace android {
23
24/**
25 * This is an utility class which wraps the license information which was
26 * retrieved from the online DRM server.
27 *
28 * Caller can instantiate DrmRights by invoking DrmRights(const DrmBuffer&, String)
29 * constructor by using the result of DrmManagerClient::ProcessDrmInfo(const DrmInfo*) API.
30 * Caller can also instantiate DrmRights using the file path which contains rights information.
31 *
32 */
33class DrmRights {
34public:
35 /**
36 * Constructor for DrmRights
37 *
38 * @param[in] rightsFilePath Path of the file containing rights data
39 * @param[in] mimeType MIME type
40 * @param[in] accountId Account Id of the user
41 * @param[in] subscriptionId Subscription Id of the user
42 */
43 DrmRights(
44 const String8& rightsFilePath, const String8& mimeType,
45 const String8& accountId = String8("_NO_USER"),
46 const String8& subscriptionId = String8(""));
47
48 /**
49 * Constructor for DrmRights
50 *
51 * @param[in] rightsData Rights data
52 * @param[in] mimeType MIME type
53 * @param[in] accountId Account Id of the user
54 * @param[in] subscriptionId Subscription Id of the user
55 */
56 DrmRights(
57 const DrmBuffer& rightsData, const String8& mimeType,
58 const String8& accountId = String8("_NO_USER"),
59 const String8& subscriptionId = String8(""));
60
61 /**
62 * Destructor for DrmRights
63 */
Takeshi Aimidc549d62010-09-20 23:40:41 +090064 virtual ~DrmRights();
aimitakeshid074e302010-07-29 10:12:27 +090065
66public:
67 /**
68 * Returns the rights data associated with this instance
69 *
70 * @return Rights data
71 */
72 const DrmBuffer& getData(void) const;
73
74 /**
75 * Returns MIME type associated with this instance
76 *
77 * @return MIME type
78 */
79 String8 getMimeType(void) const;
80
81 /**
82 * Returns the account-id associated with this instance
83 *
84 * @return Account Id
85 */
86 String8 getAccountId(void) const;
87
88 /**
89 * Returns the subscription-id associated with this object
90 *
91 * @return Subscription Id
92 */
93 String8 getSubscriptionId(void) const;
94
95private:
96 DrmBuffer mData;
97 String8 mMimeType;
98 String8 mAccountId;
99 String8 mSubscriptionId;
Takeshi Aimidc549d62010-09-20 23:40:41 +0900100 char* mRightsFromFile;
aimitakeshid074e302010-07-29 10:12:27 +0900101};
102
103};
104
105#endif /* __DRM_RIGHTS_H__ */
106