# HG changeset patch # User bcoudurier # Date 1162509743 0 # Node ID 74cb68ad9dce20ed475d2b22add3b2bf4f4a4f61 # Parent 404048ea11bcf321a87ce51180f6f51e8518a9d0 kill AVImageFormat diff -r 404048ea11bc -r 74cb68ad9dce Makefile --- a/Makefile Wed Nov 01 22:39:58 2006 +0000 +++ b/Makefile Thu Nov 02 23:22:23 2006 +0000 @@ -47,10 +47,6 @@ 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_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 -r 404048ea11bc -r 74cb68ad9dce allformats.c --- a/allformats.c Wed Nov 01 22:39:58 2006 +0000 +++ b/allformats.c Thu Nov 02 23:22:23 2006 +0000 @@ -167,18 +167,6 @@ #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 @@ 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 -r 404048ea11bc -r 74cb68ad9dce allformats.h --- a/allformats.h Wed Nov 01 22:39:58 2006 +0000 +++ b/allformats.h Thu Nov 02 23:22:23 2006 +0000 @@ -173,21 +173,4 @@ /* 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 -r 404048ea11bc -r 74cb68ad9dce avformat.h --- a/avformat.h Wed Nov 01 22:39:58 2006 +0000 +++ b/avformat.h Thu Nov 02 23:22:23 2006 +0000 @@ -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 @@ 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 @@ 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 -r 404048ea11bc -r 74cb68ad9dce gif.c --- a/gif.c Wed Nov 01 22:39:58 2006 +0000 +++ b/gif.c Thu Nov 02 23:22:23 2006 +0000 @@ -405,19 +405,6 @@ 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 -r 404048ea11bc -r 74cb68ad9dce gifdec.c --- a/gifdec.c Wed Nov 01 22:39:58 2006 +0000 +++ b/gifdec.c Thu Nov 02 23:22:23 2006 +0000 @@ -20,8 +20,6 @@ */ #include "avformat.h" -int gif_write(ByteIOContext *pb, AVImageInfo *info); - //#define DEBUG #define MAXBITS 12 @@ -144,17 +142,6 @@ 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 @@ 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 @@ 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 -r 404048ea11bc -r 74cb68ad9dce utils.c --- a/utils.c Wed Nov 01 22:39:58 2006 +0000 +++ b/utils.c Thu Nov 02 23:22:23 2006 +0000 @@ -38,8 +38,6 @@ 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 @@ 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 @@ } 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); -} -