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