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 #include "UtSourceTest1.h"
17 
18 namespace OHOS {
19 namespace Media {
20 namespace Plugin {
21 bool UtSourceTest1::available = true;
22 
PluginCreator(const std::string & name)23 static std::shared_ptr<SourcePlugin> PluginCreator(const std::string &name)
24 {
25     return std::make_shared<UtSourceTest1>(name);
26 }
27 
SourceRegister(const std::shared_ptr<Register> & reg)28 static Status SourceRegister(const std::shared_ptr<Register> &reg)
29 {
30     if (UtSourceTest1::available) {
31         SourcePluginDef definition;
32         definition.name = "UtSourceTest1";
33         definition.description = "unit test source test1";
34         definition.rank = 100; // 100
35         definition.protocol.emplace_back(ProtocolType::FILE);
36         definition.creator = PluginCreator;
37         return reg->AddPlugin(definition);
38     } else {
39         return Status::ERROR_UNIMPLEMENTED;
40     }
41 }
42 
__anone8e186510102null43 PLUGIN_DEFINITION(UtSourceTest1, LicenseType::APACHE_V2, SourceRegister, [] {});
44 
SetSource(std::shared_ptr<MediaSource> source)45 Status OHOS::Media::Plugin::UtSourceTest1::SetSource(std::shared_ptr<MediaSource> source)
46 {
47     return Status::OK;
48 }
49 
Read(std::shared_ptr<Buffer> & buffer,size_t expectedLen)50 Status UtSourceTest1::Read(std::shared_ptr<Buffer> &buffer, size_t expectedLen)
51 {
52     return Status::OK;
53 }
54 
GetSize(uint64_t & size)55 Status UtSourceTest1::GetSize(uint64_t &size)
56 {
57     return Status::OK;
58 }
59 
IsSeekable(bool & seekable)60 Status UtSourceTest1::IsSeekable(bool& seekable)
61 {
62     seekable = false;
63     return Status::OK;
64 }
65 
GetSeekable()66 Seekable UtSourceTest1::GetSeekable()
67 {
68     return Seekable::UNSEEKABLE;
69 }
70 
SeekTo(uint64_t offset)71 Status UtSourceTest1::SeekTo(uint64_t offset)
72 {
73     return Status::OK;
74 }
75 
GetAllocator()76 std::shared_ptr<Allocator> UtSourceTest1::GetAllocator()
77 {
78     return std::shared_ptr<Allocator>();
79 }
80 
SetCallback(Callback * cb)81 Status UtSourceTest1::SetCallback(Callback* cb)
82 {
83     return Status::OK;
84 }
85 }
86 }
87 }
88