Files
multimedia_video_processing…/services/include/event_handler_factory.h
T
liushang 761822fbfb init vpe code
Signed-off-by: liushang <liushang2@huawei.com>
2025-02-27 19:09:30 +08:00

51 lines
1.7 KiB
C++

/*
* Copyright (c) 2024 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 OHOS_VPE_EVENT_HANDLER_FACTORY_H
#define OHOS_VPE_EVENT_HANDLER_FACTORY_H
#include <map>
#include <memory>
#include <mutex>
#include "event_handler.h"
#include "vpe_log.h"
namespace OHOS {
namespace Media {
namespace VideoProcessingEngine {
class EventHandlerFactory {
public:
static EventHandlerFactory& GetInstance();
private:
EventHandlerFactory(const EventHandlerFactory&) = delete;
EventHandlerFactory& operator= (const EventHandlerFactory&) = delete;
EventHandlerFactory(EventHandlerFactory&&) = delete;
EventHandlerFactory& operator= (EventHandlerFactory&&) = delete;
public:
int32_t Init();
int32_t UnInit();
std::shared_ptr<AppExecFwk::EventHandler> CreateEventHandler(const std::string& handlerName);
private:
EventHandlerFactory() = default;
virtual ~EventHandlerFactory() = default;
std::mutex eventHandlerMutex_;
std::map<std::string, std::shared_ptr<AppExecFwk::EventHandler>> eventHandlerMap_;
};
} // namespace VideoProcessingEngine
} // namespace Media
} // namespace OHOS
#endif // OHOS_VPE_EVENT_HANDLER_FACTORY_H