• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "common/media_source.h"
17 #include <type_traits>
18 
19 namespace OHOS {
20 namespace Media {
21 namespace Plugins {
MediaSource(std::string uri)22 MediaSource::MediaSource(std::string uri)
23     : uri_(std::move(uri)), type_(SourceType::SOURCE_TYPE_URI)
24 {
25 }
26 
27 #ifndef OHOS_LITE
MediaSource(std::shared_ptr<IMediaDataSource> dataSrc)28 MediaSource::MediaSource(std::shared_ptr<IMediaDataSource> dataSrc)
29     :type_(SourceType::SOURCE_TYPE_STREAM), dataSrc_(std::move(dataSrc))
30 {
31 }
32 #endif
33 
MediaSource(std::string uri,std::map<std::string,std::string> header)34 MediaSource::MediaSource(std::string uri, std::map<std::string, std::string> header)
35     : uri_(std::move(uri)), header_(std::move(header))
36 {
37 }
38 
GetSourceType() const39 SourceType MediaSource::GetSourceType() const
40 {
41     return type_;
42 }
43 
GetSourceUri() const44 const std::string &MediaSource::GetSourceUri() const
45 {
46     return uri_;
47 }
48 
GetSourceHeader() const49 const std::map<std::string, std::string> &MediaSource::GetSourceHeader() const
50 {
51     return header_;
52 }
53 
54 #ifndef OHOS_LITE
GetDataSrc() const55 std::shared_ptr<IMediaDataSource> MediaSource::GetDataSrc() const
56 {
57     return dataSrc_;
58 }
59 #endif
60 } // namespace Plugins
61 } // namespace Media
62 } // namespace OHOS
63 
64