1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

movenc: encryption with time code track fix

instead of deciding whether to encrypt based on the encryption scheme,
decide according to whether cenc was initialized or not.
mov_create_timecode_track calls ff_mov_write_packet with a track that
doesn't have cenc initialized.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
erankor 2017-05-17 12:32:06 +03:00 committed by Michael Niedermayer
parent 357f2316a0
commit 15bd309af8

View File

@ -2353,7 +2353,7 @@ static int mov_write_stbl_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext
mov_write_stsc_tag(pb, track);
mov_write_stsz_tag(pb, track);
mov_write_stco_tag(pb, track);
if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) {
if (track->cenc.aes_ctr) {
ff_mov_cenc_write_stbl_atoms(&track->cenc, pb);
}
if (track->par->codec_id == AV_CODEC_ID_OPUS) {
@ -5114,7 +5114,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
&size);
avio_write(pb, reformatted_data, size);
} else {
if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) {
if (trk->cenc.aes_ctr) {
size = ff_mov_cenc_avc_parse_nal_units(&trk->cenc, pb, pkt->data, size);
if (size < 0) {
ret = size;
@ -5143,7 +5143,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
avio_write(pb, pkt->data, size);
#endif
} else {
if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) {
if (trk->cenc.aes_ctr) {
if (par->codec_id == AV_CODEC_ID_H264 && par->extradata_size > 4) {
int nal_size_length = (par->extradata[4] & 0x3) + 1;
ret = ff_mov_cenc_avc_write_nal_units(s, &trk->cenc, nal_size_length, pb, pkt->data, size);