1 /*
2 * Copyright 2017, 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 //#define LOG_NDEBUG 0
18 #define LOG_TAG "CodecBase"
19
20 #include <android/hardware/cas/native/1.0/IDescrambler.h>
21 #include <android/hardware/drm/1.0/types.h>
22 #include <hidlmemory/FrameworkUtils.h>
23 #include <mediadrm/ICrypto.h>
24 #include <media/stagefright/CodecBase.h>
25 #include <utils/Log.h>
26
27 namespace android {
28
IMemoryToSharedBuffer(const sp<IMemory> & memory,int32_t heapSeqNum,hardware::drm::V1_0::SharedBuffer * buf)29 void BufferChannelBase::IMemoryToSharedBuffer(
30 const sp<IMemory> &memory,
31 int32_t heapSeqNum,
32 hardware::drm::V1_0::SharedBuffer *buf) {
33 ssize_t offset;
34 size_t size;
35
36 sp<hardware::HidlMemory> hidlMemory;
37 hidlMemory = hardware::fromHeap(memory->getMemory(&offset, &size));
38 buf->bufferId = static_cast<uint32_t>(heapSeqNum);
39 buf->offset = offset >= 0 ? offset : 0;
40 buf->size = size;
41 }
42
querySupportedParameters(std::vector<std::string> * names)43 status_t CodecBase::querySupportedParameters(std::vector<std::string> *names) {
44 if (names == nullptr) {
45 return BAD_VALUE;
46 }
47 names->clear();
48 return OK;
49 }
50
describeParameter(const std::string &,CodecParameterDescriptor *)51 status_t CodecBase::describeParameter(const std::string &, CodecParameterDescriptor *) {
52 return ERROR_UNSUPPORTED;
53 }
54
subscribeToParameters(const std::vector<std::string> & names)55 status_t CodecBase::subscribeToParameters(const std::vector<std::string> &names) {
56 if (names.empty()) {
57 return OK;
58 }
59 return ERROR_UNSUPPORTED;
60 }
61
unsubscribeFromParameters(const std::vector<std::string> & names)62 status_t CodecBase::unsubscribeFromParameters(const std::vector<std::string> &names) {
63 if (names.empty()) {
64 return OK;
65 }
66 return ERROR_UNSUPPORTED;
67 }
68
69
70 } // namespace android
71