1 /* 2 * Copyright (C) 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 /** 17 * @addtogroup VideoEncoder 18 * @{ 19 * 20 * @brief The VideoEncoder module provides interfaces for video encoding. 21 * 22 * @syscap SystemCapability.Multimedia.VideoEncoder 23 * @since 9 24 */ 25 26 /** 27 * @file native_avcodec_videoencoder.h 28 * 29 * @brief Declare the interface used for video encoding. 30 * 31 * @kit AVCodecKit 32 * @library libnative_media_venc.so 33 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 34 * @since 9 35 */ 36 37 #ifndef NATIVE_AVCODEC_VIDEOENCODER_H 38 #define NATIVE_AVCODEC_VIDEOENCODER_H 39 40 #include <stdint.h> 41 #include <stdio.h> 42 #include "native_avcodec_base.h" 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 48 /** 49 * @brief When OH_AVCodec needs new input parameter during the running process, the function pointer will be called and 50 * carry an available OH_AVFormat to fill in the new input parameter. This parameter takes effect immediately with the 51 * frame. 52 * 53 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 54 * @param codec OH_AVCodec instance 55 * @param index The index corresponding to the new OH_AVFormat instance 56 * @param parameter Parameter containing the new OH_AVFormat instance 57 * @param userData specified data 58 * @since 12 59 */ 60 typedef void (*OH_VideoEncoder_OnNeedInputParameter)(OH_AVCodec *codec, uint32_t index, OH_AVFormat *parameter, 61 void *userData); 62 63 /** 64 * @brief Creates a video encoder instance from the mime type, which is recommended in most cases. 65 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 66 * @param mime mime type description string, refer to {@link AVCODEC_MIME_TYPE} 67 * @return Returns a Pointer to an OH_AVCodec instance. 68 * Return NULL if memory ran out or the mime type is not supported. 69 * @since 9 70 * @version 1.0 71 */ 72 OH_AVCodec *OH_VideoEncoder_CreateByMime(const char *mime); 73 74 /** 75 * @brief Create a video encoder instance through the video encoder name. The premise of using this interface is to 76 * know the exact name of the encoder. 77 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 78 * @param name Video encoder name 79 * @return Returns a Pointer to an OH_AVCodec instance. 80 * Return NULL if memory ran out or the encoder name is not supported. 81 * @since 9 82 * @version 1.0 83 */ 84 OH_AVCodec *OH_VideoEncoder_CreateByName(const char *name); 85 86 /** 87 * @brief Clear the internal resources of the encoder and destroy the encoder instance 88 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 89 * @param codec Pointer to an OH_AVCodec instance 90 * @return Returns AV_ERR_OK if the execution is successful, 91 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 92 * {@link AV_ERR_NO_MEMORY}, inner resource has already released. 93 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 94 * {@link AV_ERR_UNKNOWN}, unknown error. 95 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 96 * @since 9 97 * @version 1.0 98 */ 99 OH_AVErrCode OH_VideoEncoder_Destroy(OH_AVCodec *codec); 100 101 /** 102 * @brief Set the asynchronous callback function so that your application can respond to the events generated by the 103 * video encoder. This interface must be called before Prepare is called. 104 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 105 * @param codec Pointer to an OH_AVCodec instance 106 * @param callback A collection of all callback functions, see {@link OH_AVCodecAsyncCallback} 107 * @param userData User specific data 108 * @return Returns AV_ERR_OK if the execution is successful, 109 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 110 * {@link AV_ERR_NO_MEMORY}, inner resource has already released. 111 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 112 * {@link AV_ERR_UNKNOWN}, unknown error. 113 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 114 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare. 115 * @deprecated since 11 116 * @useinstead OH_VideoEncoder_RegisterCallback 117 * @since 9 118 * @version 1.0 119 */ 120 OH_AVErrCode OH_VideoEncoder_SetCallback(OH_AVCodec *codec, OH_AVCodecAsyncCallback callback, void *userData); 121 122 /** 123 * @brief Set the asynchronous callback function so that your application can respond to the events generated by the 124 * video encoder. This interface must be called before Prepare is called. 125 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 126 * @param codec Pointer to an OH_AVCodec instance 127 * @param callback A collection of all callback functions, see {@link OH_AVCodecCallback} 128 * @param userData User specific data 129 * @return Returns AV_ERR_OK if the execution is successful, 130 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 131 * {@link AV_ERR_NO_MEMORY}, inner resource has already released. 132 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 133 * {@link AV_ERR_UNKNOWN}, unknown error. 134 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 135 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare. 136 * @since 11 137 */ 138 OH_AVErrCode OH_VideoEncoder_RegisterCallback(OH_AVCodec *codec, OH_AVCodecCallback callback, void *userData); 139 140 /** 141 * @brief Set the asynchronous callback function so that your application can respond to the events generated by the 142 * video encoder. This interface is optional only for input surface. If this interface is used, it must be invoked 143 * before {@link OH_VideoEncoder_Configure}. 144 * 145 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 146 * @param codec Pointer to an OH_AVCodec instance 147 * @param onInputParameter A callback functions, see {@link OH_VideoEncoder_OnNeedInputParameter} 148 * @param userData User specific data 149 * @return Returns AV_ERR_OK if the execution is successful, 150 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 151 * {@link AV_ERR_NO_MEMORY}, inner resource has already released. 152 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 153 * {@link AV_ERR_UNKNOWN}, unknown error. 154 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 155 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare. 156 * @since 12 157 */ 158 OH_AVErrCode OH_VideoEncoder_RegisterParameterCallback(OH_AVCodec *codec, 159 OH_VideoEncoder_OnNeedInputParameter onInputParameter, 160 void *userData); 161 162 /** 163 * @brief To configure the video encoder, typically, you need to configure the description information of the 164 * encoded video track. This interface must be called before Prepare is called. 165 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 166 * @param codec Pointer to an OH_AVCodec instance 167 * @param format A pointer to an OH_AVFormat that gives the description of the video track to be encoded 168 * @return Returns AV_ERR_OK if the execution is successful, 169 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 170 * {@link AV_ERR_NO_MEMORY}, instance has already released. 171 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. Invalid param in format. 172 * {@link AV_ERR_UNKNOWN}, unknown error. 173 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 174 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state, must be called before Prepare. 175 * @since 9 176 * @version 1.0 177 */ 178 OH_AVErrCode OH_VideoEncoder_Configure(OH_AVCodec *codec, OH_AVFormat *format); 179 180 /** 181 * @brief To prepare the internal resources of the encoder, the Configure interface must be called before 182 * calling this interface. 183 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 184 * @param codec Pointer to an OH_AVCodec instance 185 * @return Returns AV_ERR_OK if the execution is successful, 186 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 187 * {@link AV_ERR_NO_MEMORY}, instance has already released. 188 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 189 * {@link AV_ERR_UNKNOWN}, unknown error. 190 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 191 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. 192 * @since 9 193 * @version 1.0 194 */ 195 OH_AVErrCode OH_VideoEncoder_Prepare(OH_AVCodec *codec); 196 197 /** 198 * @brief Start the encoder, this interface must be called after the Prepare is successful. After being 199 * successfully started, the encoder will start reporting NeedInputData events. 200 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 201 * @param codec Pointer to an OH_AVCodec instance 202 * @return Returns AV_ERR_OK if the execution is successful, 203 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 204 * {@link AV_ERR_NO_MEMORY}, instance has already released. 205 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 206 * {@link AV_ERR_UNKNOWN}, unknown error. 207 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 208 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. 209 * @since 9 210 * @version 1.0 211 */ 212 OH_AVErrCode OH_VideoEncoder_Start(OH_AVCodec *codec); 213 214 /** 215 * @brief Stop the encoder. After stopping, you can re-enter the Started state through Start. 216 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 217 * @param codec Pointer to an OH_AVCodec instance 218 * @return Returns AV_ERR_OK if the execution is successful, 219 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 220 * {@link AV_ERR_NO_MEMORY}, instance has already released. 221 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 222 * {@link AV_ERR_UNKNOWN}, unknown error. 223 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 224 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. 225 * @since 9 226 * @version 1.0 227 */ 228 OH_AVErrCode OH_VideoEncoder_Stop(OH_AVCodec *codec); 229 230 /** 231 * @brief Clear the input and output data buffered in the encoder. After this interface is called, all the Buffer 232 * indexes previously reported through the asynchronous callback will be invalidated, make sure not to access the 233 * Buffers corresponding to these indexes. 234 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 235 * @param codec Pointer to an OH_AVCodec instance 236 * @return Returns AV_ERR_OK if the execution is successful, 237 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 238 * {@link AV_ERR_NO_MEMORY}, instance has already released. 239 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 240 * {@link AV_ERR_UNKNOWN}, unknown error. 241 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 242 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. 243 * @since 9 244 * @version 1.0 245 */ 246 OH_AVErrCode OH_VideoEncoder_Flush(OH_AVCodec *codec); 247 248 /** 249 * @brief Reset the encoder. To continue coding, you need to call the Configure interface again to 250 * configure the encoder instance. 251 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 252 * @param codec Pointer to an OH_AVCodec instance 253 * @return Returns AV_ERR_OK if the execution is successful, 254 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 255 * {@link AV_ERR_NO_MEMORY}, instance has already released. 256 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 257 * {@link AV_ERR_UNKNOWN}, unknown error. 258 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 259 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. 260 * @since 9 261 * @version 1.0 262 */ 263 OH_AVErrCode OH_VideoEncoder_Reset(OH_AVCodec *codec); 264 265 /** 266 * @brief Get the description information of the output data of the encoder, refer to {@link OH_AVFormat} for details. 267 * It should be noted that the life cycle of the OH_AVFormat instance pointed to by the return value * needs to 268 * be manually released by the caller. 269 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 270 * @param codec Pointer to an OH_AVCodec instance 271 * @return Returns a pointer to an OH_AVFormat instance. 272 * Return NULL if the codec is NULL or invaild. 273 * @since 9 274 * @version 1.0 275 */ 276 OH_AVFormat *OH_VideoEncoder_GetOutputDescription(OH_AVCodec *codec); 277 278 /** 279 * @brief Set dynamic parameters to the encoder. Note: This interface can only be called after the encoder is started. 280 * At the same time, incorrect parameter settings may cause the encoding to fail. 281 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 282 * @param codec Pointer to an OH_AVCodec instance 283 * @param format OH_AVFormat handle pointer 284 * @return Returns AV_ERR_OK if the execution is successful, 285 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 286 * {@link AV_ERR_NO_MEMORY}, instance has already released. 287 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. Invalid param in format. 288 * {@link AV_ERR_UNKNOWN}, unknown error. 289 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 290 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. 291 * @since 9 292 * @version 1.0 293 */ 294 OH_AVErrCode OH_VideoEncoder_SetParameter(OH_AVCodec *codec, OH_AVFormat *format); 295 296 /** 297 * @brief Get the input Surface from the video encoder, this interface must be called before Prepare is called. 298 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 299 * @param codec Pointer to an OH_AVCodec instance 300 * @param window A pointer to a OHNativeWindow instance, see {@link OHNativeWindow}, the application is responsible for 301 * managing the life cycle of the window, call OH_NativeWindow_DestroyNativeWindow() when done. 302 * @return Returns AV_ERR_OK if the execution is successful, 303 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 304 * {@link AV_ERR_NO_MEMORY}, inner resource has already released. 305 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 306 * {@link AV_ERR_UNKNOWN}, unknown error. 307 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 308 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. 309 * @since 9 310 * @version 1.0 311 */ 312 OH_AVErrCode OH_VideoEncoder_GetSurface(OH_AVCodec *codec, OHNativeWindow **window); 313 314 /** 315 * @brief Return the processed output Buffer to the encoder. 316 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 317 * @param codec Pointer to an OH_AVCodec instance 318 * @param index The index value corresponding to the output Buffer 319 * @return Returns AV_ERR_OK if the execution is successful, 320 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 321 * {@link AV_ERR_NO_MEMORY}, instance has already released. 322 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 323 * Buffer index should be given by {@link OH_AVCodecOnNewOutputData}. 324 * {@link AV_ERR_UNKNOWN}, unknown error. 325 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 326 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. 327 * @deprecated since 11 328 * @useinstead OH_VideoEncoder_FreeOutputBuffer 329 * @since 9 330 * @version 1.0 331 */ 332 OH_AVErrCode OH_VideoEncoder_FreeOutputData(OH_AVCodec *codec, uint32_t index); 333 334 /** 335 * @brief Notifies the video encoder that the input stream has ended. It is recommended to use this interface to notify 336 * the encoder of the end of the stream in surface mode 337 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 338 * @param codec Pointer to an OH_AVCodec instance 339 * @return Returns AV_ERR_OK if the execution is successful, 340 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 341 * {@link AV_ERR_NO_MEMORY}, instance has already released. 342 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 343 * {@link AV_ERR_UNKNOWN}, unknown error. 344 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 345 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. 346 * @since 9 347 * @version 1.0 348 */ 349 OH_AVErrCode OH_VideoEncoder_NotifyEndOfStream(OH_AVCodec *codec); 350 351 /** 352 * @brief Submit the input buffer filled with data to the video encoder. 353 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 354 * @param codec Pointer to an OH_AVCodec instance 355 * @param index Enter the index value corresponding to the Buffer 356 * @param attr Information describing the data contained in the Buffer 357 * @return Returns AV_ERR_OK if the execution is successful, 358 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 359 * {@link AV_ERR_NO_MEMORY}, instance has already released. 360 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 361 * Buffer index should be given by {@link OH_AVCodecOnNeedInputData}. 362 * {@link AV_ERR_UNKNOWN}, unknown error. 363 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 364 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. 365 * @deprecated since 11 366 * @useinstead OH_VideoEncoder_PushInputBuffer 367 * @since 10 368 */ 369 OH_AVErrCode OH_VideoEncoder_PushInputData(OH_AVCodec *codec, uint32_t index, OH_AVCodecBufferAttr attr); 370 371 /** 372 * @brief Submit the input buffer filled with data to the video encoder. 373 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 374 * @param codec Pointer to an OH_AVCodec instance 375 * @param index Enter the index value corresponding to the Buffer 376 * @return Returns AV_ERR_OK if the execution is successful, 377 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 378 * {@link AV_ERR_NO_MEMORY}, instance has already released. 379 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 380 * Buffer index should be given by {@link OH_AVCodecOnNeedInputBuffer}. 381 * {@link AV_ERR_UNKNOWN}, unknown error. 382 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 383 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. 384 385 * @since 11 386 */ 387 OH_AVErrCode OH_VideoEncoder_PushInputBuffer(OH_AVCodec *codec, uint32_t index); 388 389 /** 390 * @brief Submit the input parameter filled with data to the video encoder. 391 * 392 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 393 * @param codec Pointer to an OH_AVCodec instance 394 * @param index Enter the index value corresponding to the input parameter 395 * @return Returns AV_ERR_OK if the execution is successful, 396 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 397 * {@link AV_ERR_NO_MEMORY}, instance has already released. 398 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 399 * Index should be given by {@link OH_VideoEncoder_OnNeedInputParameter}. 400 * {@link AV_ERR_UNKNOWN}, unknown error. 401 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 402 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. 403 * @since 12 404 */ 405 OH_AVErrCode OH_VideoEncoder_PushInputParameter(OH_AVCodec *codec, uint32_t index); 406 407 /** 408 * @brief Return the processed output Buffer to the encoder. 409 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 410 * @param codec Pointer to an OH_AVCodec instance 411 * @param index The index value corresponding to the output Buffer 412 * @return Returns AV_ERR_OK if the execution is successful, 413 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 414 * {@link AV_ERR_NO_MEMORY}, instance has already released. 415 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 416 * Buffer index should be given by {@link OH_AVCodecOnNewOutputBuffer}. 417 * {@link AV_ERR_UNKNOWN}, unknown error. 418 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 419 * {@link AV_ERR_INVALID_STATE}, this interface was called in invalid state. 420 * @since 11 421 */ 422 OH_AVErrCode OH_VideoEncoder_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index); 423 424 /** 425 * @brief Get the input data description of the encoder after call {@OH_VideoEncoder_Configure}, 426 * refer to {@link OH_AVFormat} for details. It should be noted that the life cycle of the OH_AVFormat 427 * instance pointed to by the return value needs to be manually released by the caller. 428 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 429 * @param codec Pointer to an OH_AVCodec instance 430 * @return Returns a pointer to an OH_AVFormat instance. 431 * Return NULL if the encoder is NULL or invaild. 432 * @since 10 433 */ 434 OH_AVFormat *OH_VideoEncoder_GetInputDescription(OH_AVCodec *codec); 435 436 /** 437 * @brief Check whether the current codec instance is valid. It can be used fault recovery or app 438 * switchback from the background 439 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 440 * @param codec Pointer to an OH_AVCodec instance 441 * @param isValid Output Parameter. A pointer to a boolean instance, it is true if the codec instance is valid, 442 * false if the codec instance is invalid 443 * @return Returns AV_ERR_OK if the execution is successful, 444 * otherwise returns a specific error code, refer to {@link OH_AVErrCode}. 445 * {@link AV_ERR_NO_MEMORY}, instance has already released. 446 * {@link AV_ERR_INVALID_VAL}, the encoder is NULL or invalid. 447 * {@link AV_ERR_UNKNOWN}, unknown error. 448 * {@link AV_ERR_SERVICE_DIED}, avcodec service is died. 449 * @since 10 450 */ 451 OH_AVErrCode OH_VideoEncoder_IsValid(OH_AVCodec *codec, bool *isValid); 452 453 /** 454 * @brief The bitrate mode of video encoder. 455 * @syscap SystemCapability.Multimedia.Media.VideoEncoder 456 * @since 9 457 * @version 1.0 458 */ 459 typedef enum OH_VideoEncodeBitrateMode { 460 /* constant bit rate mode. */ 461 CBR = 0, 462 /* variable bit rate mode. */ 463 VBR = 1, 464 /* constant quality mode. */ 465 CQ = 2, 466 } OH_VideoEncodeBitrateMode; 467 468 #ifdef __cplusplus 469 } 470 #endif 471 472 #endif // NATIVE_AVCODEC_VIDEOENCODER_H 473 /** @} */