Mercurial > libavformat.hg
comparison mpc.c @ 4254:d05b13327b07 libavformat
Fix probing of files with ID3v2 tags. Discussed at
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-January/059302.html
author | alexc |
---|---|
date | Mon, 19 Jan 2009 21:54:06 +0000 |
parents | 1d3d17de20ba |
children | 304a0ea063f0 |
comparison
equal
deleted
inserted
replaced
4253:b43c5c858f25 | 4254:d05b13327b07 |
---|---|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 */ | 20 */ |
21 | 21 |
22 #include "libavcodec/bitstream.h" | 22 #include "libavcodec/bitstream.h" |
23 #include "avformat.h" | 23 #include "avformat.h" |
24 #include "id3v2.h" | |
24 | 25 |
25 #define MPC_FRAMESIZE 1152 | 26 #define MPC_FRAMESIZE 1152 |
26 #define DELAY_FRAMES 32 | 27 #define DELAY_FRAMES 32 |
27 | 28 |
28 static const int mpc_rate[4] = { 44100, 48000, 37800, 32000 }; | 29 static const int mpc_rate[4] = { 44100, 48000, 37800, 32000 }; |
41 } MPCContext; | 42 } MPCContext; |
42 | 43 |
43 static int mpc_probe(AVProbeData *p) | 44 static int mpc_probe(AVProbeData *p) |
44 { | 45 { |
45 const uint8_t *d = p->buf; | 46 const uint8_t *d = p->buf; |
47 if (ff_id3v2_match(d)) { | |
48 d += ff_id3v2_tag_len(d); | |
49 } | |
50 if (d+3 < p->buf+p->buf_size) | |
46 if (d[0] == 'M' && d[1] == 'P' && d[2] == '+' && (d[3] == 0x17 || d[3] == 0x7)) | 51 if (d[0] == 'M' && d[1] == 'P' && d[2] == '+' && (d[3] == 0x17 || d[3] == 0x7)) |
47 return AVPROBE_SCORE_MAX; | 52 return AVPROBE_SCORE_MAX; |
48 if (d[0] == 'I' && d[1] == 'D' && d[2] == '3') | |
49 return AVPROBE_SCORE_MAX / 2; | |
50 return 0; | 53 return 0; |
51 } | 54 } |
52 | 55 |
53 static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) | 56 static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) |
54 { | 57 { |