• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "post_processing_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 ConfigureImpl(Media::Format& config);
41     int32_t PrepareImpl();
42     int32_t StartImpl();
43     int32_t StopImpl();
44     int32_t FlushImpl();
45     int32_t GetOutputFormatImpl(Media::Format& format);
46     int32_t ResetImpl();
47     int32_t ReleaseImpl();
48     int32_t ReleaseOutputBufferImpl(uint32_t index, bool render);
49     int32_t NotifyEosImpl();
50 
51 private:
52     GSError OnProducerBufferReleased(sptr<SurfaceBuffer> &buffer);
53 
54     bool ready_{false};
55     DynamicInterface interface_;
56     DynamicColorSpaceConverterHandle* instance_{nullptr};
57     static constexpr HiviewDFX::HiLogLabel LABEL{LogLabel("DynamicController")};
58 };
59 
60 } // namespace PostProcessing
61 } // namespace MediaAVCodec
62 } // namespace OHOS
63 
64 #endif // POST_PROCESSING_DYNAMIC_CONTROLLER_H