FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
tak.h File Reference

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

#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

#define TAK_FORMAT_DATA_TYPE_BITS   3

Definition at line 35 of file tak.h.

Referenced by ff_tak_parse_streaminfo().

#define TAK_FORMAT_SAMPLE_RATE_BITS   18

Definition at line 36 of file tak.h.

Referenced by ff_tak_parse_streaminfo().

#define TAK_FORMAT_BPS_BITS   5

Definition at line 37 of file tak.h.

Referenced by ff_tak_parse_streaminfo().

#define TAK_FORMAT_CHANNEL_BITS   4

Definition at line 38 of file tak.h.

Referenced by ff_tak_parse_streaminfo().

#define TAK_FORMAT_VALID_BITS   5

Definition at line 39 of file tak.h.

Referenced by ff_tak_parse_streaminfo().

#define TAK_FORMAT_CH_LAYOUT_BITS   6

Definition at line 40 of file tak.h.

Referenced by ff_tak_parse_streaminfo().

#define TAK_SIZE_FRAME_DURATION_BITS   4

Definition at line 41 of file tak.h.

Referenced by ff_tak_parse_streaminfo().

#define TAK_SIZE_SAMPLES_NUM_BITS   35

Definition at line 42 of file tak.h.

Referenced by ff_tak_parse_streaminfo().

#define TAK_LAST_FRAME_POS_BITS   40

Definition at line 43 of file tak.h.

Referenced by tak_read_header().

#define TAK_LAST_FRAME_SIZE_BITS   24

Definition at line 44 of file tak.h.

Referenced by tak_read_header().

#define TAK_ENCODER_CODEC_BITS   6

Definition at line 45 of file tak.h.

Referenced by ff_tak_parse_streaminfo().

#define TAK_ENCODER_PROFILE_BITS   4

Definition at line 46 of file tak.h.

Referenced by ff_tak_parse_streaminfo().

#define TAK_ENCODER_VERSION_BITS   24

Definition at line 47 of file tak.h.

Referenced by tak_read_header().

#define TAK_SAMPLE_RATE_MIN   6000

Definition at line 48 of file tak.h.

Referenced by ff_tak_parse_streaminfo().

#define TAK_CHANNELS_MIN   1

Definition at line 49 of file tak.h.

Referenced by ff_tak_parse_streaminfo().

#define TAK_BPS_MIN   8

Definition at line 50 of file tak.h.

Referenced by ff_tak_parse_streaminfo().

#define TAK_FRAME_HEADER_FLAGS_BITS   3

Definition at line 51 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_FRAME_HEADER_SYNC_ID   0xA0FF

Definition at line 52 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_FRAME_HEADER_SYNC_ID_BITS   16

Definition at line 53 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_FRAME_HEADER_SAMPLE_COUNT_BITS   14

Definition at line 54 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_FRAME_HEADER_NO_BITS   21

Definition at line 55 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_FRAME_DURATION_QUANT_SHIFT   5

Definition at line 56 of file tak.h.

Referenced by tak_get_nb_samples().

#define TAK_CRC24_BITS   24

Definition at line 57 of file tak.h.

#define TAK_FRAME_FLAG_IS_LAST   0x1

Definition at line 60 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_FRAME_FLAG_HAS_INFO   0x2

Definition at line 61 of file tak.h.

Referenced by ff_tak_decode_frame_header(), and tak_parse().

#define TAK_FRAME_FLAG_HAS_METADATA   0x4

Definition at line 62 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_MAX_CHANNELS   (1 << TAK_FORMAT_CHANNEL_BITS)

Definition at line 64 of file tak.h.

#define TAK_MIN_FRAME_HEADER_BITS
Value:
#define TAK_FRAME_HEADER_NO_BITS
Definition: tak.h:55
#define TAK_FRAME_HEADER_FLAGS_BITS
Definition: tak.h:51
#define TAK_CRC24_BITS
Definition: tak.h:57
#define TAK_FRAME_HEADER_SYNC_ID_BITS
Definition: tak.h:53

Definition at line 66 of file tak.h.

#define TAK_MIN_FRAME_HEADER_LAST_BITS
Value:
#define TAK_MIN_FRAME_HEADER_BITS
Definition: tak.h:66
#define TAK_FRAME_HEADER_SAMPLE_COUNT_BITS
Definition: tak.h:54

Definition at line 71 of file tak.h.

#define TAK_ENCODER_BITS
Value:
#define TAK_ENCODER_CODEC_BITS
Definition: tak.h:45
#define TAK_ENCODER_PROFILE_BITS
Definition: tak.h:46

Definition at line 74 of file tak.h.

#define TAK_SIZE_BITS
Value:
#define TAK_SIZE_FRAME_DURATION_BITS
Definition: tak.h:41
#define TAK_SIZE_SAMPLES_NUM_BITS
Definition: tak.h:42

Definition at line 77 of file tak.h.

#define TAK_FORMAT_BITS
Value:
#define TAK_MAX_CHANNELS
Definition: tak.h:64
#define TAK_FORMAT_BPS_BITS
Definition: tak.h:37
#define TAK_FORMAT_DATA_TYPE_BITS
Definition: tak.h:35
#define TAK_FORMAT_CH_LAYOUT_BITS
Definition: tak.h:40
#define TAK_FORMAT_VALID_BITS
Definition: tak.h:39
#define TAK_FORMAT_CHANNEL_BITS
Definition: tak.h:38
#define TAK_FORMAT_SAMPLE_RATE_BITS
Definition: tak.h:36

Definition at line 80 of file tak.h.

#define TAK_STREAMINFO_BITS
Value:
#define TAK_ENCODER_BITS
Definition: tak.h:74
#define TAK_FORMAT_BITS
Definition: tak.h:80
#define TAK_SIZE_BITS
Definition: tak.h:77

Definition at line 88 of file tak.h.

#define TAK_MAX_FRAME_HEADER_BITS
Value:
#define TAK_STREAMINFO_BITS
Definition: tak.h:88
#define TAK_MIN_FRAME_HEADER_LAST_BITS
Definition: tak.h:71

Definition at line 92 of file tak.h.

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

Definition at line 95 of file tak.h.

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

Definition at line 96 of file tak.h.

Referenced by tak_parse().

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

Definition at line 97 of file tak.h.

Referenced by tak_decode_frame().

Enumeration Type Documentation

Enumerator
TAK_CODEC_MONO_STEREO 
TAK_CODEC_MULTICHANNEL 

Definition at line 99 of file tak.h.

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.

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

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().

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().

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().

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().