aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mp3enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-09-16 14:31:58 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-09-16 14:31:58 +0200
commit197bbcf44c2834fd9f5bef93f9254c097ebc0975 (patch)
tree2fa6aa889b153ff15d84c79f24c37300afb429b1 /libavformat/mp3enc.c
parentf276a490f01bd31b3c9b6111867745e72da7e59d (diff)
downloadffmpeg-197bbcf44c2834fd9f5bef93f9254c097ebc0975.tar.gz
mp3enc: move mp3_update_xing() down
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mp3enc.c')
-rw-r--r--libavformat/mp3enc.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 251f263e91..3a59efcd0f 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -255,32 +255,6 @@ static void mp3_xing_add_frame(MP3Context *mp3, AVPacket *pkt)
}
}
-static void mp3_update_xing(AVFormatContext *s)
-{
- MP3Context *mp3 = s->priv_data;
- int i;
-
- /* replace "Xing" identification string with "Info" for CBR files. */
- if (!mp3->has_variable_bitrate) {
- avio_seek(s->pb, mp3->xing_offset, SEEK_SET);
- ffio_wfourcc(s->pb, "Info");
- }
-
- avio_seek(s->pb, mp3->xing_offset + 8, SEEK_SET);
- avio_wb32(s->pb, mp3->frames);
- avio_wb32(s->pb, mp3->size);
-
- avio_w8(s->pb, 0); // first toc entry has to be zero.
-
- for (i = 1; i < XING_TOC_SIZE; ++i) {
- int j = i * mp3->pos / XING_TOC_SIZE;
- int seek_point = 256LL * mp3->bag[j] / mp3->size;
- avio_w8(s->pb, FFMIN(seek_point, 255));
- }
-
- avio_seek(s->pb, 0, SEEK_END);
-}
-
static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
{
MP3Context *mp3 = s->priv_data;
@@ -341,6 +315,32 @@ static int mp3_queue_flush(AVFormatContext *s)
return ret;
}
+static void mp3_update_xing(AVFormatContext *s)
+{
+ MP3Context *mp3 = s->priv_data;
+ int i;
+
+ /* replace "Xing" identification string with "Info" for CBR files. */
+ if (!mp3->has_variable_bitrate) {
+ avio_seek(s->pb, mp3->xing_offset, SEEK_SET);
+ ffio_wfourcc(s->pb, "Info");
+ }
+
+ avio_seek(s->pb, mp3->xing_offset + 8, SEEK_SET);
+ avio_wb32(s->pb, mp3->frames);
+ avio_wb32(s->pb, mp3->size);
+
+ avio_w8(s->pb, 0); // first toc entry has to be zero.
+
+ for (i = 1; i < XING_TOC_SIZE; ++i) {
+ int j = i * mp3->pos / XING_TOC_SIZE;
+ int seek_point = 256LL * mp3->bag[j] / mp3->size;
+ avio_w8(s->pb, FFMIN(seek_point, 255));
+ }
+
+ avio_seek(s->pb, 0, SEEK_END);
+}
+
static int mp2_write_trailer(struct AVFormatContext *s)
{
uint8_t buf[ID3v1_TAG_SIZE];