[FFmpeg-cvslog] mp3enc: merge mp2/mp3_write_trailer

Michael Niedermayer git at videolan.org
Sun Sep 16 14:42:28 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Sep 16 14:37:50 2012 +0200| [744e4429cf9a2ac5c7c1e4ed8bfbb6f9f09a882a] | committer: Michael Niedermayer

mp3enc: merge mp2/mp3_write_trailer

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=744e4429cf9a2ac5c7c1e4ed8bfbb6f9f09a882a
---

 libavformat/mp3enc.c |   24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 3a59efc..3c7c4aa 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -341,7 +341,7 @@ static void mp3_update_xing(AVFormatContext *s)
     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];
     MP3Context *mp3 = s->priv_data;
@@ -357,12 +357,8 @@ static int mp2_write_trailer(struct AVFormatContext *s)
         avio_write(s->pb, buf, ID3v1_TAG_SIZE);
     }
 
-    /* write number of frames */
-    if (mp3->xing_offset) {
-        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);
-    }
+    if (mp3->xing_offset)
+        mp3_update_xing(s);
 
     return 0;
 }
@@ -498,20 +494,6 @@ static int mp3_write_header(struct AVFormatContext *s)
     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 = {
     .name              = "mp3",
     .long_name         = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),



More information about the ffmpeg-cvslog mailing list