[Ffmpeg-cvslog] r6875 - in trunk: ffmpeg.c ffplay.c libavformat/Makefile libavformat/allformats.c libavformat/allformats.h libavformat/avformat.h libavformat/gif.c libavformat/gifdec.c libavformat/utils.c

bcoudurier subversion
Fri Nov 3 00:22:24 CET 2006


Author: bcoudurier
Date: Fri Nov  3 00:22:23 2006
New Revision: 6875

Modified:
   trunk/ffmpeg.c
   trunk/ffplay.c
   trunk/libavformat/Makefile
   trunk/libavformat/allformats.c
   trunk/libavformat/allformats.h
   trunk/libavformat/avformat.h
   trunk/libavformat/gif.c
   trunk/libavformat/gifdec.c
   trunk/libavformat/utils.c

Log:
kill AVImageFormat

Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c	(original)
+++ trunk/ffmpeg.c	Fri Nov  3 00:22:23 2006
@@ -91,7 +91,6 @@
 
 static AVInputFormat *file_iformat;
 static AVOutputFormat *file_oformat;
-static AVImageFormat *image_format;
 static int frame_width  = 0;
 static int frame_height = 0;
 static float frame_aspect_ratio = 0;
@@ -2055,21 +2054,6 @@
 }
 #endif
 
-static void opt_image_format(const char *arg)
-{
-    AVImageFormat *f;
-
-    for(f = first_image_format; f != NULL; f = f->next) {
-        if (!strcmp(arg, f->name))
-            break;
-    }
-    if (!f) {
-        fprintf(stderr, "Unknown image format: '%s'\n", arg);
-        exit(1);
-    }
-    image_format = f;
-}
-
 static void opt_format(const char *arg)
 {
     /* compatibility stuff for pgmyuv */
@@ -2589,7 +2573,6 @@
     ap->time_base.num = frame_rate_base;
     ap->width = frame_width + frame_padleft + frame_padright;
     ap->height = frame_height + frame_padtop + frame_padbottom;
-    ap->image_format = image_format;
     ap->pix_fmt = frame_pix_fmt;
     ap->device  = grab_device;
     ap->channel = video_channel;
@@ -2716,7 +2699,6 @@
     nb_input_files++;
     file_iformat = NULL;
     file_oformat = NULL;
-    image_format = NULL;
 
     grab_device = NULL;
     video_channel = 0;
@@ -3185,7 +3167,6 @@
     }
 
     memset(ap, 0, sizeof(*ap));
-    ap->image_format = image_format;
     if (av_set_parameters(oc, ap) < 0) {
         fprintf(stderr, "%s: Invalid encoding parameters\n",
                 oc->filename);
@@ -3206,7 +3187,6 @@
     /* reset some options */
     file_oformat = NULL;
     file_iformat = NULL;
-    image_format = NULL;
 }
 
 /* prepare dummy protocols for grab */
@@ -3341,7 +3321,6 @@
 {
     AVInputFormat *ifmt;
     AVOutputFormat *ofmt;
-    AVImageFormat *image_fmt;
     URLProtocol *up;
     AVCodec *p, *p2;
     const char **pp, *last_name;
@@ -3385,18 +3364,6 @@
     }
     printf("\n");
 
-    printf("Image formats (filename extensions, if any, follow):\n");
-    for(image_fmt = first_image_format; image_fmt != NULL;
-        image_fmt = image_fmt->next) {
-        printf(
-            " %s%s %-6s %s\n",
-            image_fmt->img_read  ? "D":" ",
-            image_fmt->img_write ? "E":" ",
-            image_fmt->name,
-            image_fmt->extensions ? image_fmt->extensions:" ");
-    }
-    printf("\n");
-
     printf("Codecs:\n");
     last_name= "000";
     for(;;){
@@ -3729,7 +3696,6 @@
     { "version", 0, {(void*)show_version}, "show version" },
     { "formats", 0, {(void*)show_formats}, "show available formats, codecs, protocols, ..." },
     { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
-    { "img", HAS_ARG, {(void*)opt_image_format}, "force image format", "img_fmt" },
     { "i", HAS_ARG, {(void*)opt_input_file}, "input file name", "filename" },
     { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" },
     { "map", HAS_ARG | OPT_EXPERT, {(void*)opt_map}, "set input stream mapping", "file:stream[:syncfile:syncstream]" },

Modified: trunk/ffplay.c
==============================================================================
--- trunk/ffplay.c	(original)
+++ trunk/ffplay.c	Fri Nov  3 00:22:23 2006
@@ -185,7 +185,6 @@
 
 /* options specified by the user */
 static AVInputFormat *file_iformat;
-static AVImageFormat *image_format;
 static const char *input_filename;
 static int fs_screen_width;
 static int fs_screen_height;
@@ -1797,7 +1796,6 @@
     url_set_interrupt_cb(decode_interrupt_cb);
 
     memset(ap, 0, sizeof(*ap));
-    ap->image_format = image_format;
     ap->initial_pause = 1; /* we force a pause when starting an RTSP
                               stream */
 
@@ -2294,21 +2292,6 @@
     }
 }
 
-static void opt_image_format(const char *arg)
-{
-    AVImageFormat *f;
-
-    for(f = first_image_format; f != NULL; f = f->next) {
-        if (!strcmp(arg, f->name))
-            break;
-    }
-    if (!f) {
-        fprintf(stderr, "Unknown image format: '%s'\n", arg);
-        exit(1);
-    }
-    image_format = f;
-}
-
 #ifdef CONFIG_NETWORK
 void opt_rtp_tcp(void)
 {
@@ -2363,7 +2346,6 @@
     { "ss", HAS_ARG, {(void*)&opt_seek}, "seek to a given position in seconds", "pos" },
     { "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" },
     { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
-    { "img", HAS_ARG, {(void*)opt_image_format}, "force image format", "img_fmt" },
     { "stats", OPT_BOOL | OPT_EXPERT, {(void*)&show_status}, "show status", "" },
     { "debug", HAS_ARG | OPT_EXPERT, {(void*)opt_debug}, "print specific debug info", "" },
     { "bug", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&workaround_bugs}, "workaround bugs", "" },

Modified: trunk/libavformat/Makefile
==============================================================================
--- trunk/libavformat/Makefile	(original)
+++ trunk/libavformat/Makefile	Fri Nov  3 00:22:23 2006
@@ -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)

Modified: trunk/libavformat/allformats.c
==============================================================================
--- trunk/libavformat/allformats.c	(original)
+++ trunk/libavformat/allformats.c	Fri Nov  3 00:22:23 2006
@@ -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);

Modified: trunk/libavformat/allformats.h
==============================================================================
--- trunk/libavformat/allformats.h	(original)
+++ trunk/libavformat/allformats.h	Fri Nov  3 00:22:23 2006
@@ -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

Modified: trunk/libavformat/avformat.h
==============================================================================
--- trunk/libavformat/avformat.h	(original)
+++ trunk/libavformat/avformat.h	Fri Nov  3 00:22:23 2006
@@ -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 */

Modified: trunk/libavformat/gif.c
==============================================================================
--- trunk/libavformat/gif.c	(original)
+++ trunk/libavformat/gif.c	Fri Nov  3 00:22:23 2006
@@ -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",

Modified: trunk/libavformat/gifdec.c
==============================================================================
--- trunk/libavformat/gifdec.c	(original)
+++ trunk/libavformat/gifdec.c	Fri Nov  3 00:22:23 2006
@@ -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
-};

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	(original)
+++ trunk/libavformat/utils.c	Fri Nov  3 00:22:23 2006
@@ -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);
-}
-




More information about the ffmpeg-cvslog mailing list