[FFmpeg-cvslog] r20329 - in trunk/libavformat: Makefile mp3.c

diego subversion
Tue Oct 20 01:22:23 CEST 2009


Author: diego
Date: Tue Oct 20 01:22:23 2009
New Revision: 20329

Log:
Move function that is only used by the MP3 muxer below the corresponding #if.
This removes the dependency of the MP2 muxer on the id3v2 object file.

Modified:
   trunk/libavformat/Makefile
   trunk/libavformat/mp3.c

Modified: trunk/libavformat/Makefile
==============================================================================
--- trunk/libavformat/Makefile	Tue Oct 20 00:45:22 2009	(r20328)
+++ trunk/libavformat/Makefile	Tue Oct 20 01:22:23 2009	(r20329)
@@ -106,7 +106,7 @@ OBJS-$(CONFIG_MMF_DEMUXER)              
 OBJS-$(CONFIG_MMF_MUXER)                 += mmf.o riff.o
 OBJS-$(CONFIG_MOV_DEMUXER)               += mov.o riff.o isom.o
 OBJS-$(CONFIG_MOV_MUXER)                 += movenc.o riff.o isom.o avc.o
-OBJS-$(CONFIG_MP2_MUXER)                 += mp3.o id3v1.o id3v2.o
+OBJS-$(CONFIG_MP2_MUXER)                 += mp3.o id3v1.o
 OBJS-$(CONFIG_MP3_DEMUXER)               += mp3.o id3v1.o id3v2.o
 OBJS-$(CONFIG_MP3_MUXER)                 += mp3.o id3v1.o id3v2.o
 OBJS-$(CONFIG_MPC_DEMUXER)               += mpc.o id3v1.o id3v2.o apetag.o

Modified: trunk/libavformat/mp3.c
==============================================================================
--- trunk/libavformat/mp3.c	Tue Oct 20 00:45:22 2009	(r20328)
+++ trunk/libavformat/mp3.c	Tue Oct 20 01:22:23 2009	(r20329)
@@ -252,6 +252,42 @@ static void id3v2_put_ttag(AVFormatConte
 }
 
 
+static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt)
+{
+    put_buffer(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) {
+        put_buffer(s->pb, buf, ID3v1_TAG_SIZE);
+        put_flush_packet(s->pb);
+    }
+    return 0;
+}
+#endif /* CONFIG_MP2_MUXER || CONFIG_MP3_MUXER */
+
+#if CONFIG_MP2_MUXER
+AVOutputFormat mp2_muxer = {
+    "mp2",
+    NULL_IF_CONFIG_SMALL("MPEG audio layer 2"),
+    "audio/x-mpeg",
+    "mp2,m2a",
+    0,
+    CODEC_ID_MP2,
+    CODEC_ID_NONE,
+    NULL,
+    mp3_write_packet,
+    mp3_write_trailer,
+};
+#endif
+
+#if CONFIG_MP3_MUXER
 /**
  * Write an ID3v2.4 header at beginning of stream
  */
@@ -312,41 +348,6 @@ static int mp3_write_header(struct AVFor
     return 0;
 }
 
-static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
-    put_buffer(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) {
-        put_buffer(s->pb, buf, ID3v1_TAG_SIZE);
-        put_flush_packet(s->pb);
-    }
-    return 0;
-}
-#endif /* CONFIG_MP2_MUXER || CONFIG_MP3_MUXER */
-
-#if CONFIG_MP2_MUXER
-AVOutputFormat mp2_muxer = {
-    "mp2",
-    NULL_IF_CONFIG_SMALL("MPEG audio layer 2"),
-    "audio/x-mpeg",
-    "mp2,m2a",
-    0,
-    CODEC_ID_MP2,
-    CODEC_ID_NONE,
-    NULL,
-    mp3_write_packet,
-    mp3_write_trailer,
-};
-#endif
-#if CONFIG_MP3_MUXER
 AVOutputFormat mp3_muxer = {
     "mp3",
     NULL_IF_CONFIG_SMALL("MPEG audio layer 3"),



More information about the ffmpeg-cvslog mailing list