1 /*
2  * Copyright (C) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "codecbase.h"
17 #include "avcodec_errors.h"
18 #include "avcodec_log.h"
19 
20 namespace {
21 constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_FRAMEWORK, "CodecBase"};
22 }
23 
24 namespace OHOS {
25 namespace MediaAVCodec {
SetCallback(const std::shared_ptr<AVCodecCallback> & callback)26 int32_t CodecBase::SetCallback(const std::shared_ptr<AVCodecCallback> &callback)
27 {
28     (void)callback;
29     AVCODEC_LOGD("SetCallback of AVCodecCallback is not supported");
30     return AVCS_ERR_OK;
31 }
SetCallback(const std::shared_ptr<MediaCodecCallback> & callback)32 int32_t CodecBase::SetCallback(const std::shared_ptr<MediaCodecCallback> &callback)
33 {
34     (void)callback;
35     AVCODEC_LOGD("SetCallback of MediaCodecCallback is not supported");
36     return AVCS_ERR_OK;
37 }
38 
QueueInputBuffer(uint32_t index,const AVCodecBufferInfo & info,AVCodecBufferFlag flag)39 int32_t CodecBase::QueueInputBuffer(uint32_t index, const AVCodecBufferInfo &info, AVCodecBufferFlag flag)
40 {
41     (void)index;
42     (void)info;
43     (void)flag;
44     AVCODEC_LOGD("QueueInputBuffer of AVSharedMemory is not supported");
45     return AVCS_ERR_OK;
46 }
47 
QueueInputBuffer(uint32_t index)48 int32_t CodecBase::QueueInputBuffer(uint32_t index)
49 {
50     (void)index;
51     AVCODEC_LOGD("QueueInputBuffer of AVBuffer is not supported");
52     return AVCS_ERR_OK;
53 }
54 
NotifyEos()55 int32_t CodecBase::NotifyEos()
56 {
57     AVCODEC_LOGW("NotifyEos is not supported");
58     return AVCS_ERR_OK;
59 }
60 
CreateInputSurface()61 sptr<Surface> CodecBase::CreateInputSurface()
62 {
63     AVCODEC_LOGW("CreateInputSurface is not supported");
64     return nullptr;
65 }
66 
SetInputSurface(sptr<Surface> surface)67 int32_t CodecBase::SetInputSurface(sptr<Surface> surface)
68 {
69     (void)surface;
70     AVCODEC_LOGW("SetInputSurface is not supported");
71     return AVCS_ERR_OK;
72 }
73 
SetOutputSurface(sptr<Surface> surface)74 int32_t CodecBase::SetOutputSurface(sptr<Surface> surface)
75 {
76     (void)surface;
77     AVCODEC_LOGW("SetOutputSurface is not supported");
78     return AVCS_ERR_OK;
79 }
80 
RenderOutputBuffer(uint32_t index)81 int32_t CodecBase::RenderOutputBuffer(uint32_t index)
82 {
83     (void)index;
84     AVCODEC_LOGW("RenderOutputBuffer is not supported");
85     return AVCS_ERR_OK;
86 }
87 
SignalRequestIDRFrame()88 int32_t CodecBase::SignalRequestIDRFrame()
89 {
90     AVCODEC_LOGW("SignalRequestIDRFrame is not supported");
91     return AVCS_ERR_OK;
92 }
93 
GetInputFormat(Format & format)94 int32_t CodecBase::GetInputFormat(Format& format)
95 {
96     (void)format;
97     AVCODEC_LOGW("GetInputFormat is not supported");
98     return AVCS_ERR_OK;
99 }
100 
SetCustomBuffer(std::shared_ptr<AVBuffer> buffer)101 int32_t CodecBase::SetCustomBuffer(std::shared_ptr<AVBuffer> buffer)
102 {
103     (void)buffer;
104     AVCODEC_LOGW("Set custom buffer is not supported");
105     return AVCS_ERR_OK;
106 }
107 } // namespace MediaAVCodec
108 } // namespace OHOS
109