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 "get_bits.h"
#include "avcodec.h"

Go to the source code of this file.

Data Structures

struct  TAKStreamInfo
 

Macros

#define BITSTREAM_READER_LE
 
#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)
 
void avpriv_tak_parse_streaminfo (GetBitContext *gb, TAKStreamInfo *s)
 Parse the Streaminfo metadata block.
 
int ff_tak_decode_frame_header (AVCodecContext *avctx, GetBitContext *gb, TAKStreamInfo *s, int log_level_offset)
 Validate and decode a frame header.
 

Detailed Description

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

Definition in file tak.h.

Macro Definition Documentation

#define BITSTREAM_READER_LE

Definition at line 32 of file tak.h.

#define TAK_FORMAT_DATA_TYPE_BITS   3

Definition at line 36 of file tak.h.

Referenced by avpriv_tak_parse_streaminfo().

#define TAK_FORMAT_SAMPLE_RATE_BITS   18

Definition at line 37 of file tak.h.

Referenced by avpriv_tak_parse_streaminfo().

#define TAK_FORMAT_BPS_BITS   5

Definition at line 38 of file tak.h.

Referenced by avpriv_tak_parse_streaminfo().

#define TAK_FORMAT_CHANNEL_BITS   4

Definition at line 39 of file tak.h.

Referenced by avpriv_tak_parse_streaminfo().

#define TAK_FORMAT_VALID_BITS   5

Definition at line 40 of file tak.h.

Referenced by avpriv_tak_parse_streaminfo().

#define TAK_FORMAT_CH_LAYOUT_BITS   6

Definition at line 41 of file tak.h.

Referenced by avpriv_tak_parse_streaminfo().

#define TAK_SIZE_FRAME_DURATION_BITS   4

Definition at line 42 of file tak.h.

Referenced by avpriv_tak_parse_streaminfo().

#define TAK_SIZE_SAMPLES_NUM_BITS   35

Definition at line 43 of file tak.h.

Referenced by avpriv_tak_parse_streaminfo().

#define TAK_LAST_FRAME_POS_BITS   40

Definition at line 44 of file tak.h.

Referenced by tak_read_header().

#define TAK_LAST_FRAME_SIZE_BITS   24

Definition at line 45 of file tak.h.

Referenced by tak_read_header().

#define TAK_ENCODER_CODEC_BITS   6

Definition at line 46 of file tak.h.

Referenced by avpriv_tak_parse_streaminfo().

#define TAK_ENCODER_PROFILE_BITS   4

Definition at line 47 of file tak.h.

Referenced by avpriv_tak_parse_streaminfo().

#define TAK_ENCODER_VERSION_BITS   24

Definition at line 48 of file tak.h.

Referenced by tak_read_header().

#define TAK_SAMPLE_RATE_MIN   6000

Definition at line 49 of file tak.h.

Referenced by avpriv_tak_parse_streaminfo().

#define TAK_CHANNELS_MIN   1

Definition at line 50 of file tak.h.

Referenced by avpriv_tak_parse_streaminfo().

#define TAK_BPS_MIN   8

Definition at line 51 of file tak.h.

Referenced by avpriv_tak_parse_streaminfo().

#define TAK_FRAME_HEADER_FLAGS_BITS   3

Definition at line 52 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_FRAME_HEADER_SYNC_ID   0xA0FF

Definition at line 53 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_FRAME_HEADER_SYNC_ID_BITS   16

Definition at line 54 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_FRAME_HEADER_SAMPLE_COUNT_BITS   14

Definition at line 55 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_FRAME_HEADER_NO_BITS   21

Definition at line 56 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_FRAME_DURATION_QUANT_SHIFT   5

Definition at line 57 of file tak.h.

Referenced by tak_get_nb_samples().

#define TAK_CRC24_BITS   24

Definition at line 58 of file tak.h.

#define TAK_FRAME_FLAG_IS_LAST   0x1

Definition at line 61 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_FRAME_FLAG_HAS_INFO   0x2

Definition at line 62 of file tak.h.

Referenced by ff_tak_decode_frame_header(), and tak_parse().

#define TAK_FRAME_FLAG_HAS_METADATA   0x4

Definition at line 63 of file tak.h.

Referenced by ff_tak_decode_frame_header().

#define TAK_MAX_CHANNELS   (1 << TAK_FORMAT_CHANNEL_BITS)

Definition at line 65 of file tak.h.

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

Definition at line 67 of file tak.h.

#define TAK_MIN_FRAME_HEADER_LAST_BITS
Value:
TAK_FRAME_HEADER_SAMPLE_COUNT_BITS)

Definition at line 72 of file tak.h.

#define TAK_ENCODER_BITS
Value:
TAK_ENCODER_PROFILE_BITS)

Definition at line 75 of file tak.h.

#define TAK_SIZE_BITS
Value:
TAK_SIZE_FRAME_DURATION_BITS)

Definition at line 78 of file tak.h.

#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 81 of file tak.h.

#define TAK_STREAMINFO_BITS
Value:
TAK_SIZE_BITS + \
TAK_FORMAT_BITS)

Definition at line 89 of file tak.h.

#define TAK_MAX_FRAME_HEADER_BITS
Value:
TAK_STREAMINFO_BITS + 31)

Definition at line 93 of file tak.h.

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

Definition at line 96 of file tak.h.

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

Definition at line 97 of file tak.h.

Referenced by tak_parse().

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

Definition at line 98 of file tak.h.

Referenced by tak_decode_frame().

Enumeration Type Documentation

Enumerator:
TAK_CODEC_MONO_STEREO 
TAK_CODEC_MULTICHANNEL 

Definition at line 100 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 105 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 116 of file tak.h.

Function Documentation

int ff_tak_check_crc ( const uint8_t buf,
unsigned int  buf_size 
)

Definition at line 75 of file tak.c.

Referenced by tak_decode_frame(), and tak_parse().

void avpriv_tak_parse_streaminfo ( GetBitContext gb,
TAKStreamInfo s 
)

Parse the Streaminfo metadata block.

Parameters
[in]gbpointer to GetBitContext
[out]sstorage for parsed information

Definition at line 91 of file tak.c.

Referenced by ff_tak_decode_frame_header(), and tak_read_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 126 of file tak.c.

Referenced by tak_decode_frame(), and tak_parse().