VIDEO_TRANSFER APIs

[English]

重要

The VIDEO_TRANSFER API v1.0 is the lastest stable VIDEO_TRANSFER APIs. All new applications should use VIDEO_TRANSFER API v1.0.

VIDEO_TRANSFER API Categories

Most of VIDEO_TRANSFER APIs can be categoried as:

  • VIDEO_TRANSFER APIs

    The common APIs are prefixed with bk_video, e.g. bk_video_transfer_init() etc.

VIDEO_TRANSFER APIs:

API Reference

Header File

Functions

bk_err_t bk_video_transfer_init(video_setup_t *setup_cfg)

video transfer init

This API will create video thread, init msg queue, and excute camera init

参数

setup_cfg – configure of the video transfer include packet process, method of transfer, etc.

返回

  • kNoErr: succeed

  • others: other errors.

bk_err_t bk_video_transfer_deinit(void)

video transfer deinit

This API will quit video thread, and free all reasource

返回

  • kNoErr: succeed

  • others: other errors.

bk_err_t bk_video_buffer_open(media_camera_device_t *device)

set video transfer param

This API will open video tranfer data_buffer, and star transfer

Attention

1. when call this function, the video date will transfer to wifi(UDP/others)

参数

device – referenc type : meida_camera_device_t

返回

  • kNoErr: succeed

  • others: other errors.

bk_err_t bk_video_buffer_close(void)

set video buffer close

This API will deinit video tranfer, stop transfer video data

返回

  • kNoErr: succeed

  • others: other errors.

uint32_t bk_video_buffer_read_frame(uint8_t *buf, uint32_t buf_len, int *err_code, uint32_t timeout)

read video buffer frame

This API will malloc a data_buffer, and save video data to this buffer

参数
  • buf – malloc buf pointer

  • buf_len – buf length

  • err_code

    • 0: success

    • 1: param error

    • 2: buffer full

    • 3: frame data err

    • 4: timeout

    • 5: unknow err

  • timeout – read frame data timeout

返回

  • 0: failed

  • other: frame_length.

bk_err_t bk_video_transfer_stop(void)

read video buffer frame

This API will stop camera, but not free malloc memory for transfer

返回

  • kNoErr: succeed

  • others: other errors.

bk_err_t bk_video_transfer_start(void)

read video buffer frame

This API will start camera after stopping camera

1. this function must called after bk_video_transfer_stop

返回

  • kNoErr: succeed

  • others: other errors.

API Typedefs

Header File

Structures

struct video_config_t

Public Members

uint8_t *rxbuf

the buffer save camera data

void (*node_full_handler)(void *curptr, uint32_t newlen, uint32_t is_eof, uint32_t frame_len)

node full handler

This is a transfer camera data to uplayer api, when transfer node_len jpeg data finish , this function will be called

Param curptr

the start address of transfer data.

Param newlen

the transfer data length

Param is_eof

0/1: whether this packet data is the last packet of this frame, will called in jpeg_end_frame isr

Param frame_len

the complete jpeg frame size, if is_eof=1, the frame_len is the true value of jpeg frame size, is_eof=0, the frame_len=0, in other words, only when transfer really frame_len at the last packet in jpeg_end_frame isr

void (*data_end_handler)(void)

brief data_end_handler

This api use to inforamte video transfer thread to deal transfer camera data

media_camera_device_t *device

config of camera

uint16_t rxbuf_len

The length of receiving camera data buff

uint16_t rx_read_len

manage the node_full_handler callback function input params

uint32_t node_len

video transfer network comunication protocol length a time

struct video_packet_t

Public Members

uint32_t ptklen

The current packet length

uint32_t frame_id

The current packet frame id

uint32_t is_eof

The current packet is the last packet

uint32_t frame_len

The frame length

struct video_setup_t

Public Members

media_camera_device_t *device

config of camera

uint16_t open_type

video transfer network comunication protocol type, video_open_type_t

uint16_t send_type

video transfer network comunication protocol type, video_send_type_t

video_transfer_send_func send_func

function ptr for send to uplayer

video_transfer_start_cb start_cb

function ptr for start to send to uplayer

video_transfer_start_cb end_cb

function ptr for end to send to uplayer

uint32_t pkt_header_size

packet header size

tvideo_add_pkt_header add_pkt_header

function ptr for add packet header

struct video_header_t

Public Members

uint8_t id

the frame id

uint8_t is_eof

the flag of end frame, 1 for end

uint8_t pkt_cnt

the packet count of one frame

uint8_t pkt_seq

the packet header’s count of one frame

struct video_buff_t

Public Members

beken_semaphore_t aready_semaphore

the video data receive complete

uint8_t *buf_base

the receive video data, malloc by user

uint32_t buf_len

video buff length, malloc by user

uint32_t frame_id

frame id

uint32_t frame_pkt_cnt

the packet count of one frame

uint8_t *buf_ptr

recoder the buff ptr of every time receive video packte

uint32_t frame_len

the length of receive one frame

uint32_t start_buf

video buff receive state

Type Definitions

typedef void (*tvideo_add_pkt_header)(video_packet_t *param)
typedef int (*video_transfer_send_func)(uint8_t *data, uint32_t len)
typedef void (*video_transfer_start_cb)(void)
typedef void (*video_transfer_end_cb)(void)

Enumerations

enum video_open_type_t

video sample module protocol type

Values:

enumerator TVIDEO_OPEN_NONE

not sample module

enumerator TVIDEO_OPEN_SCCB

sample module follow sccb protocol

enumerator TVIDEO_OPEN_SPIDMA

sample module follow spidma protocol

enum video_send_type_t

video transfer network comunication protocol type

Values:

enumerator TVIDEO_SND_NONE

not transfer

enumerator TVIDEO_SND_UDP

follow udp protocol

enumerator TVIDEO_SND_TCP

follow tcp protocol

enumerator TVIDEO_SND_INTF

transfer to inter frame

enumerator TVIDEO_SND_BUFFER

transfer to buffer

enum video_buff_state_t

Values:

enumerator BUF_STA_INIT

video buff init

enumerator BUF_STA_COPY

video buff begin copy

enumerator BUF_STA_GET

video frame get

enumerator BUF_STA_FULL

video buff full

enumerator BUF_STA_DEINIT

video buff deinit

enumerator BUF_STA_ERR

other error