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