You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
Add support for ID3v2 year tag
Patch by: patrice bensoussan a free d fr Originally committed as revision 11008 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
committed by
Andreas Öman
parent
5fba300d02
commit
bd548b99aa
@@ -582,9 +582,12 @@ static int mp3_write_header(struct AVFormatContext *s)
|
|||||||
{
|
{
|
||||||
int totlen = 0;
|
int totlen = 0;
|
||||||
char tracktxt[10];
|
char tracktxt[10];
|
||||||
|
char yeartxt[10];
|
||||||
|
|
||||||
if(s->track)
|
if(s->track)
|
||||||
snprintf(tracktxt, sizeof(tracktxt) - 1, "%d", s->track);
|
snprintf(tracktxt, sizeof(tracktxt) - 1, "%d", s->track);
|
||||||
|
if(s->year)
|
||||||
|
snprintf( yeartxt, sizeof(yeartxt) , "%d", s->year );
|
||||||
|
|
||||||
if(s->title[0]) totlen += 11 + strlen(s->title);
|
if(s->title[0]) totlen += 11 + strlen(s->title);
|
||||||
if(s->author[0]) totlen += 11 + strlen(s->author);
|
if(s->author[0]) totlen += 11 + strlen(s->author);
|
||||||
@@ -592,6 +595,7 @@ static int mp3_write_header(struct AVFormatContext *s)
|
|||||||
if(s->genre[0]) totlen += 11 + strlen(s->genre);
|
if(s->genre[0]) totlen += 11 + strlen(s->genre);
|
||||||
if(s->copyright[0]) totlen += 11 + strlen(s->copyright);
|
if(s->copyright[0]) totlen += 11 + strlen(s->copyright);
|
||||||
if(s->track) totlen += 11 + strlen(tracktxt);
|
if(s->track) totlen += 11 + strlen(tracktxt);
|
||||||
|
if(s->year) totlen += 11 + strlen(yeartxt);
|
||||||
if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT))
|
if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT))
|
||||||
totlen += strlen(LIBAVFORMAT_IDENT) + 11;
|
totlen += strlen(LIBAVFORMAT_IDENT) + 11;
|
||||||
|
|
||||||
@@ -610,6 +614,7 @@ static int mp3_write_header(struct AVFormatContext *s)
|
|||||||
if(s->genre[0]) id3v2_put_ttag(s, s->genre, MKBETAG('T', 'C', 'O', 'N'));
|
if(s->genre[0]) id3v2_put_ttag(s, s->genre, MKBETAG('T', 'C', 'O', 'N'));
|
||||||
if(s->copyright[0]) id3v2_put_ttag(s, s->copyright, MKBETAG('T', 'C', 'O', 'P'));
|
if(s->copyright[0]) id3v2_put_ttag(s, s->copyright, MKBETAG('T', 'C', 'O', 'P'));
|
||||||
if(s->track) id3v2_put_ttag(s, tracktxt, MKBETAG('T', 'R', 'C', 'K'));
|
if(s->track) id3v2_put_ttag(s, tracktxt, MKBETAG('T', 'R', 'C', 'K'));
|
||||||
|
if(s->year) id3v2_put_ttag(s, yeartxt, MKBETAG('T', 'Y', 'E', 'R'));
|
||||||
if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT))
|
if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT))
|
||||||
id3v2_put_ttag(s, LIBAVFORMAT_IDENT, MKBETAG('T', 'E', 'N', 'C'));
|
id3v2_put_ttag(s, LIBAVFORMAT_IDENT, MKBETAG('T', 'E', 'N', 'C'));
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user