st->codec.codec_type = CODEC_TYPE_AUDIO;
st->codec.codec_id = CODEC_ID_MP3;
-
+ st->need_parsing = 1;
+
/* try to get the TAG */
if (!url_is_streamed(&s->pb)) {
/* XXX: change that */
size= MP3_PACKET_SIZE;
if (av_new_packet(pkt, size) < 0)
- return -EIO;
+ return AVERROR_IO;
pkt->stream_index = 0;
ret = get_buffer(&s->pb, pkt->data, size);
if (ret <= 0) {
av_free_packet(pkt);
- return -EIO;
+ return AVERROR_IO;
}
/* note: we need to modify the packet size here to handle the last
packet */
return 0;
}
+#ifdef CONFIG_ENCODERS
/* simple formats */
static int mp3_write_header(struct AVFormatContext *s)
{
return 0;
}
-static int mp3_write_packet(struct AVFormatContext *s, int stream_index,
- unsigned char *buf, int size, int force_pts)
+static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt)
{
- put_buffer(&s->pb, buf, size);
+ put_buffer(&s->pb, pkt->data, pkt->size);
put_flush_packet(&s->pb);
return 0;
}
}
return 0;
}
+#endif //CONFIG_ENCODERS
AVInputFormat mp3_iformat = {
"mp3",
.extensions = "mp2,mp3", /* XXX: use probe */
};
+#ifdef CONFIG_ENCODERS
AVOutputFormat mp2_oformat = {
"mp2",
"MPEG audio layer 2",
mp3_write_trailer,
};
#endif
+#endif //CONFIG_ENCODERS
int mp3_init(void)
{
av_register_input_format(&mp3_iformat);
+#ifdef CONFIG_ENCODERS
av_register_output_format(&mp2_oformat);
#ifdef CONFIG_MP3LAME
av_register_output_format(&mp3_oformat);
#endif
+#endif //CONFIG_ENCODERS
return 0;
}