1 /* 2 * Copyright (c) 2023 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 #ifndef HISTREAMER_PLUGIN_MEDIA_SOURCE_H 17 #define HISTREAMER_PLUGIN_MEDIA_SOURCE_H 18 19 #include <map> 20 #include <memory> 21 #include <string> 22 23 namespace OHOS { 24 namespace MediaAVCodec { 25 namespace Plugin { 26 /** 27 * @brief Unified enumerates media source types. 28 * 29 * @since 1.0 30 * @version 1.0 31 */ 32 enum class SourceType : int32_t { 33 /** Local file path or network address */ 34 SOURCE_TYPE_URI = 0, 35 /** Local file descriptor */ 36 SOURCE_TYPE_FD, 37 /** Stream data */ 38 SOURCE_TYPE_STREAM, 39 }; 40 41 class MediaSource { 42 public: 43 /// Construct an a specified URI. 44 explicit MediaSource(std::string uri); 45 46 /// Destructor 47 virtual ~MediaSource() = default; 48 49 /// Obtains the source type. 50 SourceType GetSourceType() const; 51 52 /// Obtains the media source URI. 53 const std::string &GetSourceUri() const; 54 55 private: 56 std::string uri_ {}; 57 SourceType type_ {}; 58 }; 59 } // namespace Plugin 60 } // namespace MediaAVCodec 61 } // namespace OHOS 62 #endif