Mercurial > libavformat.hg
comparison mp3.c @ 3561:bc473761b9e7 libavformat
Move one function that is only used for muxing below #ifdef CONFIG_MUXERS.
author | diego |
---|---|
date | Fri, 11 Jul 2008 07:41:11 +0000 |
parents | 3dfb35d2ac51 |
children | 3790cb6c893d |
comparison
equal
deleted
inserted
replaced
3560:507108c26477 | 3561:bc473761b9e7 |
---|---|
358 if (genre <= ID3v1_GENRE_MAX) | 358 if (genre <= ID3v1_GENRE_MAX) |
359 av_strlcpy(s->genre, id3v1_genre_str[genre], sizeof(s->genre)); | 359 av_strlcpy(s->genre, id3v1_genre_str[genre], sizeof(s->genre)); |
360 return 0; | 360 return 0; |
361 } | 361 } |
362 | 362 |
363 static void id3v1_create_tag(AVFormatContext *s, uint8_t *buf) | |
364 { | |
365 int v, i; | |
366 | |
367 memset(buf, 0, ID3v1_TAG_SIZE); /* fail safe */ | |
368 buf[0] = 'T'; | |
369 buf[1] = 'A'; | |
370 buf[2] = 'G'; | |
371 strncpy(buf + 3, s->title, 30); | |
372 strncpy(buf + 33, s->author, 30); | |
373 strncpy(buf + 63, s->album, 30); | |
374 v = s->year; | |
375 if (v > 0) { | |
376 for(i = 0;i < 4; i++) { | |
377 buf[96 - i] = '0' + (v % 10); | |
378 v = v / 10; | |
379 } | |
380 } | |
381 strncpy(buf + 97, s->comment, 30); | |
382 if (s->track != 0) { | |
383 buf[125] = 0; | |
384 buf[126] = s->track; | |
385 } | |
386 for(i = 0; i <= ID3v1_GENRE_MAX; i++) { | |
387 if (!strcasecmp(s->genre, id3v1_genre_str[i])) { | |
388 buf[127] = i; | |
389 break; | |
390 } | |
391 } | |
392 } | |
393 | |
394 /* mp3 read */ | 363 /* mp3 read */ |
395 | 364 |
396 static int mp3_read_probe(AVProbeData *p) | 365 static int mp3_read_probe(AVProbeData *p) |
397 { | 366 { |
398 int max_frames, first_frames = 0; | 367 int max_frames, first_frames = 0; |
550 pkt->size = ret; | 519 pkt->size = ret; |
551 return ret; | 520 return ret; |
552 } | 521 } |
553 | 522 |
554 #ifdef CONFIG_MUXERS | 523 #ifdef CONFIG_MUXERS |
524 static void id3v1_create_tag(AVFormatContext *s, uint8_t *buf) | |
525 { | |
526 int v, i; | |
527 | |
528 memset(buf, 0, ID3v1_TAG_SIZE); /* fail safe */ | |
529 buf[0] = 'T'; | |
530 buf[1] = 'A'; | |
531 buf[2] = 'G'; | |
532 strncpy(buf + 3, s->title, 30); | |
533 strncpy(buf + 33, s->author, 30); | |
534 strncpy(buf + 63, s->album, 30); | |
535 v = s->year; | |
536 if (v > 0) { | |
537 for(i = 0;i < 4; i++) { | |
538 buf[96 - i] = '0' + (v % 10); | |
539 v = v / 10; | |
540 } | |
541 } | |
542 strncpy(buf + 97, s->comment, 30); | |
543 if (s->track != 0) { | |
544 buf[125] = 0; | |
545 buf[126] = s->track; | |
546 } | |
547 for(i = 0; i <= ID3v1_GENRE_MAX; i++) { | |
548 if (!strcasecmp(s->genre, id3v1_genre_str[i])) { | |
549 buf[127] = i; | |
550 break; | |
551 } | |
552 } | |
553 } | |
554 | |
555 /* simple formats */ | 555 /* simple formats */ |
556 | 556 |
557 static void id3v2_put_size(AVFormatContext *s, int size) | 557 static void id3v2_put_size(AVFormatContext *s, int size) |
558 { | 558 { |
559 put_byte(s->pb, size >> 21 & 0x7f); | 559 put_byte(s->pb, size >> 21 & 0x7f); |