]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/mp3.c
try to guess the codec for imag2pipe too
[ffmpeg] / libavformat / mp3.c
index fa27283fc98aec53a5dc3f25fba25b44a3ae0668..dc4ec3dfc237d64ce7c5815abbd06426bc3ed1c7 100644 (file)
@@ -253,7 +253,8 @@ static int mp3_read_header(AVFormatContext *s,
 
     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 */
@@ -297,13 +298,13 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
     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 */
@@ -316,16 +317,16 @@ static int mp3_read_close(AVFormatContext *s)
     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;
 }
@@ -342,6 +343,7 @@ static int mp3_write_trailer(struct AVFormatContext *s)
     }
     return 0;
 }
+#endif //CONFIG_ENCODERS
 
 AVInputFormat mp3_iformat = {
     "mp3",
@@ -354,6 +356,7 @@ AVInputFormat mp3_iformat = {
     .extensions = "mp2,mp3", /* XXX: use probe */
 };
 
+#ifdef CONFIG_ENCODERS
 AVOutputFormat mp2_oformat = {
     "mp2",
     "MPEG audio layer 2",
@@ -385,13 +388,16 @@ AVOutputFormat mp3_oformat = {
     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;
 }