comparison raw.c @ 4285:d8803d0a4274 libavformat

Handle ID3v2 tags in raw FLAC streams by skipping them. Patch by David DeHaven (dave sagetv com)
author jbr
date Sun, 25 Jan 2009 00:16:27 +0000
parents d05b13327b07
children 0e275ee37217
comparison
equal deleted inserted replaced
4284:40c9bef5b4e2 4285:d8803d0a4274
287 return AVERROR(ENOMEM); 287 return AVERROR(ENOMEM);
288 st->codec->codec_type = CODEC_TYPE_AUDIO; 288 st->codec->codec_type = CODEC_TYPE_AUDIO;
289 st->codec->codec_id = s->iformat->value; 289 st->codec->codec_id = s->iformat->value;
290 st->need_parsing = AVSTREAM_PARSE_FULL; 290 st->need_parsing = AVSTREAM_PARSE_FULL;
291 /* the parameters will be extracted from the compressed bitstream */ 291 /* the parameters will be extracted from the compressed bitstream */
292
293 if(st->codec->codec_id == CODEC_ID_FLAC) {
294 /* skip ID3v2 header if found */
295 uint8_t buf[ID3v2_HEADER_SIZE];
296 int ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
297 if (ret == ID3v2_HEADER_SIZE && ff_id3v2_match(buf)) {
298 int len = ff_id3v2_tag_len(buf);
299 url_fseek(s->pb, len - ID3v2_HEADER_SIZE, SEEK_CUR);
300 } else {
301 url_fseek(s->pb, 0, SEEK_SET);
302 }
303 }
292 return 0; 304 return 0;
293 } 305 }
294 306
295 /* MPEG-1/H.263 input */ 307 /* MPEG-1/H.263 input */
296 static int video_read_header(AVFormatContext *s, 308 static int video_read_header(AVFormatContext *s,
571 #endif 583 #endif
572 584
573 #if CONFIG_FLAC_DEMUXER 585 #if CONFIG_FLAC_DEMUXER
574 static int flac_probe(AVProbeData *p) 586 static int flac_probe(AVProbeData *p)
575 { 587 {
576 if(memcmp(p->buf, "fLaC", 4)) return 0; 588 uint8_t *bufptr = p->buf;
589
590 if(ff_id3v2_match(bufptr))
591 bufptr += ff_id3v2_tag_len(bufptr);
592
593 if(memcmp(bufptr, "fLaC", 4)) return 0;
577 else return AVPROBE_SCORE_MAX / 2; 594 else return AVPROBE_SCORE_MAX / 2;
578 } 595 }
579 #endif 596 #endif
580 597
581 #if CONFIG_AAC_DEMUXER 598 #if CONFIG_AAC_DEMUXER