Commit 744e4429 authored by Michael Niedermayer's avatar Michael Niedermayer

mp3enc: merge mp2/mp3_write_trailer

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 197bbcf4
...@@ -341,7 +341,7 @@ static void mp3_update_xing(AVFormatContext *s) ...@@ -341,7 +341,7 @@ static void mp3_update_xing(AVFormatContext *s)
avio_seek(s->pb, 0, SEEK_END); avio_seek(s->pb, 0, SEEK_END);
} }
static int mp2_write_trailer(struct AVFormatContext *s) static int mp3_write_trailer(struct AVFormatContext *s)
{ {
uint8_t buf[ID3v1_TAG_SIZE]; uint8_t buf[ID3v1_TAG_SIZE];
MP3Context *mp3 = s->priv_data; MP3Context *mp3 = s->priv_data;
...@@ -357,12 +357,8 @@ static int mp2_write_trailer(struct AVFormatContext *s) ...@@ -357,12 +357,8 @@ static int mp2_write_trailer(struct AVFormatContext *s)
avio_write(s->pb, buf, ID3v1_TAG_SIZE); avio_write(s->pb, buf, ID3v1_TAG_SIZE);
} }
/* write number of frames */ if (mp3->xing_offset)
if (mp3->xing_offset) { mp3_update_xing(s);
avio_seek(s->pb, mp3->xing_offset+8, SEEK_SET);
avio_wb32(s->pb, s->streams[mp3->audio_stream_idx]->nb_frames);
avio_seek(s->pb, 0, SEEK_END);
}
return 0; return 0;
} }
...@@ -498,20 +494,6 @@ static int mp3_write_header(struct AVFormatContext *s) ...@@ -498,20 +494,6 @@ static int mp3_write_header(struct AVFormatContext *s)
return 0; return 0;
} }
static int mp3_write_trailer(AVFormatContext *s)
{
MP3Context *mp3 = s->priv_data;
int ret=mp2_write_trailer(s);
if (ret < 0)
return ret;
if (mp3->xing_offset)
mp3_update_xing(s);
return 0;
}
AVOutputFormat ff_mp3_muxer = { AVOutputFormat ff_mp3_muxer = {
.name = "mp3", .name = "mp3",
.long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"), .long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment