FFmpeg
Data Structures | Macros | Functions | Variables
crypto.c File Reference
#include "libavutil/aes.h"
#include "libavutil/avstring.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "url.h"

Go to the source code of this file.

Data Structures

struct  CryptoContext
 

Macros

#define MAX_BUFFER_BLOCKS   257
 
#define BLOCKSIZE   16
 
#define OFFSET(x)   offsetof(CryptoContext, x)
 
#define D   AV_OPT_FLAG_DECODING_PARAM
 
#define E   AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static int set_aes_arg (URLContext *h, uint8_t **buf, int *buf_len, uint8_t *default_buf, int default_buf_len, const char *desc)
 
static int crypto_open2 (URLContext *h, const char *uri, int flags, AVDictionary **options)
 
static int crypto_read (URLContext *h, uint8_t *buf, int size)
 
static int64_t crypto_seek (URLContext *h, int64_t pos, int whence)
 
static int crypto_write (URLContext *h, const unsigned char *buf, int size)
 
static int crypto_close (URLContext *h)
 

Variables

static const AVOption crypto_options []
 
static const AVClass crypto_class
 
const URLProtocol ff_crypto_protocol
 

Macro Definition Documentation

◆ MAX_BUFFER_BLOCKS

#define MAX_BUFFER_BLOCKS   257

Definition at line 29 of file crypto.c.

◆ BLOCKSIZE

#define BLOCKSIZE   16

Definition at line 30 of file crypto.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(CryptoContext, x)

Definition at line 62 of file crypto.c.

◆ D

Definition at line 63 of file crypto.c.

◆ E

Definition at line 64 of file crypto.c.

Function Documentation

◆ set_aes_arg()

static int set_aes_arg ( URLContext h,
uint8_t **  buf,
int *  buf_len,
uint8_t *  default_buf,
int  default_buf_len,
const char *  desc 
)
static

Definition at line 82 of file crypto.c.

Referenced by crypto_open2().

◆ crypto_open2()

static int crypto_open2 ( URLContext h,
const char *  uri,
int  flags,
AVDictionary **  options 
)
static

Definition at line 109 of file crypto.c.

◆ crypto_read()

static int crypto_read ( URLContext h,
uint8_t *  buf,
int  size 
)
static

Definition at line 182 of file crypto.c.

Referenced by crypto_seek().

◆ crypto_seek()

static int64_t crypto_seek ( URLContext h,
int64_t  pos,
int  whence 
)
static

Definition at line 232 of file crypto.c.

◆ crypto_write()

static int crypto_write ( URLContext h,
const unsigned char *  buf,
int  size 
)
static

Definition at line 328 of file crypto.c.

◆ crypto_close()

static int crypto_close ( URLContext h)
static

Definition at line 369 of file crypto.c.

Variable Documentation

◆ crypto_options

const AVOption crypto_options[]
static
Initial value:
= {
{"key", "AES encryption/decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, .flags = D|E },
{"iv", "AES encryption/decryption initialization vector", OFFSET(iv), AV_OPT_TYPE_BINARY, .flags = D|E },
{"decryption_key", "AES decryption key", OFFSET(decrypt_key), AV_OPT_TYPE_BINARY, .flags = D },
{"decryption_iv", "AES decryption initialization vector", OFFSET(decrypt_iv), AV_OPT_TYPE_BINARY, .flags = D },
{"encryption_key", "AES encryption key", OFFSET(encrypt_key), AV_OPT_TYPE_BINARY, .flags = E },
{"encryption_iv", "AES encryption initialization vector", OFFSET(encrypt_iv), AV_OPT_TYPE_BINARY, .flags = E },
{ NULL }
}

Definition at line 65 of file crypto.c.

◆ crypto_class

const AVClass crypto_class
static
Initial value:
= {
.class_name = "crypto",
.item_name = av_default_item_name,
.option = crypto_options,
}

Definition at line 75 of file crypto.c.

◆ ff_crypto_protocol

const URLProtocol ff_crypto_protocol
Initial value:
= {
.name = "crypto",
.url_open2 = crypto_open2,
.url_seek = crypto_seek,
.url_read = crypto_read,
.url_write = crypto_write,
.url_close = crypto_close,
.priv_data_size = sizeof(CryptoContext),
.priv_data_class = &crypto_class,
}

Definition at line 390 of file crypto.c.

crypto_write
static int crypto_write(URLContext *h, const unsigned char *buf, int size)
Definition: crypto.c:328
OFFSET
#define OFFSET(x)
Definition: crypto.c:62
AV_OPT_TYPE_BINARY
@ AV_OPT_TYPE_BINARY
Underlying C type is a uint8_t* that is either NULL or points to an array allocated with the av_mallo...
Definition: opt.h:286
crypto_class
static const AVClass crypto_class
Definition: crypto.c:75
key
const char * key
Definition: hwcontext_opencl.c:189
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
CryptoContext
@ CryptoContext
Definition: mxf.h:42
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
URL_PROTOCOL_FLAG_NESTED_SCHEME
#define URL_PROTOCOL_FLAG_NESTED_SCHEME
Definition: url.h:32
crypto_open2
static int crypto_open2(URLContext *h, const char *uri, int flags, AVDictionary **options)
Definition: crypto.c:109
crypto_close
static int crypto_close(URLContext *h)
Definition: crypto.c:369
crypto_options
static const AVOption crypto_options[]
Definition: crypto.c:65
D
#define D
Definition: crypto.c:63
E
#define E
Definition: crypto.c:64
crypto_read
static int crypto_read(URLContext *h, uint8_t *buf, int size)
Definition: crypto.c:182
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
crypto_seek
static int64_t crypto_seek(URLContext *h, int64_t pos, int whence)
Definition: crypto.c:232