2
// C++ Implementation: ADM_a52info
7
// Author: mean <fixounet@free.fr>, (C) 2004
9
// Copyright: See COPYING file that comes with this distribution
15
#include "ADM_library/default.h"
16
#include "ADM_audio/ADM_dcainfo.h"
17
#include "ADM_assert.h"
22
#include "ADM_lavcodec/bitstream.h"
29
static const int dts_sample_rates[] =
31
0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
32
12000, 24000, 48000, 96000, 192000
35
static const int dts_bit_rates[] =
37
32000, 56000, 64000, 96000, 112000, 128000,
38
192000, 224000, 256000, 320000, 384000,
39
448000, 512000, 576000, 640000, 768000,
40
896000, 1024000, 1152000, 1280000, 1344000,
41
1408000, 1411200, 1472000, 1536000, 1920000,
42
2048000, 3072000, 3840000, 1/*open*/, 2/*variable*/, 3/*lossless*/
45
static const uint8_t dts_channels[] =
47
1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8
53
int ADM_DCAGetInfo(uint8_t *buf, uint32_t len, uint32_t *fq, uint32_t *br, uint32_t *chan,uint32_t *syncoff,uint32_t *flagso,uint32_t *nbSample)
55
uint8_t *end=buf+len-4-DTS_HEADER_SIZE;
57
uint32_t size,len1,len2,flags,sr,framesize=0,index,nbBlocks;
58
// Assume 16 bits big endian
59
// Search for 7F FE 80 01 as sync start
64
if(*cur!=0x7F) continue;
65
if(cur[1]!=0xfe) continue;
66
if(cur[2]!=0x80) continue;
67
if(cur[3]!=0x01) continue;
68
// ok we got a starcode
69
// State : 32 bits, already got them
75
// **** Inefficient ! ****
77
init_get_bits( &s,cur, (end-cur)*8);
83
nbBlocks=(get_bits(&s,7)+1);
93
*fq=dts_sample_rates[index];
95
*br=dts_bit_rates[index];
97
printf("[dts]Flags :%u\n",flags);
98
printf("[dts]Fq :%u\n",*fq);
99
printf("[dts]br :%u\n",*br);
100
printf("[dts]len1 :%u\n",len1);
101
printf("[dts]len2 :%u\n",len2);
104
if(*syncoff) printf("[dts] Dropped %u bytes\n",*syncoff);
105
*chan=dts_channels[flags & 0xf];
106
// if(*chan==5 && (flags & 0X80)) *chan++;
107
*nbSample=nbBlocks*32;
112
printf("[DTS] Cannot find sync\n");