29     size_t new_alloc_size;
 
   59     uint16_t clear_bytes, uint32_t encrypted_bytes)
 
   76     p += 
sizeof(uint16_t);
 
   93     const uint8_t* cur_pos = buf_in;
 
   97     while (size_left > 0) {
 
   98         cur_size = 
FFMIN(size_left, 
sizeof(chunk));
 
  102         size_left -= cur_size;
 
  139     size_t new_alloc_size;
 
  197     const uint8_t *nal_start, *nal_end;
 
  208         while (nal_start < end && !*(nal_start++));
 
  209         if (nal_start == end)
 
  220         size += 4 + nal_end - nal_start;
 
  246         if (size < nal_length_size + 1) {
 
  247             av_log(s, 
AV_LOG_ERROR, 
"CENC-AVC: remaining size %d smaller than nal length+type %d\n",
 
  248                 size, nal_length_size + 1);
 
  255         for (j = 0; j < nal_length_size; j++) {
 
  256             nalsize = (nalsize << 8) | *buf_in++;
 
  258         size -= nal_length_size;
 
  261         if (nalsize <= 0 || nalsize > size) {
 
  293                                    int64_t* auxiliary_info_offset)
 
  313     version = auxiliary_info_offset > 0xffffffff ? 1 : 0;
 
  341     int64_t auxiliary_info_offset;
 
  389                      int use_subsamples, 
int bitexact)
 
void avio_wb64(AVIOContext *s, uint64_t val)
 
const uint8_t * ff_avc_find_startcode(const uint8_t *p, const uint8_t *end)
 
static int64_t update_size(AVIOContext *pb, int64_t pos)
 
static int mov_cenc_write_saiz_tag(MOVMuxCencContext *ctx, AVIOContext *pb)
 
size_t auxiliary_info_size
 
struct AVAESCTR * aes_ctr
 
static int mov_cenc_start_packet(MOVMuxCencContext *ctx)
Start writing a packet. 
 
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext. 
 
void ff_mov_cenc_free(MOVMuxCencContext *ctx)
Free a CENC context. 
 
void av_aes_ctr_increment_iv(struct AVAESCTR *a)
Increment the top 64 bit of the iv (performed after each frame) 
 
static int auxiliary_info_write(MOVMuxCencContext *ctx, const uint8_t *buf_in, int size)
 
uint32_t auxiliary_info_entries
 
int ff_mov_cenc_write_packet(MOVMuxCencContext *ctx, AVIOContext *pb, const uint8_t *buf_in, int size)
Write a fully encrypted packet. 
 
static int mov_cenc_write_senc_tag(MOVMuxCencContext *ctx, AVIOContext *pb, int64_t *auxiliary_info_offset)
 
void av_aes_ctr_crypt(struct AVAESCTR *a, uint8_t *dst, const uint8_t *src, int count)
Process a buffer using a previously initialized context. 
 
void avio_wl32(AVIOContext *s, unsigned int val)
 
static int auxiliary_info_add_subsample(MOVMuxCencContext *ctx, uint16_t clear_bytes, uint32_t encrypted_bytes)
 
static av_cold int end(AVCodecContext *avctx)
 
static int mov_cenc_write_saio_tag(AVIOContext *pb, int64_t auxiliary_info_offset)
 
size_t auxiliary_info_sizes_alloc_size
 
int ff_mov_cenc_init(MOVMuxCencContext *ctx, uint8_t *encryption_key, int use_subsamples, int bitexact)
Initialize a CENC context. 
 
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext. 
 
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
 
static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
 
void av_aes_ctr_free(struct AVAESCTR *a)
Release an AVAESCTR context. 
 
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. 
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
 
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 bod...
 
struct AVAESCTR * av_aes_ctr_alloc(void)
Allocate an AVAESCTR context. 
 
static int auxiliary_info_alloc_size(MOVMuxCencContext *ctx, int size)
 
uint8_t * auxiliary_info_sizes
 
void avio_wb24(AVIOContext *s, unsigned int val)
 
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 ...
 
void av_aes_ctr_set_random_iv(struct AVAESCTR *a)
Generate a random iv. 
 
static int mov_cenc_write_schi_tag(AVIOContext *pb, uint8_t *kid)
 
void avio_w8(AVIOContext *s, int b)
 
int ff_mov_cenc_write_sinf_tag(MOVTrack *track, AVIOContext *pb, uint8_t *kid)
Write the sinf atom, contained inside stsd. 
 
size_t auxiliary_info_alloc_size
 
size_t auxiliary_info_subsample_start
 
int av_reallocp(void *ptr, size_t size)
Allocate or reallocate a block of memory. 
 
int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key)
Initialize an AVAESCTR context. 
 
void avio_wb32(AVIOContext *s, unsigned int val)
 
void ff_mov_cenc_write_stbl_atoms(MOVMuxCencContext *ctx, AVIOContext *pb)
Write the cenc atoms that should reside inside stbl. 
 
static int mov_cenc_end_packet(MOVMuxCencContext *ctx)
Finalize a packet. 
 
const uint8_t * av_aes_ctr_get_iv(struct AVAESCTR *a)
Get the current iv.