/* * Copyright (c) 2023-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef HISTREAMER_PIPELINE_CORE_PIPELINE_H #define HISTREAMER_PIPELINE_CORE_PIPELINE_H #include #include #include #include "common/status.h" #include "filter/filter.h" #include "osal/task/mutex.h" namespace OHOS { namespace Media { namespace Pipeline { class FilterCallback; class Pipeline : public EventReceiver { public: ~Pipeline(); void Init(const std::shared_ptr& receiver, const std::shared_ptr& callback, const std::string &playerId); Status Prepare(); Status Start(); Status Pause(); Status Resume(); Status Stop(); Status Flush(); Status Release(); Status Preroll(bool render); Status SetPlayRange(int64_t start, int64_t end); Status AddHeadFilters(std::vector> filters); Status RemoveHeadFilter(const std::shared_ptr& filter); Status LinkFilters(const std::shared_ptr& preFilter, const std::vector>& filters, StreamType type); Status UpdateFilters(const std::shared_ptr& preFilter, const std::vector>& filters, StreamType type); Status UnLinkFilters(const std::shared_ptr& preFilter, const std::vector>& filters, StreamType type); void OnEvent(const Event& event) override; static int32_t GetNextPipelineId(); private: std::string groupId_; Mutex mutex_ {}; std::vector> filters_ {}; std::shared_ptr eventReceiver_ {nullptr}; std::shared_ptr filterCallback_ {nullptr}; }; } // namespace Pipeline } // namespace Media } // namespace OHOS #endif // HISTREAMER_PIPELINE_CORE_PIPELINE_H