comparison flacdec.c @ 6121:81614e9b541b libavformat

Generalize ID3v2 functions to support ID3v2-like ID headers with a different magic in the header (mainly targeted to Sony's .oma/.aa3 format). Patch by Michael Karcher, ffmpeg A mkarcher dialup fu-berlin de
author cehoyos
date Fri, 11 Jun 2010 13:44:57 +0000
parents 08cd1179a20d
children 4775a49a6045
comparison
equal deleted inserted replaced
6120:a2a55244ca6b 6121:81614e9b541b
41 st->need_parsing = AVSTREAM_PARSE_FULL; 41 st->need_parsing = AVSTREAM_PARSE_FULL;
42 /* the parameters will be extracted from the compressed bitstream */ 42 /* the parameters will be extracted from the compressed bitstream */
43 43
44 /* skip ID3v2 header if found */ 44 /* skip ID3v2 header if found */
45 ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE); 45 ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
46 if (ret == ID3v2_HEADER_SIZE && ff_id3v2_match(buf)) { 46 if (ret == ID3v2_HEADER_SIZE && ff_id3v2_match(buf, ID3v2_DEFAULT_MAGIC)) {
47 int len = ff_id3v2_tag_len(buf); 47 int len = ff_id3v2_tag_len(buf);
48 url_fseek(s->pb, len - ID3v2_HEADER_SIZE, SEEK_CUR); 48 url_fseek(s->pb, len - ID3v2_HEADER_SIZE, SEEK_CUR);
49 } else { 49 } else {
50 url_fseek(s->pb, 0, SEEK_SET); 50 url_fseek(s->pb, 0, SEEK_SET);
51 } 51 }
128 static int flac_probe(AVProbeData *p) 128 static int flac_probe(AVProbeData *p)
129 { 129 {
130 uint8_t *bufptr = p->buf; 130 uint8_t *bufptr = p->buf;
131 uint8_t *end = p->buf + p->buf_size; 131 uint8_t *end = p->buf + p->buf_size;
132 132
133 if(ff_id3v2_match(bufptr)) 133 if(ff_id3v2_match(bufptr, ID3v2_DEFAULT_MAGIC))
134 bufptr += ff_id3v2_tag_len(bufptr); 134 bufptr += ff_id3v2_tag_len(bufptr);
135 135
136 if(bufptr > end-4 || memcmp(bufptr, "fLaC", 4)) return 0; 136 if(bufptr > end-4 || memcmp(bufptr, "fLaC", 4)) return 0;
137 else return AVPROBE_SCORE_MAX/2; 137 else return AVPROBE_SCORE_MAX/2;
138 } 138 }