Mercurial > libavformat.hg
annotate id3v1.c @ 6165:df361adebc1d libavformat
Fix date specification accepted by parse_date().
author | stefano |
---|---|
date | Tue, 22 Jun 2010 22:54:29 +0000 |
parents | f74198942337 |
children |
rev | line source |
---|---|
885 | 1 /* |
5016
eb6dd7717805
Move id3v2 parsing code from mp3.c to id3v2.h and id3v2.c.
diego
parents:
4900
diff
changeset
|
2 * ID3v1 header parser |
4251
77e0c7511d41
cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents:
4221
diff
changeset
|
3 * Copyright (c) 2003 Fabrice Bellard |
234 | 4 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1321
diff
changeset
|
5 * This file is part of FFmpeg. |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1321
diff
changeset
|
6 * |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1321
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
234 | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1321
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
234 | 11 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1321
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
234 | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1321
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
896
edbe5c3717f9
Update licensing information: The FSF changed postal address.
diego
parents:
885
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
234 | 20 */ |
3286 | 21 |
5016
eb6dd7717805
Move id3v2 parsing code from mp3.c to id3v2.h and id3v2.c.
diego
parents:
4900
diff
changeset
|
22 #include "id3v1.h" |
5045
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
23 #include "libavcodec/avcodec.h" |
5450 | 24 #include "libavutil/avstring.h" |
234 | 25 |
5160 | 26 const char * const ff_id3v1_genre_str[ID3v1_GENRE_MAX + 1] = { |
5017
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
27 [0] = "Blues", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
28 [1] = "Classic Rock", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
29 [2] = "Country", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
30 [3] = "Dance", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
31 [4] = "Disco", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
32 [5] = "Funk", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
33 [6] = "Grunge", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
34 [7] = "Hip-Hop", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
35 [8] = "Jazz", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
36 [9] = "Metal", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
37 [10] = "New Age", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
38 [11] = "Oldies", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
39 [12] = "Other", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
40 [13] = "Pop", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
41 [14] = "R&B", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
42 [15] = "Rap", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
43 [16] = "Reggae", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
44 [17] = "Rock", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
45 [18] = "Techno", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
46 [19] = "Industrial", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
47 [20] = "Alternative", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
48 [21] = "Ska", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
49 [22] = "Death Metal", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
50 [23] = "Pranks", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
51 [24] = "Soundtrack", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
52 [25] = "Euro-Techno", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
53 [26] = "Ambient", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
54 [27] = "Trip-Hop", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
55 [28] = "Vocal", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
56 [29] = "Jazz+Funk", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
57 [30] = "Fusion", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
58 [31] = "Trance", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
59 [32] = "Classical", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
60 [33] = "Instrumental", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
61 [34] = "Acid", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
62 [35] = "House", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
63 [36] = "Game", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
64 [37] = "Sound Clip", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
65 [38] = "Gospel", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
66 [39] = "Noise", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
67 [40] = "AlternRock", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
68 [41] = "Bass", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
69 [42] = "Soul", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
70 [43] = "Punk", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
71 [44] = "Space", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
72 [45] = "Meditative", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
73 [46] = "Instrumental Pop", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
74 [47] = "Instrumental Rock", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
75 [48] = "Ethnic", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
76 [49] = "Gothic", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
77 [50] = "Darkwave", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
78 [51] = "Techno-Industrial", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
79 [52] = "Electronic", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
80 [53] = "Pop-Folk", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
81 [54] = "Eurodance", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
82 [55] = "Dream", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
83 [56] = "Southern Rock", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
84 [57] = "Comedy", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
85 [58] = "Cult", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
86 [59] = "Gangsta", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
87 [60] = "Top 40", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
88 [61] = "Christian Rap", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
89 [62] = "Pop/Funk", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
90 [63] = "Jungle", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
91 [64] = "Native American", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
92 [65] = "Cabaret", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
93 [66] = "New Wave", |
5592 | 94 [67] = "Psychadelic", |
5017
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
95 [68] = "Rave", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
96 [69] = "Showtunes", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
97 [70] = "Trailer", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
98 [71] = "Lo-Fi", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
99 [72] = "Tribal", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
100 [73] = "Acid Punk", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
101 [74] = "Acid Jazz", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
102 [75] = "Polka", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
103 [76] = "Retro", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
104 [77] = "Musical", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
105 [78] = "Rock & Roll", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
106 [79] = "Hard Rock", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
107 [80] = "Folk", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
108 [81] = "Folk-Rock", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
109 [82] = "National Folk", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
110 [83] = "Swing", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
111 [84] = "Fast Fusion", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
112 [85] = "Bebob", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
113 [86] = "Latin", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
114 [87] = "Revival", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
115 [88] = "Celtic", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
116 [89] = "Bluegrass", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
117 [90] = "Avantgarde", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
118 [91] = "Gothic Rock", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
119 [92] = "Progressive Rock", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
120 [93] = "Psychedelic Rock", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
121 [94] = "Symphonic Rock", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
122 [95] = "Slow Rock", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
123 [96] = "Big Band", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
124 [97] = "Chorus", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
125 [98] = "Easy Listening", |
1763f7d0d8d0
cosmetics: Reformat to K&R and prettyprint newly created files.
diego
parents:
5016
diff
changeset
|
126 [99] = "Acoustic", |
234 | 127 [100] = "Humour", |
128 [101] = "Speech", | |
129 [102] = "Chanson", | |
130 [103] = "Opera", | |
131 [104] = "Chamber Music", | |
132 [105] = "Sonata", | |
133 [106] = "Symphony", | |
134 [107] = "Booty Bass", | |
135 [108] = "Primus", | |
136 [109] = "Porn Groove", | |
137 [110] = "Satire", | |
138 [111] = "Slow Jam", | |
139 [112] = "Club", | |
140 [113] = "Tango", | |
141 [114] = "Samba", | |
142 [115] = "Folklore", | |
143 [116] = "Ballad", | |
144 [117] = "Power Ballad", | |
145 [118] = "Rhythmic Soul", | |
146 [119] = "Freestyle", | |
147 [120] = "Duet", | |
148 [121] = "Punk Rock", | |
149 [122] = "Drum Solo", | |
150 [123] = "A capella", | |
151 [124] = "Euro-House", | |
152 [125] = "Dance Hall", | |
5447 | 153 [126] = "Goa", |
154 [127] = "Drum & Bass", | |
155 [128] = "Club-House", | |
156 [129] = "Hardcore", | |
157 [130] = "Terror", | |
158 [131] = "Indie", | |
159 [132] = "BritPop", | |
160 [133] = "Negerpunk", | |
161 [134] = "Polsk Punk", | |
162 [135] = "Beat", | |
163 [136] = "Christian Gangsta", | |
164 [137] = "Heavy Metal", | |
165 [138] = "Black Metal", | |
166 [139] = "Crossover", | |
5453 | 167 [140] = "Contemporary Christian", |
5447 | 168 [141] = "Christian Rock", |
169 [142] = "Merengue", | |
170 [143] = "Salsa", | |
171 [144] = "Thrash Metal", | |
172 [145] = "Anime", | |
173 [146] = "JPop", | |
174 [147] = "SynthPop", | |
234 | 175 }; |
5045
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
176 |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
177 static void get_string(AVFormatContext *s, const char *key, |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
178 const uint8_t *buf, int buf_size) |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
179 { |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
180 int i, c; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
181 char *q, str[512]; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
182 |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
183 q = str; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
184 for(i = 0; i < buf_size; i++) { |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
185 c = buf[i]; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
186 if (c == '\0') |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
187 break; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
188 if ((q - str) >= sizeof(str) - 1) |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
189 break; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
190 *q++ = c; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
191 } |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
192 *q = '\0'; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
193 |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
194 if (*str) |
5982
f74198942337
Mark av_metadata_set() as deprecated, and use av_metadata_set2()
stefano
parents:
5618
diff
changeset
|
195 av_metadata_set2(&s->metadata, key, str, 0); |
5045
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
196 } |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
197 |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
198 /** |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
199 * Parse an ID3v1 tag |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
200 * |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
201 * @param buf ID3v1_TAG_SIZE long buffer containing the tag |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
202 */ |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
203 static int parse_tag(AVFormatContext *s, const uint8_t *buf) |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
204 { |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
205 int genre; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
206 |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
207 if (!(buf[0] == 'T' && |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
208 buf[1] == 'A' && |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
209 buf[2] == 'G')) |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
210 return -1; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
211 get_string(s, "title", buf + 3, 30); |
5448 | 212 get_string(s, "artist", buf + 33, 30); |
5045
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
213 get_string(s, "album", buf + 63, 30); |
5618
27fd77f20a89
Add a list of generic tags and change demuxers to follow it.
pross
parents:
5592
diff
changeset
|
214 get_string(s, "date", buf + 93, 4); |
5045
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
215 get_string(s, "comment", buf + 97, 30); |
5450 | 216 if (buf[125] == 0 && buf[126] != 0) |
217 av_metadata_set2(&s->metadata, "track", av_d2str(buf[126]), AV_METADATA_DONT_STRDUP_VAL); | |
5045
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
218 genre = buf[127]; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
219 if (genre <= ID3v1_GENRE_MAX) |
5982
f74198942337
Mark av_metadata_set() as deprecated, and use av_metadata_set2()
stefano
parents:
5618
diff
changeset
|
220 av_metadata_set2(&s->metadata, "genre", ff_id3v1_genre_str[genre], 0); |
5045
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
221 return 0; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
222 } |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
223 |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
224 void ff_id3v1_read(AVFormatContext *s) |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
225 { |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
226 int ret, filesize; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
227 uint8_t buf[ID3v1_TAG_SIZE]; |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
228 |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
229 if (!url_is_streamed(s->pb)) { |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
230 /* XXX: change that */ |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
231 filesize = url_fsize(s->pb); |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
232 if (filesize > 128) { |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
233 url_fseek(s->pb, filesize - 128, SEEK_SET); |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
234 ret = get_buffer(s->pb, buf, ID3v1_TAG_SIZE); |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
235 if (ret == ID3v1_TAG_SIZE) { |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
236 parse_tag(s, buf); |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
237 } |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
238 url_fseek(s->pb, 0, SEEK_SET); |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
239 } |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
240 } |
9ed3c88ed9ba
Move id3v1/id3v2 handling code from mp3.c to id3v[12].c.
diego
parents:
5017
diff
changeset
|
241 } |