1 /* 2 * Copyright (c) 2021-2021 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 HISTREAMER_PIPELINE_CORE_FILTER_CALLBACK_H 17 #define HISTREAMER_PIPELINE_CORE_FILTER_CALLBACK_H 18 19 #include <string> 20 #include <vector> 21 22 #include "plugin/common/any.h" 23 #include "foundation/error_code.h" 24 #include "utils/utils.h" 25 26 namespace OHOS { 27 namespace Media { 28 namespace Pipeline { 29 class Filter; 30 31 // FilterCallback用于同步处理完再返回的场景 32 // Filter Callback Types 33 enum class FilterCallbackType { PORT_ADDED, PORT_REMOVE }; 34 35 enum class PortType { IN, OUT }; 36 37 struct PortDesc { 38 std::string name; 39 bool isPcm; 40 }; 41 42 struct PortInfo { 43 PortType type; 44 std::vector<PortDesc> ports; 45 }; 46 47 class FilterCallback { 48 public: 49 virtual ~FilterCallback() = default; 50 virtual ErrorCode OnCallback(const FilterCallbackType& type, Filter* filter, const Plugin::Any& parameter) = 0; 51 }; 52 } // namespace Pipeline 53 } // namespace Media 54 } // namespace OHOS 55 56 #endif // HISTREAMER_PIPELINE_CORE_FILTER_CALLBACK_H 57