• 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 #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     FORWARD,  ///< Seeks forwards for the keyframe closest to specified position
51     BACKWARD, ///< Seeks backwards for the keyframe closest to specified position
52     BYTE,     ///< Seeks based on position in bytes
53     ANY,      ///< Seeks to any frame, even non-keyframes
54     FRAME,    ///< Seeks seeking based on frame number
55 };
56 
57 /**
58  * @enum Api Return Status.
59  *
60  * @since 1.0
61  * @version 1.0
62  */
63 enum struct Status : int32_t {
64     END_OF_STREAM = 1,         ///< Read source when end of stream
65     OK = 0,                    ///< The execution result is correct.
66     NO_ERROR = OK,             ///< Same as Status::OK
67     ERROR_UNKNOWN = -1,        ///< An unknown error occurred.
68     ERROR_PLUGIN_ALREADY_EXISTS = -2, ///< The plugin already exists, usually occurs when in plugin registered.
69     ERROR_INCOMPATIBLE_VERSION =
70         -3,                         ///< Incompatible version, may occur during plugin registration or function calling.
71     ERROR_NO_MEMORY = -4,           ///< The system memory is insufficient.
72     ERROR_WRONG_STATE = -5,         ///< The function is called in an invalid state.
73     ERROR_UNIMPLEMENTED = -6,       ///< This method or interface is not implemented.
74     ERROR_INVALID_PARAMETER = -7,   ///< The plugin does not support this parameter.
75     ERROR_INVALID_DATA = -8,        ///< The value is not in the valid range.
76     ERROR_MISMATCHED_TYPE = -9,     ///< Mismatched data type
77     ERROR_TIMED_OUT = -10,          ///< Operation timeout.
78     ERROR_UNSUPPORTED_FORMAT = -11, ///< The plugin not support this format/name.
79     ERROR_NOT_ENOUGH_DATA = -12,    ///< Not enough data when read from source.
80     ERROR_NOT_EXISTED = -13,        ///< Source is not existed.
81     ERROR_AGAIN = -14,              ///< Operation is not available right now, should try again later.
82     ERROR_PERMISSION_DENIED = -15,  ///< Permission denied.
83     ERROR_NULL_POINTER = -16,       ///< Null pointer.
84     ERROR_INVALID_OPERATION = -17,  ///< Invalid operation.
85     ERROR_FUNCTION_CALL = -18,      ///< Call some function failed.
86     ERROR_CLIENT = -19,             ///< Http client error
87     ERROR_SERVER = -20,             ///< Http server error
88     ERROR_DELAY_READY = -21,        ///< Delay ready event
89 };
90 
91 /**
92  * @enum Plugin Type.
93  *
94  * @since 1.0
95  * @version 1.0
96  */
97 enum struct PluginType : int32_t {
98     INVALID_TYPE = -1, ///< Invalid plugin
99     SOURCE = 1,        ///< reference SourcePlugin
100     DEMUXER,           ///< reference DemuxerPlugin
101     CODEC,             ///< reference CodecPlugin
102     AUDIO_SINK,        ///< reference AudioSinkPlugin
103     VIDEO_SINK,        ///< reference VideoSinkPlugin
104     MUXER,             ///< reference MuxerPlugin
105     OUTPUT_SINK,       ///< reference OutputSinkPlugin
106 };
107 } // namespace Plugin
108 } // namespace Media
109 } // namespace OHOS
110 #endif // HISTREAMER_PLUGIN_TYPES_H
111