1 /* 2 * Copyright (c) 2025 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 "surface_decoder_adapter_mock.h" 17 18 using namespace std; 19 using namespace OHOS; 20 using namespace OHOS::DistributedCollab; 21 Init(const std::string & mime)22Media::Status SurfaceDecoderAdapter::Init(const std::string& mime) 23 { 24 if (ISurfaceDecoderApt::surfaceDecoderAptMock == nullptr) { 25 return Media::Status::ERROR_UNKNOWN; 26 } 27 return ISurfaceDecoderApt::surfaceDecoderAptMock->Init(mime); 28 } 29 Configure(const MediaAVCodec::Format & format)30Media::Status SurfaceDecoderAdapter::Configure(const MediaAVCodec::Format& format) 31 { 32 if (ISurfaceDecoderApt::surfaceDecoderAptMock == nullptr) { 33 return Media::Status::ERROR_UNKNOWN; 34 } 35 return ISurfaceDecoderApt::surfaceDecoderAptMock->Configure(format); 36 } 37 GetInputBufferQueue()38sptr<Media::AVBufferQueueProducer> SurfaceDecoderAdapter::GetInputBufferQueue() 39 { 40 if (ISurfaceDecoderApt::surfaceDecoderAptMock == nullptr) { 41 return nullptr; 42 } 43 return ISurfaceDecoderApt::surfaceDecoderAptMock->GetInputBufferQueue(); 44 } 45 SetOutputSurface(const sptr<Surface> & surface)46Media::Status SurfaceDecoderAdapter::SetOutputSurface(const sptr<Surface>& surface) 47 { 48 if (ISurfaceDecoderApt::surfaceDecoderAptMock == nullptr) { 49 return Media::Status::ERROR_UNKNOWN; 50 } 51 return ISurfaceDecoderApt::surfaceDecoderAptMock->SetOutputSurface(surface); 52 } 53 SetDecoderAdapterCallback(const std::shared_ptr<DecoderAdapterCallback> & decoderAdapterCallback)54Media::Status SurfaceDecoderAdapter::SetDecoderAdapterCallback( 55 const std::shared_ptr<DecoderAdapterCallback>& decoderAdapterCallback) 56 { 57 if (ISurfaceDecoderApt::surfaceDecoderAptMock == nullptr) { 58 return Media::Status::ERROR_UNKNOWN; 59 } 60 return ISurfaceDecoderApt::surfaceDecoderAptMock->SetDecoderAdapterCallback(decoderAdapterCallback); 61 } 62 Start()63Media::Status SurfaceDecoderAdapter::Start() 64 { 65 if (ISurfaceDecoderApt::surfaceDecoderAptMock == nullptr) { 66 return Media::Status::ERROR_UNKNOWN; 67 } 68 return ISurfaceDecoderApt::surfaceDecoderAptMock->Start(); 69 } 70 Stop()71Media::Status SurfaceDecoderAdapter::Stop() 72 { 73 if (ISurfaceDecoderApt::surfaceDecoderAptMock == nullptr) { 74 return Media::Status::ERROR_UNKNOWN; 75 } 76 return ISurfaceDecoderApt::surfaceDecoderAptMock->Stop(); 77 } 78 Pause()79Media::Status SurfaceDecoderAdapter::Pause() 80 { 81 if (ISurfaceDecoderApt::surfaceDecoderAptMock == nullptr) { 82 return Media::Status::ERROR_UNKNOWN; 83 } 84 return ISurfaceDecoderApt::surfaceDecoderAptMock->Pause(); 85 } 86 Resume()87Media::Status SurfaceDecoderAdapter::Resume() 88 { 89 if (ISurfaceDecoderApt::surfaceDecoderAptMock == nullptr) { 90 return Media::Status::ERROR_UNKNOWN; 91 } 92 return ISurfaceDecoderApt::surfaceDecoderAptMock->Resume(); 93 } 94 Flush()95Media::Status SurfaceDecoderAdapter::Flush() 96 { 97 if (ISurfaceDecoderApt::surfaceDecoderAptMock == nullptr) { 98 return Media::Status::ERROR_UNKNOWN; 99 } 100 return ISurfaceDecoderApt::surfaceDecoderAptMock->Flush(); 101 } 102 Release()103Media::Status SurfaceDecoderAdapter::Release() 104 { 105 if (ISurfaceDecoderApt::surfaceDecoderAptMock == nullptr) { 106 return Media::Status::ERROR_UNKNOWN; 107 } 108 return ISurfaceDecoderApt::surfaceDecoderAptMock->Release(); 109 } 110 SetParameter(const MediaAVCodec::Format & format)111Media::Status SurfaceDecoderAdapter::SetParameter(const MediaAVCodec::Format& format) 112 { 113 if (ISurfaceDecoderApt::surfaceDecoderAptMock == nullptr) { 114 return Media::Status::ERROR_UNKNOWN; 115 } 116 return ISurfaceDecoderApt::surfaceDecoderAptMock->SetParameter(format); 117 } 118