blob: 24400d6a4ca16517e2ad643e05b275fd573abc40 [file] [log] [blame]
Gong Ke3489c0f2020-01-16 18:11:44 +08001/**
2 * \file
Gong Ke497c4c22020-03-20 10:15:42 +08003 * \brief Crypto function
4 *
5 * Crypto function is used as a callback function in dvr_record and dvr_playback module.
6 * User can used it to encrypt the TS data in recording and decrypt the TS data in playback process.
Gong Ke3489c0f2020-01-16 18:11:44 +08007 */
8
Pengfei Liu2afc35d2020-01-07 10:47:39 +08009#ifndef _DVR_CRYPTO_H_
10#define _DVR_CRYPTO_H_
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
Pengfei Liu47ed6c92020-01-17 11:23:41 +080016#include <dvr_types.h>
17
Gong Ke3489c0f2020-01-16 18:11:44 +080018/**Work type.*/
Pengfei Liuc181a982020-01-07 19:27:13 +080019typedef enum {
Gong Ke3489c0f2020-01-16 18:11:44 +080020 DVR_CRYPTO_TYPE_ENCRYPT, /**< Encrypt.*/
21 DVR_CRYPTO_TYPE_DECRYPT /**< Decrypt.*/
22} DVR_CryptoType_t;
Pengfei Liuc181a982020-01-07 19:27:13 +080023
Gong Ke3489c0f2020-01-16 18:11:44 +080024/**Crypto parameters.*/
Pengfei Liu2afc35d2020-01-07 10:47:39 +080025typedef struct DVR_CryptoParams_s {
Gong Ke3489c0f2020-01-16 18:11:44 +080026 DVR_CryptoType_t type; /**< Work type.*/
27 char location[DVR_MAX_LOCATION_SIZE]; /**< Location of the record file.*/
28 int segment_id; /**< Current segment's index.*/
29 loff_t offset; /**< Current offset in the segment file.*/
30 DVR_Buffer_t input_buffer; /**< Input data buffer.*/
31 DVR_Buffer_t output_buffer; /**< Output data buffer.*/
32 size_t output_size; /**< Output data size in bytes.*/
Pengfei Liuc181a982020-01-07 19:27:13 +080033} DVR_CryptoParams_t;
Pengfei Liu2afc35d2020-01-07 10:47:39 +080034
Gong Ke3489c0f2020-01-16 18:11:44 +080035/**Crypto function.*/
Pengfei Liu47ed6c92020-01-17 11:23:41 +080036typedef DVR_Result_t (*DVR_CryptoFunction_t) (DVR_CryptoParams_t *params, void *userdata);
Pengfei Liu2afc35d2020-01-07 10:47:39 +080037
38#ifdef __cplusplus
39}
40#endif
41
42#endif /*END _DVR_CRYPTO_H_*/