Commit 764ef400 authored by Mike Melanson's avatar Mike Melanson

disable encoders where appropriate (patch courtesy of BERO

<bero -at- geocities.co.jp>)

Originally committed as revision 2375 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent a003ee9a
...@@ -107,6 +107,7 @@ typedef struct ADPCMContext { ...@@ -107,6 +107,7 @@ typedef struct ADPCMContext {
/* XXX: implement encoding */ /* XXX: implement encoding */
#ifdef CONFIG_ENCODERS
static int adpcm_encode_init(AVCodecContext *avctx) static int adpcm_encode_init(AVCodecContext *avctx)
{ {
if (avctx->channels > 2) if (avctx->channels > 2)
...@@ -265,6 +266,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, ...@@ -265,6 +266,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
} }
return dst - frame; return dst - frame;
} }
#endif //CONFIG_ENCODERS
static int adpcm_decode_init(AVCodecContext * avctx) static int adpcm_decode_init(AVCodecContext * avctx)
{ {
...@@ -685,7 +687,10 @@ static int adpcm_decode_frame(AVCodecContext *avctx, ...@@ -685,7 +687,10 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
return src - buf; return src - buf;
} }
#define ADPCM_CODEC(id, name) \
#ifdef CONFIG_ENCODERS
#define ADPCM_ENCODER(id,name) \
AVCodec name ## _encoder = { \ AVCodec name ## _encoder = { \
#name, \ #name, \
CODEC_TYPE_AUDIO, \ CODEC_TYPE_AUDIO, \
...@@ -695,7 +700,13 @@ AVCodec name ## _encoder = { \ ...@@ -695,7 +700,13 @@ AVCodec name ## _encoder = { \
adpcm_encode_frame, \ adpcm_encode_frame, \
adpcm_encode_close, \ adpcm_encode_close, \
NULL, \ NULL, \
}; \ };
#else
#define ADPCM_ENCODER(id,name)
#endif
#ifdef CONFIG_DECODERS
#define ADPCM_DECODER(id,name) \
AVCodec name ## _decoder = { \ AVCodec name ## _decoder = { \
#name, \ #name, \
CODEC_TYPE_AUDIO, \ CODEC_TYPE_AUDIO, \
...@@ -706,6 +717,12 @@ AVCodec name ## _decoder = { \ ...@@ -706,6 +717,12 @@ AVCodec name ## _decoder = { \
NULL, \ NULL, \
adpcm_decode_frame, \ adpcm_decode_frame, \
}; };
#else
#define ADPCM_DECODER(id,name)
#endif
#define ADPCM_CODEC(id, name) \
ADPCM_ENCODER(id,name) ADPCM_DECODER(id,name)
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt); ADPCM_CODEC(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt);
ADPCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav); ADPCM_CODEC(CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav);
......
...@@ -171,6 +171,7 @@ static const uint64_t ff_pw_15 __attribute__ ((aligned(8))) = 0x000F000F000F000F ...@@ -171,6 +171,7 @@ static const uint64_t ff_pw_15 __attribute__ ((aligned(8))) = 0x000F000F000F000F
/***********************************/ /***********************************/
/* standard MMX */ /* standard MMX */
#ifdef CONFIG_ENCODERS
static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size) static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size)
{ {
asm volatile( asm volatile(
...@@ -227,6 +228,7 @@ static inline void diff_pixels_mmx(DCTELEM *block, const uint8_t *s1, const uint ...@@ -227,6 +228,7 @@ static inline void diff_pixels_mmx(DCTELEM *block, const uint8_t *s1, const uint
: "%eax" : "%eax"
); );
} }
#endif //CONFIG_ENCODERS
void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size) void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
{ {
...@@ -401,6 +403,7 @@ static void clear_blocks_mmx(DCTELEM *blocks) ...@@ -401,6 +403,7 @@ static void clear_blocks_mmx(DCTELEM *blocks)
); );
} }
#ifdef CONFIG_ENCODERS
static int pix_sum16_mmx(uint8_t * pix, int line_size){ static int pix_sum16_mmx(uint8_t * pix, int line_size){
const int h=16; const int h=16;
int sum; int sum;
...@@ -438,6 +441,7 @@ static int pix_sum16_mmx(uint8_t * pix, int line_size){ ...@@ -438,6 +441,7 @@ static int pix_sum16_mmx(uint8_t * pix, int line_size){
return sum; return sum;
} }
#endif //CONFIG_ENCODERS
static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){ static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){
int i=0; int i=0;
...@@ -461,6 +465,7 @@ static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){ ...@@ -461,6 +465,7 @@ static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){
dst[i+0] += src[i+0]; dst[i+0] += src[i+0];
} }
#ifdef CONFIG_ENCODERS
static int pix_norm1_mmx(uint8_t *pix, int line_size) { static int pix_norm1_mmx(uint8_t *pix, int line_size) {
int tmp; int tmp;
asm volatile ( asm volatile (
...@@ -856,6 +861,7 @@ static int hadamard8_diff_mmx2(void *s, uint8_t *src1, uint8_t *src2, int stride ...@@ -856,6 +861,7 @@ static int hadamard8_diff_mmx2(void *s, uint8_t *src1, uint8_t *src2, int stride
WARPER88_1616(hadamard8_diff_mmx, hadamard8_diff16_mmx) WARPER88_1616(hadamard8_diff_mmx, hadamard8_diff16_mmx)
WARPER88_1616(hadamard8_diff_mmx2, hadamard8_diff16_mmx2) WARPER88_1616(hadamard8_diff_mmx2, hadamard8_diff16_mmx2)
#endif //CONFIG_ENCODERS
#define put_no_rnd_pixels8_mmx(a,b,c,d) put_pixels8_mmx(a,b,c,d) #define put_no_rnd_pixels8_mmx(a,b,c,d) put_pixels8_mmx(a,b,c,d)
#define put_no_rnd_pixels16_mmx(a,b,c,d) put_pixels16_mmx(a,b,c,d) #define put_no_rnd_pixels16_mmx(a,b,c,d) put_pixels16_mmx(a,b,c,d)
...@@ -1619,12 +1625,16 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) ...@@ -1619,12 +1625,16 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
} }
#ifdef CONFIG_ENCODERS
c->get_pixels = get_pixels_mmx; c->get_pixels = get_pixels_mmx;
c->diff_pixels = diff_pixels_mmx; c->diff_pixels = diff_pixels_mmx;
#endif //CONFIG_ENCODERS
c->put_pixels_clamped = put_pixels_clamped_mmx; c->put_pixels_clamped = put_pixels_clamped_mmx;
c->add_pixels_clamped = add_pixels_clamped_mmx; c->add_pixels_clamped = add_pixels_clamped_mmx;
c->clear_blocks = clear_blocks_mmx; c->clear_blocks = clear_blocks_mmx;
#ifdef CONFIG_ENCODERS
c->pix_sum = pix_sum16_mmx; c->pix_sum = pix_sum16_mmx;
#endif //CONFIG_ENCODERS
c->put_pixels_tab[0][0] = put_pixels16_mmx; c->put_pixels_tab[0][0] = put_pixels16_mmx;
c->put_pixels_tab[0][1] = put_pixels16_x2_mmx; c->put_pixels_tab[0][1] = put_pixels16_x2_mmx;
...@@ -1667,6 +1677,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) ...@@ -1667,6 +1677,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_mmx; c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_mmx;
c->add_bytes= add_bytes_mmx; c->add_bytes= add_bytes_mmx;
#ifdef CONFIG_ENCODERS
c->diff_bytes= diff_bytes_mmx; c->diff_bytes= diff_bytes_mmx;
c->hadamard8_diff[0]= hadamard8_diff16_mmx; c->hadamard8_diff[0]= hadamard8_diff16_mmx;
...@@ -1674,6 +1685,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) ...@@ -1674,6 +1685,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->pix_norm1 = pix_norm1_mmx; c->pix_norm1 = pix_norm1_mmx;
c->sse[0] = sse16_mmx; c->sse[0] = sse16_mmx;
#endif //CONFIG_ENCODERS
if (mm_flags & MM_MMXEXT) { if (mm_flags & MM_MMXEXT) {
c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2; c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2;
...@@ -1690,8 +1702,10 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) ...@@ -1690,8 +1702,10 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmx2; c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmx2;
c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2; c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2;
#ifdef CONFIG_ENCODERS
c->hadamard8_diff[0]= hadamard8_diff16_mmx2; c->hadamard8_diff[0]= hadamard8_diff16_mmx2;
c->hadamard8_diff[1]= hadamard8_diff_mmx2; c->hadamard8_diff[1]= hadamard8_diff_mmx2;
#endif //CONFIG_ENCODERS
if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2; c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2;
...@@ -1797,7 +1811,9 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) ...@@ -1797,7 +1811,9 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
} }
} }
#ifdef CONFIG_ENCODERS
dsputil_init_pix_mmx(c, avctx); dsputil_init_pix_mmx(c, avctx);
#endif //CONFIG_ENCODERS
#if 0 #if 0
// for speed testing // for speed testing
get_pixels = just_return; get_pixels = just_return;
......
...@@ -243,6 +243,7 @@ static void build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code, ...@@ -243,6 +243,7 @@ static void build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
} }
} }
#ifdef CONFIG_ENCODERS
int mjpeg_init(MpegEncContext *s) int mjpeg_init(MpegEncContext *s)
{ {
MJpegContext *m; MJpegContext *m;
...@@ -280,6 +281,7 @@ void mjpeg_close(MpegEncContext *s) ...@@ -280,6 +281,7 @@ void mjpeg_close(MpegEncContext *s)
{ {
av_free(s->mjpeg_ctx); av_free(s->mjpeg_ctx);
} }
#endif //CONFIG_ENCODERS
#define PREDICT(ret, topleft, top, left, predictor)\ #define PREDICT(ret, topleft, top, left, predictor)\
switch(predictor){\ switch(predictor){\
......
...@@ -48,10 +48,12 @@ ...@@ -48,10 +48,12 @@
#define MB_BTYPE_VLC_BITS 6 #define MB_BTYPE_VLC_BITS 6
#define TEX_VLC_BITS 9 #define TEX_VLC_BITS 9
#ifdef CONFIG_ENCODERS
static void mpeg1_encode_block(MpegEncContext *s, static void mpeg1_encode_block(MpegEncContext *s,
DCTELEM *block, DCTELEM *block,
int component); int component);
static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code); // RAL: f_code parameter added static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code); // RAL: f_code parameter added
#endif //CONFIG_ENCODERS
static void mpeg1_skip_picture(MpegEncContext *s, int pict_num); static void mpeg1_skip_picture(MpegEncContext *s, int pict_num);
static inline int mpeg1_decode_block_inter(MpegEncContext *s, static inline int mpeg1_decode_block_inter(MpegEncContext *s,
DCTELEM *block, DCTELEM *block,
...@@ -85,7 +87,7 @@ static uint32_t mpeg1_chr_dc_uni[512]; ...@@ -85,7 +87,7 @@ static uint32_t mpeg1_chr_dc_uni[512];
static uint8_t mpeg1_index_run[2][64]; static uint8_t mpeg1_index_run[2][64];
static int8_t mpeg1_max_level[2][64]; static int8_t mpeg1_max_level[2][64];
#endif #endif //CONFIG_ENCODERS
static void init_2d_vlc_rl(RLTable *rl) static void init_2d_vlc_rl(RLTable *rl)
{ {
...@@ -361,7 +363,7 @@ static void mpeg1_skip_picture(MpegEncContext *s, int pict_num) ...@@ -361,7 +363,7 @@ static void mpeg1_skip_picture(MpegEncContext *s, int pict_num)
put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 1);
put_bits(&s->pb, 1, 1); put_bits(&s->pb, 1, 1);
} }
#endif #endif //CONFIG_ENCODERS
static void common_init(MpegEncContext *s) static void common_init(MpegEncContext *s)
{ {
......
...@@ -173,6 +173,7 @@ void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_s ...@@ -173,6 +173,7 @@ void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_s
} }
} }
#ifdef CONFIG_ENCODERS
void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix){ void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix){
int i; int i;
...@@ -184,6 +185,7 @@ void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix){ ...@@ -184,6 +185,7 @@ void ff_write_quant_matrix(PutBitContext *pb, int16_t *matrix){
}else }else
put_bits(pb, 1, 0); put_bits(pb, 1, 0);
} }
#endif //CONFIG_ENCODERS
/* init common dct for both encoder and decoder */ /* init common dct for both encoder and decoder */
int DCT_common_init(MpegEncContext *s) int DCT_common_init(MpegEncContext *s)
......
...@@ -31,26 +31,36 @@ void av_register_all(void) ...@@ -31,26 +31,36 @@ void av_register_all(void)
mpegps_init(); mpegps_init();
mpegts_init(); mpegts_init();
#ifdef CONFIG_ENCODERS
crc_init(); crc_init();
img_init(); img_init();
#endif //CONFIG_ENCODERS
raw_init(); raw_init();
mp3_init(); mp3_init();
rm_init(); rm_init();
#ifdef CONFIG_RISKY #ifdef CONFIG_RISKY
asf_init(); asf_init();
#endif #endif
#ifdef CONFIG_ENCODERS
avienc_init(); avienc_init();
#endif //CONFIG_ENCODERS
avidec_init(); avidec_init();
wav_init(); wav_init();
swf_init(); swf_init();
au_init(); au_init();
#ifdef CONFIG_ENCODERS
gif_init(); gif_init();
#endif //CONFIG_ENCODERS
mov_init(); mov_init();
#ifdef CONFIG_ENCODERS
movenc_init(); movenc_init();
jpeg_init(); jpeg_init();
#endif //CONFIG_ENCODERS
dv_init(); dv_init();
fourxm_init(); fourxm_init();
#ifdef CONFIG_ENCODERS
flvenc_init(); flvenc_init();
#endif //CONFIG_ENCODERS
flvdec_init(); flvdec_init();
str_init(); str_init();
roq_init(); roq_init();
...@@ -59,6 +69,7 @@ void av_register_all(void) ...@@ -59,6 +69,7 @@ void av_register_all(void)
westwood_init(); westwood_init();
film_init(); film_init();
idcin_init(); idcin_init();
vmd_init();
#if defined(AMR_NB) || defined(AMR_NB_FIXED) || defined(AMR_WB) #if defined(AMR_NB) || defined(AMR_NB_FIXED) || defined(AMR_WB)
amr_init(); amr_init();
...@@ -85,6 +96,7 @@ void av_register_all(void) ...@@ -85,6 +96,7 @@ void av_register_all(void)
nut_init(); nut_init();
#ifdef CONFIG_ENCODERS
/* image formats */ /* image formats */
av_register_image_format(&pnm_image_format); av_register_image_format(&pnm_image_format);
av_register_image_format(&pbm_image_format); av_register_image_format(&pbm_image_format);
...@@ -98,6 +110,7 @@ void av_register_all(void) ...@@ -98,6 +110,7 @@ void av_register_all(void)
#endif #endif
av_register_image_format(&jpeg_image_format); av_register_image_format(&jpeg_image_format);
av_register_image_format(&gif_image_format); av_register_image_format(&gif_image_format);
#endif //CONFIG_ENCODERS
/* file protocols */ /* file protocols */
register_protocol(&file_protocol); register_protocol(&file_protocol);
......
...@@ -182,6 +182,7 @@ static const GUID my_guid = { ...@@ -182,6 +182,7 @@ static const GUID my_guid = {
0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 },
}; };
#ifdef CONFIG_ENCODERS
static void put_guid(ByteIOContext *s, const GUID *g) static void put_guid(ByteIOContext *s, const GUID *g)
{ {
int i; int i;
...@@ -661,6 +662,7 @@ static int asf_write_trailer(AVFormatContext *s) ...@@ -661,6 +662,7 @@ static int asf_write_trailer(AVFormatContext *s)
put_flush_packet(&s->pb); put_flush_packet(&s->pb);
return 0; return 0;
} }
#endif //CONFIG_ENCODERS
/**********************************/ /**********************************/
/* decoding */ /* decoding */
...@@ -1245,6 +1247,7 @@ static AVInputFormat asf_iformat = { ...@@ -1245,6 +1247,7 @@ static AVInputFormat asf_iformat = {
asf_read_seek, asf_read_seek,
}; };
#ifdef CONFIG_ENCODERS
static AVOutputFormat asf_oformat = { static AVOutputFormat asf_oformat = {
"asf", "asf",
"asf format", "asf format",
...@@ -1278,11 +1281,14 @@ static AVOutputFormat asf_stream_oformat = { ...@@ -1278,11 +1281,14 @@ static AVOutputFormat asf_stream_oformat = {
asf_write_packet, asf_write_packet,
asf_write_trailer, asf_write_trailer,
}; };
#endif //CONFIG_ENCODERS
int asf_init(void) int asf_init(void)
{ {
av_register_input_format(&asf_iformat); av_register_input_format(&asf_iformat);
#ifdef CONFIG_ENCODERS
av_register_output_format(&asf_oformat); av_register_output_format(&asf_oformat);
av_register_output_format(&asf_stream_oformat); av_register_output_format(&asf_stream_oformat);
#endif //CONFIG_ENCODERS
return 0; return 0;
} }
...@@ -39,6 +39,7 @@ static const CodecTag codec_au_tags[] = { ...@@ -39,6 +39,7 @@ static const CodecTag codec_au_tags[] = {
{ 0, 0 }, { 0, 0 },
}; };
#ifdef CONFIG_ENCODERS
/* AUDIO_FILE header */ /* AUDIO_FILE header */
static int put_au_header(ByteIOContext *pb, AVCodecContext *enc) static int put_au_header(ByteIOContext *pb, AVCodecContext *enc)
{ {
...@@ -97,6 +98,7 @@ static int au_write_trailer(AVFormatContext *s) ...@@ -97,6 +98,7 @@ static int au_write_trailer(AVFormatContext *s)
return 0; return 0;
} }
#endif //CONFIG_ENCODERS
static int au_probe(AVProbeData *p) static int au_probe(AVProbeData *p)
{ {
...@@ -187,6 +189,7 @@ static AVInputFormat au_iformat = { ...@@ -187,6 +189,7 @@ static AVInputFormat au_iformat = {
au_read_close, au_read_close,
}; };
#ifdef CONFIG_ENCODERS
static AVOutputFormat au_oformat = { static AVOutputFormat au_oformat = {
"au", "au",
"SUN AU Format", "SUN AU Format",
...@@ -199,10 +202,13 @@ static AVOutputFormat au_oformat = { ...@@ -199,10 +202,13 @@ static AVOutputFormat au_oformat = {
au_write_packet, au_write_packet,
au_write_trailer, au_write_trailer,
}; };
#endif //CONFIG_ENCODERS
int au_init(void) int au_init(void)
{ {
av_register_input_format(&au_iformat); av_register_input_format(&au_iformat);
#ifdef CONFIG_ENCODERS
av_register_output_format(&au_oformat); av_register_output_format(&au_oformat);
#endif //CONFIG_ENCODERS
return 0; return 0;
} }
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* - fill all fields if non streamed (nb_frames for example) * - fill all fields if non streamed (nb_frames for example)
*/ */
#ifdef CONFIG_ENCODERS
typedef struct AVIIentry { typedef struct AVIIentry {
unsigned int flags, pos, len; unsigned int flags, pos, len;
} AVIIentry; } AVIIentry;
...@@ -69,6 +70,7 @@ void end_tag(ByteIOContext *pb, offset_t start) ...@@ -69,6 +70,7 @@ void end_tag(ByteIOContext *pb, offset_t start)
put_le32(pb, (uint32_t)(pos - start)); put_le32(pb, (uint32_t)(pos - start));
url_fseek(pb, pos, SEEK_SET); url_fseek(pb, pos, SEEK_SET);
} }
#endif //CONFIG_ENCODERS
/* Note: when encoding, the first matching tag is used, so order is /* Note: when encoding, the first matching tag is used, so order is
important if multiple tags possible for a given codec. */ important if multiple tags possible for a given codec. */
...@@ -206,6 +208,7 @@ enum CodecID codec_get_wav_id(unsigned int tag) ...@@ -206,6 +208,7 @@ enum CodecID codec_get_wav_id(unsigned int tag)
return codec_get_id(codec_wav_tags, tag); return codec_get_id(codec_wav_tags, tag);
} }
#ifdef CONFIG_ENCODERS
/* BITMAPINFOHEADER header */ /* BITMAPINFOHEADER header */
void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const CodecTag *tags, int for_asf) void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const CodecTag *tags, int for_asf)
{ {
...@@ -720,3 +723,4 @@ int avienc_init(void) ...@@ -720,3 +723,4 @@ int avienc_init(void)
av_register_output_format(&avi_oformat); av_register_output_format(&avi_oformat);
return 0; return 0;
} }
#endif //CONFIG_ENCODERS
...@@ -100,6 +100,7 @@ int url_read(URLContext *h, unsigned char *buf, int size) ...@@ -100,6 +100,7 @@ int url_read(URLContext *h, unsigned char *buf, int size)
return ret; return ret;
} }
#ifdef CONFIG_ENCODERS
int url_write(URLContext *h, unsigned char *buf, int size) int url_write(URLContext *h, unsigned char *buf, int size)
{ {
int ret; int ret;
...@@ -111,6 +112,7 @@ int url_write(URLContext *h, unsigned char *buf, int size) ...@@ -111,6 +112,7 @@ int url_write(URLContext *h, unsigned char *buf, int size)
ret = h->prot->url_write(h, buf, size); ret = h->prot->url_write(h, buf, size);
return ret; return ret;
} }
#endif //CONFIG_ENCODERS
offset_t url_seek(URLContext *h, offset_t pos, int whence) offset_t url_seek(URLContext *h, offset_t pos, int whence)
{ {
......
...@@ -52,6 +52,7 @@ int init_put_byte(ByteIOContext *s, ...@@ -52,6 +52,7 @@ int init_put_byte(ByteIOContext *s,
} }
#ifdef CONFIG_ENCODERS
static void flush_buffer(ByteIOContext *s) static void flush_buffer(ByteIOContext *s)
{ {
if (s->buf_ptr > s->buffer) { if (s->buf_ptr > s->buffer) {
...@@ -93,6 +94,7 @@ void put_flush_packet(ByteIOContext *s) ...@@ -93,6 +94,7 @@ void put_flush_packet(ByteIOContext *s)
flush_buffer(s); flush_buffer(s);
s->must_flush = 0; s->must_flush = 0;
} }
#endif //CONFIG_ENCODERS
offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence) offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
{ {
...@@ -101,6 +103,7 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence) ...@@ -101,6 +103,7 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
if (whence != SEEK_CUR && whence != SEEK_SET) if (whence != SEEK_CUR && whence != SEEK_SET)
return -EINVAL; return -EINVAL;
#ifdef CONFIG_ENCODERS
if (s->write_flag) { if (s->write_flag) {
if (whence == SEEK_CUR) { if (whence == SEEK_CUR) {
offset1 = s->pos + (s->buf_ptr - s->buffer); offset1 = s->pos + (s->buf_ptr - s->buffer);
...@@ -122,7 +125,9 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence) ...@@ -122,7 +125,9 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
s->seek(s->opaque, offset, SEEK_SET); s->seek(s->opaque, offset, SEEK_SET);
s->pos = offset; s->pos = offset;
} }
} else { } else
#endif //CONFIG_ENCODERS
{
if (whence == SEEK_CUR) { if (whence == SEEK_CUR) {
offset1 = s->pos - (s->buf_end - s->buffer) + (s->buf_ptr - s->buffer); offset1 = s->pos - (s->buf_end - s->buffer) + (s->buf_ptr - s->buffer);
if (offset == 0) if (offset == 0)
...@@ -161,6 +166,7 @@ int url_feof(ByteIOContext *s) ...@@ -161,6 +166,7 @@ int url_feof(ByteIOContext *s)
return s->eof_reached; return s->eof_reached;
} }
#ifdef CONFIG_ENCODERS
void put_le32(ByteIOContext *s, unsigned int val) void put_le32(ByteIOContext *s, unsigned int val)
{ {
put_byte(s, val); put_byte(s, val);
...@@ -226,6 +232,7 @@ void put_tag(ByteIOContext *s, const char *tag) ...@@ -226,6 +232,7 @@ void put_tag(ByteIOContext *s, const char *tag)
put_byte(s, *tag++); put_byte(s, *tag++);
} }
} }
#endif //CONFIG_ENCODERS
/* Input stream */ /* Input stream */
...@@ -382,11 +389,15 @@ uint64_t get_be64(ByteIOContext *s) ...@@ -382,11 +389,15 @@ uint64_t get_be64(ByteIOContext *s)
/* link with avio functions */ /* link with avio functions */
#ifdef CONFIG_ENCODERS
static void url_write_packet(void *opaque, uint8_t *buf, int buf_size) static void url_write_packet(void *opaque, uint8_t *buf, int buf_size)
{ {
URLContext *h = opaque; URLContext *h = opaque;
url_write(h, buf, buf_size); 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) static int url_read_packet(void *opaque, uint8_t *buf, int buf_size)
{ {
...@@ -479,6 +490,7 @@ URLContext *url_fileno(ByteIOContext *s) ...@@ -479,6 +490,7 @@ URLContext *url_fileno(ByteIOContext *s)
return s->opaque; return s->opaque;
} }
#ifdef CONFIG_ENCODERS
/* XXX: currently size is limited */ /* XXX: currently size is limited */
int url_fprintf(ByteIOContext *s, const char *fmt, ...) int url_fprintf(ByteIOContext *s, const char *fmt, ...)
{ {
...@@ -492,6 +504,7 @@ int url_fprintf(ByteIOContext *s, const char *fmt, ...) ...@@ -492,6 +504,7 @@ int url_fprintf(ByteIOContext *s, const char *fmt, ...)
put_buffer(s, buf, strlen(buf)); put_buffer(s, buf, strlen(buf));
return ret; return ret;
} }
#endif //CONFIG_ENCODERS
/* note: unlike fgets, the EOL character is not returned and a whole /* note: unlike fgets, the EOL character is not returned and a whole
line is parsed. return NULL if first char read was EOF */ line is parsed. return NULL if first char read was EOF */
...@@ -529,6 +542,7 @@ int url_fget_max_packet_size(ByteIOContext *s) ...@@ -529,6 +542,7 @@ int url_fget_max_packet_size(ByteIOContext *s)
return s->max_packet_size; return s->max_packet_size;
} }
#ifdef CONFIG_ENCODERS
/* buffer handling */ /* buffer handling */
int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags) int url_open_buf(ByteIOContext *s, uint8_t *buf, int buf_size, int flags)
{ {
...@@ -682,3 +696,4 @@ int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer) ...@@ -682,3 +696,4 @@ int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer)
av_free(d); av_free(d);
return size; return size;
} }
#endif //CONFIG_ENCODERS
...@@ -54,6 +54,7 @@ typedef struct FFMContext { ...@@ -54,6 +54,7 @@ typedef struct FFMContext {
/* disable pts hack for testing */ /* disable pts hack for testing */
int ffm_nopts = 0; int ffm_nopts = 0;
#ifdef CONFIG_ENCODERS
static void flush_packet(AVFormatContext *s) static void flush_packet(AVFormatContext *s)
{ {
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
...@@ -273,6 +274,7 @@ static int ffm_write_trailer(AVFormatContext *s) ...@@ -273,6 +274,7 @@ static int ffm_write_trailer(AVFormatContext *s)
av_freep(&s->streams[i]->priv_data); av_freep(&s->streams[i]->priv_data);
return 0; return 0;
} }
#endif //CONFIG_ENCODERS
/* ffm demux */ /* ffm demux */
...@@ -663,6 +665,7 @@ static AVInputFormat ffm_iformat = { ...@@ -663,6 +665,7 @@ static AVInputFormat ffm_iformat = {
ffm_seek, ffm_seek,
}; };
#ifdef CONFIG_ENCODERS
static AVOutputFormat ffm_oformat = { static AVOutputFormat ffm_oformat = {
"ffm", "ffm",
"ffm format", "ffm format",
...@@ -676,10 +679,13 @@ static AVOutputFormat ffm_oformat = { ...@@ -676,10 +679,13 @@ static AVOutputFormat ffm_oformat = {
ffm_write_packet, ffm_write_packet,
ffm_write_trailer, ffm_write_trailer,
}; };
#endif //CONFIG_ENCODERS
int ffm_init(void) int ffm_init(void)
{ {
av_register_input_format(&ffm_iformat); av_register_input_format(&ffm_iformat);
#ifdef CONFIG_ENCODERS
av_register_output_format(&ffm_oformat); av_register_output_format(&ffm_oformat);
#endif //CONFIG_ENCODERS
return 0; return 0;
} }
...@@ -316,6 +316,7 @@ static int mp3_read_close(AVFormatContext *s) ...@@ -316,6 +316,7 @@ static int mp3_read_close(AVFormatContext *s)
return 0; return 0;
} }
#ifdef CONFIG_ENCODERS
/* simple formats */ /* simple formats */
static int mp3_write_header(struct AVFormatContext *s) static int mp3_write_header(struct AVFormatContext *s)
{ {
...@@ -342,6 +343,7 @@ static int mp3_write_trailer(struct AVFormatContext *s) ...@@ -342,6 +343,7 @@ static int mp3_write_trailer(struct AVFormatContext *s)
} }
return 0; return 0;
} }
#endif //CONFIG_ENCODERS
AVInputFormat mp3_iformat = { AVInputFormat mp3_iformat = {
"mp3", "mp3",
...@@ -354,6 +356,7 @@ AVInputFormat mp3_iformat = { ...@@ -354,6 +356,7 @@ AVInputFormat mp3_iformat = {
.extensions = "mp2,mp3", /* XXX: use probe */ .extensions = "mp2,mp3", /* XXX: use probe */
}; };
#ifdef CONFIG_ENCODERS
AVOutputFormat mp2_oformat = { AVOutputFormat mp2_oformat = {
"mp2", "mp2",
"MPEG audio layer 2", "MPEG audio layer 2",
...@@ -385,13 +388,16 @@ AVOutputFormat mp3_oformat = { ...@@ -385,13 +388,16 @@ AVOutputFormat mp3_oformat = {
mp3_write_trailer, mp3_write_trailer,
}; };
#endif #endif
#endif //CONFIG_ENCODERS
int mp3_init(void) int mp3_init(void)
{ {
av_register_input_format(&mp3_iformat); av_register_input_format(&mp3_iformat);
#ifdef CONFIG_ENCODERS
av_register_output_format(&mp2_oformat); av_register_output_format(&mp2_oformat);
#ifdef CONFIG_MP3LAME #ifdef CONFIG_MP3LAME
av_register_output_format(&mp3_oformat); av_register_output_format(&mp3_oformat);
#endif #endif
#endif //CONFIG_ENCODERS
return 0; return 0;
} }
...@@ -61,6 +61,7 @@ typedef struct { ...@@ -61,6 +61,7 @@ typedef struct {
#define AUDIO_ID 0xc0 #define AUDIO_ID 0xc0
#define VIDEO_ID 0xe0 #define VIDEO_ID 0xe0
#ifdef CONFIG_ENCODERS
extern AVOutputFormat mpeg1system_mux; extern AVOutputFormat mpeg1system_mux;
extern AVOutputFormat mpeg1vcd_mux; extern AVOutputFormat mpeg1vcd_mux;
extern AVOutputFormat mpeg2vob_mux; extern AVOutputFormat mpeg2vob_mux;
...@@ -396,6 +397,7 @@ static int mpeg_mux_end(AVFormatContext *ctx) ...@@ -396,6 +397,7 @@ static int mpeg_mux_end(AVFormatContext *ctx)
return 0; return 0;
} }
#endif //CONFIG_ENCODERS
/*********************************************/ /*********************************************/
/* demux code */ /* demux code */
...@@ -650,6 +652,7 @@ static int mpegps_read_close(AVFormatContext *s) ...@@ -650,6 +652,7 @@ static int mpegps_read_close(AVFormatContext *s)
return 0; return 0;
} }
#ifdef CONFIG_ENCODERS
static AVOutputFormat mpeg1system_mux = { static AVOutputFormat mpeg1system_mux = {
"mpeg", "mpeg",
"MPEG1 System format", "MPEG1 System format",
...@@ -688,6 +691,7 @@ static AVOutputFormat mpeg2vob_mux = { ...@@ -688,6 +691,7 @@ static AVOutputFormat mpeg2vob_mux = {
mpeg_mux_write_packet, mpeg_mux_write_packet,
mpeg_mux_end, mpeg_mux_end,
}; };
#endif //CONFIG_ENCODERS
AVInputFormat mpegps_demux = { AVInputFormat mpegps_demux = {
"mpeg", "mpeg",
...@@ -702,9 +706,11 @@ AVInputFormat mpegps_demux = { ...@@ -702,9 +706,11 @@ AVInputFormat mpegps_demux = {
int mpegps_init(void) int mpegps_init(void)
{ {
#ifdef CONFIG_ENCODERS
av_register_output_format(&mpeg1system_mux); av_register_output_format(&mpeg1system_mux);
av_register_output_format(&mpeg1vcd_mux); av_register_output_format(&mpeg1vcd_mux);
av_register_output_format(&mpeg2vob_mux); av_register_output_format(&mpeg2vob_mux);
#endif //CONFIG_ENCODERS
av_register_input_format(&mpegps_demux); av_register_input_format(&mpegps_demux);
return 0; return 0;
} }
...@@ -1047,6 +1047,8 @@ AVInputFormat mpegts_demux = { ...@@ -1047,6 +1047,8 @@ AVInputFormat mpegts_demux = {
int mpegts_init(void) int mpegts_init(void)
{ {
av_register_input_format(&mpegts_demux); av_register_input_format(&mpegts_demux);
#ifdef CONFIG_ENCODERS
av_register_output_format(&mpegts_mux); av_register_output_format(&mpegts_mux);
#endif
return 0; return 0;
} }
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define BOUNDARY_TAG "ffserver" #define BOUNDARY_TAG "ffserver"
#ifdef CONFIG_ENCODERS
static int mpjpeg_write_header(AVFormatContext *s) static int mpjpeg_write_header(AVFormatContext *s)
{ {
uint8_t buf1[256]; uint8_t buf1[256];
...@@ -106,3 +107,4 @@ int jpeg_init(void) ...@@ -106,3 +107,4 @@ int jpeg_init(void)
av_register_output_format(&single_jpeg_format); av_register_output_format(&single_jpeg_format);
return 0; return 0;
} }
#endif //CONFIG_ENCODERS
...@@ -133,6 +133,7 @@ static int get_length(uint64_t val){ ...@@ -133,6 +133,7 @@ static int get_length(uint64_t val){
return 7; //not reached return 7; //not reached
} }
#ifdef CONFIG_ENCODERS
static int put_v(ByteIOContext *bc, uint64_t val) static int put_v(ByteIOContext *bc, uint64_t val)
{ {
int i; int i;
...@@ -393,6 +394,7 @@ static int nut_write_trailer(AVFormatContext *s) ...@@ -393,6 +394,7 @@ static int nut_write_trailer(AVFormatContext *s)
return 0; return 0;
} }
#endif //CONFIG_ENCODERS
static int nut_probe(AVProbeData *p) static int nut_probe(AVProbeData *p)
{ {
...@@ -561,6 +563,7 @@ static AVInputFormat nut_iformat = { ...@@ -561,6 +563,7 @@ static AVInputFormat nut_iformat = {
.extensions = "nut", .extensions = "nut",
}; };
#ifdef CONFIG_ENCODERS
static AVOutputFormat nut_oformat = { static AVOutputFormat nut_oformat = {
"nut", "nut",
"nut format", "nut format",
...@@ -579,10 +582,13 @@ static AVOutputFormat nut_oformat = { ...@@ -579,10 +582,13 @@ static AVOutputFormat nut_oformat = {
nut_write_packet, nut_write_packet,
nut_write_trailer, nut_write_trailer,
}; };
#endif //CONFIG_ENCODERS
int nut_init(void) int nut_init(void)
{ {
av_register_input_format(&nut_iformat); av_register_input_format(&nut_iformat);
#ifdef CONFIG_ENCODERS
av_register_output_format(&nut_oformat); av_register_output_format(&nut_oformat);
#endif //CONFIG_ENCODERS
return 0; return 0;
} }
...@@ -30,6 +30,7 @@ typedef struct OggContext { ...@@ -30,6 +30,7 @@ typedef struct OggContext {
} OggContext ; } OggContext ;
#ifdef CONFIG_ENCODERS
static int ogg_write_header(AVFormatContext *avfcontext) static int ogg_write_header(AVFormatContext *avfcontext)
{ {
OggContext *context = avfcontext->priv_data; OggContext *context = avfcontext->priv_data;
...@@ -162,6 +163,7 @@ static AVOutputFormat ogg_oformat = { ...@@ -162,6 +163,7 @@ static AVOutputFormat ogg_oformat = {
ogg_write_packet, ogg_write_packet,
ogg_write_trailer, ogg_write_trailer,
} ; } ;
#endif //CONFIG_ENCODERS
static int next_packet(AVFormatContext *avfcontext, ogg_packet *op) { static int next_packet(AVFormatContext *avfcontext, ogg_packet *op) {
...@@ -257,7 +259,9 @@ static AVInputFormat ogg_iformat = { ...@@ -257,7 +259,9 @@ static AVInputFormat ogg_iformat = {
int ogg_init(void) { int ogg_init(void) {
#ifdef CONFIG_ENCODERS
av_register_output_format(&ogg_oformat) ; av_register_output_format(&ogg_oformat) ;
#endif
av_register_input_format(&ogg_iformat); av_register_input_format(&ogg_iformat);
return 0 ; return 0 ;
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include "avformat.h" #include "avformat.h"
#ifdef CONFIG_ENCODERS
/* simple formats */ /* simple formats */
static int raw_write_header(struct AVFormatContext *s) static int raw_write_header(struct AVFormatContext *s)
{ {
...@@ -36,6 +37,7 @@ static int raw_write_trailer(struct AVFormatContext *s) ...@@ -36,6 +37,7 @@ static int raw_write_trailer(struct AVFormatContext *s)
{ {
return 0; return 0;
} }
#endif //CONFIG_ENCODERS
/* raw input */ /* raw input */
static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap) static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
...@@ -204,6 +206,7 @@ AVInputFormat ac3_iformat = { ...@@ -204,6 +206,7 @@ AVInputFormat ac3_iformat = {
.extensions = "ac3", .extensions = "ac3",
}; };
#ifdef CONFIG_ENCODERS
AVOutputFormat ac3_oformat = { AVOutputFormat ac3_oformat = {
"ac3", "ac3",
"raw ac3", "raw ac3",
...@@ -216,6 +219,7 @@ AVOutputFormat ac3_oformat = { ...@@ -216,6 +219,7 @@ AVOutputFormat ac3_oformat = {
raw_write_packet, raw_write_packet,
raw_write_trailer, raw_write_trailer,
}; };
#endif //CONFIG_ENCODERS
AVInputFormat h263_iformat = { AVInputFormat h263_iformat = {
"h263", "h263",
...@@ -229,6 +233,7 @@ AVInputFormat h263_iformat = { ...@@ -229,6 +233,7 @@ AVInputFormat h263_iformat = {
.value = CODEC_ID_H263, .value = CODEC_ID_H263,
}; };
#ifdef CONFIG_ENCODERS
AVOutputFormat h263_oformat = { AVOutputFormat h263_oformat = {
"h263", "h263",
"raw h263", "raw h263",
...@@ -241,6 +246,7 @@ AVOutputFormat h263_oformat = { ...@@ -241,6 +246,7 @@ AVOutputFormat h263_oformat = {
raw_write_packet, raw_write_packet,
raw_write_trailer, raw_write_trailer,
}; };
#endif //CONFIG_ENCODERS
AVInputFormat m4v_iformat = { AVInputFormat m4v_iformat = {
"m4v", "m4v",
...@@ -254,6 +260,7 @@ AVInputFormat m4v_iformat = { ...@@ -254,6 +260,7 @@ AVInputFormat m4v_iformat = {
.value = CODEC_ID_MPEG4, .value = CODEC_ID_MPEG4,
}; };
#ifdef CONFIG_ENCODERS
AVOutputFormat m4v_oformat = { AVOutputFormat m4v_oformat = {
"m4v", "m4v",
"raw MPEG4 video format", "raw MPEG4 video format",
...@@ -266,6 +273,7 @@ AVOutputFormat m4v_oformat = { ...@@ -266,6 +273,7 @@ AVOutputFormat m4v_oformat = {
raw_write_packet, raw_write_packet,
raw_write_trailer, raw_write_trailer,
}; };
#endif //CONFIG_ENCODERS
AVInputFormat h264_iformat = { AVInputFormat h264_iformat = {
"h264", "h264",
...@@ -279,6 +287,7 @@ AVInputFormat h264_iformat = { ...@@ -279,6 +287,7 @@ AVInputFormat h264_iformat = {
.value = CODEC_ID_H264, .value = CODEC_ID_H264,
}; };
#ifdef CONFIG_ENCODERS
AVOutputFormat h264_oformat = { AVOutputFormat h264_oformat = {
"h264", "h264",
"raw H264 video format", "raw H264 video format",
...@@ -291,6 +300,7 @@ AVOutputFormat h264_oformat = { ...@@ -291,6 +300,7 @@ AVOutputFormat h264_oformat = {
raw_write_packet, raw_write_packet,
raw_write_trailer, raw_write_trailer,
}; };
#endif //CONFIG_ENCODERS
AVInputFormat mpegvideo_iformat = { AVInputFormat mpegvideo_iformat = {
"mpegvideo", "mpegvideo",
...@@ -303,6 +313,7 @@ AVInputFormat mpegvideo_iformat = { ...@@ -303,6 +313,7 @@ AVInputFormat mpegvideo_iformat = {
.value = CODEC_ID_MPEG1VIDEO, .value = CODEC_ID_MPEG1VIDEO,
}; };
#ifdef CONFIG_ENCODERS
AVOutputFormat mpeg1video_oformat = { AVOutputFormat mpeg1video_oformat = {
"mpeg1video", "mpeg1video",
"MPEG video", "MPEG video",
...@@ -315,6 +326,7 @@ AVOutputFormat mpeg1video_oformat = { ...@@ -315,6 +326,7 @@ AVOutputFormat mpeg1video_oformat = {
raw_write_packet, raw_write_packet,
raw_write_trailer, raw_write_trailer,
}; };
#endif //CONFIG_ENCODERS
AVInputFormat mjpeg_iformat = { AVInputFormat mjpeg_iformat = {
"mjpeg", "mjpeg",
...@@ -328,6 +340,7 @@ AVInputFormat mjpeg_iformat = { ...@@ -328,6 +340,7 @@ AVInputFormat mjpeg_iformat = {
.value = CODEC_ID_MJPEG, .value = CODEC_ID_MJPEG,
}; };
#ifdef CONFIG_ENCODERS
AVOutputFormat mjpeg_oformat = { AVOutputFormat mjpeg_oformat = {
"mjpeg", "mjpeg",
"MJPEG video", "MJPEG video",
...@@ -340,8 +353,25 @@ AVOutputFormat mjpeg_oformat = { ...@@ -340,8 +353,25 @@ AVOutputFormat mjpeg_oformat = {
raw_write_packet, raw_write_packet,
raw_write_trailer, raw_write_trailer,
}; };
#endif //CONFIG_ENCODERS
/* pcm formats */ /* 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) \ #define PCMDEF(name, long_name, ext, codec) \
AVInputFormat pcm_ ## name ## _iformat = {\ AVInputFormat pcm_ ## name ## _iformat = {\
...@@ -368,6 +398,7 @@ AVOutputFormat pcm_ ## name ## _oformat = {\ ...@@ -368,6 +398,7 @@ AVOutputFormat pcm_ ## name ## _oformat = {\
raw_write_packet,\ raw_write_packet,\
raw_write_trailer,\ raw_write_trailer,\
}; };
#endif //CONFIG_ENCODERS
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
#define BE_DEF(s) s #define BE_DEF(s) s
...@@ -444,6 +475,7 @@ AVInputFormat rawvideo_iformat = { ...@@ -444,6 +475,7 @@ AVInputFormat rawvideo_iformat = {
.value = CODEC_ID_RAWVIDEO, .value = CODEC_ID_RAWVIDEO,
}; };
#ifdef CONFIG_ENCODERS
AVOutputFormat rawvideo_oformat = { AVOutputFormat rawvideo_oformat = {
"rawvideo", "rawvideo",
"raw video format", "raw video format",
...@@ -456,7 +488,9 @@ AVOutputFormat rawvideo_oformat = { ...@@ -456,7 +488,9 @@ AVOutputFormat rawvideo_oformat = {
raw_write_packet, raw_write_packet,
raw_write_trailer, raw_write_trailer,
}; };
#endif //CONFIG_ENCODERS
#ifdef CONFIG_ENCODERS
static int null_write_packet(struct AVFormatContext *s, static int null_write_packet(struct AVFormatContext *s,
int stream_index, int stream_index,
const uint8_t *buf, int size, int64_t pts) const uint8_t *buf, int size, int64_t pts)
...@@ -481,6 +515,14 @@ AVOutputFormat null_oformat = { ...@@ -481,6 +515,14 @@ AVOutputFormat null_oformat = {
raw_write_trailer, raw_write_trailer,
.flags = AVFMT_NOFILE | AVFMT_RAWPICTURE, .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) int raw_init(void)
{ {
......
...@@ -42,6 +42,7 @@ typedef struct { ...@@ -42,6 +42,7 @@ typedef struct {
int old_format; int old_format;
} RMContext; } RMContext;
#ifdef CONFIG_ENCODERS
static void put_str(ByteIOContext *s, const char *tag) static void put_str(ByteIOContext *s, const char *tag)
{ {
put_be16(s,strlen(tag)); put_be16(s,strlen(tag));
...@@ -435,6 +436,7 @@ static int rm_write_trailer(AVFormatContext *s) ...@@ -435,6 +436,7 @@ static int rm_write_trailer(AVFormatContext *s)
put_flush_packet(pb); put_flush_packet(pb);
return 0; return 0;
} }
#endif //CONFIG_ENCODERS
/***************************************************/ /***************************************************/
...@@ -834,6 +836,7 @@ static AVInputFormat rm_iformat = { ...@@ -834,6 +836,7 @@ static AVInputFormat rm_iformat = {
rm_read_close, rm_read_close,
}; };
#ifdef CONFIG_ENCODERS
static AVOutputFormat rm_oformat = { static AVOutputFormat rm_oformat = {
"rm", "rm",
"rm format", "rm format",
...@@ -846,10 +849,13 @@ static AVOutputFormat rm_oformat = { ...@@ -846,10 +849,13 @@ static AVOutputFormat rm_oformat = {
rm_write_packet, rm_write_packet,
rm_write_trailer, rm_write_trailer,
}; };
#endif //CONFIG_ENCODERS
int rm_init(void) int rm_init(void)
{ {
av_register_input_format(&rm_iformat); av_register_input_format(&rm_iformat);
#ifdef CONFIG_ENCODERS
av_register_output_format(&rm_oformat); av_register_output_format(&rm_oformat);
#endif //CONFIG_ENCODERS
return 0; return 0;
} }
...@@ -49,6 +49,7 @@ typedef struct { ...@@ -49,6 +49,7 @@ typedef struct {
int tag; int tag;
} SWFContext; } SWFContext;
#ifdef CONFIG_ENCODERS
static void put_swf_tag(AVFormatContext *s, int tag) static void put_swf_tag(AVFormatContext *s, int tag)
{ {
SWFContext *swf = s->priv_data; SWFContext *swf = s->priv_data;
...@@ -418,6 +419,7 @@ static int swf_write_trailer(AVFormatContext *s) ...@@ -418,6 +419,7 @@ static int swf_write_trailer(AVFormatContext *s)
} }
return 0; return 0;
} }
#endif //CONFIG_ENCODERS
/***********************************/ /***********************************/
/* just to extract MP3 from swf */ /* just to extract MP3 from swf */
...@@ -551,6 +553,7 @@ static AVInputFormat swf_iformat = { ...@@ -551,6 +553,7 @@ static AVInputFormat swf_iformat = {
swf_read_close, swf_read_close,
}; };
#ifdef CONFIG_ENCODERS
static AVOutputFormat swf_oformat = { static AVOutputFormat swf_oformat = {
"swf", "swf",
"Flash format", "Flash format",
...@@ -563,10 +566,13 @@ static AVOutputFormat swf_oformat = { ...@@ -563,10 +566,13 @@ static AVOutputFormat swf_oformat = {
swf_write_packet, swf_write_packet,
swf_write_trailer, swf_write_trailer,
}; };
#endif //CONFIG_ENCODERS
int swf_init(void) int swf_init(void)
{ {
av_register_input_format(&swf_iformat); av_register_input_format(&swf_iformat);
#ifdef CONFIG_ENCODERS
av_register_output_format(&swf_oformat); av_register_output_format(&swf_oformat);
#endif //CONFIG_ENCODERS
return 0; return 0;
} }
...@@ -36,6 +36,7 @@ const CodecTag codec_wav_tags[] = { ...@@ -36,6 +36,7 @@ const CodecTag codec_wav_tags[] = {
{ 0, 0 }, { 0, 0 },
}; };
#ifdef CONFIG_ENCODERS
/* WAVEFORMATEX header */ /* WAVEFORMATEX header */
/* returns the size or -1 on error */ /* returns the size or -1 on error */
int put_wav_header(ByteIOContext *pb, AVCodecContext *enc) int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
...@@ -106,6 +107,7 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc) ...@@ -106,6 +107,7 @@ int put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
return hdrsize; return hdrsize;
} }
#endif //CONFIG_ENCODERS
/* We could be given one of the three possible structures here: /* We could be given one of the three possible structures here:
* WAVEFORMAT, PCMWAVEFORMAT or WAVEFORMATEX. Each structure * WAVEFORMAT, PCMWAVEFORMAT or WAVEFORMATEX. Each structure
...@@ -160,6 +162,7 @@ int wav_codec_get_id(unsigned int tag, int bps) ...@@ -160,6 +162,7 @@ int wav_codec_get_id(unsigned int tag, int bps)
return id; return id;
} }
#ifdef CONFIG_ENCODERS
typedef struct { typedef struct {
offset_t data; offset_t data;
} WAVContext; } WAVContext;
...@@ -217,6 +220,7 @@ static int wav_write_trailer(AVFormatContext *s) ...@@ -217,6 +220,7 @@ static int wav_write_trailer(AVFormatContext *s)
} }
return 0; return 0;
} }
#endif //CONFIG_ENCODERS
/* return the size of the found tag */ /* return the size of the found tag */
/* XXX: > 2GB ? */ /* XXX: > 2GB ? */
...@@ -325,6 +329,7 @@ static AVInputFormat wav_iformat = { ...@@ -325,6 +329,7 @@ static AVInputFormat wav_iformat = {
wav_read_close, wav_read_close,
}; };
#ifdef CONFIG_ENCODERS
static AVOutputFormat wav_oformat = { static AVOutputFormat wav_oformat = {
"wav", "wav",
"wav format", "wav format",
...@@ -337,10 +342,13 @@ static AVOutputFormat wav_oformat = { ...@@ -337,10 +342,13 @@ static AVOutputFormat wav_oformat = {
wav_write_packet, wav_write_packet,
wav_write_trailer, wav_write_trailer,
}; };
#endif //CONFIG_ENCODERS
int wav_init(void) int wav_init(void)
{ {
av_register_input_format(&wav_iformat); av_register_input_format(&wav_iformat);
#ifdef CONFIG_ENCODERS
av_register_output_format(&wav_oformat); av_register_output_format(&wav_oformat);
#endif //CONFIG_ENCODERS
return 0; return 0;
} }
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define Y4M_FRAME_MAGIC "FRAME" #define Y4M_FRAME_MAGIC "FRAME"
#define Y4M_LINE_MAX 256 #define Y4M_LINE_MAX 256
#ifdef CONFIG_ENCODERS
static int yuv4_write_header(AVFormatContext *s) static int yuv4_write_header(AVFormatContext *s)
{ {
AVStream *st; AVStream *st;
...@@ -172,6 +173,7 @@ AVOutputFormat yuv4mpegpipe_oformat = { ...@@ -172,6 +173,7 @@ AVOutputFormat yuv4mpegpipe_oformat = {
yuv4_write_trailer, yuv4_write_trailer,
.flags = AVFMT_RAWPICTURE, .flags = AVFMT_RAWPICTURE,
}; };
#endif //CONFIG_ENCODERS
/* Header size increased to allow room for optional flags */ /* Header size increased to allow room for optional flags */
#define MAX_YUV4_HEADER 80 #define MAX_YUV4_HEADER 80
...@@ -268,7 +270,9 @@ AVInputFormat yuv4mpegpipe_iformat = { ...@@ -268,7 +270,9 @@ AVInputFormat yuv4mpegpipe_iformat = {
int yuv4mpeg_init(void) int yuv4mpeg_init(void)
{ {
av_register_input_format(&yuv4mpegpipe_iformat); av_register_input_format(&yuv4mpegpipe_iformat);
#ifdef CONFIG_ENCODERS
av_register_output_format(&yuv4mpegpipe_oformat); av_register_output_format(&yuv4mpegpipe_oformat);
#endif //CONFIG_ENCODERS
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment