1 /* 2 * Copyright (c) 2024 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 #ifndef POST_PROCESSING_DYNAMIC_CONTROLLER_H 17 #define POST_PROCESSING_DYNAMIC_CONTROLLER_H 18 19 #include "controller.h" 20 #include "dynamic_interface.h" 21 #include "utils.h" 22 23 namespace OHOS { 24 namespace MediaAVCodec { 25 namespace PostProcessing { 26 27 class DynamicController : public Controller<DynamicController> { 28 public: 29 ~DynamicController(); 30 31 bool LoadInterfacesImpl(); 32 void UnloadInterfacesImpl(); 33 34 bool IsColorSpaceConversionSupportedImpl(const CapabilityInfo& input, const CapabilityInfo& output); 35 int32_t CreateImpl(); 36 void DestroyImpl(); 37 int32_t SetCallbackImpl(void* callback, void* userData); 38 int32_t SetOutputSurfaceImpl(sptr<Surface> surface); 39 int32_t CreateInputSurfaceImpl(sptr<Surface>& surface); 40 int32_t SetParameterImpl(Media::Format& parameter); 41 int32_t GetParameterImpl(Media::Format& parameter); 42 int32_t ConfigureImpl(Media::Format& config); 43 int32_t PrepareImpl(); 44 int32_t StartImpl(); 45 int32_t StopImpl(); 46 int32_t FlushImpl(); 47 int32_t GetOutputFormatImpl(Media::Format& format); 48 int32_t ResetImpl(); 49 int32_t ReleaseImpl(); 50 int32_t ReleaseOutputBufferImpl(uint32_t index, bool render); 51 52 private: 53 GSError OnProducerBufferReleased(sptr<SurfaceBuffer> &buffer); 54 55 bool ready_{false}; 56 DynamicInterface interface_; 57 DynamicColorSpaceConverterHandle* instance_{nullptr}; 58 static constexpr HiviewDFX::HiLogLabel LABEL{LogLabel("DynamicController")}; 59 }; 60 61 } // namespace PostProcessing 62 } // namespace MediaAVCodec 63 } // namespace OHOS 64 65 #endif // POST_PROCESSING_DYNAMIC_CONTROLLER_H