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
18using namespace OHOS::Media::Plugin;
19
20bool UtSourceTest2::available = true;
21
22static std::shared_ptr<SourcePlugin> PluginCreator(const std::string &name)
23{
24    return std::make_shared<UtSourceTest2>(name);
25}
26
27static Status SourceRegister(const std::shared_ptr<Register> &reg)
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
42PLUGIN_DEFINITION(UtSourceTest2, LicenseType::APACHE_V2, SourceRegister, [] {});
43
44Status UtSourceTest2::SetSource(std::shared_ptr<MediaSource> source)
45{
46    return Status::OK;
47}
48
49Status UtSourceTest2::Read(std::shared_ptr<Buffer> &buffer, size_t expectedLen)
50{
51    return Status::OK;
52}
53
54Status UtSourceTest2::GetSize(uint64_t &size)
55{
56    return Status::OK;
57}
58
59Status UtSourceTest2::IsSeekable(bool& seekable)
60{
61    seekable = false;
62    return Status::OK;
63}
64
65Seekable UtSourceTest2::GetSeekable()
66{
67    return Seekable::UNSEEKABLE;
68}
69
70Status UtSourceTest2::SeekToPos(int64_t offset)
71{
72    return Status::OK;
73}
74
75std::shared_ptr<Allocator> UtSourceTest2::GetAllocator()
76{
77    return std::shared_ptr<Allocator>();
78}
79
80Status UtSourceTest2::SetCallback(Callback* cb)
81{
82    return Status::OK;
83}
84