FFmpeg  4.0
Macros | Functions
encryption_info.c File Reference
#include "encryption_info.h"
#include "mem.h"
#include "intreadwrite.h"

Go to the source code of this file.

Macros

#define FF_ENCRYPTION_INFO_EXTRA   24
 This file is part of FFmpeg. More...
 
#define FF_ENCRYPTION_INIT_INFO_EXTRA   16
 

Functions

AVEncryptionInfoav_encryption_info_alloc (uint32_t subsample_count, uint32_t key_id_size, uint32_t iv_size)
 Allocates an AVEncryptionInfo structure and sub-pointers to hold the given number of subsamples. More...
 
AVEncryptionInfoav_encryption_info_clone (const AVEncryptionInfo *info)
 Allocates an AVEncryptionInfo structure with a copy of the given data. More...
 
void av_encryption_info_free (AVEncryptionInfo *info)
 Frees the given encryption info object. More...
 
AVEncryptionInfoav_encryption_info_get_side_data (const uint8_t *buffer, size_t size)
 Creates a copy of the AVEncryptionInfo that is contained in the given side data. More...
 
uint8_tav_encryption_info_add_side_data (const AVEncryptionInfo *info, size_t *size)
 Allocates and initializes side data that holds a copy of the given encryption info. More...
 
AVEncryptionInitInfoav_encryption_init_info_alloc (uint32_t system_id_size, uint32_t num_key_ids, uint32_t key_id_size, uint32_t data_size)
 Allocates an AVEncryptionInitInfo structure and sub-pointers to hold the given sizes. More...
 
void av_encryption_init_info_free (AVEncryptionInitInfo *info)
 Frees the given encryption init info object. More...
 
AVEncryptionInitInfoav_encryption_init_info_get_side_data (const uint8_t *side_data, size_t side_data_size)
 Creates a copy of the AVEncryptionInitInfo that is contained in the given side data. More...
 
uint8_tav_encryption_init_info_add_side_data (const AVEncryptionInitInfo *info, size_t *side_data_size)
 Allocates and initializes side data that holds a copy of the given encryption init info. More...
 

Macro Definition Documentation

◆ FF_ENCRYPTION_INFO_EXTRA

#define FF_ENCRYPTION_INFO_EXTRA   24

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

Definition at line 23 of file encryption_info.c.

Referenced by av_encryption_info_add_side_data(), and av_encryption_info_get_side_data().

◆ FF_ENCRYPTION_INIT_INFO_EXTRA

#define FF_ENCRYPTION_INIT_INFO_EXTRA   16

Function Documentation

◆ av_encryption_info_alloc()

AVEncryptionInfo* av_encryption_info_alloc ( uint32_t  subsample_count,
uint32_t  key_id_size,
uint32_t  iv_size 
)

Allocates an AVEncryptionInfo structure and sub-pointers to hold the given number of subsamples.

This will allocate pointers for the key ID, IV, and subsample entries, set the size members, and zero-initialize the rest.

Parameters
subsample_countThe number of subsamples.
key_id_sizeThe number of bytes in the key ID, should be 16.
key_id_sizeThe number of bytes in the IV, should be 16.
Returns
The new AVEncryptionInfo structure, or NULL on error.

Definition at line 39 of file encryption_info.c.

Referenced by av_encryption_info_clone(), and av_encryption_info_get_side_data().

◆ av_encryption_info_clone()

AVEncryptionInfo* av_encryption_info_clone ( const AVEncryptionInfo info)

Allocates an AVEncryptionInfo structure with a copy of the given data.

Returns
The new AVEncryptionInfo structure, or NULL on error.

Definition at line 63 of file encryption_info.c.

◆ av_encryption_info_free()

void av_encryption_info_free ( AVEncryptionInfo info)

Frees the given encryption info object.

This MUST NOT be used to free the side-data data pointer, that should use normal side-data methods.

Definition at line 80 of file encryption_info.c.

Referenced by av_encryption_info_alloc().

◆ av_encryption_info_get_side_data()

AVEncryptionInfo* av_encryption_info_get_side_data ( const uint8_t side_data,
size_t  side_data_size 
)

Creates a copy of the AVEncryptionInfo that is contained in the given side data.

The resulting object should be passed to av_encryption_info_free() when done.

Returns
The new AVEncryptionInfo structure, or NULL on error.

Definition at line 90 of file encryption_info.c.

◆ av_encryption_info_add_side_data()

uint8_t* av_encryption_info_add_side_data ( const AVEncryptionInfo info,
size_t *  side_data_size 
)

Allocates and initializes side data that holds a copy of the given encryption info.

The resulting pointer should be either freed using av_free or given to av_packet_add_side_data().

Returns
The new side-data pointer, or NULL.

Definition at line 125 of file encryption_info.c.

◆ av_encryption_init_info_alloc()

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 
)

Allocates an AVEncryptionInitInfo structure and sub-pointers to hold the given sizes.

This will allocate pointers and set all the fields.

Returns
The new AVEncryptionInitInfo structure, or NULL on error.

Definition at line 173 of file encryption_info.c.

Referenced by av_encryption_init_info_get_side_data().

◆ av_encryption_init_info_free()

void av_encryption_init_info_free ( AVEncryptionInitInfo info)

Frees the given encryption init info object.

This MUST NOT be used to free the side-data data pointer, that should use normal side-data methods.

Definition at line 211 of file encryption_info.c.

Referenced by av_encryption_init_info_alloc().

◆ av_encryption_init_info_get_side_data()

AVEncryptionInitInfo* av_encryption_init_info_get_side_data ( const uint8_t side_data,
size_t  side_data_size 
)

Creates a copy of the AVEncryptionInitInfo that is contained in the given side data.

The resulting object should be passed to av_encryption_init_info_free() when done.

Returns
The new AVEncryptionInitInfo structure, or NULL on error.

Definition at line 225 of file encryption_info.c.

◆ av_encryption_init_info_add_side_data()

uint8_t* av_encryption_init_info_add_side_data ( const AVEncryptionInitInfo info,
size_t *  side_data_size 
)

Allocates and initializes side data that holds a copy of the given encryption init info.

The resulting pointer should be either freed using av_free or given to av_packet_add_side_data().

Returns
The new side-data pointer, or NULL.

Definition at line 258 of file encryption_info.c.