59 lines
2.0 KiB
C
Raw Normal View History

2022-09-18 03:35:35 +08:00
#ifndef _DECRYPT_H
#define _DECRYPT_H
#include "common.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void *dec_media;
typedef struct
{
/// alloc new packet
/// @param[in] param user-defined parameter(by dec_media_create)
/// @param[in] bytes alloc memory size in byte
/// @return memory pointer
void* (API_CALL *alloc)(void* param, size_t bytes);
/// free packet
/// @param[in] param user-defined parameter(by dec_media_create)
/// @param[in] packet frame packet pointer(alloc return pointer)
void (API_CALL *free)(void* param, void* packet);
/// callback on PS packet done
/// @param[in] param user-defined parameter(by dec_media_create)
/// @param[in] packet frame packet pointer(alloc return pointer)
/// @param[in] bytes packet size
/// @param[in] timestamp packet timestamp
/// @param[in] frametype packet type
void (API_CALL *write)(void* param, void* packet, size_t bytes,uint64_t timestamp,uint8_t frametype);
}dec_media_func_t;
/// create a object for decrypt media data
/// @param func call back (dec_media_func_t)
/// @param param user-defined parameter
API_EXPORT dec_media API_CALL dec_media_create(dec_media_func_t * func,void * param) ;
/// input media data(only accept single frame, merged frame(such as sps pps I ) should be feeded in separately)
/// @param frame_type the type of NALU
/// @param prefix the number of prefix bytes, (0x00 0x00 0x00 0x01) => prefix=4
API_EXPORT int API_CALL dec_media_decoded(dec_media ctx,uint8_t* frame,size_t len,uint64_t timestamp, uint8_t frame_type,uint8_t prefix);
/// input media data(only accept single frame, merged frame(such as sps pps I ) should be feeded in separately)
/// @param frame frame data
/// @param prefix the number of prefix bytes, (0x00 0x00 0x00 0x01) => prefix=4
/// @param code 0:h264 1:h265 6:svac
/// @param return <0:error >=0:security level
API_EXPORT int API_CALL dec_security_SEI(uint8_t* frame,size_t len,uint8_t prefix,uint8_t code);
API_EXPORT void API_CALL dec_media_release(dec_media ctx);
#ifdef __cplusplus
}
#endif
#endif /* _DECRYPT_H */