FFmpeg
Data Structures | Macros | Enumerations | Functions
tak.h File Reference
#include <stdint.h>
#include "avcodec.h"
#include "get_bits.h"

Go to the source code of this file.

Data Structures

struct  TAKStreamInfo
 

Macros

#define TAK_FORMAT_DATA_TYPE_BITS   3
 
#define TAK_FORMAT_SAMPLE_RATE_BITS   18
 
#define TAK_FORMAT_BPS_BITS   5
 
#define TAK_FORMAT_CHANNEL_BITS   4
 
#define TAK_FORMAT_VALID_BITS   5
 
#define TAK_FORMAT_CH_LAYOUT_BITS   6
 
#define TAK_SIZE_FRAME_DURATION_BITS   4
 
#define TAK_SIZE_SAMPLES_NUM_BITS   35
 
#define TAK_LAST_FRAME_POS_BITS   40
 
#define TAK_LAST_FRAME_SIZE_BITS   24
 
#define TAK_ENCODER_CODEC_BITS   6
 
#define TAK_ENCODER_PROFILE_BITS   4
 
#define TAK_ENCODER_VERSION_BITS   24
 
#define TAK_SAMPLE_RATE_MIN   6000
 
#define TAK_CHANNELS_MIN   1
 
#define TAK_BPS_MIN   8
 
#define TAK_FRAME_HEADER_FLAGS_BITS   3
 
#define TAK_FRAME_HEADER_SYNC_ID   0xA0FF
 
#define TAK_FRAME_HEADER_SYNC_ID_BITS   16
 
#define TAK_FRAME_HEADER_SAMPLE_COUNT_BITS   14
 
#define TAK_FRAME_HEADER_NO_BITS   21
 
#define TAK_FRAME_DURATION_QUANT_SHIFT   5
 
#define TAK_CRC24_BITS   24
 
#define TAK_FRAME_FLAG_IS_LAST   0x1
 
#define TAK_FRAME_FLAG_HAS_INFO   0x2
 
#define TAK_FRAME_FLAG_HAS_METADATA   0x4
 
#define TAK_MAX_CHANNELS   (1 << TAK_FORMAT_CHANNEL_BITS)
 
#define TAK_MIN_FRAME_HEADER_BITS
 
#define TAK_MIN_FRAME_HEADER_LAST_BITS
 
#define TAK_ENCODER_BITS
 
#define TAK_SIZE_BITS
 
#define TAK_FORMAT_BITS
 
#define TAK_STREAMINFO_BITS
 
#define TAK_MAX_FRAME_HEADER_BITS
 
#define TAK_STREAMINFO_BYTES   ((TAK_STREAMINFO_BITS + 7) / 8)
 
#define TAK_MAX_FRAME_HEADER_BYTES   ((TAK_MAX_FRAME_HEADER_BITS + 7) / 8)
 
#define TAK_MIN_FRAME_HEADER_BYTES   ((TAK_MIN_FRAME_HEADER_BITS + 7) / 8)
 

Enumerations

enum  TAKCodecType { TAK_CODEC_MONO_STEREO = 2, TAK_CODEC_MULTICHANNEL = 4 }
 
enum  TAKMetaDataType {
  TAK_METADATA_END = 0, TAK_METADATA_STREAMINFO, TAK_METADATA_SEEKTABLE, TAK_METADATA_SIMPLE_WAVE_DATA,
  TAK_METADATA_ENCODER, TAK_METADATA_PADDING, TAK_METADATA_MD5, TAK_METADATA_LAST_FRAME
}
 
enum  TAKFrameSizeType {
  TAK_FST_94ms = 0, TAK_FST_125ms, TAK_FST_188ms, TAK_FST_250ms,
  TAK_FST_4096, TAK_FST_8192, TAK_FST_16384, TAK_FST_512,
  TAK_FST_1024, TAK_FST_2048
}
 

Functions

int ff_tak_check_crc (const uint8_t *buf, unsigned int buf_size)
 
int avpriv_tak_parse_streaminfo (TAKStreamInfo *s, const uint8_t *buf, int size)
 Parse the Streaminfo metadata block. More...
 
void ff_tak_parse_streaminfo (TAKStreamInfo *s, GetBitContext *gb)
 
int ff_tak_decode_frame_header (AVCodecContext *avctx, GetBitContext *gb, TAKStreamInfo *s, int log_level_offset)
 Validate and decode a frame header. More...
 

Detailed Description

TAK (Tom's lossless Audio Kompressor) decoder/demuxer common functions

Definition in file tak.h.

Macro Definition Documentation

◆ TAK_FORMAT_DATA_TYPE_BITS

#define TAK_FORMAT_DATA_TYPE_BITS   3

Definition at line 35 of file tak.h.

◆ TAK_FORMAT_SAMPLE_RATE_BITS

#define TAK_FORMAT_SAMPLE_RATE_BITS   18

Definition at line 36 of file tak.h.

◆ TAK_FORMAT_BPS_BITS

#define TAK_FORMAT_BPS_BITS   5

Definition at line 37 of file tak.h.

◆ TAK_FORMAT_CHANNEL_BITS

#define TAK_FORMAT_CHANNEL_BITS   4

Definition at line 38 of file tak.h.

◆ TAK_FORMAT_VALID_BITS

#define TAK_FORMAT_VALID_BITS   5

Definition at line 39 of file tak.h.

◆ TAK_FORMAT_CH_LAYOUT_BITS

#define TAK_FORMAT_CH_LAYOUT_BITS   6

Definition at line 40 of file tak.h.

◆ TAK_SIZE_FRAME_DURATION_BITS

#define TAK_SIZE_FRAME_DURATION_BITS   4

Definition at line 41 of file tak.h.

◆ TAK_SIZE_SAMPLES_NUM_BITS

#define TAK_SIZE_SAMPLES_NUM_BITS   35

Definition at line 42 of file tak.h.

◆ TAK_LAST_FRAME_POS_BITS

#define TAK_LAST_FRAME_POS_BITS   40

Definition at line 43 of file tak.h.

◆ TAK_LAST_FRAME_SIZE_BITS

#define TAK_LAST_FRAME_SIZE_BITS   24

Definition at line 44 of file tak.h.

◆ TAK_ENCODER_CODEC_BITS

#define TAK_ENCODER_CODEC_BITS   6

Definition at line 45 of file tak.h.

◆ TAK_ENCODER_PROFILE_BITS

#define TAK_ENCODER_PROFILE_BITS   4

Definition at line 46 of file tak.h.

◆ TAK_ENCODER_VERSION_BITS

#define TAK_ENCODER_VERSION_BITS   24

Definition at line 47 of file tak.h.

◆ TAK_SAMPLE_RATE_MIN

#define TAK_SAMPLE_RATE_MIN   6000

Definition at line 48 of file tak.h.

◆ TAK_CHANNELS_MIN

#define TAK_CHANNELS_MIN   1

Definition at line 49 of file tak.h.

◆ TAK_BPS_MIN

#define TAK_BPS_MIN   8

Definition at line 50 of file tak.h.

◆ TAK_FRAME_HEADER_FLAGS_BITS

#define TAK_FRAME_HEADER_FLAGS_BITS   3

Definition at line 51 of file tak.h.

◆ TAK_FRAME_HEADER_SYNC_ID

#define TAK_FRAME_HEADER_SYNC_ID   0xA0FF

Definition at line 52 of file tak.h.

◆ TAK_FRAME_HEADER_SYNC_ID_BITS

#define TAK_FRAME_HEADER_SYNC_ID_BITS   16

Definition at line 53 of file tak.h.

◆ TAK_FRAME_HEADER_SAMPLE_COUNT_BITS

#define TAK_FRAME_HEADER_SAMPLE_COUNT_BITS   14

Definition at line 54 of file tak.h.

◆ TAK_FRAME_HEADER_NO_BITS

#define TAK_FRAME_HEADER_NO_BITS   21

Definition at line 55 of file tak.h.

◆ TAK_FRAME_DURATION_QUANT_SHIFT

#define TAK_FRAME_DURATION_QUANT_SHIFT   5

Definition at line 56 of file tak.h.

◆ TAK_CRC24_BITS

#define TAK_CRC24_BITS   24

Definition at line 57 of file tak.h.

◆ TAK_FRAME_FLAG_IS_LAST

#define TAK_FRAME_FLAG_IS_LAST   0x1

Definition at line 60 of file tak.h.

◆ TAK_FRAME_FLAG_HAS_INFO

#define TAK_FRAME_FLAG_HAS_INFO   0x2

Definition at line 61 of file tak.h.

◆ TAK_FRAME_FLAG_HAS_METADATA

#define TAK_FRAME_FLAG_HAS_METADATA   0x4

Definition at line 62 of file tak.h.

◆ TAK_MAX_CHANNELS

#define TAK_MAX_CHANNELS   (1 << TAK_FORMAT_CHANNEL_BITS)

Definition at line 64 of file tak.h.

◆ TAK_MIN_FRAME_HEADER_BITS

#define TAK_MIN_FRAME_HEADER_BITS
Value:
TAK_FRAME_HEADER_FLAGS_BITS + \
TAK_FRAME_HEADER_NO_BITS + \
TAK_CRC24_BITS)

Definition at line 66 of file tak.h.

◆ TAK_MIN_FRAME_HEADER_LAST_BITS

#define TAK_MIN_FRAME_HEADER_LAST_BITS
Value:
TAK_FRAME_HEADER_SAMPLE_COUNT_BITS)

Definition at line 71 of file tak.h.

◆ TAK_ENCODER_BITS

#define TAK_ENCODER_BITS
Value:
TAK_ENCODER_PROFILE_BITS)

Definition at line 74 of file tak.h.

◆ TAK_SIZE_BITS

#define TAK_SIZE_BITS
Value:
TAK_SIZE_FRAME_DURATION_BITS)

Definition at line 77 of file tak.h.

◆ TAK_FORMAT_BITS

#define TAK_FORMAT_BITS
Value:
TAK_FORMAT_SAMPLE_RATE_BITS + \
TAK_FORMAT_BPS_BITS + \
TAK_FORMAT_CHANNEL_BITS + 1 + \
TAK_FORMAT_VALID_BITS + 1 + \
TAK_FORMAT_CH_LAYOUT_BITS * \
TAK_MAX_CHANNELS)

Definition at line 80 of file tak.h.

◆ TAK_STREAMINFO_BITS

#define TAK_STREAMINFO_BITS
Value:
TAK_SIZE_BITS + \
TAK_FORMAT_BITS)

Definition at line 88 of file tak.h.

◆ TAK_MAX_FRAME_HEADER_BITS

#define TAK_MAX_FRAME_HEADER_BITS
Value:
TAK_STREAMINFO_BITS + 31)

Definition at line 92 of file tak.h.

◆ TAK_STREAMINFO_BYTES

#define TAK_STREAMINFO_BYTES   ((TAK_STREAMINFO_BITS + 7) / 8)

Definition at line 95 of file tak.h.

◆ TAK_MAX_FRAME_HEADER_BYTES

#define TAK_MAX_FRAME_HEADER_BYTES   ((TAK_MAX_FRAME_HEADER_BITS + 7) / 8)

Definition at line 96 of file tak.h.

◆ TAK_MIN_FRAME_HEADER_BYTES

#define TAK_MIN_FRAME_HEADER_BYTES   ((TAK_MIN_FRAME_HEADER_BITS + 7) / 8)

Definition at line 97 of file tak.h.

Enumeration Type Documentation

◆ TAKCodecType

Enumerator
TAK_CODEC_MONO_STEREO 
TAK_CODEC_MULTICHANNEL 

Definition at line 99 of file tak.h.

◆ TAKMetaDataType

Enumerator
TAK_METADATA_END 
TAK_METADATA_STREAMINFO 
TAK_METADATA_SEEKTABLE 
TAK_METADATA_SIMPLE_WAVE_DATA 
TAK_METADATA_ENCODER 
TAK_METADATA_PADDING 
TAK_METADATA_MD5 
TAK_METADATA_LAST_FRAME 

Definition at line 104 of file tak.h.

◆ TAKFrameSizeType

Enumerator
TAK_FST_94ms 
TAK_FST_125ms 
TAK_FST_188ms 
TAK_FST_250ms 
TAK_FST_4096 
TAK_FST_8192 
TAK_FST_16384 
TAK_FST_512 
TAK_FST_1024 
TAK_FST_2048 

Definition at line 115 of file tak.h.

Function Documentation

◆ ff_tak_check_crc()

int ff_tak_check_crc ( const uint8_t buf,
unsigned int  buf_size 
)

Definition at line 77 of file tak.c.

Referenced by tak_decode_frame(), and tak_parse().

◆ avpriv_tak_parse_streaminfo()

int avpriv_tak_parse_streaminfo ( TAKStreamInfo s,
const uint8_t buf,
int  size 
)

Parse the Streaminfo metadata block.

Parameters
[out]sstorage for parsed information
[in]bufinput buffer
[in]sizesize of input buffer in bytes
Returns
non-zero on error, 0 if OK

Definition at line 128 of file tak.c.

Referenced by tak_read_header().

◆ ff_tak_parse_streaminfo()

void ff_tak_parse_streaminfo ( TAKStreamInfo s,
GetBitContext gb 
)

Definition at line 93 of file tak.c.

Referenced by avpriv_tak_parse_streaminfo(), and ff_tak_decode_frame_header().

◆ ff_tak_decode_frame_header()

int ff_tak_decode_frame_header ( AVCodecContext avctx,
GetBitContext gb,
TAKStreamInfo s,
int  log_level_offset 
)

Validate and decode a frame header.

Parameters
avctxAVCodecContext to use as av_log() context
[in]gbGetBitContext from which to read frame header
[out]sframe information
log_level_offsetlog level offset, can be used to silence error messages.
Returns
non-zero on error, 0 if OK

Definition at line 141 of file tak.c.

Referenced by tak_decode_frame(), and tak_parse().

TAK_MIN_FRAME_HEADER_LAST_BITS
#define TAK_MIN_FRAME_HEADER_LAST_BITS
Definition: tak.h:71
TAK_ENCODER_BITS
#define TAK_ENCODER_BITS
Definition: tak.h:74
TAK_MIN_FRAME_HEADER_BITS
#define TAK_MIN_FRAME_HEADER_BITS
Definition: tak.h:66
TAK_FRAME_HEADER_SYNC_ID_BITS
#define TAK_FRAME_HEADER_SYNC_ID_BITS
Definition: tak.h:53
TAK_SIZE_SAMPLES_NUM_BITS
#define TAK_SIZE_SAMPLES_NUM_BITS
Definition: tak.h:42
TAK_FORMAT_DATA_TYPE_BITS
#define TAK_FORMAT_DATA_TYPE_BITS
Definition: tak.h:35
TAK_ENCODER_CODEC_BITS
#define TAK_ENCODER_CODEC_BITS
Definition: tak.h:45