FFmpeg
Data Structures | Macros | Functions | Variables
tta.c File Reference
#include <limits.h>
#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "ttadata.h"
#include "ttadsp.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "get_bits.h"
#include "thread.h"
#include "unary.h"

Go to the source code of this file.

Data Structures

struct  TTAContext
 

Macros

#define BITSTREAM_READER_LE
 
#define FORMAT_SIMPLE   1
 
#define FORMAT_ENCRYPTED   2
 
#define PRED(x, k)   (int32_t)((((uint64_t)(x) << (k)) - (x)) >> (k))
 
#define OFFSET(x)   offsetof(TTAContext, x)
 
#define DEC   (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)
 

Functions

static int tta_check_crc (TTAContext *s, const uint8_t *buf, int buf_size)
 
static uint64_t tta_check_crc64 (uint8_t *pass)
 
static int allocate_buffers (AVCodecContext *avctx)
 
static av_cold int tta_decode_init (AVCodecContext *avctx)
 
static int tta_decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
 
static av_cold int tta_decode_close (AVCodecContext *avctx)
 

Variables

static const int64_t tta_channel_layouts [7]
 
static const AVOption options []
 
static const AVClass tta_decoder_class
 
const FFCodec ff_tta_decoder
 

Detailed Description

TTA (The Lossless True Audio) decoder

See also
http://www.true-audio.com/
http://tta.corecodec.org/
Author
Alex Beregszaszi

Definition in file tta.c.

Macro Definition Documentation

◆ BITSTREAM_READER_LE

#define BITSTREAM_READER_LE

Definition at line 38 of file tta.c.

◆ FORMAT_SIMPLE

#define FORMAT_SIMPLE   1

Definition at line 47 of file tta.c.

◆ FORMAT_ENCRYPTED

#define FORMAT_ENCRYPTED   2

Definition at line 48 of file tta.c.

◆ PRED

#define PRED (   x,
 
)    (int32_t)((((uint64_t)(x) << (k)) - (x)) >> (k))

◆ OFFSET

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

Definition at line 415 of file tta.c.

◆ DEC

Definition at line 416 of file tta.c.

Function Documentation

◆ tta_check_crc()

static int tta_check_crc ( TTAContext s,
const uint8_t *  buf,
int  buf_size 
)
static

Definition at line 77 of file tta.c.

Referenced by tta_decode_frame().

◆ tta_check_crc64()

static uint64_t tta_check_crc64 ( uint8_t *  pass)
static

Definition at line 91 of file tta.c.

Referenced by tta_decode_init().

◆ allocate_buffers()

static int allocate_buffers ( AVCodecContext avctx)
static

Definition at line 106 of file tta.c.

Referenced by tta_decode_init().

◆ tta_decode_init()

static av_cold int tta_decode_init ( AVCodecContext avctx)
static

Definition at line 124 of file tta.c.

◆ tta_decode_frame()

static int tta_decode_frame ( AVCodecContext avctx,
AVFrame frame,
int *  got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 229 of file tta.c.

◆ tta_decode_close()

static av_cold int tta_decode_close ( AVCodecContext avctx)
static

Definition at line 403 of file tta.c.

Variable Documentation

◆ tta_channel_layouts

const int64_t tta_channel_layouts[7]
static

◆ options

const AVOption options[]
static
Initial value:
= {
{ "password", "Set decoding password", OFFSET(pass), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, DEC },
{ NULL },
}

Definition at line 417 of file tta.c.

◆ tta_decoder_class

const AVClass tta_decoder_class
static
Initial value:
= {
.class_name = "TTA Decoder",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 422 of file tta.c.

◆ ff_tta_decoder

const FFCodec ff_tta_decoder
Initial value:
= {
.p.name = "tta",
CODEC_LONG_NAME("TTA (True Audio)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_TTA,
.priv_data_size = sizeof(TTAContext),
.close = tta_decode_close,
.p.priv_class = &tta_decoder_class,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}

Definition at line 429 of file tta.c.

FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:43
TTAContext
Definition: tta.c:50
tta_decoder_class
static const AVClass tta_decoder_class
Definition: tta.c:422
AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_STEREO
Definition: channel_layout.h:218
AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_QUAD
Definition: channel_layout.h:226
AV_CODEC_ID_TTA
@ AV_CODEC_ID_TTA
Definition: codec_id.h:468
AV_CH_LOW_FREQUENCY
#define AV_CH_LOW_FREQUENCY
Definition: channel_layout.h:178
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:311
tta_decode_init
static av_cold int tta_decode_init(AVCodecContext *avctx)
Definition: tta.c:124
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
AV_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:110
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
DEC
#define DEC
Definition: tta.c:416
AV_CODEC_CAP_CHANNEL_CONF
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:106
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
AV_CH_LAYOUT_5POINT1_BACK
#define AV_CH_LAYOUT_5POINT1_BACK
Definition: channel_layout.h:230
tta_decode_frame
static int tta_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: tta.c:229
AV_CH_BACK_CENTER
#define AV_CH_BACK_CENTER
Definition: channel_layout.h:183
AV_CH_LAYOUT_7POINT1_WIDE
#define AV_CH_LAYOUT_7POINT1_WIDE
Definition: channel_layout.h:241
tta_decode_close
static av_cold int tta_decode_close(AVCodecContext *avctx)
Definition: tta.c:403
OFFSET
#define OFFSET(x)
Definition: tta.c:415
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
options
static const AVOption options[]
Definition: tta.c:417