* MP3 muxer
* Copyright (c) 2003 Fabrice Bellard
*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
*
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
#include "id3v1.h"
#include "id3v2.h"
+#include "rawenc.h"
+#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
{
AVMetadataTag *tag;
if ((tag = av_metadata_get(s->metadata, key, NULL, 0)))
- strncpy(buf, tag->value, buf_size);
+ av_strlcpy(buf, tag->value, buf_size);
return !!tag;
}
uint8_t *pb;
int (*put)(AVIOContext*, const char*);
AVIOContext *dyn_buf;
- if (url_open_dyn_buf(&dyn_buf) < 0)
+ if (avio_open_dyn_buf(&dyn_buf) < 0)
return AVERROR(ENOMEM);
/* check if the strings are ASCII-only and use UTF16 only if
put(dyn_buf, str1);
if (str2)
put(dyn_buf, str2);
- len = url_close_dyn_buf(dyn_buf, &pb);
+ len = avio_close_dyn_buf(dyn_buf, &pb);
avio_wb32(s->pb, tag);
id3v2_put_size(s, len);
return len + ID3v2_HEADER_SIZE;
}
-
-static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
- avio_write(s->pb, pkt->data, pkt->size);
- put_flush_packet(s->pb);
- return 0;
-}
-
static int mp3_write_trailer(struct AVFormatContext *s)
{
uint8_t buf[ID3v1_TAG_SIZE];
/* write the id3v1 tag */
if (id3v1_create_tag(s, buf) > 0) {
avio_write(s->pb, buf, ID3v1_TAG_SIZE);
- put_flush_packet(s->pb);
+ avio_flush(s->pb);
}
return 0;
}
CODEC_ID_MP2,
CODEC_ID_NONE,
NULL,
- mp3_write_packet,
+ ff_raw_write_packet,
mp3_write_trailer,
};
#endif
CODEC_ID_MP3,
CODEC_ID_NONE,
mp3_write_header,
- mp3_write_packet,
+ ff_raw_write_packet,
mp3_write_trailer,
AVFMT_NOTIMESTAMPS,
.priv_class = &mp3_muxer_class,