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 #ifndef HISTREAMER_PLUGIN_TYPES_H 17 #define HISTREAMER_PLUGIN_TYPES_H 18 19 #include <cstdint> // NOLINT: using int32_t in this file 20 21 namespace OHOS { 22 namespace Media { 23 namespace Plugin { 24 /** 25 * @enum Plugin running state. 26 * 27 * @since 1.0 28 * @version 1.0 29 */ 30 enum struct State : int32_t { 31 CREATED = 0, ///< Indicates the status of the plugin when it is constructed. 32 ///< The plug-in will not be restored in the entire life cycle. 33 INITIALIZED = 1, ///< Plugin global resource initialization completion status. 34 PREPARED = 2, ///< Status of parameters required for plugin running. 35 RUNNING = 3, ///< The system enters the running state after call start(). 36 PAUSED = 4, ///< Plugin temporarily stops processing data. This state is optional. 37 DESTROYED = -1, ///< Plugin destruction state. In this state, all resources are released. 38 INVALID = -2, ///< An error occurs in any state and the plugin enters the invalid state. 39 }; 40 41 /** 42 * @enum Enumerates types of Seek Mode. 43 * 44 * @brief Seek modes, Options that SeekTo() behaviour. 45 * 46 * @since 1.0 47 * @version 1.0 48 */ 49 enum struct SeekMode : uint32_t { 50 SEEK_NEXT_SYNC = 0, ///> sync to keyframes after the time point. 51 SEEK_PREVIOUS_SYNC, ///> sync to keyframes before the time point. 52 SEEK_CLOSEST_SYNC, ///> sync to closest keyframes. 53 SEEK_CLOSEST, ///> seek to frames closest the time point. 54 }; 55 56 /** 57 * @enum Seekable Status. 58 * 59 * @since 1.0 60 * @version 1.0 61 */ 62 enum class Seekable : int32_t { 63 INVALID = -1, 64 UNSEEKABLE = 0, 65 SEEKABLE = 1 66 }; 67 68 /** 69 * @enum Api Return Status. 70 * 71 * @since 1.0 72 * @version 1.0 73 */ 74 enum struct Status : int32_t { 75 END_OF_STREAM = 1, ///< Read source when end of stream 76 OK = 0, ///< The execution result is correct. 77 NO_ERROR = OK, ///< Same as Status::OK 78 ERROR_UNKNOWN = -1, ///< An unknown error occurred. 79 ERROR_PLUGIN_ALREADY_EXISTS = -2, ///< The plugin already exists, usually occurs when in plugin registered. 80 ERROR_INCOMPATIBLE_VERSION = 81 -3, ///< Incompatible version, may occur during plugin registration or function calling. 82 ERROR_NO_MEMORY = -4, ///< The system memory is insufficient. 83 ERROR_WRONG_STATE = -5, ///< The function is called in an invalid state. 84 ERROR_UNIMPLEMENTED = -6, ///< This method or interface is not implemented. 85 ERROR_INVALID_PARAMETER = -7, ///< The plugin does not support this parameter. 86 ERROR_INVALID_DATA = -8, ///< The value is not in the valid range. 87 ERROR_MISMATCHED_TYPE = -9, ///< Mismatched data type 88 ERROR_TIMED_OUT = -10, ///< Operation timeout. 89 ERROR_UNSUPPORTED_FORMAT = -11, ///< The plugin not support this format/name. 90 ERROR_NOT_ENOUGH_DATA = -12, ///< Not enough data when read from source. 91 ERROR_NOT_EXISTED = -13, ///< Source is not existed. 92 ERROR_AGAIN = -14, ///< Operation is not available right now, should try again later. 93 ERROR_PERMISSION_DENIED = -15, ///< Permission denied. 94 ERROR_NULL_POINTER = -16, ///< Null pointer. 95 ERROR_INVALID_OPERATION = -17, ///< Invalid operation. 96 ERROR_CLIENT = -18, ///< Http client error 97 ERROR_SERVER = -19, ///< Http server error 98 ERROR_DELAY_READY = -20, ///< Delay ready event 99 }; 100 101 /** 102 * @enum Plugin Type. 103 * 104 * @since 1.0 105 * @version 1.0 106 */ 107 enum struct PluginType : int32_t { 108 INVALID_TYPE = -1, ///< Invalid plugin 109 SOURCE = 1, ///< reference SourcePlugin 110 DEMUXER, ///< reference DemuxerPlugin 111 CODEC, ///< reference CodecPlugin 112 AUDIO_SINK, ///< reference AudioSinkPlugin 113 VIDEO_SINK, ///< reference VideoSinkPlugin 114 MUXER, ///< reference MuxerPlugin 115 OUTPUT_SINK, ///< reference OutputSinkPlugin 116 }; 117 118 /* 119 * @brief Audio RenderInfo, default ContentType::CONTENT_TYPE_UNKNOWN(0) and StreamUsage::STREAM_USAGE_UNKNOWN(0) 120 * combined into AudioStreamType::STREAM_MUSIC. 121 */ 122 struct AudioRenderInfo { 123 int32_t contentType {0}; 124 int32_t streamUsage {0}; 125 int32_t rendererFlags {0}; 126 }; 127 128 struct AudioInterruptEvent { 129 uint32_t eventType {0}; 130 uint32_t forceType {0}; 131 uint32_t hintType {0}; 132 }; 133 134 enum class AudioInterruptMode { 135 SHARE_MODE, 136 INDEPENDENT_MODE 137 }; 138 } // namespace Plugin 139 } // namespace Media 140 } // namespace OHOS 141 #endif // HISTREAMER_PLUGIN_TYPES_H 142