diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2006-11-03 02:22:23 +0300 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2006-11-03 02:22:23 +0300 |
commit | f932cdf2096d57a0f22189ca9defdf3a15d4b674 (patch) | |
tree | f9ca557b231c1e17b6572e3d3a1c72187861dd12 /libavformat | |
parent | 93481fe5fe092d2646a2ae6cccc4ffaaec5b0297 (diff) |
kill AVImageFormat
Originally committed as revision 6875 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/Makefile | 6 | ||||
-rw-r--r-- | libavformat/allformats.c | 29 | ||||
-rw-r--r-- | libavformat/allformats.h | 17 | ||||
-rw-r--r-- | libavformat/avformat.h | 47 | ||||
-rw-r--r-- | libavformat/gif.c | 13 | ||||
-rw-r--r-- | libavformat/gifdec.c | 51 | ||||
-rw-r--r-- | libavformat/utils.c | 98 |
7 files changed, 2 insertions, 259 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile index 642cbf5422..6ede844810 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -47,10 +47,6 @@ OBJS-$(CONFIG_IMAGE2_DEMUXER) += img2.o OBJS-$(CONFIG_IMAGE2PIPE_DEMUXER) += img2.o OBJS-$(CONFIG_IMAGE2_MUXER) += img2.o OBJS-$(CONFIG_IMAGE2PIPE_MUXER) += img2.o -OBJS-$(CONFIG_IMAGE_DEMUXER) += img.o -OBJS-$(CONFIG_IMAGEPIPE_DEMUXER) += img.o -OBJS-$(CONFIG_IMAGE_MUXER) += img.o -OBJS-$(CONFIG_IMAGEPIPE_MUXER) += img.o OBJS-$(CONFIG_IPMOVIE_DEMUXER) += ipmovie.o OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroska.o riff.o OBJS-$(CONFIG_MM_DEMUXER) += mm.o @@ -132,8 +128,6 @@ OBJS-$(CONFIG_WV_DEMUXER) += wv.o OBJS-$(CONFIG_YUV4MPEGPIPE_MUXER) += yuv4mpeg.o OBJS-$(CONFIG_YUV4MPEGPIPE_DEMUXER) += yuv4mpeg.o -# image formats -OBJS+= pnm.o yuv.o png.o jpeg.o gifdec.o sgi.o OBJS+= framehook.o ifeq ($(CONFIG_VIDEO4LINUX),yes) diff --git a/libavformat/allformats.c b/libavformat/allformats.c index dafbfb4e8a..5536ea9e6b 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -167,18 +167,6 @@ void av_register_all(void) #ifdef CONFIG_IMAGE2PIPE_MUXER av_register_output_format(&image2pipe_muxer); #endif -#ifdef CONFIG_IMAGE_DEMUXER - av_register_input_format(&image_demuxer); -#endif -#ifdef CONFIG_IMAGEPIPE_DEMUXER - av_register_input_format(&imagepipe_demuxer); -#endif -#ifdef CONFIG_IMAGE_MUXER - av_register_output_format(&image_muxer); -#endif -#ifdef CONFIG_IMAGEPIPE_MUXER - av_register_output_format(&imagepipe_muxer); -#endif #ifdef CONFIG_IPMOVIE_DEMUXER av_register_input_format(&ipmovie_demuxer); #endif @@ -483,23 +471,6 @@ void av_register_all(void) av_register_input_format(&tiertexseq_demuxer); #endif - /* image formats */ -#if 0 - av_register_image_format(&pnm_image_format); - av_register_image_format(&pbm_image_format); - av_register_image_format(&pgm_image_format); - av_register_image_format(&ppm_image_format); - av_register_image_format(&pam_image_format); - av_register_image_format(&pgmyuv_image_format); - av_register_image_format(&yuv_image_format); -#ifdef CONFIG_ZLIB - av_register_image_format(&png_image_format); -#endif - av_register_image_format(&jpeg_image_format); -#endif - av_register_image_format(&gif_image_format); -// av_register_image_format(&sgi_image_format); heap corruption, dont enable - #ifdef CONFIG_PROTOCOLS /* file protocols */ register_protocol(&file_protocol); diff --git a/libavformat/allformats.h b/libavformat/allformats.h index 27f0952098..a138841c9c 100644 --- a/libavformat/allformats.h +++ b/libavformat/allformats.h @@ -173,21 +173,4 @@ int redir_open(AVFormatContext **ic_ptr, ByteIOContext *f); /* rtp.c */ void av_register_rtp_dynamic_payload_handlers(); - -#if 0 -extern AVImageFormat pnm_image_format; -extern AVImageFormat pbm_image_format; -extern AVImageFormat pgm_image_format; -extern AVImageFormat ppm_image_format; -extern AVImageFormat pam_image_format; -extern AVImageFormat pgmyuv_image_format; -extern AVImageFormat yuv_image_format; -#ifdef CONFIG_ZLIB -extern AVImageFormat png_image_format; -#endif -extern AVImageFormat jpeg_image_format; -#endif -extern AVImageFormat gif_image_format; -//extern AVImageFormat sgi_image_format; //broken in itself - #endif diff --git a/libavformat/avformat.h b/libavformat/avformat.h index a1d6b3617a..c4f27f9193 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -25,8 +25,8 @@ extern "C" { #endif -#define LIBAVFORMAT_VERSION_INT ((50<<16)+(6<<8)+0) -#define LIBAVFORMAT_VERSION 50.6.0 +#define LIBAVFORMAT_VERSION_INT ((51<<16)+(6<<8)+0) +#define LIBAVFORMAT_VERSION 51.6.0 #define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT #define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) @@ -122,7 +122,6 @@ typedef struct AVFormatParameters { int width; int height; enum PixelFormat pix_fmt; - struct AVImageFormat *image_format; int channel; /* used to select dv channel */ const char *device; /* video, audio or DV device */ const char *standard; /* tv standard, NTSC, PAL, SECAM */ @@ -377,49 +376,7 @@ typedef struct AVPacketList { extern AVInputFormat *first_iformat; extern AVOutputFormat *first_oformat; -/* still image support */ -struct AVInputImageContext attribute_deprecated; -typedef struct AVInputImageContext AVInputImageContext attribute_deprecated; - -typedef struct AVImageInfo { - enum PixelFormat pix_fmt; /* requested pixel format */ - int width; /* requested width */ - int height; /* requested height */ - int interleaved; /* image is interleaved (e.g. interleaved GIF) */ - AVPicture pict; /* returned allocated image */ -} AVImageInfo attribute_deprecated; - -/* AVImageFormat.flags field constants */ -#define AVIMAGE_INTERLEAVED 0x0001 /* image format support interleaved output */ - -typedef struct AVImageFormat { - const char *name; - const char *extensions; - /* tell if a given file has a chance of being parsing by this format */ - int (*img_probe)(AVProbeData *); - /* read a whole image. 'alloc_cb' is called when the image size is - known so that the caller can allocate the image. If 'allo_cb' - returns non zero, then the parsing is aborted. Return '0' if - OK. */ - int (*img_read)(ByteIOContext *, - int (*alloc_cb)(void *, AVImageInfo *info), void *); - /* write the image */ - int supported_pixel_formats; /* mask of supported formats for output */ - int (*img_write)(ByteIOContext *, AVImageInfo *); - int flags; - struct AVImageFormat *next; -} AVImageFormat attribute_deprecated; - -void av_register_image_format(AVImageFormat *img_fmt) attribute_deprecated; -AVImageFormat *av_probe_image_format(AVProbeData *pd) attribute_deprecated; -AVImageFormat *guess_image_format(const char *filename) attribute_deprecated; enum CodecID av_guess_image2_codec(const char *filename); -int av_read_image(ByteIOContext *pb, const char *filename, - AVImageFormat *fmt, - int (*alloc_cb)(void *, AVImageInfo *info), void *opaque) attribute_deprecated; -int av_write_image(ByteIOContext *pb, AVImageFormat *fmt, AVImageInfo *img) attribute_deprecated; - -extern AVImageFormat *first_image_format attribute_deprecated; /* XXX: use automatic init with either ELF sections or C file parser */ /* modules */ diff --git a/libavformat/gif.c b/libavformat/gif.c index 03dc6dc265..1083710d5c 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -405,19 +405,6 @@ static int gif_write_trailer(AVFormatContext *s) return 0; } -/* better than nothing gif image writer */ -int gif_write(ByteIOContext *pb, AVImageInfo *info) -{ - gif_image_write_header(pb, info->width, info->height, AVFMT_NOOUTPUTLOOP, - (uint32_t *)info->pict.data[1]); - gif_image_write_image(pb, 0, 0, info->width, info->height, - info->pict.data[0], info->pict.linesize[0], - PIX_FMT_PAL8); - put_byte(pb, 0x3b); - put_flush_packet(pb); - return 0; -} - AVOutputFormat gif_muxer = { "gif", "GIF Animation", diff --git a/libavformat/gifdec.c b/libavformat/gifdec.c index c70d3d942c..692ca6466d 100644 --- a/libavformat/gifdec.c +++ b/libavformat/gifdec.c @@ -20,8 +20,6 @@ */ #include "avformat.h" -int gif_write(ByteIOContext *pb, AVImageInfo *info); - //#define DEBUG #define MAXBITS 12 @@ -144,17 +142,6 @@ static int gif_video_probe(AVProbeData * pd) return 0; } -static int gif_image_probe(AVProbeData * pd) -{ - if (pd->buf_size >= 24 && - (memcmp(pd->buf, gif87a_sig, 6) == 0 || - memcmp(pd->buf, gif89a_sig, 6) == 0)) - return AVPROBE_SCORE_MAX - 1; - else - return 0; -} - - static void GLZWDecodeInit(GifState * s, int csize) { /* read buffer */ @@ -594,33 +581,6 @@ static int gif_read_close(AVFormatContext *s1) return 0; } -/* read gif as image */ -static int gif_read(ByteIOContext *f, - int (*alloc_cb)(void *opaque, AVImageInfo *info), void *opaque) -{ - GifState s1, *s = &s1; - AVImageInfo info1, *info = &info1; - int ret; - - memset(s, 0, sizeof(GifState)); - s->f = f; - if (gif_read_header1(s) < 0) - return -1; - info->width = s->screen_width; - info->height = s->screen_height; - info->pix_fmt = PIX_FMT_PAL8; - ret = alloc_cb(opaque, info); - if (ret) - return ret; - s->image_buf = info->pict.data[0]; - s->image_linesize = info->pict.linesize[0]; - s->image_palette = (uint32_t *)info->pict.data[1]; - - if (gif_parse_next_image(s) < 0) - return -1; - return 0; -} - AVInputFormat gif_demuxer = { "gif", @@ -631,14 +591,3 @@ AVInputFormat gif_demuxer = gif_read_packet, gif_read_close, }; - -AVImageFormat gif_image_format = { - "gif", - "gif", - gif_image_probe, - gif_read, - (1 << PIX_FMT_PAL8), -#ifdef CONFIG_GIF_MUXER - gif_write, -#endif -}; diff --git a/libavformat/utils.c b/libavformat/utils.c index 52ed0185f2..78974c7e74 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -38,8 +38,6 @@ static void av_frac_set(AVFrac *f, int64_t val); AVInputFormat *first_iformat = NULL; /** head of registered output format linked list. */ AVOutputFormat *first_oformat = NULL; -/** head of registered image format linked list. */ -AVImageFormat *first_image_format = NULL; void av_register_input_format(AVInputFormat *format) { @@ -100,12 +98,6 @@ AVOutputFormat *guess_format(const char *short_name, const char *filename, return guess_format("image2", NULL, NULL); } #endif - if (!short_name && filename && - av_filename_number_test(filename) && - guess_image_format(filename)) { - return guess_format("image", NULL, NULL); - } - /* find the proper file type */ fmt_found = NULL; score_max = 0; @@ -3092,93 +3084,3 @@ static void av_frac_add(AVFrac *f, int64_t incr) } f->num = num; } - -/** - * register a new image format - * @param img_fmt Image format descriptor - */ -void av_register_image_format(AVImageFormat *img_fmt) -{ - AVImageFormat **p; - - p = &first_image_format; - while (*p != NULL) p = &(*p)->next; - *p = img_fmt; - img_fmt->next = NULL; -} - -/** - * Guesses image format based on data in the image. - */ -AVImageFormat *av_probe_image_format(AVProbeData *pd) -{ - AVImageFormat *fmt1, *fmt; - int score, score_max; - - fmt = NULL; - score_max = 0; - for(fmt1 = first_image_format; fmt1 != NULL; fmt1 = fmt1->next) { - if (fmt1->img_probe) { - score = fmt1->img_probe(pd); - if (score > score_max) { - score_max = score; - fmt = fmt1; - } - } - } - return fmt; -} - -/** - * Guesses image format based on file name extensions. - */ -AVImageFormat *guess_image_format(const char *filename) -{ - AVImageFormat *fmt1; - - for(fmt1 = first_image_format; fmt1 != NULL; fmt1 = fmt1->next) { - if (fmt1->extensions && match_ext(filename, fmt1->extensions)) - return fmt1; - } - return NULL; -} - -/** - * Read an image from a stream. - * @param gb byte stream containing the image - * @param fmt image format, NULL if probing is required - */ -int av_read_image(ByteIOContext *pb, const char *filename, - AVImageFormat *fmt, - int (*alloc_cb)(void *, AVImageInfo *info), void *opaque) -{ - uint8_t buf[PROBE_BUF_MIN]; - AVProbeData probe_data, *pd = &probe_data; - offset_t pos; - int ret; - - if (!fmt) { - pd->filename = filename; - pd->buf = buf; - pos = url_ftell(pb); - pd->buf_size = get_buffer(pb, buf, PROBE_BUF_MIN); - url_fseek(pb, pos, SEEK_SET); - fmt = av_probe_image_format(pd); - } - if (!fmt) - return AVERROR_NOFMT; - ret = fmt->img_read(pb, alloc_cb, opaque); - return ret; -} - -/** - * Write an image to a stream. - * @param pb byte stream for the image output - * @param fmt image format - * @param img image data and informations - */ -int av_write_image(ByteIOContext *pb, AVImageFormat *fmt, AVImageInfo *img) -{ - return fmt->img_write(pb, img); -} - |