Revision 58607ca7 libavformat/mp3.c

View differences:

libavformat/mp3.c
360 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 363
/* mp3 read */
395 364

  
396 365
static int mp3_read_probe(AVProbeData *p)
......
552 521
}
553 522

  
554 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 555
/* simple formats */
556 556

  
557 557
static void id3v2_put_size(AVFormatContext *s, int size)

Also available in: Unified diff