Mercurial > libavformat.hg
comparison mpc.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 | 536e5527c1e0 |
children |
comparison
equal
deleted
inserted
replaced
6120:a2a55244ca6b | 6121:81614e9b541b |
---|---|
43 } MPCContext; | 43 } MPCContext; |
44 | 44 |
45 static int mpc_probe(AVProbeData *p) | 45 static int mpc_probe(AVProbeData *p) |
46 { | 46 { |
47 const uint8_t *d = p->buf; | 47 const uint8_t *d = p->buf; |
48 if (ff_id3v2_match(d)) { | 48 if (ff_id3v2_match(d, ID3v2_DEFAULT_MAGIC)) { |
49 d += ff_id3v2_tag_len(d); | 49 d += ff_id3v2_tag_len(d); |
50 } | 50 } |
51 if (d+3 < p->buf+p->buf_size) | 51 if (d+3 < p->buf+p->buf_size) |
52 if (d[0] == 'M' && d[1] == 'P' && d[2] == '+' && (d[3] == 0x17 || d[3] == 0x7)) | 52 if (d[0] == 'M' && d[1] == 'P' && d[2] == '+' && (d[3] == 0x17 || d[3] == 0x7)) |
53 return AVPROBE_SCORE_MAX; | 53 return AVPROBE_SCORE_MAX; |
65 if(t != MKTAG('M', 'P', '+', 0)){ | 65 if(t != MKTAG('M', 'P', '+', 0)){ |
66 uint8_t buf[ID3v2_HEADER_SIZE]; | 66 uint8_t buf[ID3v2_HEADER_SIZE]; |
67 if (url_fseek(s->pb, pos, SEEK_SET) < 0) | 67 if (url_fseek(s->pb, pos, SEEK_SET) < 0) |
68 return -1; | 68 return -1; |
69 ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE); | 69 ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE); |
70 if (ret != ID3v2_HEADER_SIZE || !ff_id3v2_match(buf)) { | 70 if (ret != ID3v2_HEADER_SIZE || !ff_id3v2_match(buf, ID3v2_DEFAULT_MAGIC)) { |
71 av_log(s, AV_LOG_ERROR, "Not a Musepack file\n"); | 71 av_log(s, AV_LOG_ERROR, "Not a Musepack file\n"); |
72 return -1; | 72 return -1; |
73 } | 73 } |
74 /* skip ID3 tags and try again */ | 74 /* skip ID3 tags and try again */ |
75 t = ff_id3v2_tag_len(buf) - ID3v2_HEADER_SIZE; | 75 t = ff_id3v2_tag_len(buf) - ID3v2_HEADER_SIZE; |
80 return -1; | 80 return -1; |
81 } | 81 } |
82 /* read ID3 tags */ | 82 /* read ID3 tags */ |
83 if (url_fseek(s->pb, pos, SEEK_SET) < 0) | 83 if (url_fseek(s->pb, pos, SEEK_SET) < 0) |
84 return -1; | 84 return -1; |
85 ff_id3v2_read(s); | 85 ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC); |
86 get_le24(s->pb); | 86 get_le24(s->pb); |
87 } | 87 } |
88 c->ver = get_byte(s->pb); | 88 c->ver = get_byte(s->pb); |
89 if(c->ver != 0x07 && c->ver != 0x17){ | 89 if(c->ver != 0x07 && c->ver != 0x17){ |
90 av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver); | 90 av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver); |