Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: source/patched-ffmpeg-mt/libavformat/mp3.c

Issue 4533003: patched ffmpeg nov 2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * MP3 muxer and demuxer 2 * MP3 muxer and demuxer
3 * Copyright (c) 2003 Fabrice Bellard 3 * Copyright (c) 2003 Fabrice Bellard
4 * 4 *
5 * This file is part of FFmpeg. 5 * This file is part of FFmpeg.
6 * 6 *
7 * FFmpeg is free software; you can redistribute it and/or 7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version. 10 * version 2.1 of the License, or (at your option) any later version.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 AVInputFormat mp3_demuxer = { 189 AVInputFormat mp3_demuxer = {
190 "mp3", 190 "mp3",
191 NULL_IF_CONFIG_SMALL("MPEG audio layer 2/3"), 191 NULL_IF_CONFIG_SMALL("MPEG audio layer 2/3"),
192 0, 192 0,
193 mp3_read_probe, 193 mp3_read_probe,
194 mp3_read_header, 194 mp3_read_header,
195 mp3_read_packet, 195 mp3_read_packet,
196 .flags= AVFMT_GENERIC_INDEX, 196 .flags= AVFMT_GENERIC_INDEX,
197 .extensions = "mp2,mp3,m2a", /* XXX: use probe */ 197 .extensions = "mp2,mp3,m2a", /* XXX: use probe */
198 .metadata_conv = ff_id3v2_metadata_conv,
199 }; 198 };
200 #endif 199 #endif
201 200
202 #if CONFIG_MP2_MUXER || CONFIG_MP3_MUXER 201 #if CONFIG_MP2_MUXER || CONFIG_MP3_MUXER
203 static int id3v1_set_string(AVFormatContext *s, const char *key, 202 static int id3v1_set_string(AVFormatContext *s, const char *key,
204 uint8_t *buf, int buf_size) 203 uint8_t *buf, int buf_size)
205 { 204 {
206 AVMetadataTag *tag; 205 AVMetadataTag *tag;
207 if ((tag = av_metadata_get(s->metadata, key, NULL, 0))) 206 if ((tag = av_metadata_get(s->metadata, key, NULL, 0)))
208 strncpy(buf, tag->value, buf_size); 207 strncpy(buf, tag->value, buf_size);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 "mp2", 286 "mp2",
288 NULL_IF_CONFIG_SMALL("MPEG audio layer 2"), 287 NULL_IF_CONFIG_SMALL("MPEG audio layer 2"),
289 "audio/x-mpeg", 288 "audio/x-mpeg",
290 "mp2,m2a", 289 "mp2,m2a",
291 0, 290 0,
292 CODEC_ID_MP2, 291 CODEC_ID_MP2,
293 CODEC_ID_NONE, 292 CODEC_ID_NONE,
294 NULL, 293 NULL,
295 mp3_write_packet, 294 mp3_write_packet,
296 mp3_write_trailer, 295 mp3_write_trailer,
297 .metadata_conv = ff_id3v2_metadata_conv,
298 }; 296 };
299 #endif 297 #endif
300 298
301 #if CONFIG_MP3_MUXER 299 #if CONFIG_MP3_MUXER
302 /** 300 /**
303 * Write an ID3v2.4 header at beginning of stream 301 * Write an ID3v2.4 header at beginning of stream
304 */ 302 */
305 303
306 static int mp3_write_header(struct AVFormatContext *s) 304 static int mp3_write_header(struct AVFormatContext *s)
307 { 305 {
308 AVMetadataTag *t = NULL; 306 AVMetadataTag *t = NULL;
309 int totlen = 0; 307 int totlen = 0;
310 int64_t size_pos, cur_pos; 308 int64_t size_pos, cur_pos;
311 309
312 put_be32(s->pb, MKBETAG('I', 'D', '3', 0x04)); /* ID3v2.4 */ 310 put_be32(s->pb, MKBETAG('I', 'D', '3', 0x04)); /* ID3v2.4 */
313 put_byte(s->pb, 0); 311 put_byte(s->pb, 0);
314 put_byte(s->pb, 0); /* flags */ 312 put_byte(s->pb, 0); /* flags */
315 313
316 /* reserve space for size */ 314 /* reserve space for size */
317 size_pos = url_ftell(s->pb); 315 size_pos = url_ftell(s->pb);
318 put_be32(s->pb, 0); 316 put_be32(s->pb, 0);
319 317
318 ff_metadata_conv(&s->metadata, ff_id3v2_metadata_conv, NULL);
320 while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) { 319 while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) {
321 uint32_t tag = 0; 320 uint32_t tag = 0;
322 321
323 if (t->key[0] == 'T' && strlen(t->key) == 4) { 322 if (t->key[0] == 'T' && strlen(t->key) == 4) {
324 int i; 323 int i;
325 for (i = 0; *ff_id3v2_tags[i]; i++) 324 for (i = 0; *ff_id3v2_tags[i]; i++)
326 if (AV_RB32(t->key) == AV_RB32(ff_id3v2_tags[i])) { 325 if (AV_RB32(t->key) == AV_RB32(ff_id3v2_tags[i])) {
327 int len = strlen(t->value); 326 int len = strlen(t->value);
328 tag = AV_RB32(t->key); 327 tag = AV_RB32(t->key);
329 totlen += len + ID3v2_HEADER_SIZE + 2; 328 totlen += len + ID3v2_HEADER_SIZE + 2;
(...skipping 29 matching lines...) Expand all
359 NULL_IF_CONFIG_SMALL("MPEG audio layer 3"), 358 NULL_IF_CONFIG_SMALL("MPEG audio layer 3"),
360 "audio/x-mpeg", 359 "audio/x-mpeg",
361 "mp3", 360 "mp3",
362 0, 361 0,
363 CODEC_ID_MP3, 362 CODEC_ID_MP3,
364 CODEC_ID_NONE, 363 CODEC_ID_NONE,
365 mp3_write_header, 364 mp3_write_header,
366 mp3_write_packet, 365 mp3_write_packet,
367 mp3_write_trailer, 366 mp3_write_trailer,
368 AVFMT_NOTIMESTAMPS, 367 AVFMT_NOTIMESTAMPS,
369 .metadata_conv = ff_id3v2_metadata_conv,
370 }; 368 };
371 #endif 369 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698