FFmpeg
|
#include "movenccenc.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "avio_internal.h"
#include "movenc.h"
#include "avc.h"
Go to the source code of this file.
Functions | |
static int | auxiliary_info_alloc_size (MOVMuxCencContext *ctx, int size) |
static int | auxiliary_info_write (MOVMuxCencContext *ctx, const uint8_t *buf_in, int size) |
static int | auxiliary_info_add_subsample (MOVMuxCencContext *ctx, uint16_t clear_bytes, uint32_t encrypted_bytes) |
static void | mov_cenc_write_encrypted (MOVMuxCencContext *ctx, AVIOContext *pb, const uint8_t *buf_in, int size) |
Encrypt the input buffer and write using avio_write. More... | |
static int | mov_cenc_start_packet (MOVMuxCencContext *ctx) |
Start writing a packet. More... | |
static int | mov_cenc_end_packet (MOVMuxCencContext *ctx) |
Finalize a packet. More... | |
int | ff_mov_cenc_write_packet (MOVMuxCencContext *ctx, AVIOContext *pb, const uint8_t *buf_in, int size) |
Write a fully encrypted packet. More... | |
int | ff_mov_cenc_avc_parse_nal_units (MOVMuxCencContext *ctx, AVIOContext *pb, const uint8_t *buf_in, int size) |
Parse AVC NAL units from annex B format, the nal size and type are written in the clear while the body is encrypted. More... | |
int | ff_mov_cenc_avc_write_nal_units (AVFormatContext *s, MOVMuxCencContext *ctx, int nal_length_size, AVIOContext *pb, const uint8_t *buf_in, int size) |
Write AVC NAL units that are in MP4 format, the nal size and type are written in the clear while the body is encrypted. More... | |
static int64_t | update_size (AVIOContext *pb, int64_t pos) |
static int | mov_cenc_write_senc_tag (MOVMuxCencContext *ctx, AVIOContext *pb, int64_t *auxiliary_info_offset) |
static int | mov_cenc_write_saio_tag (AVIOContext *pb, int64_t auxiliary_info_offset) |
static int | mov_cenc_write_saiz_tag (MOVMuxCencContext *ctx, AVIOContext *pb) |
void | ff_mov_cenc_write_stbl_atoms (MOVMuxCencContext *ctx, AVIOContext *pb) |
Write the cenc atoms that should reside inside stbl. More... | |
static int | mov_cenc_write_schi_tag (AVIOContext *pb, uint8_t *kid) |
int | ff_mov_cenc_write_sinf_tag (MOVTrack *track, AVIOContext *pb, uint8_t *kid) |
Write the sinf atom, contained inside stsd. More... | |
int | ff_mov_cenc_init (MOVMuxCencContext *ctx, uint8_t *encryption_key, int use_subsamples, int bitexact) |
Initialize a CENC context. More... | |
void | ff_mov_cenc_free (MOVMuxCencContext *ctx) |
Free a CENC context. More... | |
|
static |
Definition at line 28 of file movenccenc.c.
Referenced by auxiliary_info_add_subsample(), and auxiliary_info_write().
|
static |
Definition at line 44 of file movenccenc.c.
Referenced by mov_cenc_start_packet().
|
static |
Definition at line 59 of file movenccenc.c.
Referenced by ff_mov_cenc_avc_parse_nal_units(), ff_mov_cenc_avc_write_nal_units(), and ff_mov_cenc_write_packet().
|
static |
Encrypt the input buffer and write using avio_write.
Definition at line 90 of file movenccenc.c.
Referenced by ff_mov_cenc_avc_parse_nal_units(), ff_mov_cenc_avc_write_nal_units(), and ff_mov_cenc_write_packet().
|
static |
Start writing a packet.
Definition at line 110 of file movenccenc.c.
Referenced by ff_mov_cenc_avc_parse_nal_units(), ff_mov_cenc_avc_write_nal_units(), and ff_mov_cenc_write_packet().
|
static |
Finalize a packet.
Definition at line 138 of file movenccenc.c.
Referenced by ff_mov_cenc_avc_parse_nal_units(), ff_mov_cenc_avc_write_nal_units(), and ff_mov_cenc_write_packet().
int ff_mov_cenc_write_packet | ( | MOVMuxCencContext * | ctx, |
AVIOContext * | pb, | ||
const uint8_t * | buf_in, | ||
int | size | ||
) |
Write a fully encrypted packet.
Definition at line 168 of file movenccenc.c.
Referenced by ff_mov_write_packet().
int ff_mov_cenc_avc_parse_nal_units | ( | MOVMuxCencContext * | ctx, |
AVIOContext * | pb, | ||
const uint8_t * | buf_in, | ||
int | size | ||
) |
Parse AVC NAL units from annex B format, the nal size and type are written in the clear while the body is encrypted.
Definition at line 193 of file movenccenc.c.
Referenced by ff_mov_write_packet().
int ff_mov_cenc_avc_write_nal_units | ( | AVFormatContext * | s, |
MOVMuxCencContext * | ctx, | ||
int | nal_length_size, | ||
AVIOContext * | pb, | ||
const uint8_t * | buf_in, | ||
int | size | ||
) |
Write AVC NAL units that are in MP4 format, the nal size and type are written in the clear while the body is encrypted.
Definition at line 233 of file movenccenc.c.
Referenced by ff_mov_write_packet().
|
static |
Definition at line 283 of file movenccenc.c.
Referenced by ff_mov_cenc_write_sinf_tag(), mov_cenc_write_saio_tag(), mov_cenc_write_saiz_tag(), mov_cenc_write_schi_tag(), and mov_cenc_write_senc_tag().
|
static |
Definition at line 293 of file movenccenc.c.
Referenced by ff_mov_cenc_write_stbl_atoms().
|
static |
Definition at line 307 of file movenccenc.c.
Referenced by ff_mov_cenc_write_stbl_atoms().
|
static |
Definition at line 326 of file movenccenc.c.
Referenced by ff_mov_cenc_write_stbl_atoms().
void ff_mov_cenc_write_stbl_atoms | ( | MOVMuxCencContext * | ctx, |
AVIOContext * | pb | ||
) |
Write the cenc atoms that should reside inside stbl.
Definition at line 340 of file movenccenc.c.
Referenced by mov_write_stbl_tag().
|
static |
Definition at line 349 of file movenccenc.c.
Referenced by ff_mov_cenc_write_sinf_tag().
int ff_mov_cenc_write_sinf_tag | ( | MOVTrack * | track, |
AVIOContext * | pb, | ||
uint8_t * | kid | ||
) |
Write the sinf atom, contained inside stsd.
Definition at line 365 of file movenccenc.c.
Referenced by mov_write_audio_tag(), and mov_write_video_tag().
int ff_mov_cenc_init | ( | MOVMuxCencContext * | ctx, |
uint8_t * | encryption_key, | ||
int | use_subsamples, | ||
int | bitexact | ||
) |
Initialize a CENC context.
key | encryption key, must have a length of AES_CTR_KEY_SIZE |
use_subsamples | when enabled parts of a packet can be encrypted, otherwise the whole packet is encrypted |
Definition at line 389 of file movenccenc.c.
Referenced by mov_init().
void ff_mov_cenc_free | ( | MOVMuxCencContext * | ctx | ) |