1  /*
2   * Copyright (c) 2023-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 STATUS_H
17  #define STATUS_H
18  
19  #include <cstdint> // NOLINT: using int32_t in this file
20  
21  namespace OHOS {
22  namespace Media {
23  // 需要参考OH的错误码编码规范来写,模块+错误码,常见具体错误是有固定定义
24  // 后续再定义北向接口 MfErrCode,那么它应该是Status的子集。
25  /**
26  * @enum Api Return Status.
27  *
28  * @since 1.0
29  * @version 1.0
30  */
31  enum struct Status : int32_t {
32      END_OF_STREAM = 1,         ///< Read source when end of stream
33      OK = 0,                    ///< The execution result is correct.
34      NO_ERROR = OK,             ///< Same as Status::OK
35      ERROR_UNKNOWN = -1,        ///< An unknown error occurred.
36      ERROR_PLUGIN_ALREADY_EXISTS = -2, ///< The plugin already exists, usually occurs when in plugin registered.
37      ERROR_INCOMPATIBLE_VERSION =
38          -3, ///< Incompatible version, may occur during plugin registration or function calling.
39      ERROR_NO_MEMORY = -4,           ///< The system memory is insufficient.
40      ERROR_WRONG_STATE = -5,         ///< The function is called in an invalid state.
41      ERROR_UNIMPLEMENTED = -6,       ///< This method or interface is not implemented.
42      ERROR_INVALID_PARAMETER = -7,   ///< The plugin does not support this parameter.
43      ERROR_INVALID_DATA = -8,        ///< The value is not in the valid range.
44      ERROR_MISMATCHED_TYPE = -9,     ///< Mismatched data type
45      ERROR_TIMED_OUT = -10,          ///< Operation timeout.
46      ERROR_UNSUPPORTED_FORMAT = -11, ///< The plugin not support this format/name.
47      ERROR_NOT_ENOUGH_DATA = -12,    ///< Not enough data when read from source.
48      ERROR_NOT_EXISTED = -13,        ///< Source is not existed.
49      ERROR_AGAIN = -14,              ///< Operation is not available right now, should try again later.
50      ERROR_PERMISSION_DENIED = -15,  ///< Permission denied.
51      ERROR_NULL_POINTER = -16,       ///< Null pointer.
52      ERROR_INVALID_OPERATION = -17,  ///< Invalid operation.
53      ERROR_CLIENT = -18,             ///< Http client error
54      ERROR_SERVER = -19,             ///< Http server error
55      ERROR_DELAY_READY = -20,        ///< Delay ready event
56      ERROR_INVALID_STATE = -21,
57      ERROR_AUDIO_INTERRUPT = -22,
58      ERROR_INVALID_BUFFER_SIZE = 0xF001,
59      ERROR_UNEXPECTED_MEMORY_TYPE = 0xF002,
60      ERROR_CREATE_BUFFER = 0xF003,
61      ERROR_NULL_POINT_BUFFER = 0xF004,
62      ERROR_INVALID_BUFFER_ID = 0xF005,
63      ERROR_INVALID_BUFFER_STATE = 0xF006,
64      ERROR_NO_FREE_BUFFER = 0xF007,
65      ERROR_NO_DIRTY_BUFFER = 0xF008,
66      ERROR_NO_CONSUMER_LISTENER = 0xF009,
67      ERROR_NULL_BUFFER_QUEUE = 0xF00A,
68      ERROR_WAIT_TIMEOUT = 0xF00B,
69      ERROR_OUT_OF_RANGE = 0xF00C,
70      ERROR_NULL_SURFACE = 0xF00D,
71      ERROR_SURFACE_INNER = 0xF00E,
72      ERROR_NULL_SURFACE_BUFFER = 0xF00F,
73      ERROR_DRM_DECRYPT_FAILED = 0xF010,
74  
75      ERROR_IPC_WRITE_INTERFACE_TOKEN = 0xF101,
76      ERROR_IPC_SEND_REQUEST = 0xF102,
77  };
78  } // namespace Media
79  } // namespace OHOS
80  #endif // STATUS_H
81