1 /* 2 * Copyright (c) 2025 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 /** 17 * @addtogroup AVTranscoder 18 * @{ 19 * 20 * @brief Provides APIs of request capability for Transcoder. 21 * 22 * @syscap SystemCapability.Multimedia.Media.AVTranscoder 23 * @since 20 24 * @} 25 */ 26 27 /** 28 * @file avtranscoder_base.h 29 * 30 * @brief Defines the structure and enumeration for Media AVTranscoder. 31 * 32 * @kit MediaKit 33 * @library libavtranscoder.so 34 * @syscap SystemCapability.Multimedia.Media.AVTranscoder 35 * @since 20 36 */ 37 38 #ifndef MULTIMEDIA_PLAYER_FRAMEWORK_AVTRANSCODER_BASE_H 39 #define MULTIMEDIA_PLAYER_FRAMEWORK_AVTRANSCODER_BASE_H 40 41 #include <string> 42 #include <stdint.h> 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 48 /** 49 * @brief definiton of avtranscoder 50 * @since 20 51 */ 52 typedef struct OH_AVTranscoder OH_AVTranscoder; 53 54 /** 55 * @brief definiton of avtranscoder config 56 * @since 20 57 */ 58 typedef struct OH_AVTranscoder_Config OH_AVTranscoder_Config; 59 60 /** 61 * @brief Transcoder States 62 * @since 20 63 */ 64 typedef enum OH_AVTranscoder_State { 65 /** prepared states */ 66 AVTRANSCODER_PREPARED = 1, 67 /** started states */ 68 AVTRANSCODER_STARTED = 2, 69 /** paused states */ 70 AVTRANSCODER_PAUSED = 3, 71 /** cancelled states */ 72 AVTRANSCODER_CANCELLED = 4, 73 /** completed states */ 74 AVTRANSCODER_COMPLETED = 5 75 } OH_AVTranscoder_State; 76 77 /** 78 * @brief Called when the state changed of current transcoding. 79 * @param {OH_AVTranscoder*} transcoder The pointer to an OH_AVTranscoder instance. 80 * @param {OH_AVTranscoder_State} state Indicates the transcoder state. For details, see {@link OH_AVTranscoder_State}. 81 * @param {void*} userData Pointer to user specific data. 82 * @since 20 83 */ 84 typedef void (*OH_AVTranscoder_OnStateChange)(OH_AVTranscoder *transcoder, OH_AVTranscoder_State state, void *userData); 85 86 /** 87 * @brief Called when an error occurred during transcoding 88 * @param {OH_AVTranscoder*} transcoder Pointer to an OH_AVTranscoder instance. 89 * @param {int32_t} errorCode Error code. 90 * {@link AV_ERR_NO_MEMORY} if memory is insufficient. 91 * {@link AV_ERR_IO} if IO access failed. 92 * {@link AV_ERR_INVALID_STATE} if the current state does not support this operation. 93 * {@link AV_ERR_UNSUPPORT} if unsurpport function. 94 * {@link AV_ERR_INVALID_VAL} if the parameter check failed. 95 * {@link AV_ERR_OPERATE_NOT_PERMIT} if operation not allowed. 96 * @param {const char*} errorMsg Error message. 97 * @param {void*} userData Pointer to user specific data. 98 * @since 20 99 */ 100 typedef void (*OH_AVTranscoder_OnError)(OH_AVTranscoder *transcoder, int32_t errorCode, const char *errorMsg, 101 void *userData); 102 103 /** 104 * @brief Progress indicator function definition, called when transcoding progress is updated 105 * @param {OH_AVTranscoder*} transcoder Pointer to an OH_AVTranscoder instance. 106 * @param {int32_t} progress Transcoding progress. 107 * @param {void*} userData Pointer to user specific data. 108 * @since 20 109 */ 110 typedef void (*OH_AVTranscoder_OnProgressUpdate)(OH_AVTranscoder *transcoder, int32_t progress, void *userData); 111 112 #ifdef __cplusplus 113 } 114 #endif 115 116 #endif // MULTIMEDIA_PLAYER_FRAMEWORK_AVTRANSCODER_BASE_H