FFmpeg
|
#include "movenccenc.h"
#include "libavcodec/av1_parse.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/cbs_av1.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "avio_internal.h"
#include "movenc.h"
#include "avc.h"
#include "nal.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 int | write_tiles (AVFormatContext *s, MOVMuxCencContext *ctx, AVIOContext *pb, AV1_OBU_Type type, const AV1RawFrameHeader *frame_header, const uint8_t *fh_data, size_t fh_data_size, const AV1RawTileGroup *tile_group) |
int | ff_mov_cenc_av1_write_obus (AVFormatContext *s, MOVMuxCencContext *ctx, AVIOContext *pb, const AVPacket *pkt) |
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, int64_t moof_offset) |
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, enum AVCodecID codec_id, int bitexact) |
Initialize a CENC context. More... | |
void | ff_mov_cenc_free (MOVMuxCencContext *ctx) |
Free a CENC context. More... | |
Variables | |
static const CodedBitstreamUnitType | decompose_unit_types [] |
|
static |
Definition at line 32 of file movenccenc.c.
Referenced by auxiliary_info_add_subsample(), and auxiliary_info_write().
|
static |
Definition at line 48 of file movenccenc.c.
Referenced by mov_cenc_start_packet().
|
static |
Definition at line 63 of file movenccenc.c.
Referenced by ff_mov_cenc_av1_write_obus(), ff_mov_cenc_avc_parse_nal_units(), ff_mov_cenc_avc_write_nal_units(), ff_mov_cenc_write_packet(), and write_tiles().
|
static |
Encrypt the input buffer and write using avio_write.
Definition at line 94 of file movenccenc.c.
Referenced by ff_mov_cenc_avc_parse_nal_units(), ff_mov_cenc_avc_write_nal_units(), ff_mov_cenc_write_packet(), and write_tiles().
|
static |
Start writing a packet.
Definition at line 114 of file movenccenc.c.
Referenced by ff_mov_cenc_av1_write_obus(), 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 142 of file movenccenc.c.
Referenced by ff_mov_cenc_av1_write_obus(), 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 172 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 197 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 237 of file movenccenc.c.
Referenced by ff_mov_write_packet().
|
static |
Definition at line 286 of file movenccenc.c.
Referenced by ff_mov_cenc_av1_write_obus().
int ff_mov_cenc_av1_write_obus | ( | AVFormatContext * | s, |
MOVMuxCencContext * | ctx, | ||
AVIOContext * | pb, | ||
const AVPacket * | pkt | ||
) |
Definition at line 386 of file movenccenc.c.
Referenced by ff_mov_write_packet().
|
static |
Definition at line 484 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 494 of file movenccenc.c.
Referenced by ff_mov_cenc_write_stbl_atoms().
|
static |
Definition at line 508 of file movenccenc.c.
Referenced by ff_mov_cenc_write_stbl_atoms().
|
static |
Definition at line 527 of file movenccenc.c.
Referenced by ff_mov_cenc_write_stbl_atoms().
void ff_mov_cenc_write_stbl_atoms | ( | MOVMuxCencContext * | ctx, |
AVIOContext * | pb, | ||
int64_t | moof_offset | ||
) |
Write the cenc atoms that should reside inside stbl.
Definition at line 541 of file movenccenc.c.
Referenced by mov_write_stbl_tag(), and mov_write_traf_tag().
|
static |
Definition at line 551 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 567 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, | ||
enum AVCodecID | codec_id, | ||
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 599 of file movenccenc.c.
Referenced by mov_init().
void ff_mov_cenc_free | ( | MOVMuxCencContext * | ctx | ) |
|
static |