Revision 9d82b0dd libavcodec/flac.c
libavcodec/flac.c | ||
---|---|---|
85 | 85 |
256<<0, 256<<1, 256<<2, 256<<3, 256<<4, 256<<5, 256<<6, 256<<7 |
86 | 86 |
}; |
87 | 87 |
|
88 |
static int64_t get_utf8(GetBitContext *gb) |
|
89 |
{ |
|
90 |
uint64_t val; |
|
91 |
int ones=0, bytes; |
|
92 |
|
|
93 |
while(get_bits1(gb)) |
|
94 |
ones++; |
|
95 |
|
|
96 |
if (ones==0) bytes=0; |
|
97 |
else if(ones==1) return -1; |
|
98 |
else bytes= ones - 1; |
|
99 |
|
|
100 |
val= get_bits(gb, 7-ones); |
|
101 |
while(bytes--){ |
|
102 |
const int tmp = get_bits(gb, 8); |
|
103 |
|
|
104 |
if((tmp>>6) != 2) |
|
105 |
return -1; |
|
106 |
val<<=6; |
|
107 |
val|= tmp&0x3F; |
|
108 |
} |
|
88 |
static int64_t get_utf8(GetBitContext *gb){ |
|
89 |
int64_t val; |
|
90 |
GET_UTF8(val, get_bits(gb, 8), return -1;) |
|
109 | 91 |
return val; |
110 | 92 |
} |
111 | 93 |
|
112 |
#if 0 |
|
113 |
static int skip_utf8(GetBitContext *gb) |
|
114 |
{ |
|
115 |
int ones=0, bytes; |
|
116 |
|
|
117 |
while(get_bits1(gb)) |
|
118 |
ones++; |
|
119 |
|
|
120 |
if (ones==0) bytes=0; |
|
121 |
else if(ones==1) return -1; |
|
122 |
else bytes= ones - 1; |
|
123 |
|
|
124 |
skip_bits(gb, 7-ones); |
|
125 |
while(bytes--){ |
|
126 |
const int tmp = get_bits(gb, 8); |
|
127 |
|
|
128 |
if((tmp>>6) != 2) |
|
129 |
return -1; |
|
130 |
} |
|
131 |
return 0; |
|
132 |
} |
|
133 |
#endif |
|
134 |
|
|
135 | 94 |
static void metadata_streaminfo(FLACContext *s); |
136 | 95 |
static void dump_headers(FLACContext *s); |
137 | 96 |
|
Also available in: Unified diff