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 "plugin/common/media_source.h"
17#include <type_traits>
18
19namespace OHOS {
20namespace Media {
21namespace Plugin {
22MediaSource::MediaSource(std::string uri)
23    : uri_(std::move(uri)), type_(SourceType::SOURCE_TYPE_URI)
24{
25}
26
27MediaSource::MediaSource(std::shared_ptr<DataConsumer> dataStream)
28    : type_(SourceType::SOURCE_TYPE_STREAM), dataConsumer_(std::move(dataStream))
29{
30}
31
32MediaSource::MediaSource(std::string uri, std::map<std::string, std::string> header)
33    : uri_(std::move(uri)), header_(std::move(header))
34{
35}
36
37SourceType MediaSource::GetSourceType() const
38{
39    return type_;
40}
41
42const std::string &MediaSource::GetSourceUri() const
43{
44    return uri_;
45}
46
47const std::map<std::string, std::string> &MediaSource::GetSourceHeader() const
48{
49    return header_;
50}
51
52std::shared_ptr<DataConsumer> MediaSource::GetDataConsumer() const
53{
54    return dataConsumer_;
55}
56} // namespace Plugin
57} // namespace Media
58} // namespace OHOS
59
60