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 "source.h"
17 #include "interface/source_plugin.h"
18
19 using namespace OHOS::Media::Plugin;
20
Source(uint32_t pkgVer,uint32_t apiVer,std::shared_ptr<SourcePlugin> plugin)21 Source::Source(uint32_t pkgVer, uint32_t apiVer, std::shared_ptr<SourcePlugin> plugin)
22 : Base(pkgVer, apiVer, plugin), source_(std::move(plugin))
23 {
24 }
25
SetSource(std::shared_ptr<MediaSource> source)26 Status Source::SetSource(std::shared_ptr<MediaSource> source)
27 {
28 return source_->SetSource(source);
29 }
30
Read(std::shared_ptr<Buffer> & buffer,size_t expectedLen)31 Status Source::Read(std::shared_ptr<Buffer>& buffer, size_t expectedLen)
32 {
33 return source_->Read(buffer, expectedLen);
34 }
35
GetSize(size_t & size)36 Status Source::GetSize(size_t& size)
37 {
38 return source_->GetSize(size);
39 }
40
IsSeekable()41 bool Source::IsSeekable()
42 {
43 return source_->IsSeekable();
44 }
45
SeekTo(uint64_t offset)46 Status Source::SeekTo(uint64_t offset)
47 {
48 return source_->SeekTo(offset);
49 }
50