[Ffmpeg-devel] [PATCH] disabling encoders in libavformat

Gianluigi Tiesi mplayer
Sun Sep 18 09:48:12 CEST 2005


libavformat has some problem to compile when CONFIG_ENCODERS is not
defined, this patch make it works.
Yes the output of this patch can look not much clean,
but I've not "moved" any code block, doing this the patch would be
big but ifdef are less.

Bye
-- 
Gianluigi Tiesi <sherpya at netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/
-------------- next part --------------
diff -NubBr -xCVS -xhelp_mp.h -x'*.a' -x'*.exe' -x'*.o' -xconfigure.log -xconfig.mak -x.cvsignore -xconfig.h -xcodecs.conf.h -xversion.h -x.depend main/libavformat/amr.c sherpya/libavformat/amr.c
--- main/libavformat/amr.c	2005-07-26 21:14:18.380824000 +0200
+++ sherpya/libavformat/amr.c	2005-09-17 23:54:16.627433600 +0200
@@ -27,7 +27,7 @@
 
 static const unsigned char AMR_header [] = "#!AMR\n";
 static const unsigned char AMRWB_header [] = "#!AMR-WB\n";
-
+#ifdef CONFIG_ENCODERS
 static int amr_write_header(AVFormatContext *s)
 {
     ByteIOContext *pb = &s->pb;
@@ -62,7 +62,7 @@
 {
     return 0;
 }
-
+#endif
 static int amr_probe(AVProbeData *p)
 {
     //Only check for "#!AMR" which could be amr-wb, amr-nb. 
@@ -222,7 +222,7 @@
     amr_read_packet,
     amr_read_close,
 };
-
+#ifdef CONFIG_ENCODERS
 static AVOutputFormat amr_oformat = {
     "amr",
     "3gpp amr file format",
@@ -235,10 +235,12 @@
     amr_write_packet,
     amr_write_trailer,
 };
-
+#endif
 int amr_init(void)
 {
     av_register_input_format(&amr_iformat);
+#ifdef CONFIG_ENCODERS
     av_register_output_format(&amr_oformat);
+#endif
     return 0;
 }
diff -NubBr -xCVS -xhelp_mp.h -x'*.a' -x'*.exe' -x'*.o' -xconfigure.log -xconfig.mak -x.cvsignore -xconfig.h -xcodecs.conf.h -xversion.h -x.depend main/libavformat/crc.c sherpya/libavformat/crc.c
--- main/libavformat/crc.c	2004-05-29 04:06:31.000000000 +0200
+++ sherpya/libavformat/crc.c	2005-09-17 23:55:07.029908800 +0200
@@ -60,7 +60,7 @@
 typedef struct CRCState {
     uint32_t crcval;
 } CRCState;
-
+#ifdef CONFIG_ENCODERS
 static int crc_write_header(struct AVFormatContext *s)
 {
     CRCState *crc = s->priv_data;
@@ -107,3 +107,4 @@
     av_register_output_format(&crc_format);
     return 0;
 }
+#endif
\ No newline at end of file
diff -NubBr -xCVS -xhelp_mp.h -x'*.a' -x'*.exe' -x'*.o' -xconfigure.log -xconfig.mak -x.cvsignore -xconfig.h -xcodecs.conf.h -xversion.h -x.depend main/libavformat/dv.c sherpya/libavformat/dv.c
--- main/libavformat/dv.c	2005-09-06 03:27:41.851328000 +0200
+++ sherpya/libavformat/dv.c	2005-09-17 23:55:07.029908800 +0200
@@ -171,6 +171,7 @@
 		                            sizeof(sys->audio_samples_dist[0]))];
 }
 
+#ifdef CONFIG_ENCODERS
 static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* buf)
 {
     struct tm tc;
@@ -428,7 +429,7 @@
        }
     }
 }
-
+#endif
 /* 
  * This is the dumbest implementation of all -- it simply looks at
  * a fixed offset and if pack isn't there -- fails. We might want
@@ -610,7 +611,7 @@
     }
     return size;
 }
-
+#ifdef CONFIG_ENCODERS
 /* 
  * The following 6 functions constitute our interface to the world
  */
@@ -732,7 +733,7 @@
 {    
     fifo_free(&c->audio_data);
 }
-
+#endif
 DVDemuxContext* dv_init_demux(AVFormatContext *s)
 {
     DVDemuxContext *c;
@@ -906,7 +907,7 @@
     av_free(c->dv_demux);
     return 0;
 }
-
+#ifdef CONFIG_ENCODERS
 static int dv_write_header(AVFormatContext *s)
 {
     s->priv_data = dv_init_mux(s);
@@ -944,7 +945,7 @@
     dv_delete_mux((DVMuxContext *)s->priv_data);
     return 0;
 }
-
+#endif
 static AVInputFormat dv_iformat = {
     "dv",
     "DV video format",
@@ -956,7 +957,7 @@
     dv_read_seek,
     .extensions = "dv,dif",
 };
-
+#ifdef CONFIG_ENCODERS
 static AVOutputFormat dv_oformat = {
     "dv",
     "DV video format",
@@ -969,10 +970,12 @@
     dv_write_packet,
     dv_write_trailer,
 };
-
+#endif
 int ff_dv_init(void)
 {
     av_register_input_format(&dv_iformat);
+#ifdef CONFIG_ENCODERS
     av_register_output_format(&dv_oformat);
+#endif
     return 0;
 }
diff -NubBr -xCVS -xhelp_mp.h -x'*.a' -x'*.exe' -x'*.o' -xconfigure.log -xconfig.mak -x.cvsignore -xconfig.h -xcodecs.conf.h -xversion.h -x.depend main/libavformat/img2.c sherpya/libavformat/img2.c
--- main/libavformat/img2.c	2005-07-26 21:14:20.073257600 +0200
+++ sherpya/libavformat/img2.c	2005-09-17 23:55:07.039923200 +0200
@@ -289,7 +289,7 @@
 {
     return 0;
 }
-
+#ifdef CONFIG_ENCODERS
 /******************************************************/
 /* image output */
 
@@ -358,7 +358,7 @@
 {
     return 0;
 }
-
+#endif
 /* input */
 
 static AVInputFormat image2_iformat = {
@@ -385,7 +385,7 @@
     NULL,
 };
 
-
+#ifdef CONFIG_ENCODERS
 /* output */
 
 static AVOutputFormat image2_oformat = {
@@ -414,14 +414,17 @@
     img_write_packet,
     img_write_trailer,
 };
-
+#endif
 int img2_init(void)
 {
     av_register_input_format(&image2_iformat);
+#ifdef CONFIG_ENCODERS    
     av_register_output_format(&image2_oformat);
-
+#endif
     av_register_input_format(&image2pipe_iformat);
+#ifdef CONFIG_ENCODERS
     av_register_output_format(&image2pipe_oformat);
+#endif
     
     return 0;
 }
diff -NubBr -xCVS -xhelp_mp.h -x'*.a' -x'*.exe' -x'*.o' -xconfigure.log -xconfig.mak -x.cvsignore -xconfig.h -xcodecs.conf.h -xversion.h -x.depend main/libavformat/mmf.c sherpya/libavformat/mmf.c
--- main/libavformat/mmf.c	2005-07-26 21:14:20.393718400 +0200
+++ sherpya/libavformat/mmf.c	2005-09-17 23:55:07.059952000 +0200
@@ -19,7 +19,6 @@
 #include "avformat.h"
 #include "avi.h"
 
-#ifdef CONFIG_ENCODERS
 typedef struct {
     offset_t atrpos, atsqpos, awapos;
     offset_t data_size;
@@ -43,6 +42,7 @@
     return mmf_rates[code];
 }
 
+#ifdef CONFIG_ENCODERS
 /* Copy of end_tag() from avienc.c, but for big-endian chunk size */
 static void end_tag_be(ByteIOContext *pb, offset_t start)
 {
diff -NubBr -xCVS -xhelp_mp.h -x'*.a' -x'*.exe' -x'*.o' -xconfigure.log -xconfig.mak -x.cvsignore -xconfig.h -xcodecs.conf.h -xversion.h -x.depend main/libavformat/mpegtsenc.c sherpya/libavformat/mpegtsenc.c
--- main/libavformat/mpegtsenc.c	2005-07-26 21:14:21.154812800 +0200
+++ sherpya/libavformat/mpegtsenc.c	2005-09-17 23:55:07.069966400 +0200
@@ -78,7 +78,7 @@
     
     return crc;
 }
-
+#ifdef CONFIG_ENCODERS
 /*********************************************/
 /* mpegts section writer */
 
@@ -729,3 +729,4 @@
     mpegts_write_packet,
     mpegts_write_end,
 };
+#endif
\ No newline at end of file
diff -NubBr -xCVS -xhelp_mp.h -x'*.a' -x'*.exe' -x'*.o' -xconfigure.log -xconfig.mak -x.cvsignore -xconfig.h -xcodecs.conf.h -xversion.h -x.depend main/libavformat/nut.c sherpya/libavformat/nut.c
--- main/libavformat/nut.c	2005-09-16 03:20:51.501403200 +0200
+++ sherpya/libavformat/nut.c	2005-09-17 23:55:07.069966400 +0200
@@ -689,13 +689,13 @@
     
     return 0;
 }
-
+#endif
 static int64_t lsb2full(StreamContext *stream, int64_t lsb){
     int64_t mask = (1<<stream->msb_timestamp_shift)-1;
     int64_t delta= stream->last_pts - mask/2;
     return  ((lsb - delta)&mask) + delta;
 }
-
+#ifdef CONFIG_ENCODERS
 static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     NUTContext *nut = s->priv_data;
diff -NubBr -xCVS -xhelp_mp.h -x'*.a' -x'*.exe' -x'*.o' -xconfigure.log -xconfig.mak -x.cvsignore -xconfig.h -xcodecs.conf.h -xversion.h -x.depend main/libavformat/utils.c sherpya/libavformat/utils.c
--- main/libavformat/utils.c	2005-09-16 03:20:51.661633600 +0200
+++ sherpya/libavformat/utils.c	2005-09-17 23:55:07.089995200 +0200
@@ -364,7 +364,7 @@
     }
     *wptr_ptr = wptr;
 }
-
+#ifdef CONFIG_ENCODERS
 /* get data from the fifo (return -1 if not enough data) */
 int put_fifo(ByteIOContext *pb, FifoBuffer *f, int buf_size, uint8_t **rptr_ptr)
 {
@@ -392,7 +392,7 @@
     *rptr_ptr = rptr;
     return 0;
 }
-
+#endif
 int filename_number_test(const char *filename)
 {
     char buf[1024];



More information about the ffmpeg-devel mailing list