/** * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <string.h> #include "encryption_info.h" #include "mem.h" #include "intreadwrite.h" #define FF_ENCRYPTION_INFO_EXTRA … // The format of the AVEncryptionInfo side data: // u32be scheme // u32be crypt_byte_block // u32be skip_byte_block // u32be key_id_size // u32be iv_size // u32be subsample_count // u8[key_id_size] key_id // u8[iv_size] iv // { // u32be bytes_of_clear_data // u32be bytes_of_protected_data // }[subsample_count] AVEncryptionInfo *av_encryption_info_alloc(uint32_t subsample_count, uint32_t key_id_size, uint32_t iv_size) { … } AVEncryptionInfo *av_encryption_info_clone(const AVEncryptionInfo *info) { … } void av_encryption_info_free(AVEncryptionInfo *info) { … } AVEncryptionInfo *av_encryption_info_get_side_data(const uint8_t* buffer, size_t size) { … } uint8_t *av_encryption_info_add_side_data(const AVEncryptionInfo *info, size_t *size) { … } // The format of the AVEncryptionInitInfo side data: // u32be init_info_count // { // u32be system_id_size // u32be num_key_ids // u32be key_id_size // u32be data_size // u8[system_id_size] system_id // u8[key_id_size][num_key_id] key_ids // u8[data_size] data // }[init_info_count] #define FF_ENCRYPTION_INIT_INFO_EXTRA … AVEncryptionInitInfo *av_encryption_init_info_alloc( uint32_t system_id_size, uint32_t num_key_ids, uint32_t key_id_size, uint32_t data_size) { … } void av_encryption_init_info_free(AVEncryptionInitInfo *info) { … } AVEncryptionInitInfo *av_encryption_init_info_get_side_data( const uint8_t *side_data, size_t side_data_size) { … } uint8_t *av_encryption_init_info_add_side_data(const AVEncryptionInitInfo *info, size_t *side_data_size) { … }