diff raw.c @ 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 3d92f793fd67
children e7a8d4dd8e14
line wrap: on
line diff
--- 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)
 {