Mercurial > libavformat.hg
changeset 277:a313e1080322 libavformat
disable encoders where appropriate (patch courtesy of BERO
<bero -at- geocities.co.jp>)
author | melanson |
---|---|
date | Tue, 14 Oct 2003 04:15:53 +0000 |
parents | 3dd3646e0164 |
children | 1344cea6e2a8 |
files | allformats.c asf.c au.c avienc.c avio.c aviobuf.c ffm.c mp3.c mpeg.c mpegts.c mpjpeg.c nut.c ogg.c raw.c rm.c swf.c wav.c yuv4mpeg.c |
diffstat | 18 files changed, 145 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/allformats.c Mon Oct 13 10:59:57 2003 +0000 +++ b/allformats.c Tue Oct 14 04:15:53 2003 +0000 @@ -31,26 +31,36 @@ mpegps_init(); mpegts_init(); +#ifdef CONFIG_ENCODERS crc_init(); img_init(); +#endif //CONFIG_ENCODERS raw_init(); mp3_init(); rm_init(); #ifdef CONFIG_RISKY asf_init(); #endif +#ifdef CONFIG_ENCODERS avienc_init(); +#endif //CONFIG_ENCODERS avidec_init(); wav_init(); swf_init(); au_init(); +#ifdef CONFIG_ENCODERS gif_init(); +#endif //CONFIG_ENCODERS mov_init(); +#ifdef CONFIG_ENCODERS movenc_init(); jpeg_init(); +#endif //CONFIG_ENCODERS dv_init(); fourxm_init(); +#ifdef CONFIG_ENCODERS flvenc_init(); +#endif //CONFIG_ENCODERS flvdec_init(); str_init(); roq_init(); @@ -59,6 +69,7 @@ westwood_init(); film_init(); idcin_init(); + vmd_init(); #if defined(AMR_NB) || defined(AMR_NB_FIXED) || defined(AMR_WB) amr_init(); @@ -85,6 +96,7 @@ nut_init(); +#ifdef CONFIG_ENCODERS /* image formats */ av_register_image_format(&pnm_image_format); av_register_image_format(&pbm_image_format); @@ -98,6 +110,7 @@ #endif av_register_image_format(&jpeg_image_format); av_register_image_format(&gif_image_format); +#endif //CONFIG_ENCODERS /* file protocols */ register_protocol(&file_protocol);
--- a/asf.c Mon Oct 13 10:59:57 2003 +0000 +++ b/asf.c Tue Oct 14 04:15:53 2003 +0000 @@ -182,6 +182,7 @@ 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, }; +#ifdef CONFIG_ENCODERS static void put_guid(ByteIOContext *s, const GUID *g) { int i; @@ -661,6 +662,7 @@ put_flush_packet(&s->pb); return 0; } +#endif //CONFIG_ENCODERS /**********************************/ /* decoding */ @@ -1245,6 +1247,7 @@ asf_read_seek, }; +#ifdef CONFIG_ENCODERS static AVOutputFormat asf_oformat = { "asf", "asf format", @@ -1278,11 +1281,14 @@ asf_write_packet, asf_write_trailer, }; +#endif //CONFIG_ENCODERS int asf_init(void) { av_register_input_format(&asf_iformat); +#ifdef CONFIG_ENCODERS av_register_output_format(&asf_oformat); av_register_output_format(&asf_stream_oformat); +#endif //CONFIG_ENCODERS return 0; }
--- a/au.c Mon Oct 13 10:59:57 2003 +0000 +++ b/au.c Tue Oct 14 04:15:53 2003 +0000 @@ -39,6 +39,7 @@ { 0, 0 }, }; +#ifdef CONFIG_ENCODERS /* AUDIO_FILE header */ static int put_au_header(ByteIOContext *pb, AVCodecContext *enc) { @@ -97,6 +98,7 @@ return 0; } +#endif //CONFIG_ENCODERS static int au_probe(AVProbeData *p) { @@ -187,6 +189,7 @@ au_read_close, }; +#ifdef CONFIG_ENCODERS static AVOutputFormat au_oformat = { "au", "SUN AU Format", @@ -199,10 +202,13 @@ au_write_packet, au_write_trailer, }; +#endif //CONFIG_ENCODERS int au_init(void) { av_register_input_format(&au_iformat); +#ifdef CONFIG_ENCODERS av_register_output_format(&au_oformat); +#endif //CONFIG_ENCODERS return 0; }
--- a/avienc.c Mon Oct 13 10:59:57 2003 +0000 +++ b/avienc.c Tue Oct 14 04:15:53 2003 +0000 @@ -24,6 +24,7 @@ * - fill all fields if non streamed (nb_frames for example) */ +#ifdef CONFIG_ENCODERS typedef struct AVIIentry { unsigned int flags, pos, len; } AVIIentry; @@ -69,6 +70,7 @@ put_le32(pb, (uint32_t)(pos - start)); url_fseek(pb, pos, SEEK_SET); } +#endif //CONFIG_ENCODERS /* Note: when encoding, the first matching tag is used, so order is important if multiple tags possible for a given codec. */ @@ -206,6 +208,7 @@ return codec_get_id(codec_wav_tags, tag); } +#ifdef CONFIG_ENCODERS /* BITMAPINFOHEADER header */ void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const CodecTag *tags, int for_asf) { @@ -720,3 +723,4 @@ av_register_output_format(&avi_oformat); return 0; } +#endif //CONFIG_ENCODERS
--- a/avio.c Mon Oct 13 10:59:57 2003 +0000 +++ b/avio.c Tue Oct 14 04:15:53 2003 +0000 @@ -100,6 +100,7 @@ return ret; } +#ifdef CONFIG_ENCODERS int url_write(URLContext *h, unsigned char *buf, int size) { int ret; @@ -111,6 +112,7 @@ ret = h->prot->url_write(h, buf, size); return ret; } +#endif //CONFIG_ENCODERS offset_t url_seek(URLContext *h, offset_t pos, int whence) {
--- a/aviobuf.c Mon Oct 13 10:59:57 2003 +0000 +++ b/aviobuf.c Tue Oct 14 04:15:53 2003 +0000 @@ -52,6 +52,7 @@ } +#ifdef CONFIG_ENCODERS static void flush_buffer(ByteIOContext *s) { if (s->buf_ptr > s->buffer) { @@ -93,6 +94,7 @@ flush_buffer(s); s->must_flush = 0; } +#endif //CONFIG_ENCODERS offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence) { @@ -101,6 +103,7 @@ if (whence != SEEK_CUR && whence != SEEK_SET) return -EINVAL; +#ifdef CONFIG_ENCODERS if (s->write_flag) { if (whence == SEEK_CUR) { offset1 = s->pos + (s->buf_ptr - s->buffer); @@ -122,7 +125,9 @@ s->seek(s->opaque, offset, SEEK_SET); s->pos = offset; } - } else { + } else +#endif //CONFIG_ENCODERS + { if (whence == SEEK_CUR) { offset1 = s->pos - (s->buf_end - s->buffer) + (s->buf_ptr - s->buffer); if (offset == 0) @@ -161,6 +166,7 @@ return s->eof_reached; } +#ifdef CONFIG_ENCODERS void put_le32(ByteIOContext *s, unsigned int val) { put_byte(s, val); @@ -226,6 +232,7 @@ put_byte(s, *tag++); } } +#endif //CONFIG_ENCODERS /* Input stream */ @@ -382,11 +389,15 @@ /* link with avio functions */ +#ifdef CONFIG_ENCODERS static void url_write_packet(void *opaque, uint8_t *buf, int buf_size) { URLContext *h = opaque; url_write(h, buf, buf_size); } +#else +#define url_write_packet NULL +#endif //CONFIG_ENCODERS static int url_read_packet(void *opaque, uint8_t *buf, int buf_size) { @@ -479,6 +490,7 @@ return s->opaque; } +#ifdef CONFIG_ENCODERS /* XXX: currently size is limited */ int url_fprintf(ByteIOContext *s, const char *fmt, ...) { @@ -492,6 +504,7 @@ put_buffer(s, buf, strlen(buf)); return ret; } +#endif //CONFIG_ENCODERS /* note: unlike fgets, the EOL character is not returned and a whole line is parsed. return NULL if first char read was EOF */ @@ -529,6 +542,7 @@ return s->max_packet_size; } +#ifdef CONFIG_ENCODERS /* buffer handling */ int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags) { @@ -682,3 +696,4 @@ av_free(d); return size; } +#endif //CONFIG_ENCODERS
--- a/ffm.c Mon Oct 13 10:59:57 2003 +0000 +++ b/ffm.c Tue Oct 14 04:15:53 2003 +0000 @@ -54,6 +54,7 @@ /* disable pts hack for testing */ int ffm_nopts = 0; +#ifdef CONFIG_ENCODERS static void flush_packet(AVFormatContext *s) { FFMContext *ffm = s->priv_data; @@ -273,6 +274,7 @@ av_freep(&s->streams[i]->priv_data); return 0; } +#endif //CONFIG_ENCODERS /* ffm demux */ @@ -663,6 +665,7 @@ ffm_seek, }; +#ifdef CONFIG_ENCODERS static AVOutputFormat ffm_oformat = { "ffm", "ffm format", @@ -676,10 +679,13 @@ ffm_write_packet, ffm_write_trailer, }; +#endif //CONFIG_ENCODERS int ffm_init(void) { av_register_input_format(&ffm_iformat); +#ifdef CONFIG_ENCODERS av_register_output_format(&ffm_oformat); +#endif //CONFIG_ENCODERS return 0; }
--- a/mp3.c Mon Oct 13 10:59:57 2003 +0000 +++ b/mp3.c Tue Oct 14 04:15:53 2003 +0000 @@ -316,6 +316,7 @@ return 0; } +#ifdef CONFIG_ENCODERS /* simple formats */ static int mp3_write_header(struct AVFormatContext *s) { @@ -342,6 +343,7 @@ } return 0; } +#endif //CONFIG_ENCODERS AVInputFormat mp3_iformat = { "mp3", @@ -354,6 +356,7 @@ .extensions = "mp2,mp3", /* XXX: use probe */ }; +#ifdef CONFIG_ENCODERS AVOutputFormat mp2_oformat = { "mp2", "MPEG audio layer 2", @@ -385,13 +388,16 @@ 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; }
--- a/mpeg.c Mon Oct 13 10:59:57 2003 +0000 +++ b/mpeg.c Tue Oct 14 04:15:53 2003 +0000 @@ -61,6 +61,7 @@ #define AUDIO_ID 0xc0 #define VIDEO_ID 0xe0 +#ifdef CONFIG_ENCODERS extern AVOutputFormat mpeg1system_mux; extern AVOutputFormat mpeg1vcd_mux; extern AVOutputFormat mpeg2vob_mux; @@ -396,6 +397,7 @@ return 0; } +#endif //CONFIG_ENCODERS /*********************************************/ /* demux code */ @@ -650,6 +652,7 @@ return 0; } +#ifdef CONFIG_ENCODERS static AVOutputFormat mpeg1system_mux = { "mpeg", "MPEG1 System format", @@ -688,6 +691,7 @@ mpeg_mux_write_packet, mpeg_mux_end, }; +#endif //CONFIG_ENCODERS AVInputFormat mpegps_demux = { "mpeg", @@ -702,9 +706,11 @@ int mpegps_init(void) { +#ifdef CONFIG_ENCODERS av_register_output_format(&mpeg1system_mux); av_register_output_format(&mpeg1vcd_mux); av_register_output_format(&mpeg2vob_mux); +#endif //CONFIG_ENCODERS av_register_input_format(&mpegps_demux); return 0; }
--- a/mpegts.c Mon Oct 13 10:59:57 2003 +0000 +++ b/mpegts.c Tue Oct 14 04:15:53 2003 +0000 @@ -1047,6 +1047,8 @@ int mpegts_init(void) { av_register_input_format(&mpegts_demux); +#ifdef CONFIG_ENCODERS av_register_output_format(&mpegts_mux); +#endif return 0; }
--- a/mpjpeg.c Mon Oct 13 10:59:57 2003 +0000 +++ b/mpjpeg.c Tue Oct 14 04:15:53 2003 +0000 @@ -22,6 +22,7 @@ #define BOUNDARY_TAG "ffserver" +#ifdef CONFIG_ENCODERS static int mpjpeg_write_header(AVFormatContext *s) { uint8_t buf1[256]; @@ -106,3 +107,4 @@ av_register_output_format(&single_jpeg_format); return 0; } +#endif //CONFIG_ENCODERS
--- a/nut.c Mon Oct 13 10:59:57 2003 +0000 +++ b/nut.c Tue Oct 14 04:15:53 2003 +0000 @@ -133,6 +133,7 @@ return 7; //not reached } +#ifdef CONFIG_ENCODERS static int put_v(ByteIOContext *bc, uint64_t val) { int i; @@ -393,6 +394,7 @@ return 0; } +#endif //CONFIG_ENCODERS static int nut_probe(AVProbeData *p) { @@ -561,6 +563,7 @@ .extensions = "nut", }; +#ifdef CONFIG_ENCODERS static AVOutputFormat nut_oformat = { "nut", "nut format", @@ -579,10 +582,13 @@ nut_write_packet, nut_write_trailer, }; +#endif //CONFIG_ENCODERS int nut_init(void) { av_register_input_format(&nut_iformat); +#ifdef CONFIG_ENCODERS av_register_output_format(&nut_oformat); +#endif //CONFIG_ENCODERS return 0; }
--- a/ogg.c Mon Oct 13 10:59:57 2003 +0000 +++ b/ogg.c Tue Oct 14 04:15:53 2003 +0000 @@ -30,6 +30,7 @@ } OggContext ; +#ifdef CONFIG_ENCODERS static int ogg_write_header(AVFormatContext *avfcontext) { OggContext *context = avfcontext->priv_data; @@ -162,6 +163,7 @@ ogg_write_packet, ogg_write_trailer, } ; +#endif //CONFIG_ENCODERS static int next_packet(AVFormatContext *avfcontext, ogg_packet *op) { @@ -257,7 +259,9 @@ int ogg_init(void) { +#ifdef CONFIG_ENCODERS av_register_output_format(&ogg_oformat) ; +#endif av_register_input_format(&ogg_iformat); return 0 ; }
--- a/raw.c Mon Oct 13 10:59:57 2003 +0000 +++ b/raw.c Tue Oct 14 04:15:53 2003 +0000 @@ -18,6 +18,7 @@ */ #include "avformat.h" +#ifdef CONFIG_ENCODERS /* simple formats */ static int raw_write_header(struct AVFormatContext *s) { @@ -36,6 +37,7 @@ { return 0; } +#endif //CONFIG_ENCODERS /* raw input */ static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap) @@ -204,6 +206,7 @@ .extensions = "ac3", }; +#ifdef CONFIG_ENCODERS AVOutputFormat ac3_oformat = { "ac3", "raw ac3", @@ -216,6 +219,7 @@ raw_write_packet, raw_write_trailer, }; +#endif //CONFIG_ENCODERS AVInputFormat h263_iformat = { "h263", @@ -229,6 +233,7 @@ .value = CODEC_ID_H263, }; +#ifdef CONFIG_ENCODERS AVOutputFormat h263_oformat = { "h263", "raw h263", @@ -241,6 +246,7 @@ raw_write_packet, raw_write_trailer, }; +#endif //CONFIG_ENCODERS AVInputFormat m4v_iformat = { "m4v", @@ -254,6 +260,7 @@ .value = CODEC_ID_MPEG4, }; +#ifdef CONFIG_ENCODERS AVOutputFormat m4v_oformat = { "m4v", "raw MPEG4 video format", @@ -266,6 +273,7 @@ raw_write_packet, raw_write_trailer, }; +#endif //CONFIG_ENCODERS AVInputFormat h264_iformat = { "h264", @@ -279,6 +287,7 @@ .value = CODEC_ID_H264, }; +#ifdef CONFIG_ENCODERS AVOutputFormat h264_oformat = { "h264", "raw H264 video format", @@ -291,6 +300,7 @@ raw_write_packet, raw_write_trailer, }; +#endif //CONFIG_ENCODERS AVInputFormat mpegvideo_iformat = { "mpegvideo", @@ -303,6 +313,7 @@ .value = CODEC_ID_MPEG1VIDEO, }; +#ifdef CONFIG_ENCODERS AVOutputFormat mpeg1video_oformat = { "mpeg1video", "MPEG video", @@ -315,6 +326,7 @@ raw_write_packet, raw_write_trailer, }; +#endif //CONFIG_ENCODERS AVInputFormat mjpeg_iformat = { "mjpeg", @@ -328,6 +340,7 @@ .value = CODEC_ID_MJPEG, }; +#ifdef CONFIG_ENCODERS AVOutputFormat mjpeg_oformat = { "mjpeg", "MJPEG video", @@ -340,8 +353,25 @@ raw_write_packet, raw_write_trailer, }; +#endif //CONFIG_ENCODERS /* pcm formats */ +#if !defined(CONFIG_ENCODERS) && defined(CONFIG_DECODERS) + +#define PCMDEF(name, long_name, ext, codec) \ +AVInputFormat pcm_ ## name ## _iformat = {\ + #name,\ + long_name,\ + 0,\ + NULL,\ + raw_read_header,\ + raw_read_packet,\ + raw_read_close,\ + .extensions = ext,\ + .value = codec,\ +}; + +#else #define PCMDEF(name, long_name, ext, codec) \ AVInputFormat pcm_ ## name ## _iformat = {\ @@ -368,6 +398,7 @@ raw_write_packet,\ raw_write_trailer,\ }; +#endif //CONFIG_ENCODERS #ifdef WORDS_BIGENDIAN #define BE_DEF(s) s @@ -444,6 +475,7 @@ .value = CODEC_ID_RAWVIDEO, }; +#ifdef CONFIG_ENCODERS AVOutputFormat rawvideo_oformat = { "rawvideo", "raw video format", @@ -456,7 +488,9 @@ raw_write_packet, raw_write_trailer, }; +#endif //CONFIG_ENCODERS +#ifdef CONFIG_ENCODERS static int null_write_packet(struct AVFormatContext *s, int stream_index, const uint8_t *buf, int size, int64_t pts) @@ -481,6 +515,14 @@ raw_write_trailer, .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE, }; +#endif //CONFIG_ENCODERS + +#ifndef CONFIG_ENCODERS +#define av_register_output_format(format) +#endif +#ifndef CONFIG_DECODERS +#define av_register_input_format(format) +#endif int raw_init(void) {
--- a/rm.c Mon Oct 13 10:59:57 2003 +0000 +++ b/rm.c Tue Oct 14 04:15:53 2003 +0000 @@ -42,6 +42,7 @@ int old_format; } RMContext; +#ifdef CONFIG_ENCODERS static void put_str(ByteIOContext *s, const char *tag) { put_be16(s,strlen(tag)); @@ -435,6 +436,7 @@ put_flush_packet(pb); return 0; } +#endif //CONFIG_ENCODERS /***************************************************/ @@ -834,6 +836,7 @@ rm_read_close, }; +#ifdef CONFIG_ENCODERS static AVOutputFormat rm_oformat = { "rm", "rm format", @@ -846,10 +849,13 @@ rm_write_packet, rm_write_trailer, }; +#endif //CONFIG_ENCODERS int rm_init(void) { av_register_input_format(&rm_iformat); +#ifdef CONFIG_ENCODERS av_register_output_format(&rm_oformat); +#endif //CONFIG_ENCODERS return 0; }
--- a/swf.c Mon Oct 13 10:59:57 2003 +0000 +++ b/swf.c Tue Oct 14 04:15:53 2003 +0000 @@ -49,6 +49,7 @@ int tag; } SWFContext; +#ifdef CONFIG_ENCODERS static void put_swf_tag(AVFormatContext *s, int tag) { SWFContext *swf = s->priv_data; @@ -418,6 +419,7 @@ } return 0; } +#endif //CONFIG_ENCODERS /***********************************/ /* just to extract MP3 from swf */ @@ -551,6 +553,7 @@ swf_read_close, }; +#ifdef CONFIG_ENCODERS static AVOutputFormat swf_oformat = { "swf", "Flash format", @@ -563,10 +566,13 @@ swf_write_packet, swf_write_trailer, }; +#endif //CONFIG_ENCODERS int swf_init(void) { av_register_input_format(&swf_iformat); +#ifdef CONFIG_ENCODERS av_register_output_format(&swf_oformat); +#endif //CONFIG_ENCODERS return 0; }
--- a/wav.c Mon Oct 13 10:59:57 2003 +0000 +++ b/wav.c Tue Oct 14 04:15:53 2003 +0000 @@ -36,6 +36,7 @@ { 0, 0 }, }; +#ifdef CONFIG_ENCODERS /* WAVEFORMATEX header */ /* returns the size or -1 on error */ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc) @@ -106,6 +107,7 @@ return hdrsize; } +#endif //CONFIG_ENCODERS /* We could be given one of the three possible structures here: * WAVEFORMAT, PCMWAVEFORMAT or WAVEFORMATEX. Each structure @@ -160,6 +162,7 @@ return id; } +#ifdef CONFIG_ENCODERS typedef struct { offset_t data; } WAVContext; @@ -217,6 +220,7 @@ } return 0; } +#endif //CONFIG_ENCODERS /* return the size of the found tag */ /* XXX: > 2GB ? */ @@ -325,6 +329,7 @@ wav_read_close, }; +#ifdef CONFIG_ENCODERS static AVOutputFormat wav_oformat = { "wav", "wav format", @@ -337,10 +342,13 @@ wav_write_packet, wav_write_trailer, }; +#endif //CONFIG_ENCODERS int wav_init(void) { av_register_input_format(&wav_iformat); +#ifdef CONFIG_ENCODERS av_register_output_format(&wav_oformat); +#endif //CONFIG_ENCODERS return 0; }
--- a/yuv4mpeg.c Mon Oct 13 10:59:57 2003 +0000 +++ b/yuv4mpeg.c Tue Oct 14 04:15:53 2003 +0000 @@ -22,6 +22,7 @@ #define Y4M_FRAME_MAGIC "FRAME" #define Y4M_LINE_MAX 256 +#ifdef CONFIG_ENCODERS static int yuv4_write_header(AVFormatContext *s) { AVStream *st; @@ -172,6 +173,7 @@ yuv4_write_trailer, .flags = AVFMT_RAWPICTURE, }; +#endif //CONFIG_ENCODERS /* Header size increased to allow room for optional flags */ #define MAX_YUV4_HEADER 80 @@ -268,7 +270,9 @@ int yuv4mpeg_init(void) { av_register_input_format(&yuv4mpegpipe_iformat); +#ifdef CONFIG_ENCODERS av_register_output_format(&yuv4mpegpipe_oformat); +#endif //CONFIG_ENCODERS return 0; }