1 // Copyright (C) 2022 Beken Corporation 2 // 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 #pragma once 16 17 #include <components/video_types.h> 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 /* @brief Overview about this API header 24 * 25 */ 26 27 /** 28 * @brief video transfer init 29 * 30 * This API will create video thread, init msg queue, and excute camera init 31 * 32 * param setup_cfg: configure of the video transfer include packet process, method of transfer, etc. 33 * 34 * @return 35 * - kNoErr: succeed 36 * - others: other errors. 37 */ 38 bk_err_t bk_video_transfer_init(video_setup_t *setup_cfg); 39 40 /** 41 * @brief video transfer deinit 42 * 43 * This API will quit video thread, and free all reasource 44 * 45 * @return 46 * - kNoErr: succeed 47 * - others: other errors. 48 */ 49 bk_err_t bk_video_transfer_deinit(void); 50 51 /** 52 * @brief set video transfer param 53 * 54 * This API will open video tranfer data_buffer, and star transfer 55 * 56 * @attention 1. when call this function, the video date will transfer to wifi(UDP/others) 57 * 58 * @return 59 * - kNoErr: succeed 60 * - others: other errors. 61 */ 62 bk_err_t bk_video_buffer_open(void); 63 64 /** 65 * @brief set video buffer close 66 * 67 * This API will deinit video tranfer, stop transfer video data 68 * 69 * @return 70 * - kNoErr: succeed 71 * - others: other errors. 72 */ 73 bk_err_t bk_video_buffer_close(void); 74 75 /** 76 * @brief read video buffer frame 77 * 78 * This API will malloc a data_buffer, and save video data to this buffer 79 * 80 * param buf: malloc buf pointer 81 * param buf_len: buf length 82 * param err_code: 0: success, -1: param error, -2: buffer full, -3: frame data err, -4: timeout, -5: unknow err 83 * param timeout: read frame data timeout 84 * 85 * @return 86 * - 0: failed 87 * - other: frame_length. 88 */ 89 uint32_t bk_video_buffer_read_frame(uint8_t *buf, uint32_t buf_len, int *err_code, uint32_t timeout); 90 91 /** 92 * @} 93 */ 94 95 #ifdef __cplusplus 96 } 97 #endif