#ifndef RSMP4DECRYPT_H
#define RSMP4DECRYPT_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct RsMp4DecryptContext RsMp4DecryptContext;
typedef void (*rsmp4decrypt_progress_callback)(unsigned int step,
unsigned int total,
void *user_data);
enum {
RSMP4DECRYPT_KEY_KIND_TRACK_ID = 0,
RSMP4DECRYPT_KEY_KIND_KID = 1,
};
enum {
RSMP4DECRYPT_STAGE_NONE = 0,
RSMP4DECRYPT_STAGE_OPEN_INPUT = 1,
RSMP4DECRYPT_STAGE_OPEN_OUTPUT = 2,
RSMP4DECRYPT_STAGE_OPEN_FRAGMENTS_INFO = 3,
RSMP4DECRYPT_STAGE_PROCESS = 4,
RSMP4DECRYPT_STAGE_COPY_OUTPUT = 5,
};
typedef struct RsMp4DecryptKeyEntry {
unsigned int kind;
unsigned int track_id;
unsigned char kid[16];
unsigned char key[16];
} RsMp4DecryptKeyEntry;
RsMp4DecryptContext *rsmp4decrypt_context_new(const RsMp4DecryptKeyEntry *keys,
unsigned int key_count);
void rsmp4decrypt_context_free(RsMp4DecryptContext *ctx);
void rsmp4decrypt_free(unsigned char *ptr);
const char *rsmp4decrypt_result_text(int result);
int rsmp4decrypt_decrypt_file(RsMp4DecryptContext *ctx, const char *input_path,
const char *output_path,
const char *fragments_info_path,
rsmp4decrypt_progress_callback progress,
void *user_data,
unsigned int *stage);
int rsmp4decrypt_decrypt_memory(RsMp4DecryptContext *ctx,
const unsigned char *input_data,
unsigned int input_size,
const unsigned char *fragments_info_data,
unsigned int fragments_info_size,
rsmp4decrypt_progress_callback progress,
void *user_data,
unsigned char **output_data,
unsigned int *output_size,
unsigned int *stage);
#ifdef __cplusplus
}
#endif
#endif