changeset 825:3cbdc6e19d7c trunk

[svn] - make this compile again
author nenolod
date Mon, 12 Mar 2007 14:37:31 -0700
parents 420eb823b2d4
children b9b0a15d0ad3
files ChangeLog src/ffmpeg/Makefile src/ffmpeg/libavformat/Makefile src/ffmpeg/libavformat/avformat.h src/ffmpeg/libavformat/grab.c src/ffmpeg/libavformat/utils.c src/ffmpeg/libavutil/common.h
diffstat 7 files changed, 198 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Mar 12 14:19:59 2007 -0700
+++ b/ChangeLog	Mon Mar 12 14:37:31 2007 -0700
@@ -1,3 +1,14 @@
+2007-03-12 21:19:59 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [1748]
+  - url_fsize support.
+  - directly link libavutil to our module
+  
+  trunk/src/ffmpeg/Makefile              |   17 +++++++++++++++--
+  trunk/src/ffmpeg/libavformat/aviobuf.c |   11 +++++++++++
+  trunk/src/ffmpeg/libavutil/Makefile    |   15 ---------------
+  3 files changed, 26 insertions(+), 17 deletions(-)
+
+
 2007-03-12 21:12:00 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [1746]
   - merge VFS support from wma plugin.
--- a/src/ffmpeg/Makefile	Mon Mar 12 14:19:59 2007 -0700
+++ b/src/ffmpeg/Makefile	Mon Mar 12 14:37:31 2007 -0700
@@ -7,7 +7,7 @@
 
 LIBDIR = $(plugindir)/$(INPUT_PLUGIN_DIR)
 
-LIBADD = ./libavformat/libavformat.a $(GTK_LIBS) $(GLIB_LIBS) $(PANGO_LIBS)
+LIBADD = $(GTK_LIBS) $(GLIB_LIBS) $(PANGO_LIBS)
 
 SOURCES = ffmpeg.c \
 	libavcodec/aasc.c \
@@ -67,6 +67,90 @@
 	libavcodec/wmadec.c \
 	libavcodec/wnv1.c \
 	libavcodec/ws-snd1.c \
+	libavformat/4xm.c \
+	libavformat/adtsenc.c \
+	libavformat/aiff.c \
+	libavformat/allformats.c \
+	libavformat/amr.c \
+	libavformat/asf-enc.c \
+	libavformat/asf.c \
+	libavformat/au.c \
+	libavformat/audio.c \
+	libavformat/avidec.c \
+	libavformat/avienc.c \
+	libavformat/avio.c \
+	libavformat/aviobuf.c \
+	libavformat/avs.c \
+	libavformat/barpainet.c \
+	libavformat/crc.c \
+	libavformat/cutils.c \
+	libavformat/daud.c \
+	libavformat/dsicin.c \
+	libavformat/electronicarts.c \
+	libavformat/ffm.c \
+	libavformat/file.c \
+	libavformat/flic.c \
+	libavformat/flvdec.c \
+	libavformat/flvenc.c \
+	libavformat/framehook.c \
+	libavformat/gif.c \
+	libavformat/gifdec.c \
+	libavformat/grab.c \
+	libavformat/gxf.c \
+	libavformat/gxfenc.c \
+	libavformat/idcin.c \
+	libavformat/idroq.c \
+	libavformat/img.c \
+	libavformat/img2.c \
+	libavformat/ipmovie.c \
+	libavformat/isom.c \
+	libavformat/jpeg.c \
+	libavformat/matroska.c \
+	libavformat/mm.c \
+	libavformat/mmf.c \
+	libavformat/mov.c \
+	libavformat/movenc.c \
+	libavformat/mp3.c \
+	libavformat/mpeg.c \
+	libavformat/mpegts.c \
+	libavformat/mpegtsenc.c \
+	libavformat/mpjpeg.c \
+	libavformat/mtv.c \
+	libavformat/mxf.c \
+	libavformat/nsvdec.c \
+	libavformat/nut.c \
+	libavformat/nuv.c \
+	libavformat/ogg.c \
+	libavformat/ogg2.c \
+	libavformat/oggparseflac.c \
+	libavformat/oggparseogm.c \
+	libavformat/oggparsetheora.c \
+	libavformat/oggparsevorbis.c \
+	libavformat/os_support.c \
+	libavformat/png.c \
+	libavformat/pnm.c \
+	libavformat/psxstr.c \
+	libavformat/raw.c \
+	libavformat/riff.c \
+	libavformat/rm.c \
+	libavformat/rtpproto.c \
+	libavformat/segafilm.c \
+	libavformat/sgi.c \
+	libavformat/sierravmd.c \
+	libavformat/smacker.c \
+	libavformat/sol.c \
+	libavformat/swf.c \
+	libavformat/tiertexseq.c \
+	libavformat/tta.c \
+	libavformat/utils.c \
+	libavformat/v4l2.c \
+	libavformat/voc.c \
+	libavformat/wav.c \
+	libavformat/wc3movie.c \
+	libavformat/westwood.c \
+	libavformat/wv.c \
+	libavformat/yuv.c \
+	libavformat/yuv4mpeg.c \
 	libavutil/adler32.c \
 	libavutil/crc.c \
 	libavutil/fifo.c \
@@ -78,12 +162,11 @@
 	libavutil/md5.c \
 	libavutil/mem.c \
 	libavutil/rational.c \
-	libavutil/softfloat.c \
-
+	libavutil/softfloat.c
 
 OBJECTS = ${SOURCES:.c=.o}
 
 CFLAGS += $(PICFLAGS) $(GTK_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) -I. -I../.. -I./libavformat \
-	-I./libavcodec -I./libavutil -std=c99 -DHAVE_AV_CONFIG_H
+	-I./libavcodec -I./libavutil -DHAVE_AV_CONFIG_H
 
 include ../../mk/objective.mk
--- a/src/ffmpeg/libavformat/Makefile	Mon Mar 12 14:19:59 2007 -0700
+++ b/src/ffmpeg/libavformat/Makefile	Mon Mar 12 14:37:31 2007 -0700
@@ -1,39 +1,4 @@
 include ../../../mk/rules.mk
 include ../../../mk/init.mk
 
-OBJECTIVE_LIBS_NOINST=	libavformat.a
-
-SOURCES = \
-4xm.c               electronicarts.c    mov.c               rm.c	\
-adtsenc.c           ffm.c               movenc.c            \
-aiff.c              file.c              mp3.c               rtpproto.c	\
-allformats.c        flic.c              mpeg.c              \
-amr.c               flvdec.c            mpegts.c            segafilm.c	\
-asf-enc.c           flvenc.c            mpegtsenc.c         sgi.c	\
-asf.c               framehook.c         mpjpeg.c            sierravmd.c	\
-au.c                gif.c               mtv.c               smacker.c	\
-audio.c             gifdec.c            mxf.c               sol.c	\
-avidec.c            grab.c              nsvdec.c            swf.c	\
-avienc.c            nut.c               \
-avio.c              gxf.c               nuv.c               tiertexseq.c\
-aviobuf.c           gxfenc.c            ogg.c               tta.c	\
-ogg2.c              \
-avs.c               idcin.c             oggparseflac.c      utils.c	\
-barpainet.c         idroq.c             oggparseogm.c       v4l2.c	\
-crc.c               img.c               oggparsetheora.c    voc.c	\
-cutils.c            img2.c              oggparsevorbis.c    wav.c	\
-daud.c              ipmovie.c           os_support.c        wc3movie.c	\
-isom.c              png.c               westwood.c	\
-dsicin.c            jpeg.c              pnm.c               wv.c	\
-matroska.c          psxstr.c            yuv.c	\
-mm.c                raw.c               yuv4mpeg.c	\
-mmf.c               riff.c
-
-CFLAGS+=	$(PICFLAGS) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -I../../.. -I../libavcodec -I../libavformat -I../libavutil -I.. -DHAVE_AV_CONFIG_H
-
-OBJECTS=${SOURCES:.c=.o}
-
 include ../../../mk/objective.mk
-
-libavformat.a: $(OBJECTS)
-	$(AR) cq $@ $(OBJECTS)
--- a/src/ffmpeg/libavformat/avformat.h	Mon Mar 12 14:19:59 2007 -0700
+++ b/src/ffmpeg/libavformat/avformat.h	Mon Mar 12 14:37:31 2007 -0700
@@ -18,6 +18,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <time.h>
+#include <stdio.h>  /* FILE */
+#include <string.h>
+
 #ifndef AVFORMAT_H
 #define AVFORMAT_H
 
@@ -37,7 +41,7 @@
 #include <time.h>
 #include <stdio.h>  /* FILE */
 #include "avcodec.h"
-
+#include "common.h"
 #include "avio.h"
 
 /* packet functions */
--- a/src/ffmpeg/libavformat/grab.c	Mon Mar 12 14:19:59 2007 -0700
+++ b/src/ffmpeg/libavformat/grab.c	Mon Mar 12 14:37:31 2007 -0700
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
+#include "common.h"
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
--- a/src/ffmpeg/libavformat/utils.c	Mon Mar 12 14:19:59 2007 -0700
+++ b/src/ffmpeg/libavformat/utils.c	Mon Mar 12 14:37:31 2007 -0700
@@ -534,6 +534,99 @@
 
 }
 
+int av_open_input_vfsfile(AVFormatContext **ic_ptr, const char *filename, VFSFile *fd,
+                       AVInputFormat *fmt,
+                       int buf_size,
+                       AVFormatParameters *ap)
+{
+    int err, must_open_file, file_opened, probe_size;
+    AVProbeData probe_data, *pd = &probe_data;
+    ByteIOContext pb1, *pb = &pb1;
+
+    file_opened = 0;
+    pd->filename = "";
+    if (filename)
+        pd->filename = filename;
+    pd->buf = NULL;
+    pd->buf_size = 0;
+
+    if (!fmt) {
+        /* guess format if no file can be opened  */
+        fmt = av_probe_input_format(pd, 0);
+    }
+
+    /* do not open file if the format does not need it. XXX: specific
+       hack needed to handle RTSP/TCP */
+    must_open_file = 1;
+    if (fmt && (fmt->flags & AVFMT_NOFILE)) {
+        must_open_file = 0;
+        pb= NULL; //FIXME this or memset(pb, 0, sizeof(ByteIOContext)); otherwise its uninitalized
+    }
+
+    if (!fmt || must_open_file) {
+        /* if no file needed do not try to open one */
+        if (url_vfdopen(pb, fd) < 0) {
+            err = AVERROR_IO;
+            goto fail;
+        }
+        file_opened = 1;
+        if (buf_size > 0) {
+            url_setbufsize(pb, buf_size);
+        }
+
+        for(probe_size= PROBE_BUF_MIN; probe_size<=PROBE_BUF_MAX && !fmt; probe_size<<=1){
+            /* read probe data */
+            pd->buf= av_realloc(pd->buf, probe_size);
+            pd->buf_size = get_buffer(pb, pd->buf, probe_size);
+            if (url_fseek(pb, 0, SEEK_SET) == (offset_t)-EPIPE) {
+                url_fclose(pb);
+                if (url_fopen(pb, filename, URL_RDONLY) < 0) {
+                    file_opened = 0;
+                    err = AVERROR_IO;
+                    goto fail;
+                }
+            }
+            /* guess file format */
+            fmt = av_probe_input_format(pd, 1);
+        }
+        av_freep(&pd->buf);
+    }
+
+    /* if still no format found, error */
+    if (!fmt) {
+        err = AVERROR_NOFMT;
+        goto fail;
+    }
+
+    /* XXX: suppress this hack for redirectors */
+#ifdef CONFIG_NETWORK
+    if (fmt == &redir_demuxer) {
+        err = redir_open(ic_ptr, pb);
+        url_fclose(pb);
+        return err;
+    }
+#endif
+
+    /* check filename in case of an image number is expected */
+    if (fmt->flags & AVFMT_NEEDNUMBER) {
+        if (!av_filename_number_test(filename)) {
+            err = AVERROR_NUMEXPECTED;
+            goto fail;
+        }
+    }
+    err = av_open_input_stream(ic_ptr, pb, filename, fmt, ap);
+    if (err)
+        goto fail;
+    return 0;
+ fail:
+    av_freep(&pd->buf);
+    if (file_opened)
+        url_fclose(pb);
+    *ic_ptr = NULL;
+    return err;
+
+}
+
 /*******************************************************/
 
 /**
--- a/src/ffmpeg/libavutil/common.h	Mon Mar 12 14:19:59 2007 -0700
+++ b/src/ffmpeg/libavutil/common.h	Mon Mar 12 14:37:31 2007 -0700
@@ -33,7 +33,7 @@
 #ifdef HAVE_AV_CONFIG_H
 /* only include the following when compiling package */
 #    include "config.h"
-
+#    include <time.h>
 #    include <stdlib.h>
 #    include <stdio.h>
 #    include <string.h>