1 /* 2 * Copyright (C) 2022 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 #include "image_creator_manager.h" 17 namespace OHOS { 18 namespace Media { 19 using namespace std; SaveImageCreator(shared_ptr<ImageCreator> imageCreator)20string ImageCreatorManager::SaveImageCreator(shared_ptr<ImageCreator> imageCreator) 21 { 22 return creatorManager_.save(imageCreator); 23 } GetSurfaceByKeyId(string keyId)24sptr<IConsumerSurface> ImageCreatorManager::GetSurfaceByKeyId(string keyId) 25 { 26 auto creator = GetImageCreatorByKeyId(keyId); 27 if (creator == nullptr) { 28 return nullptr; 29 } 30 return creator->GetCreatorSurface(); 31 } GetImageCreatorByKeyId(string keyId)32shared_ptr<ImageCreator> ImageCreatorManager::GetImageCreatorByKeyId(string keyId) 33 { 34 return creatorManager_.get(keyId); 35 } ReleaseCreatorById(string id)36void ImageCreatorManager::ReleaseCreatorById(string id) 37 { 38 ImageCreatorManager& manager = ImageCreatorManager::getInstance(); 39 manager.creatorManager_.release(id); 40 } 41 } // namespace Media 42 } // namespace OHOS 43