#ifndef AVPErrorCode_h
#define AVPErrorCode_h

typedef enum AVPErrorCode: NSUInteger {
    /**@brief 服务器返回数据为空。*/
    ERROR_SERVER_NO_RESPONSE                                  = 0x20010001,
    /**@brief 服务器返回数据不为json格式。*/
    ERROR_SERVER_WRONG_JSON                                   = 0x20010002,
    /**@brief 没有找到匹配的清晰度。*/
    ERROR_NO_MATCH_QUALITY                                    = 0x20010003,
    /**@brief PlayAuth解析错误。*/
    ERROR_PLAYAUTH_WRONG                                      = 0x20010004,
    /**@brief 请求失败。*/
    ERROR_REQUEST_FAIL                                        = 0x20010005,
    /**@brief 服务端返回播放信息为空。*/
    ERROR_NO_PLAY_INFO                                        = 0x20010006,

    //------------------     POP  begin ------------------------
    /**@brief POP未知错误。*/
    ERROR_SERVER_POP_UNKNOWN                                  = 0x20010100,
    /**@brief 缺少参数。*/
    ERROR_SERVER_POP_MISSING_PARAMETER                        = 0x20010101,
    /**@brief 参数无效。*/
    ERROR_SERVER_POP_INVALID_PARAMETER                        = 0x20010102,
    /**@brief 账号未开通视频点播服务。*/
    ERROR_SERVER_POP_OPERATION_DENIED                         = 0x20010103,
    /**@brief 账号已欠费，请充值。*/
    ERROR_SERVER_POP_OPERATION_SUSPENED                       = 0x20010104,
    /**@brief 无权限执行该操作。*/
    ERROR_SERVER_POP_FORBIDDEN                                = 0x20010105,
    /**@brief 后台发生未知错误。*/
    ERROR_SERVER_POP_INTERNAL_ERROR                           = 0x20010106,
    /**@brief 服务不可用。*/
    ERROR_SERVER_POP_SERVICE_UNAVALIABLE                      = 0x20010107,
    /**@brief 签名已经被使用。*/
    ERROR_SERVER_POP_SIGNATUREANONCE_USED                     = 0x20010108,
    /**@brief 安全token不对。*/
    ERROR_SERVER_POP_SECURITYTOKEN_MAILFORMED                 = 0x20010109,
    /**@brief 安全token与Accesskey不匹配。*/
    ERROR_SERVER_POP_SECURITYTOKEN_MISMATCH_ACCESSKEY         = 0x2001010A,
    /**@brief 签名校验不对。*/
    ERROR_SERVER_POP_SIGNATURE_NOT_MATCH                      = 0x2001010B,
    /**@brief 没有找到AccessKeyId。*/
    ERROR_SERVER_POP_ACCESSKEYID_NOT_FOUND                    = 0x2001010C,
    /**@brief Token过期。*/
    ERROR_SERVER_POP_TOKEN_EXPIRED                            = 0x2001010D,

    //------------------     VOD  begin ------------------------
    /**@brief VOD未知错误。*/
    ERROR_SERVER_VOD_UNKNOWN                                  = 0x20010200,
    /**@brief 视频状态无效。*/
    ERROR_SERVER_VOD_FORBIDDEN_ILLEGALSTATUS                  = 0x20010201,
    /**@brief 视频不存在。*/
    ERROR_SERVER_VOD_INVALIDVIDEO_NOTFOUND                    = 0x20010202,
    /**@brief 根据您的筛选条件找不到可以播放的转码输出流。*/
    ERROR_SERVER_VOD_INVALIDVIDEO_NOSTREAM                    = 0x20010203,
    /**@brief 当前仅存在阿里云视频加密的转码输出流，必须使用阿里云播放器进行播放或者设置请求参数ResultType值为Multiple。*/
    ERROR_SERVER_VOD_FORBIDDEN_ALIYUNVODENCRYPTION            = 0x20010204,
    /**@brief AuthInfo与vid不一致。*/
    ERROR_SERVER_VOD_INVALIDAUTH_MEDIAID                      = 0x20010205,
    /**@brief AuthInfo过期。*/
    ERROR_SERVER_VOD_INVALIDAUTHINFO_EXPIRETIME               = 0x20010206,

    //------------------     MPS  begin ------------------------
    /**@brief MPS未知错误。*/
    ERROR_SERVER_MPS_UNKNOWN                                  = 0x20010300,
    /**@brief MediaId无效。*/
    ERROR_SERVER_MPS_INVALID_MEDIAID                          = 0x20010301,
    /**@brief AuthTimeout无效。*/
    ERROR_SERVER_MPS_INVALID_AUTHTIMEOUT                      = 0x20010302,
    /**@brief Formats无效。*/
    ERROR_SERVER_MPS_INVALID_FORMATS                          = 0x20010303,
    /**@brief AuthInfo无效。*/
    ERROR_SERVER_MPS_INVALID_AUTHINFO                         = 0x20010304,
    /**@brief 签名校验失败。*/
    ERROR_SERVER_MPS_SIGNATURE_CHECK_FAILED                   = 0x20010305,
    /**@brief MediaId不存在。*/
    ERROR_SERVER_MPS_MEDIAID_NOT_EXIST                        = 0x20010306,
    /**@brief 媒体资源不存在。*/
    ERROR_SERVER_MPS_MEDIA_RESOURCE_NOT_EXIST                 = 0x20010307,
    /**@brief 媒体没有发布。*/
    ERROR_SERVER_MPS_MEDIA_NOT_PUBLISHED                      = 0x20010308,
    /**@brief 媒体没有加密。*/
    ERROR_SERVER_MPS_MEDIA_NOT_ENCRYPTED                      = 0x20010309,
    /**@brief ciphertextblob无效。*/
    ERROR_SERVER_MPS_INVALID_CIPHERTEXTBLOB                   = 0x2001030A,
    /**@brief CipherTextBlob不存在。*/
    ERROR_SERVER_MPS_CIPHERBLOB_NOT_EXIST                     = 0x2001030B,
    /**@brief 服务器内部错误。*/
    ERROR_SERVER_MPS_INTERNAL_ERROR                           = 0x2001030C,
    /**@brief 请求标识不允许操作。*/
    ERROR_SERVER_MPS_INVALID_IDENTITY_NOT_ORDER_VIDEO_SERVICE = 0x2001030D,
    /**@brief 更新主机配置失败。*/
    ERROR_SERVER_MPS_UPDATE_CDN_DOMAIN_CONFIGS_FAIL           = 0x2001030E,
    /**@brief auth密钥已经存在。*/
    ERROR_SERVER_MPS_AUTH_KEY_EXIST                           = 0x2001030F,
    /**@brief auth密钥不存在。*/
    ERROR_SERVER_MPS_AUTH_KEY_NOT_EXIST                       = 0x20010310,
    /**@brief 参数超出范围。*/
    ERROR_SERVER_MPS_INVALID_PARAMETER_OUT_OF_BOUND           = 0x20010311,
    /**@brief 参数无效。*/
    ERROR_SERVER_MPS_INVALID_PARAMETER                        = 0x20010312,
    /**@brief 参数不能为null。*/
    ERROR_SERVER_MPS_INVALID_PARAMETER_NULL_VALUE             = 0x20010313,
    /**@brief 参数不能为空。*/
    ERROR_SERVER_MPS_INVALID_PARAMETER_EMPTY_VALUE            = 0x20010314,
    /**@brief 媒体资源不匹配。*/
    ERROR_SERVER_MPS_MEDIA_RESOURCE_NOT_MATCH                 = 0x20010315,
    /**@brief 没有找到MediaId的密文资源。*/
    ERROR_SERVER_MPS_MEDIA_NOT_FOUND_CIPHERTEXT               = 0x20010316,
    /**@brief 指定的参数Rand无效。*/
    ERROR_SERVER_MPS_INVALID_PARAMETER_RAND                   = 0x20010317,
    /**@brief 缓存连接池为空。*/
    ERROR_SERVER_MPS_REDIS_POOL_IS_EMPTY                      = 0x20010318,
    /**@brief 媒体id不匹配。*/
    ERROR_SERVER_MPS_SIGNATURE_CHECK_MEDIA_FAILED             = 0x20010319,
    /**@brief 指定的到期时间值已过期。*/
    ERROR_SERVER_MPS_SIGNATURE_CHECK_EXPIREDTIME_FAILED       = 0x2001031A,
    /**@brief 指定的参数SessionTime应该是>0。*/
    ERROR_SERVER_MPS_INVALID_SESSION_TIME                     = 0x2001031B,
    /**@brief EndUserId长度不对。*/
    ERROR_SERVER_MPS_INVALID_END_USER_ID                      = 0x2001031C,
    /**@brief 指定的参数LicenseUrl格式不正确。*/
    ERROR_SERVER_MPS_INVALID_URL                              = 0x2001031D,
    /**@brief 请求失败。*/
    ERROR_SERVER_MPS_HTTP_REQUEST_FAILED                      = 0x2001031E,
    /**@brief xml格式出错。*/
    ERROR_SERVER_MPS_XML_FORMAT_ERROR                         = 0x2001031F,
    /**@brief Session不存在。*/
    ERROR_SERVER_MPS_SESSION_NOT_EXIST                        = 0x20010320,
    /**@brief API不支持。*/
    ERROR_SERVER_MPS_REGION_NOT_SUPPORTED_API                 = 0x20010321,
    /**@brief 此区域未激活DRM，请联系我们。*/
    ERROR_SERVER_MPS_DRM_NOT_ACTIVATED                        = 0x20010322,
    /**@brief DRM验证错误，请为此媒体添加授权。*/
    ERROR_SERVER_MPS_DRM_AUTH_ERROR                           = 0x20010323,
    /**@brief oss域不存在cdn域配置。*/
    ERROR_SERVER_MPS_CDN_CONFIG_NOT_EXIST                     = 0x20010324,

    //------------------     LIVESHIFT  begin ------------------------
    /**@brief 时移未知错误。*/
    ERROR_SERVER_LIVESHIFT_UNKNOWN                            = 0x20010400,
    /**@brief 时移请求失败。*/
    ERROR_SERVER_LIVESHIFT_REQUEST_ERROR                      = 0x20010401,
    /**@brief 时移数据解析失败。*/
    ERROR_SERVER_LIVESHIFT_DATA_PARSER_ERROR                  = 0x20010402,

    //------------------     KEYMANANGER  begin ------------------------
    ERROR_KEYMANAGER_UNKNOWN                                  = 0x20011000,

    //------------------     TBDRM  begin ------------------------
    /**@brief 私有加密未知错误。*/
    ERROR_TBDRM_UNKNOWN                                       = 0x20012000,
    /**@brief 私有加密解封装未实现。*/
    ERROR_TBDRM_DEMUXER_UNIMPLEMENTED                         = 0x20012001,
    //------------------     UNKNOWN  begin ------------------------
    /**@brief 未知错误。*/
    ERROR_UNKNOWN_ERROR                                       = 0x20020000 - 1,

    /**@brief Demuxer错误起始码。*/
    ERROR_DEMUXER_START                                       = 0x20030000,
    /**@brief 打开URL失败。*/
    ERROR_DEMUXER_OPENURL                                     = 0x20030001,
    /**@brief 无效的流。*/
    ERROR_DEMUXER_NO_VALID_STREAM                             = 0x20030002,
    /**@brief 打开流失败。*/
    ERROR_DEMUXER_OPENSTREAM                                  = 0x20030003,
    /**@brief 加载超时。*/
    ERROR_LOADING_TIMEOUT                                     = 0x20030004,
    /**@brief 数据源URL为空。*/
    ERROR_DATASOURCE_EMPTYURL                                 = 0x20030005,
    /**@brief 网络dns解析失败。*/
    ERROR_DATASOURCE_RESOLVE                                  = 0x20030007,
    /**@brief 网络连接失败。*/
    ERROR_DATASOURCE_CONNECT                                  = 0x20030008,

    ERROR_DECODE_BASE                                         = 0x20040000,
    /**@brief 视频解码失败。*/
    ERROR_DECODE_VIDEO                                        = 0x20040001,
    /**@brief 音频解码失败。*/
    ERROR_DECODE_AUDIO                                        = 0x20040002,


    /**@brief 未知的网络错误。*/
    ERROR_NETWORK_UNKNOWN                                     = 0x20050000,
    /**@brief 协议不支持。*/
    ERROR_NETWORK_UNSUPPORTED                                 = 0x20050001,
    /**@brief 不能解析域名。*/
    ERROR_NETWORK_RESOLVE                                     = 0x20050002,
    /**@brief 网络连接超时。*/
    ERROR_NETWORK_CONNECT_TIMEOUT                             = 0x20050003,
    /**@brief 无法连接到服务器。*/
    ERROR_NETWORK_COULD_NOT_CONNECT                           = 0x20050004,
    /**@brief 403错误。*/
    ERROR_NETWORK_HTTP_403                                    = 0x20050005,
    /**@brief 404错误。*/
    ERROR_NETWORK_HTTP_404                                    = 0x20050006,
    /**@brief 其他的4XX错误。*/
    ERROR_NETWORK_HTTP_4XX                                    = 0x20050007,
    /**@brief 5XX的服务器错误。*/
    ERROR_NETWORK_HTTP_5XX                                    = 0x20050008,
    /**@brief 不支持range请求。*/
    ERROR_NETWORK_HTTP_RANGE                                  = 0x20050009,
    /**@brief 400错误。*/
    ERROR_NETWORK_HTTP_400                                    = 0x2005000A,
    /**@brief 重定向到了一个不是媒体文件的URL。*/
    ERROR_NETWORK_HTTP_REDIRECT_NONMEDIA                      = 0x2005000B,


    /**@brief 未知的解码错误。*/
    ERROR_CODEC_UNKNOWN                                       = 0x20060000,
    /**@brief 视频编码格式不支持。*/
    ERROR_CODEC_VIDEO_NOT_SUPPORT                             = 0x20060001,
    /**@brief 音频编码格式不支持。*/
    ERROR_CODEC_AUDIO_NOT_SUPPORT                             = 0x20060002,

    /**@brief 未知的内部错误。*/
    ERROR_INERNAL_UNKNOWN                                     = 0x20070000,
    /**@brief 内部退出。*/
    ERROR_INERNAL_EXIT                                        = 0x20070001,

    /**@brief 标准错误。*/
    ERROR_GENERAL_UNKNOWN                                     = 0x20080000,
    /**@brief 标准错误-1，操作不允许等。*/
    ERROR_GENERAL_EPERM                                       = 0x20080001,
    /**@brief 标准错误-2，文件不存在等。*/
    ERROR_GENERAL_ENOENT                                      = 0x20080002,
    /**@brief 标准错误-5，IO错误等。*/
    ERROR_GENERAL_EIO                                         = 0x20080005,
    
    ERROR_GENERAL_EPERM_SEEK                                  = 0x20080006,
    ERROR_GENERAL_EPERM_READ_PACKET                           = 0x20080007,
    ERROR_GENERAL_EPERM_DEM                                   = 0x20080008,
    
    /**@brief 未知渲染错误。*/
    ERROR_RENDER_UNKNOWN                                      = 0x20090000,
    /**@brief 打开音频设备失败。*/
    ERROR_RENDER_AUDIO_OPEN_DEVICE_FAILED                     = 0x20090001,

    /**@brief 未知格式错误。*/
    ERROR_FORMAT_UNKNOWN                                      = 0x200A0000,
    /**@brief 该媒体格式不支持。*/
    ERROR_FORMAT_NOT_SUPPORT                                  = 0x200A0001,
    /**@brief URL必须添加etavirp_nuyila=1才能播放私有加密的媒体。*/
    ERROR_FORMAT_URL_REQUIRE_ALIYUN_PRIVATE_TAG               = 0x200A0002,
    /**@brief 媒体meta中未找到key info 或 key info无效，如果有多个阿里云账号，请使用对应账号的license进行集成。*/
    ERROR_FORMAT_INVALID_TBDRM_MP4_KEY                        = 0x200A0003,
    /**@brief 媒体meta中未找到key info 或 key info无效，如果有多个阿里云账号，请使用对应账号的license进行集成。*/
    ERROR_FORMAT_INVALID_TBDRM_HLS_KEY                        = 0x200A0004,

    /**@brief 未知直播错误。*/
    ERROR_LIVE_UNKNOWN                                        = 0x200B0000,
    /**@brief 直播流已断开。*/
    ERROR_LIVE_STREAM_STOPPED                                 = 0x200B0001,
    
    ERROR_DRM_UNKNOWN                                         = 0x200C0000,
    ERROR_DRM_KEY_RESPONSE_INVALID                            = 0x200C0005,
    ERROR_DRM_CERT_RESPONSE_INVALID                           = 0x200C0009,
    ERROR_DRM_INVALID_API_USAGE                               = 0x200C000A,

    /**@brief 未知错误。*/
    ERROR_PLAYER_UNKNOWN                                      = 0x30000000 - 1,


    /**@brief 没有选择下载项。*/
    DOWNLOADER_ERROR_NOT_SELECT_ITEM                          = 0x30010000,
    /**@brief 没有可用下载项。*/
    DOWNLOADER_ERROR_NO_DOWNLOAD_ITEM                         = 0x30010001,
    /**@brief 没有设置Sts源。*/
    DOWNLOADER_ERROR_STS_SOURCE_NULL                          = 0x30010002,
    /**@brief 没有设置Auth源。*/
    DOWNLOADER_ERROR_AUTH_SOURCE_NULL                         = 0x30010003,
    /**@brief Auth格式不对。*/
    DOWNLOADER_ERROR_AUTH_SOURCE_WRONG                        = 0x30010004,
    /**@brief 选中的下载项不对。*/
    DOWNLOADER_ERROR_INVALID_ITEM                             = 0x30010005,
    /**@brief URL无法连接。*/
    DOWNLOADER_ERROR_URL_CANNOT_REACH                         = 0x30010006,
    /**@brief 下载的格式不支持。*/
    DOWNLOADER_ERROR_NOT_SUPPORT_FORMAT                       = 0x30010007,
    /**@brief 加密校验文件不匹配。*/
    DOWNLOADER_ERROR_ENCRYPT_FILE_NOT_MATCH                   = 0x30010008,
    /**@brief 下载功能被关闭。*/
    DOWNLOADER_ERROR_DOWNLOAD_SWITCH_OFF                      = 0x30010009,
    /**@brief 网络出错。*/
    DOWNLOADER_ERROR_NET_ERROR                                = 0x3001000A,
    /**@brief 没有设置下载路径。*/
    DOWNLOADER_ERROR_NOT_SET_SAVE_DIR                         = 0x3001000B,
    /**@brief 无法创建下载目录。*/
    DOWNLOADER_ERROR_CANNOT_CREATE_SAVE_DIR                   = 0x3001000C,
    /**@brief 没有空间。*/
    DOWNLOADER_ERROR_NO_SPACE                                 = 0x3001000D,
    /**@brief 写入文件出错。*/
    DOWNLOADER_ERROR_WRITE_ERROR                              = 0x3001000E,
    /**@brief 解密失败。*/
    DOWNLOADER_ERROR_ENCRYPT_ERROR                            = 0x3001000F,
    /**@brief 文件不存在。*/
    DOWNLOADER_ERROR_FILE_NOT_EXIST                           = 0x30010010,
    /**@brief 删除文件参数无效。*/
    DOWNLOADER_ERROR_CLEAN_INVALID_PARAM                      = 0x30010011,
    /**@brief 删除文件状态不对。*/
    DOWNLOADER_ERROR_CLEAN_WRONG_STATUS                       = 0x30010012,
    /**@brief 获取AES秘钥失败。*/
    DOWNLOADER_ERROR_GET_AES_KEY_FAIL                         = 0x30010013,
    /**@brief 加密方式不支持。*/
    DOWNLOADER_ERROR_ENCRYPTION_NOT_SUPPORT                   = 0x30010014,

    /**@brief MediaLoader未知错误。*/
    MEDIALOADER_ERROR_UNKNOWN                = 0x40010000,
    /**@brief 同一个Url已经加载过。*/
    MEDIALOADER_ERROR_ADDED                 = 0x40010001,
    /**@brief 本地缓存未开启，预加载失败。*/
    MEDIALOADER_ERROR_NOT_ENABLE           = 0x40010002,
    /**@brief 不支持。*/
    MEDIALOADER_ERROR_NOT_SUPPORT         = 0x40010003,
    /**@brief 没有找到Track。*/
    MEDIALOADER_ERROR_NO_TRACK              = 0x40010004,


    /**@brief license 验证无效。*/
    LICENSE_ERROR_INVALID              =  0x50010000,


    /**@brief 专业版license验证无效。*/
    PREMIUM_LICENSE_ERROR_INVALID = 0x50020000,


    /**@brief 专业版license验证无效, 当前格式视频无法播放。*/
    ERROR_FORMAT_PREMIUM_INVALID  = 0x50020001,

    /**@brief 专业版license验证无效, mediaLoader使用报错。*/
    ERROR_MEDIALOADER_PREMIUM_INVALID  = 0x50020002,


    /**@brief 未知license错误*/
    LICENSE_ERROR_UNKNOWN  = 0x50020100,

} AVPErrorCode;

/**@brief 播放器事件类型，带描述字符串*/
typedef enum AVPEventWithString: NSUInteger {
    /**@brief 设置了硬解，但是切换为软解。额外信息为描述信息。*/
    EVENT_SWITCH_TO_SOFTWARE_DECODER = 100,
    /**@brief 音频解码格式不支持。额外信息为描述信息。*/
    EVENT_AUDIO_CODEC_NOT_SUPPORT    = 101,
    /**@brief 音频解码器设备失败。额外信息为描述信息。*/
    EVENT_AUDIO_DECODER_DEVICE_ERROR = 102,
    /**@brief 视频解码格式不支持。额外信息为描述信息。*/
    EVENT_VIDEO_CODEC_NOT_SUPPORT    = 103,
    /**@brief 视频解码器设备失败。额外信息为描述信息。*/
    EVENT_VIDEO_DECODER_DEVICE_ERROR = 104,
    /**@brief 视频渲染设备初始化失败。额外信息为描述信息。*/
    EVENT_VIDEO_RENDER_INIT_ERROR    = 105,
    /**@brief Demuxer trace ID for artc*/
    EVENT_PLAYER_DEMUXER_TRACE_ID    = 106,
    /**@brief 网络失败，需要重试。无额外信息。*/
    EVENT_PLAYER_NETWORK_RETRY       = 108,
    /**@brief 缓存成功。无额外信息。*/
    EVENT_PLAYER_CACHE_SUCCESS       = 109,
    /**@brief 缓存失败。额外信息为描述信息。*/
    EVENT_PLAYER_CACHE_ERROR         = 110,
    /**@brief 系统无可用内存来存放媒体数据。*/
    EVENT_PLAYER_LOW_MEMORY          = 111,
    /**@brief 网络重试成功。无额外信息。*/
    EVENT_PLAYER_NETWORK_RETRY_SUCCESS = 113,
    /**@brief 字幕选择失败。额外信息为失败原因。*/
    EVENT_PLAYER_SUBTITLE_SELECT_ERROR = 114,
    /**@brief 后台恢复时所需解码帧过多 */
    EVENT_PLAYER_EVENT_DECODER_RECOVER_SIZE = 115,

    /**@brief 播放组件中透传输出的消息 */
    EVENT_PLAYER_DIRECT_COMPONENT_MSG = 116,

    /**@brief 打开hls流中的segment失败 */
    EVENT_PLAYER_DEMUXER_SEGMENT_OPEN_FAILED = 119,
    
    /**@brief H265自适应降级 */
    EVENT_PLAYER_H265ADAPTIVE_DEGRADE = 121,

    /**@brief 本次播放唯一id，跟随prepare接口调用刷新 */
    EVENT_PLAYER_VPS_ID = 122,

    /**@brief RTS 服务器可能断开连接。*/
    EVENT_PLAYER_RTS_SERVER_MAYBE_DISCONNECT = 0x30010001,
    /**@brief RTS 服务器恢复连接。*/
    EVENT_PLAYER_RTS_SERVER_RECOVER          = 0x30010002,
} AVPEventWithString;

#endif

