aboutsummaryrefslogtreecommitdiffstats
path: root/multimedia
diff options
context:
space:
mode:
authorlioux <lioux@FreeBSD.org>2002-10-12 03:28:30 +0800
committerlioux <lioux@FreeBSD.org>2002-10-12 03:28:30 +0800
commit360b2dc1a40ea3071627ed3a0717e071e5b6c6dd (patch)
tree2c49729f6416f72b31452bacf8febeb30053164d /multimedia
parentc3438118e8f83e77aecfdc74a4a38ecab98ee857 (diff)
downloadfreebsd-ports-gnome-360b2dc1a40ea3071627ed3a0717e071e5b6c6dd.tar.gz
freebsd-ports-gnome-360b2dc1a40ea3071627ed3a0717e071e5b6c6dd.tar.zst
freebsd-ports-gnome-360b2dc1a40ea3071627ed3a0717e071e5b6c6dd.zip
o Update ffmpeg to CVS snapshot dated Aug 20, 2002. Bump PORTREVISION
since this is unversioned. o Add booktree capture support with patches kindly supplied by "Steve O'Hara-Smith" <steve@sohara.org>. Work is in progress to get these merged back into ffmpeg's CVS repo o Add WITH_MP3 for lame mp3 support o Add WITH_VORBIS for vorbis support o Install shared library for the first time, begin versioning at 0 Reviewed by: freebsd-multimedia mailing list, "Steve O'Hara-Smith" <steve@sohara.org>, Anish Mistry <mistry.7@osu.edu>
Diffstat (limited to 'multimedia')
-rw-r--r--multimedia/ffmpeg-devel/Makefile98
-rw-r--r--multimedia/ffmpeg-devel/distinfo2
-rw-r--r--multimedia/ffmpeg-devel/files/extra-bktr-patch-ffmpeg.c35
-rw-r--r--multimedia/ffmpeg-devel/files/grab_bsdbktr.c248
-rw-r--r--multimedia/ffmpeg-devel/files/patch-Makefile50
-rw-r--r--multimedia/ffmpeg-devel/files/patch-ffmpeg.c35
-rw-r--r--multimedia/ffmpeg-devel/files/patch-ffserver.c16
-rw-r--r--multimedia/ffmpeg-devel/files/patch-libav::Makefile29
-rw-r--r--multimedia/ffmpeg-devel/files/patch-libav::avformat.h9
-rw-r--r--multimedia/ffmpeg-devel/files/patch-libavcodec::Makefile27
-rw-r--r--multimedia/ffmpeg-devel/pkg-plist18
-rw-r--r--multimedia/ffmpeg/Makefile98
-rw-r--r--multimedia/ffmpeg/distinfo2
-rw-r--r--multimedia/ffmpeg/files/extra-bktr-patch-ffmpeg.c35
-rw-r--r--multimedia/ffmpeg/files/grab_bsdbktr.c248
-rw-r--r--multimedia/ffmpeg/files/patch-Makefile50
-rw-r--r--multimedia/ffmpeg/files/patch-ffmpeg.c35
-rw-r--r--multimedia/ffmpeg/files/patch-ffserver.c16
-rw-r--r--multimedia/ffmpeg/files/patch-libav::Makefile29
-rw-r--r--multimedia/ffmpeg/files/patch-libav::avformat.h9
-rw-r--r--multimedia/ffmpeg/files/patch-libavcodec::Makefile27
-rw-r--r--multimedia/ffmpeg/pkg-plist18
-rw-r--r--multimedia/ffmpeg045/Makefile98
-rw-r--r--multimedia/ffmpeg045/distinfo2
-rw-r--r--multimedia/ffmpeg045/files/grab_bsdbktr.c248
-rw-r--r--multimedia/ffmpeg045/files/patch-Makefile50
-rw-r--r--multimedia/ffmpeg045/files/patch-ffmpeg.c35
-rw-r--r--multimedia/ffmpeg045/files/patch-ffserver.c16
-rw-r--r--multimedia/ffmpeg045/files/patch-libav::Makefile29
-rw-r--r--multimedia/ffmpeg045/files/patch-libav::avformat.h9
-rw-r--r--multimedia/ffmpeg045/files/patch-libavcodec::Makefile27
-rw-r--r--multimedia/ffmpeg045/pkg-plist18
32 files changed, 1436 insertions, 230 deletions
diff --git a/multimedia/ffmpeg-devel/Makefile b/multimedia/ffmpeg-devel/Makefile
index 77f823afa071..234c5083b7f5 100644
--- a/multimedia/ffmpeg-devel/Makefile
+++ b/multimedia/ffmpeg-devel/Makefile
@@ -7,10 +7,10 @@
PORTNAME= ffmpeg
PORTVERSION= 0.4.5
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= graphics
-MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
-MASTER_SITE_SUBDIR= ${PORTNAME}
+MASTER_SITES= http://ffmpeg.sourceforge.net/
+DISTNAME= ffmpeg-cvs
MAINTAINER= lioux@FreeBSD.org
@@ -23,31 +23,100 @@ ONLY_FOR_ARCHS= i386
HAS_CONFIGURE= yes
USE_GMAKE= yes
USE_REINPLACE= yes
-MAKE_ARGS= MAKE="${GMAKE}" LOCALBASE="${LOCALBASE}"
CONFIGURE_ARGS= --cc="${CC}" --prefix="${PREFIX}" \
- --disable-grab
+ --make="${GMAKE}" --enable-shared \
+ --extra-cflags="-I${LOCALBASE}/include" \
+ --extra-libs="-L${LOCALBASE}/lib"
+PLIST_SUB= SHLIB_VERSION=${SHLIB_VERSION}
+INSTALLS_SHLIB= yes
-DOC_FILES= README
+SHLIB_VERSION= 0
+#
+DOC_FILES= COPYING Changelog README VERSION
# under subdir doc
DOC_DOCFILES= FAQ README.dev README.tech \
TODO bench.txt ffmpeg.txt \
+ HOWTO-STREAM README.beos \
ffserver.txt
HEADER_FILES= libavcodec/avcodec.h libavcodec/common.h \
libavcodec/dsputil.h
-LIB_FILES= libav/libav.a libavcodec/libavcodec.a
+LIB_FILES= libavcodec/libavcodec.a libav/libavformat.a
+
+.include <bsd.port.pre.mk>
+
+## lib detection
+##
+## lame mp3
+.if exists(${LOCALBASE}/lib/libmp3lame.so.0)
+WITH_MP3=yes
+.endif
+## vorbis
+.if exists(${LOCALBASE}/lib/libvorbisenc.so.2)
+WITH_VORBIS=yes
+.endif
+## support activation
+##
+## disable mmx
.ifdef(WITHOUT_MMX)
CONFIGURE_ARGS+= --disable-mmx
.endif
+## mp3
+.ifdef(WITH_MP3)
+LIB_DEPENDS+= mp3lame.0:${PORTSDIR}/audio/lame
+
+CONFIGURE_ARGS+= --enable-mp3lame
+.endif
+## vorbis
+.ifdef(WITH_VORBIS)
+LIB_DEPENDS+= vorbisenc.2:${PORTSDIR}/audio/libvorbis
+
+CONFIGURE_ARGS+= --enable-vorbis
+.endif
-.ifndef(WITHOUT_MMX)
pre-everything::
+.ifndef(WITHOUT_MMX)
@${ECHO_MSG} "Define WITHOUT_MMX if your system does not support MMX"
.endif
+.ifndef(WITH_MP3)
+ @${ECHO_MSG} 'Define WITH_MP3 to enable lame MP3 codec'
+.endif
+.ifndef(WITH_VORBIS)
+ @${ECHO_MSG} 'Define WITH_VORBIS to enable libvorbisenc VORBIS codec'
+.endif
+.if !(defined(WITH_BKTR_FORMAT) && defined(WITH_BKTR_DEV))
+ @${ECHO_MSG}
+ @${ECHO_MSG} 'If you want to capture from a bktr(4) supported card'
+ @${ECHO_MSG} 'you will probably need to set the input device and format'
+ @${ECHO_MSG} 'You can set WITH_BKTR_FORMAT to NTSC or PAL and you can set'
+ @${ECHO_MSG} 'WITH_BKTR_DEV to 0, 1, 2 or 3 (1 is usually the tuner)'
+ @${ECHO_MSG} 'so for a PAL tuner make WITH_BKTR_FORMAT=PAL WITH_BKTR_DEV=1'
+ @${ECHO_MSG}
+ @${ECHO_MSG} 'Warning: invalid settings will probably dump cores'
+ @${ECHO_MSG}
+.endif
+
+post-extract:
+# install booktree extension
+ @${CP} ${FILESDIR}/grab_bsdbktr.c ${WRKSRC}/libav/
post-patch:
@${REINPLACE_CMD} -e "s!/etc/ffserver.conf!${PREFIX}/etc/ffserver.conf!g" \
${WRKSRC}/ffserver.c
+# malloc.h was deprecated in favor of stdlib.h
+ @${FIND} ${WRKSRC} -type f | \
+ ${XARGS} -n 10 ${REINPLACE_CMD} -e \
+ 's|malloc.h|stdlib.h|'
+.ifdef(WITH_BKTR_FORMAT)
+ @${REINPLACE_CMD} -e \
+ "s!VIDEO_FORMAT NTSC!VIDEO_FORMAT ${WITH_BKTR_FORMAT}!" \
+ ${WRKSRC}/libav/grab_bsdbktr.c
+.endif
+.ifdef(WITH_BKTR_DEV)
+ @${REINPLACE_CMD} -e \
+ "s!VIDEO_INPUT METEOR_INPUT_DEV0!VIDEO_INPUT METEOR_INPUT_DEV${WITH_BKTR_DEV}!" \
+ ${WRKSRC}/libav/grab_bsdbktr.c
+.endif
post-install:
.ifndef(NOPORTDOCS)
@@ -63,13 +132,18 @@ post-install:
${PREFIX}/etc/ffserver.conf.sample
.for file in ${HEADER_FILES}
# fix header references prior to installation
- @${REINPLACE_CMD} -e 's|"common.h"|<libavcodec/common.h>|' \
+ @${REINPLACE_CMD} -e 's|"common.h"|<ffmpeg/common.h>|; \
+ s|"avcodec.h"|<ffmpeg/avcodec.h>|' \
${WRKSRC}/${file}
- @${MKDIR} ${PREFIX}/include/${file:H}
- @${INSTALL_DATA} ${WRKSRC}/${file} ${PREFIX}/include/${file}
+ @${INSTALL_DATA} ${WRKSRC}/${file} \
+ ${PREFIX}/include/ffmpeg/${file:T}
.endfor
.for file in ${LIB_FILES}
@${INSTALL_DATA} ${WRKSRC}/${file} ${PREFIX}/lib/${file:T}
.endfor
+# add shared lib link
+ @${LN} -sf libavcodec.so \
+ ${PREFIX}/lib/libavcodec.so.${SHLIB_VERSION}
+
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/multimedia/ffmpeg-devel/distinfo b/multimedia/ffmpeg-devel/distinfo
index 976716f02573..5830545317e7 100644
--- a/multimedia/ffmpeg-devel/distinfo
+++ b/multimedia/ffmpeg-devel/distinfo
@@ -1 +1 @@
-MD5 (ffmpeg-0.4.5.tar.gz) = 04e140b29ad8a9f88c2d3fb9e998f883
+MD5 (ffmpeg-cvs.tar.gz) = 1529544a5d5f9c2891be1f53b39510dd
diff --git a/multimedia/ffmpeg-devel/files/extra-bktr-patch-ffmpeg.c b/multimedia/ffmpeg-devel/files/extra-bktr-patch-ffmpeg.c
index 093e99aed89b..2242cdb60be1 100644
--- a/multimedia/ffmpeg-devel/files/extra-bktr-patch-ffmpeg.c
+++ b/multimedia/ffmpeg-devel/files/extra-bktr-patch-ffmpeg.c
@@ -1,10 +1,37 @@
---- ffmpeg.c.orig Mon Aug 13 18:23:57 2001
-+++ ffmpeg.c Tue Sep 25 14:47:58 2001
-@@ -35,6 +35,7 @@
+--- ffmpeg.c.orig Thu Oct 10 20:13:52 2002
++++ ffmpeg.c Thu Oct 10 20:14:03 2002
+@@ -36,6 +36,7 @@
+ #include <ctype.h>
- #include "avformat.h"
+#define INT64_C(x) x##LL
#define MAXINT64 INT64_C(0x7fffffffffffffff)
typedef struct {
+@@ -146,7 +147,7 @@
+ const char *audio_device = "none";
+ #endif
+ #ifndef CONFIG_VIDEO4LINUX
+-const char *v4l_device = "none";
++const char *video_device = "none";
+ #endif
+
+ typedef struct AVOutputStream {
+@@ -1601,7 +1602,7 @@
+
+ void opt_video_device(const char *arg)
+ {
+- v4l_device = strdup(arg);
++ video_device = strdup(arg);
+ }
+
+ void opt_audio_device(const char *arg)
+@@ -2099,7 +2100,7 @@
+ /* by now video grab has one stream */
+ ic->streams[0]->r_frame_rate = ap->frame_rate;
+ input_files[nb_input_files] = ic;
+- dump_format(ic, nb_input_files, v4l_device, 0);
++ dump_format(ic, nb_input_files, video_device, 0);
+ nb_input_files++;
+ }
+ if (has_audio) {
diff --git a/multimedia/ffmpeg-devel/files/grab_bsdbktr.c b/multimedia/ffmpeg-devel/files/grab_bsdbktr.c
new file mode 100644
index 000000000000..6f171ea7b3a9
--- /dev/null
+++ b/multimedia/ffmpeg-devel/files/grab_bsdbktr.c
@@ -0,0 +1,248 @@
+/*
+ * FreeBSD video grab interface
+ * Copyright (c) 2002 Steve O'Hara-Smith
+ * based on
+ * Linux video grab interface
+ * Copyright (c) 2000,2001 Gerard Lantau.
+ * and
+ * simple_grab.c Copyright (c) 1999 Roger Hardiman
+ *
+ * GPL virus inherited:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include "avformat.h"
+#include <machine/ioctl_meteor.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <signal.h>
+
+typedef struct {
+ int fd;
+ int tuner_fd;
+ int frame_format; /* see VIDEO_PALETTE_xxx */
+ int width, height;
+ int frame_rate;
+ int frame_size;
+} VideoData;
+
+const char *video_device = "/dev/bktr0";
+
+#define GRABBER_SETTLE_TIME 3
+#define PAL 1
+#define NTSC 2
+/* PAL is 768 x 576. NTSC is 640 x 480 */
+#define PAL_HEIGHT 576
+#define NTSC_HEIGHT 480
+
+#ifndef VIDEO_FORMAT
+#define VIDEO_FORMAT NTSC
+#endif
+
+#ifndef VIDEO_INPUT
+#define VIDEO_INPUT METEOR_INPUT_DEV0;
+#endif
+
+static UINT8 *video_buf;
+
+static void catchsignal(int signal)
+{
+ return;
+}
+
+static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
+{
+ VideoData *s = s1->priv_data;
+ int width, height;
+ int video_fd;
+ int format = VIDEO_FORMAT;
+ struct meteor_geomet geo;
+ int c;
+ struct sigaction act,old;
+
+ memset(&act,0,sizeof(act));
+ sigemptyset(&act.sa_mask);
+ act.sa_handler = catchsignal;
+ sigaction(SIGUSR1,&act,&old);
+ sigaction(SIGALRM,&act,&old);
+
+ width = s->width;
+ height = s->height;
+
+ s->tuner_fd = open ("/dev/tuner0", O_RDWR);
+
+ video_fd = open(video_device, O_RDWR);
+ if (video_fd < 0) {
+ perror(video_device);
+ return -EIO;
+ }
+ s->fd=video_fd;
+ geo.rows = height;
+ geo.columns = width;
+ geo.frames = 1;
+ geo.oformat = METEOR_GEO_YUV_PACKED; // RGB
+ if ((format == PAL) && (height <= (PAL_HEIGHT/2)))
+ geo.oformat |= METEOR_GEO_ODD_ONLY;
+ if ((format == NTSC) && (height <= (NTSC_HEIGHT/2)))
+ geo.oformat |= METEOR_GEO_ODD_ONLY;
+
+ if (ioctl(video_fd, METEORSETGEO, &geo) < 0) {
+ perror ("METEORSETGEO");
+ return -EIO;
+ }
+
+ switch (format) {
+ case PAL: c = METEOR_FMT_PAL; break;
+ case NTSC: c = METEOR_FMT_NTSC; break;
+ default: c = METEOR_FMT_PAL; break;
+ }
+
+ if (ioctl(video_fd, METEORSFMT, &c) < 0) {
+ perror ("METEORSFMT");
+ return -EIO;
+ }
+
+ c = VIDEO_INPUT;
+ if (ioctl(video_fd, METEORSINPUT, &c) < 0) {
+ perror ("METEORSINPUT");
+ return -EIO;
+ }
+ video_buf = mmap((caddr_t)0, width*height*2, PROT_READ, MAP_SHARED, // RGB
+ video_fd, (off_t) 0);
+ if (video_buf == MAP_FAILED) {
+ perror ("mmap");
+ return -EIO;
+ }
+ c = METEOR_CAP_CONTINOUS;
+ ioctl(s->fd, METEORCAPTUR, &c);
+ c = SIGUSR1;
+ ioctl (s->fd, METEORSSIGNAL, &c);
+ return 0;
+}
+
+static void bf_yuv422_to_yuv420p(UINT8 *lum, UINT8 *cb, UINT8 *cr,
+ UINT8 *src, int width, int height)
+{
+ int x, y;
+ UINT8 *p = src;
+ for(y=0;y<height;y+=2) {
+ for(x=0;x<width;x+=2) {
+ lum[0] = p[1];
+ cb[0] = p[0];
+ lum[1] = p[3];
+ cr[0] = p[2];
+ p += 4;
+ lum += 2;
+ cb++;
+ cr++;
+ }
+ for(x=0;x<width;x+=2) {
+ lum[0] = p[1];
+ lum[1] = p[3];
+ p += 4;
+ lum += 2;
+ }
+ }
+}
+
+/* note: we support only one picture read at a time */
+static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
+{
+ VideoData *s = s1->priv_data;
+ int size, halfsize;
+ sigset_t msig;
+ UINT8 *lum, *cb, *cr;
+
+ size = s->width * s->height;
+ halfsize = size << 1;
+ if (av_new_packet(pkt, size + halfsize) < 0)
+ return -EIO;
+
+ sigemptyset (&msig);
+ sigsuspend (&msig);
+
+ lum = pkt->data;
+ cb = lum + size;
+ cr = cb + size/4;
+
+ bf_yuv422_to_yuv420p (lum, cb, cr, video_buf, s->width, s->height);
+
+ return size + halfsize;
+}
+
+static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap)
+{
+ VideoData *s = s1->priv_data;
+ AVStream *st;
+ int width, height;
+ int frame_rate;
+
+ if (!ap || ap->width <= 0 || ap->height <= 0 || ap->frame_rate <= 0)
+ return -1;
+
+ width = ap->width;
+ height = ap->height;
+ frame_rate = ap->frame_rate;
+ st = av_new_stream(s1, 0);
+ if (!st)
+ return -ENOMEM;
+ s1->priv_data = s;
+ s1->nb_streams = 1;
+ s1->streams[0] = st;
+
+ s->width = width;
+ s->height = height;
+ s->frame_rate = frame_rate;
+ s->frame_size = width*height*2; /*RGB*/
+ st->codec.pix_fmt = PIX_FMT_YUV420P;
+ st->codec.codec_id = CODEC_ID_RAWVIDEO;
+ st->codec.width = width;
+ st->codec.height = height;
+ st->codec.frame_rate = frame_rate;
+
+ return bktr_init(s1, ap);
+}
+
+static int grab_read_close (AVFormatContext *s1)
+{
+ VideoData *s = s1->priv_data;
+
+ int c = METEOR_CAP_STOP_CONT;
+ ioctl(s->fd, METEORCAPTUR, &c);
+ close(s->fd);
+ close(s->tuner_fd);
+ free(s);
+ return 0;
+}
+
+AVInputFormat video_grab_device_format = {
+ "video_grab_device",
+ "video grab",
+ sizeof(VideoData),
+ NULL,
+ grab_read_header,
+ grab_read_packet,
+ grab_read_close,
+ flags: AVFMT_NOFILE,
+};
+
+int video_grab_init(void)
+{
+ av_register_input_format(&video_grab_device_format);
+ return 0;
+}
diff --git a/multimedia/ffmpeg-devel/files/patch-Makefile b/multimedia/ffmpeg-devel/files/patch-Makefile
index 2aaebddaa06f..eebc45c27552 100644
--- a/multimedia/ffmpeg-devel/files/patch-Makefile
+++ b/multimedia/ffmpeg-devel/files/patch-Makefile
@@ -1,30 +1,26 @@
---- Makefile.orig Wed Aug 15 10:11:45 2001
-+++ Makefile Tue Sep 25 15:10:12 2001
-@@ -3,8 +3,8 @@
- #
- include config.mak
+--- Makefile.orig Sun Sep 1 15:07:34 2002
++++ Makefile Tue Oct 8 13:51:49 2002
+@@ -6,12 +6,12 @@
--CFLAGS= $(OPTFLAGS) -Wall -g -I./libavcodec -I./libav
--LDFLAGS= -g
-+CFLAGS= $(OPTFLAGS) -Wall -I./libavcodec -I./libav -I$(LOCALBASE)/include
-+LDFLAGS= -L$(LOCALBASE)/lib
- ifeq ($(TARGET_GPROF),yes)
- CFLAGS+=-p
- LDFLAGS+=-p
-@@ -19,13 +19,13 @@
- $(MAKE) -C libav all
+ VPATH=$(SRC_PATH)
- ffmpeg: ffmpeg.o libav/libav.a libavcodec/libavcodec.a
-- gcc $(LDFLAGS) -o $@ $^ -lm
-+ $(CC) $(LDFLAGS) -o $@ $^ -lm
+-CFLAGS= $(OPTFLAGS) -Wall -g -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libav -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
++CFLAGS= $(OPTFLAGS) -Wall -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libav -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+ ifeq ($(CONFIG_DARWIN),yes)
+ LDFLAGS+= -g -d
+ FFSLDFLAGS= -Wl,-bind_at_load
+ else
+-LDFLAGS+= -g -Wl,--warn-common
++LDFLAGS+= -Wl,--warn-common
+ FFSLDFLAGS= -Wl,-E
+ endif
+
+@@ -60,7 +60,7 @@
+ ffserver$(EXE): ffserver.o $(DEP_LIBS)
+ $(CC) $(LDFLAGS) $(FFSLDFLAGS) \
+ -o $@ ffserver.o -L./libavcodec -L./libav \
+- -lavformat -lavcodec -ldl $(EXTRALIBS)
++ -lavformat -lavcodec $(EXTRALIBS)
- ffserver: ffserver.o libav/libav.a libavcodec/libavcodec.a
-- gcc $(LDFLAGS) -o $@ $^ -lm
-+ $(CC) $(LDFLAGS) -o $@ $^ -lm -lgnugetopt
-
- %.o: %.c
-- gcc $(CFLAGS) -c -o $@ $<
-+ $(CC) $(CFLAGS) -c -o $@ $<
-
- install: all
- install -s -m 755 $(PROG) $(prefix)/bin
+ ffplay: ffmpeg$(EXE)
+ ln -sf $< $@
diff --git a/multimedia/ffmpeg-devel/files/patch-ffmpeg.c b/multimedia/ffmpeg-devel/files/patch-ffmpeg.c
index 093e99aed89b..2242cdb60be1 100644
--- a/multimedia/ffmpeg-devel/files/patch-ffmpeg.c
+++ b/multimedia/ffmpeg-devel/files/patch-ffmpeg.c
@@ -1,10 +1,37 @@
---- ffmpeg.c.orig Mon Aug 13 18:23:57 2001
-+++ ffmpeg.c Tue Sep 25 14:47:58 2001
-@@ -35,6 +35,7 @@
+--- ffmpeg.c.orig Thu Oct 10 20:13:52 2002
++++ ffmpeg.c Thu Oct 10 20:14:03 2002
+@@ -36,6 +36,7 @@
+ #include <ctype.h>
- #include "avformat.h"
+#define INT64_C(x) x##LL
#define MAXINT64 INT64_C(0x7fffffffffffffff)
typedef struct {
+@@ -146,7 +147,7 @@
+ const char *audio_device = "none";
+ #endif
+ #ifndef CONFIG_VIDEO4LINUX
+-const char *v4l_device = "none";
++const char *video_device = "none";
+ #endif
+
+ typedef struct AVOutputStream {
+@@ -1601,7 +1602,7 @@
+
+ void opt_video_device(const char *arg)
+ {
+- v4l_device = strdup(arg);
++ video_device = strdup(arg);
+ }
+
+ void opt_audio_device(const char *arg)
+@@ -2099,7 +2100,7 @@
+ /* by now video grab has one stream */
+ ic->streams[0]->r_frame_rate = ap->frame_rate;
+ input_files[nb_input_files] = ic;
+- dump_format(ic, nb_input_files, v4l_device, 0);
++ dump_format(ic, nb_input_files, video_device, 0);
+ nb_input_files++;
+ }
+ if (has_audio) {
diff --git a/multimedia/ffmpeg-devel/files/patch-ffserver.c b/multimedia/ffmpeg-devel/files/patch-ffserver.c
index b0b444a8405a..93bd700c5137 100644
--- a/multimedia/ffmpeg-devel/files/patch-ffserver.c
+++ b/multimedia/ffmpeg-devel/files/patch-ffserver.c
@@ -1,18 +1,18 @@
---- ffserver.c.orig Tue Sep 25 14:53:44 2001
-+++ ffserver.c Tue Sep 25 14:55:12 2001
+--- ffserver.c.orig Tue Oct 8 13:45:36 2002
++++ ffserver.c Tue Oct 8 13:46:10 2002
@@ -20,7 +20,6 @@
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
+ #include "avformat.h"
+
+ #include <stdarg.h>
-#include <netinet/in.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-@@ -31,6 +30,7 @@
- #include <getopt.h>
+@@ -30,6 +29,7 @@
+ #include <time.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <netinet/in.h>
+ #include <sys/wait.h>
#include <arpa/inet.h>
#include <netdb.h>
- #include <ctype.h>
diff --git a/multimedia/ffmpeg-devel/files/patch-libav::Makefile b/multimedia/ffmpeg-devel/files/patch-libav::Makefile
index 34bf5410ed7e..bc4294226b26 100644
--- a/multimedia/ffmpeg-devel/files/patch-libav::Makefile
+++ b/multimedia/ffmpeg-devel/files/patch-libav::Makefile
@@ -1,9 +1,20 @@
---- libav/Makefile.orig Tue Aug 14 19:32:28 2001
-+++ libav/Makefile Tue Sep 25 15:05:38 2001
-@@ -1,5 +1,5 @@
- include ../config.mak
--CFLAGS= $(OPTFLAGS) -Wall -g -I../libavcodec -DHAVE_AV_CONFIG_H
-+CFLAGS= $(OPTFLAGS) -Wall -I../libavcodec -I$(LOCALBASE)/include -DHAVE_AV_CONFIG_H
-
- OBJS= rm.o mpeg.o asf.o avienc.o jpeg.o swf.o wav.o raw.o \
- avidec.o ffm.o \
+--- libav/Makefile.orig Tue Oct 8 13:54:16 2002
++++ libav/Makefile Tue Oct 8 13:54:30 2002
+@@ -6,7 +6,7 @@
+
+ VPATH=$(SRC_PATH)/libav
+
+-CFLAGS= $(OPTFLAGS) -Wall -g -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
++CFLAGS= $(OPTFLAGS) -Wall -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+
+ OBJS= utils.o cutils.o allformats.o
+
+@@ -17,7 +17,7 @@
+ OBJS+= avio.o aviobuf.o file.o
+
+ ifeq ($(CONFIG_VIDEO4LINUX),yes)
+-OBJS+= grab.o
++OBJS+= grab_bsdbktr.o
+ endif
+
+ ifeq ($(CONFIG_AUDIO_OSS),yes)
diff --git a/multimedia/ffmpeg-devel/files/patch-libav::avformat.h b/multimedia/ffmpeg-devel/files/patch-libav::avformat.h
new file mode 100644
index 000000000000..3199bc4a0bbe
--- /dev/null
+++ b/multimedia/ffmpeg-devel/files/patch-libav::avformat.h
@@ -0,0 +1,9 @@
+--- libav/avformat.h Mon Jul 8 04:38:40 2002
++++ libav/avformat.h Sun Jul 14 15:22:58 2002
+@@ -284,5 +284,5 @@
+ int video_grab_init(void);
+ int audio_init(void);
+
+-extern const char *v4l_device;
++extern const char *video_device;
+ extern const char *audio_device;
diff --git a/multimedia/ffmpeg-devel/files/patch-libavcodec::Makefile b/multimedia/ffmpeg-devel/files/patch-libavcodec::Makefile
index 383195e6f309..d760d0cee046 100644
--- a/multimedia/ffmpeg-devel/files/patch-libavcodec::Makefile
+++ b/multimedia/ffmpeg-devel/files/patch-libavcodec::Makefile
@@ -1,11 +1,22 @@
---- libavcodec/Makefile.orig Tue Sep 25 15:05:58 2001
-+++ libavcodec/Makefile Tue Sep 25 15:06:08 2001
-@@ -1,7 +1,6 @@
- include ../config.mak
+--- libavcodec/Makefile.orig Sun Oct 6 12:26:38 2002
++++ libavcodec/Makefile Wed Oct 9 14:24:34 2002
+@@ -7,8 +7,7 @@
+ VPATH=$(SRC_PATH)/libavcodec
--CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H
+ # NOTE: -I.. is needed to include config.h
+-CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
-LDFLAGS= -g
-+CFLAGS= $(OPTFLAGS) -Wall -DHAVE_AV_CONFIG_H
++CFLAGS= $(OPTFLAGS) -Wall -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
- OBJS= common.o utils.o mpegvideo.o h263.o jrevdct.o jfdctfst.o \
- mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
+ OBJS= common.o utils.o mem.o allcodecs.o \
+ mpegvideo.o h263.o jrevdct.o jfdctfst.o jfdctint.o\
+@@ -167,8 +166,7 @@
+ install: all
+ ifeq ($(BUILD_SHARED),yes)
+ install -d $(prefix)/lib
+- install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
+- ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
++ install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec.so
+ ldconfig || true
+ mkdir -p $(prefix)/include/ffmpeg
+ install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
diff --git a/multimedia/ffmpeg-devel/pkg-plist b/multimedia/ffmpeg-devel/pkg-plist
index cd53f45e0e73..13b2fb707420 100644
--- a/multimedia/ffmpeg-devel/pkg-plist
+++ b/multimedia/ffmpeg-devel/pkg-plist
@@ -1,18 +1,26 @@
bin/ffmpeg
+bin/ffplay
bin/ffserver
etc/ffserver.conf.sample
-include/libavcodec/avcodec.h
-include/libavcodec/common.h
-include/libavcodec/dsputil.h
-lib/libav.a
+include/ffmpeg/avcodec.h
+include/ffmpeg/common.h
+include/ffmpeg/dsputil.h
lib/libavcodec.a
+lib/libavcodec.so
+lib/libavcodec.so.%%SHLIB_VERSION%%
+lib/libavformat.a
+%%PORTDOCS%%share/doc/ffmpeg/COPYING
+%%PORTDOCS%%share/doc/ffmpeg/Changelog
%%PORTDOCS%%share/doc/ffmpeg/FAQ
+%%PORTDOCS%%share/doc/ffmpeg/HOWTO-STREAM
%%PORTDOCS%%share/doc/ffmpeg/README
+%%PORTDOCS%%share/doc/ffmpeg/README.beos
%%PORTDOCS%%share/doc/ffmpeg/README.dev
%%PORTDOCS%%share/doc/ffmpeg/README.tech
%%PORTDOCS%%share/doc/ffmpeg/TODO
+%%PORTDOCS%%share/doc/ffmpeg/VERSION
%%PORTDOCS%%share/doc/ffmpeg/bench.txt
%%PORTDOCS%%share/doc/ffmpeg/ffmpeg.txt
%%PORTDOCS%%share/doc/ffmpeg/ffserver.txt
%%PORTDOCS%%@dirrm share/doc/ffmpeg
-@dirrm include/libavcodec
+@dirrm include/ffmpeg
diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile
index 77f823afa071..234c5083b7f5 100644
--- a/multimedia/ffmpeg/Makefile
+++ b/multimedia/ffmpeg/Makefile
@@ -7,10 +7,10 @@
PORTNAME= ffmpeg
PORTVERSION= 0.4.5
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= graphics
-MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
-MASTER_SITE_SUBDIR= ${PORTNAME}
+MASTER_SITES= http://ffmpeg.sourceforge.net/
+DISTNAME= ffmpeg-cvs
MAINTAINER= lioux@FreeBSD.org
@@ -23,31 +23,100 @@ ONLY_FOR_ARCHS= i386
HAS_CONFIGURE= yes
USE_GMAKE= yes
USE_REINPLACE= yes
-MAKE_ARGS= MAKE="${GMAKE}" LOCALBASE="${LOCALBASE}"
CONFIGURE_ARGS= --cc="${CC}" --prefix="${PREFIX}" \
- --disable-grab
+ --make="${GMAKE}" --enable-shared \
+ --extra-cflags="-I${LOCALBASE}/include" \
+ --extra-libs="-L${LOCALBASE}/lib"
+PLIST_SUB= SHLIB_VERSION=${SHLIB_VERSION}
+INSTALLS_SHLIB= yes
-DOC_FILES= README
+SHLIB_VERSION= 0
+#
+DOC_FILES= COPYING Changelog README VERSION
# under subdir doc
DOC_DOCFILES= FAQ README.dev README.tech \
TODO bench.txt ffmpeg.txt \
+ HOWTO-STREAM README.beos \
ffserver.txt
HEADER_FILES= libavcodec/avcodec.h libavcodec/common.h \
libavcodec/dsputil.h
-LIB_FILES= libav/libav.a libavcodec/libavcodec.a
+LIB_FILES= libavcodec/libavcodec.a libav/libavformat.a
+
+.include <bsd.port.pre.mk>
+
+## lib detection
+##
+## lame mp3
+.if exists(${LOCALBASE}/lib/libmp3lame.so.0)
+WITH_MP3=yes
+.endif
+## vorbis
+.if exists(${LOCALBASE}/lib/libvorbisenc.so.2)
+WITH_VORBIS=yes
+.endif
+## support activation
+##
+## disable mmx
.ifdef(WITHOUT_MMX)
CONFIGURE_ARGS+= --disable-mmx
.endif
+## mp3
+.ifdef(WITH_MP3)
+LIB_DEPENDS+= mp3lame.0:${PORTSDIR}/audio/lame
+
+CONFIGURE_ARGS+= --enable-mp3lame
+.endif
+## vorbis
+.ifdef(WITH_VORBIS)
+LIB_DEPENDS+= vorbisenc.2:${PORTSDIR}/audio/libvorbis
+
+CONFIGURE_ARGS+= --enable-vorbis
+.endif
-.ifndef(WITHOUT_MMX)
pre-everything::
+.ifndef(WITHOUT_MMX)
@${ECHO_MSG} "Define WITHOUT_MMX if your system does not support MMX"
.endif
+.ifndef(WITH_MP3)
+ @${ECHO_MSG} 'Define WITH_MP3 to enable lame MP3 codec'
+.endif
+.ifndef(WITH_VORBIS)
+ @${ECHO_MSG} 'Define WITH_VORBIS to enable libvorbisenc VORBIS codec'
+.endif
+.if !(defined(WITH_BKTR_FORMAT) && defined(WITH_BKTR_DEV))
+ @${ECHO_MSG}
+ @${ECHO_MSG} 'If you want to capture from a bktr(4) supported card'
+ @${ECHO_MSG} 'you will probably need to set the input device and format'
+ @${ECHO_MSG} 'You can set WITH_BKTR_FORMAT to NTSC or PAL and you can set'
+ @${ECHO_MSG} 'WITH_BKTR_DEV to 0, 1, 2 or 3 (1 is usually the tuner)'
+ @${ECHO_MSG} 'so for a PAL tuner make WITH_BKTR_FORMAT=PAL WITH_BKTR_DEV=1'
+ @${ECHO_MSG}
+ @${ECHO_MSG} 'Warning: invalid settings will probably dump cores'
+ @${ECHO_MSG}
+.endif
+
+post-extract:
+# install booktree extension
+ @${CP} ${FILESDIR}/grab_bsdbktr.c ${WRKSRC}/libav/
post-patch:
@${REINPLACE_CMD} -e "s!/etc/ffserver.conf!${PREFIX}/etc/ffserver.conf!g" \
${WRKSRC}/ffserver.c
+# malloc.h was deprecated in favor of stdlib.h
+ @${FIND} ${WRKSRC} -type f | \
+ ${XARGS} -n 10 ${REINPLACE_CMD} -e \
+ 's|malloc.h|stdlib.h|'
+.ifdef(WITH_BKTR_FORMAT)
+ @${REINPLACE_CMD} -e \
+ "s!VIDEO_FORMAT NTSC!VIDEO_FORMAT ${WITH_BKTR_FORMAT}!" \
+ ${WRKSRC}/libav/grab_bsdbktr.c
+.endif
+.ifdef(WITH_BKTR_DEV)
+ @${REINPLACE_CMD} -e \
+ "s!VIDEO_INPUT METEOR_INPUT_DEV0!VIDEO_INPUT METEOR_INPUT_DEV${WITH_BKTR_DEV}!" \
+ ${WRKSRC}/libav/grab_bsdbktr.c
+.endif
post-install:
.ifndef(NOPORTDOCS)
@@ -63,13 +132,18 @@ post-install:
${PREFIX}/etc/ffserver.conf.sample
.for file in ${HEADER_FILES}
# fix header references prior to installation
- @${REINPLACE_CMD} -e 's|"common.h"|<libavcodec/common.h>|' \
+ @${REINPLACE_CMD} -e 's|"common.h"|<ffmpeg/common.h>|; \
+ s|"avcodec.h"|<ffmpeg/avcodec.h>|' \
${WRKSRC}/${file}
- @${MKDIR} ${PREFIX}/include/${file:H}
- @${INSTALL_DATA} ${WRKSRC}/${file} ${PREFIX}/include/${file}
+ @${INSTALL_DATA} ${WRKSRC}/${file} \
+ ${PREFIX}/include/ffmpeg/${file:T}
.endfor
.for file in ${LIB_FILES}
@${INSTALL_DATA} ${WRKSRC}/${file} ${PREFIX}/lib/${file:T}
.endfor
+# add shared lib link
+ @${LN} -sf libavcodec.so \
+ ${PREFIX}/lib/libavcodec.so.${SHLIB_VERSION}
+
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/multimedia/ffmpeg/distinfo b/multimedia/ffmpeg/distinfo
index 976716f02573..5830545317e7 100644
--- a/multimedia/ffmpeg/distinfo
+++ b/multimedia/ffmpeg/distinfo
@@ -1 +1 @@
-MD5 (ffmpeg-0.4.5.tar.gz) = 04e140b29ad8a9f88c2d3fb9e998f883
+MD5 (ffmpeg-cvs.tar.gz) = 1529544a5d5f9c2891be1f53b39510dd
diff --git a/multimedia/ffmpeg/files/extra-bktr-patch-ffmpeg.c b/multimedia/ffmpeg/files/extra-bktr-patch-ffmpeg.c
index 093e99aed89b..2242cdb60be1 100644
--- a/multimedia/ffmpeg/files/extra-bktr-patch-ffmpeg.c
+++ b/multimedia/ffmpeg/files/extra-bktr-patch-ffmpeg.c
@@ -1,10 +1,37 @@
---- ffmpeg.c.orig Mon Aug 13 18:23:57 2001
-+++ ffmpeg.c Tue Sep 25 14:47:58 2001
-@@ -35,6 +35,7 @@
+--- ffmpeg.c.orig Thu Oct 10 20:13:52 2002
++++ ffmpeg.c Thu Oct 10 20:14:03 2002
+@@ -36,6 +36,7 @@
+ #include <ctype.h>
- #include "avformat.h"
+#define INT64_C(x) x##LL
#define MAXINT64 INT64_C(0x7fffffffffffffff)
typedef struct {
+@@ -146,7 +147,7 @@
+ const char *audio_device = "none";
+ #endif
+ #ifndef CONFIG_VIDEO4LINUX
+-const char *v4l_device = "none";
++const char *video_device = "none";
+ #endif
+
+ typedef struct AVOutputStream {
+@@ -1601,7 +1602,7 @@
+
+ void opt_video_device(const char *arg)
+ {
+- v4l_device = strdup(arg);
++ video_device = strdup(arg);
+ }
+
+ void opt_audio_device(const char *arg)
+@@ -2099,7 +2100,7 @@
+ /* by now video grab has one stream */
+ ic->streams[0]->r_frame_rate = ap->frame_rate;
+ input_files[nb_input_files] = ic;
+- dump_format(ic, nb_input_files, v4l_device, 0);
++ dump_format(ic, nb_input_files, video_device, 0);
+ nb_input_files++;
+ }
+ if (has_audio) {
diff --git a/multimedia/ffmpeg/files/grab_bsdbktr.c b/multimedia/ffmpeg/files/grab_bsdbktr.c
new file mode 100644
index 000000000000..6f171ea7b3a9
--- /dev/null
+++ b/multimedia/ffmpeg/files/grab_bsdbktr.c
@@ -0,0 +1,248 @@
+/*
+ * FreeBSD video grab interface
+ * Copyright (c) 2002 Steve O'Hara-Smith
+ * based on
+ * Linux video grab interface
+ * Copyright (c) 2000,2001 Gerard Lantau.
+ * and
+ * simple_grab.c Copyright (c) 1999 Roger Hardiman
+ *
+ * GPL virus inherited:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include "avformat.h"
+#include <machine/ioctl_meteor.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <signal.h>
+
+typedef struct {
+ int fd;
+ int tuner_fd;
+ int frame_format; /* see VIDEO_PALETTE_xxx */
+ int width, height;
+ int frame_rate;
+ int frame_size;
+} VideoData;
+
+const char *video_device = "/dev/bktr0";
+
+#define GRABBER_SETTLE_TIME 3
+#define PAL 1
+#define NTSC 2
+/* PAL is 768 x 576. NTSC is 640 x 480 */
+#define PAL_HEIGHT 576
+#define NTSC_HEIGHT 480
+
+#ifndef VIDEO_FORMAT
+#define VIDEO_FORMAT NTSC
+#endif
+
+#ifndef VIDEO_INPUT
+#define VIDEO_INPUT METEOR_INPUT_DEV0;
+#endif
+
+static UINT8 *video_buf;
+
+static void catchsignal(int signal)
+{
+ return;
+}
+
+static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
+{
+ VideoData *s = s1->priv_data;
+ int width, height;
+ int video_fd;
+ int format = VIDEO_FORMAT;
+ struct meteor_geomet geo;
+ int c;
+ struct sigaction act,old;
+
+ memset(&act,0,sizeof(act));
+ sigemptyset(&act.sa_mask);
+ act.sa_handler = catchsignal;
+ sigaction(SIGUSR1,&act,&old);
+ sigaction(SIGALRM,&act,&old);
+
+ width = s->width;
+ height = s->height;
+
+ s->tuner_fd = open ("/dev/tuner0", O_RDWR);
+
+ video_fd = open(video_device, O_RDWR);
+ if (video_fd < 0) {
+ perror(video_device);
+ return -EIO;
+ }
+ s->fd=video_fd;
+ geo.rows = height;
+ geo.columns = width;
+ geo.frames = 1;
+ geo.oformat = METEOR_GEO_YUV_PACKED; // RGB
+ if ((format == PAL) && (height <= (PAL_HEIGHT/2)))
+ geo.oformat |= METEOR_GEO_ODD_ONLY;
+ if ((format == NTSC) && (height <= (NTSC_HEIGHT/2)))
+ geo.oformat |= METEOR_GEO_ODD_ONLY;
+
+ if (ioctl(video_fd, METEORSETGEO, &geo) < 0) {
+ perror ("METEORSETGEO");
+ return -EIO;
+ }
+
+ switch (format) {
+ case PAL: c = METEOR_FMT_PAL; break;
+ case NTSC: c = METEOR_FMT_NTSC; break;
+ default: c = METEOR_FMT_PAL; break;
+ }
+
+ if (ioctl(video_fd, METEORSFMT, &c) < 0) {
+ perror ("METEORSFMT");
+ return -EIO;
+ }
+
+ c = VIDEO_INPUT;
+ if (ioctl(video_fd, METEORSINPUT, &c) < 0) {
+ perror ("METEORSINPUT");
+ return -EIO;
+ }
+ video_buf = mmap((caddr_t)0, width*height*2, PROT_READ, MAP_SHARED, // RGB
+ video_fd, (off_t) 0);
+ if (video_buf == MAP_FAILED) {
+ perror ("mmap");
+ return -EIO;
+ }
+ c = METEOR_CAP_CONTINOUS;
+ ioctl(s->fd, METEORCAPTUR, &c);
+ c = SIGUSR1;
+ ioctl (s->fd, METEORSSIGNAL, &c);
+ return 0;
+}
+
+static void bf_yuv422_to_yuv420p(UINT8 *lum, UINT8 *cb, UINT8 *cr,
+ UINT8 *src, int width, int height)
+{
+ int x, y;
+ UINT8 *p = src;
+ for(y=0;y<height;y+=2) {
+ for(x=0;x<width;x+=2) {
+ lum[0] = p[1];
+ cb[0] = p[0];
+ lum[1] = p[3];
+ cr[0] = p[2];
+ p += 4;
+ lum += 2;
+ cb++;
+ cr++;
+ }
+ for(x=0;x<width;x+=2) {
+ lum[0] = p[1];
+ lum[1] = p[3];
+ p += 4;
+ lum += 2;
+ }
+ }
+}
+
+/* note: we support only one picture read at a time */
+static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
+{
+ VideoData *s = s1->priv_data;
+ int size, halfsize;
+ sigset_t msig;
+ UINT8 *lum, *cb, *cr;
+
+ size = s->width * s->height;
+ halfsize = size << 1;
+ if (av_new_packet(pkt, size + halfsize) < 0)
+ return -EIO;
+
+ sigemptyset (&msig);
+ sigsuspend (&msig);
+
+ lum = pkt->data;
+ cb = lum + size;
+ cr = cb + size/4;
+
+ bf_yuv422_to_yuv420p (lum, cb, cr, video_buf, s->width, s->height);
+
+ return size + halfsize;
+}
+
+static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap)
+{
+ VideoData *s = s1->priv_data;
+ AVStream *st;
+ int width, height;
+ int frame_rate;
+
+ if (!ap || ap->width <= 0 || ap->height <= 0 || ap->frame_rate <= 0)
+ return -1;
+
+ width = ap->width;
+ height = ap->height;
+ frame_rate = ap->frame_rate;
+ st = av_new_stream(s1, 0);
+ if (!st)
+ return -ENOMEM;
+ s1->priv_data = s;
+ s1->nb_streams = 1;
+ s1->streams[0] = st;
+
+ s->width = width;
+ s->height = height;
+ s->frame_rate = frame_rate;
+ s->frame_size = width*height*2; /*RGB*/
+ st->codec.pix_fmt = PIX_FMT_YUV420P;
+ st->codec.codec_id = CODEC_ID_RAWVIDEO;
+ st->codec.width = width;
+ st->codec.height = height;
+ st->codec.frame_rate = frame_rate;
+
+ return bktr_init(s1, ap);
+}
+
+static int grab_read_close (AVFormatContext *s1)
+{
+ VideoData *s = s1->priv_data;
+
+ int c = METEOR_CAP_STOP_CONT;
+ ioctl(s->fd, METEORCAPTUR, &c);
+ close(s->fd);
+ close(s->tuner_fd);
+ free(s);
+ return 0;
+}
+
+AVInputFormat video_grab_device_format = {
+ "video_grab_device",
+ "video grab",
+ sizeof(VideoData),
+ NULL,
+ grab_read_header,
+ grab_read_packet,
+ grab_read_close,
+ flags: AVFMT_NOFILE,
+};
+
+int video_grab_init(void)
+{
+ av_register_input_format(&video_grab_device_format);
+ return 0;
+}
diff --git a/multimedia/ffmpeg/files/patch-Makefile b/multimedia/ffmpeg/files/patch-Makefile
index 2aaebddaa06f..eebc45c27552 100644
--- a/multimedia/ffmpeg/files/patch-Makefile
+++ b/multimedia/ffmpeg/files/patch-Makefile
@@ -1,30 +1,26 @@
---- Makefile.orig Wed Aug 15 10:11:45 2001
-+++ Makefile Tue Sep 25 15:10:12 2001
-@@ -3,8 +3,8 @@
- #
- include config.mak
+--- Makefile.orig Sun Sep 1 15:07:34 2002
++++ Makefile Tue Oct 8 13:51:49 2002
+@@ -6,12 +6,12 @@
--CFLAGS= $(OPTFLAGS) -Wall -g -I./libavcodec -I./libav
--LDFLAGS= -g
-+CFLAGS= $(OPTFLAGS) -Wall -I./libavcodec -I./libav -I$(LOCALBASE)/include
-+LDFLAGS= -L$(LOCALBASE)/lib
- ifeq ($(TARGET_GPROF),yes)
- CFLAGS+=-p
- LDFLAGS+=-p
-@@ -19,13 +19,13 @@
- $(MAKE) -C libav all
+ VPATH=$(SRC_PATH)
- ffmpeg: ffmpeg.o libav/libav.a libavcodec/libavcodec.a
-- gcc $(LDFLAGS) -o $@ $^ -lm
-+ $(CC) $(LDFLAGS) -o $@ $^ -lm
+-CFLAGS= $(OPTFLAGS) -Wall -g -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libav -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
++CFLAGS= $(OPTFLAGS) -Wall -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libav -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+ ifeq ($(CONFIG_DARWIN),yes)
+ LDFLAGS+= -g -d
+ FFSLDFLAGS= -Wl,-bind_at_load
+ else
+-LDFLAGS+= -g -Wl,--warn-common
++LDFLAGS+= -Wl,--warn-common
+ FFSLDFLAGS= -Wl,-E
+ endif
+
+@@ -60,7 +60,7 @@
+ ffserver$(EXE): ffserver.o $(DEP_LIBS)
+ $(CC) $(LDFLAGS) $(FFSLDFLAGS) \
+ -o $@ ffserver.o -L./libavcodec -L./libav \
+- -lavformat -lavcodec -ldl $(EXTRALIBS)
++ -lavformat -lavcodec $(EXTRALIBS)
- ffserver: ffserver.o libav/libav.a libavcodec/libavcodec.a
-- gcc $(LDFLAGS) -o $@ $^ -lm
-+ $(CC) $(LDFLAGS) -o $@ $^ -lm -lgnugetopt
-
- %.o: %.c
-- gcc $(CFLAGS) -c -o $@ $<
-+ $(CC) $(CFLAGS) -c -o $@ $<
-
- install: all
- install -s -m 755 $(PROG) $(prefix)/bin
+ ffplay: ffmpeg$(EXE)
+ ln -sf $< $@
diff --git a/multimedia/ffmpeg/files/patch-ffmpeg.c b/multimedia/ffmpeg/files/patch-ffmpeg.c
index 093e99aed89b..2242cdb60be1 100644
--- a/multimedia/ffmpeg/files/patch-ffmpeg.c
+++ b/multimedia/ffmpeg/files/patch-ffmpeg.c
@@ -1,10 +1,37 @@
---- ffmpeg.c.orig Mon Aug 13 18:23:57 2001
-+++ ffmpeg.c Tue Sep 25 14:47:58 2001
-@@ -35,6 +35,7 @@
+--- ffmpeg.c.orig Thu Oct 10 20:13:52 2002
++++ ffmpeg.c Thu Oct 10 20:14:03 2002
+@@ -36,6 +36,7 @@
+ #include <ctype.h>
- #include "avformat.h"
+#define INT64_C(x) x##LL
#define MAXINT64 INT64_C(0x7fffffffffffffff)
typedef struct {
+@@ -146,7 +147,7 @@
+ const char *audio_device = "none";
+ #endif
+ #ifndef CONFIG_VIDEO4LINUX
+-const char *v4l_device = "none";
++const char *video_device = "none";
+ #endif
+
+ typedef struct AVOutputStream {
+@@ -1601,7 +1602,7 @@
+
+ void opt_video_device(const char *arg)
+ {
+- v4l_device = strdup(arg);
++ video_device = strdup(arg);
+ }
+
+ void opt_audio_device(const char *arg)
+@@ -2099,7 +2100,7 @@
+ /* by now video grab has one stream */
+ ic->streams[0]->r_frame_rate = ap->frame_rate;
+ input_files[nb_input_files] = ic;
+- dump_format(ic, nb_input_files, v4l_device, 0);
++ dump_format(ic, nb_input_files, video_device, 0);
+ nb_input_files++;
+ }
+ if (has_audio) {
diff --git a/multimedia/ffmpeg/files/patch-ffserver.c b/multimedia/ffmpeg/files/patch-ffserver.c
index b0b444a8405a..93bd700c5137 100644
--- a/multimedia/ffmpeg/files/patch-ffserver.c
+++ b/multimedia/ffmpeg/files/patch-ffserver.c
@@ -1,18 +1,18 @@
---- ffserver.c.orig Tue Sep 25 14:53:44 2001
-+++ ffserver.c Tue Sep 25 14:55:12 2001
+--- ffserver.c.orig Tue Oct 8 13:45:36 2002
++++ ffserver.c Tue Oct 8 13:46:10 2002
@@ -20,7 +20,6 @@
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
+ #include "avformat.h"
+
+ #include <stdarg.h>
-#include <netinet/in.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-@@ -31,6 +30,7 @@
- #include <getopt.h>
+@@ -30,6 +29,7 @@
+ #include <time.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <netinet/in.h>
+ #include <sys/wait.h>
#include <arpa/inet.h>
#include <netdb.h>
- #include <ctype.h>
diff --git a/multimedia/ffmpeg/files/patch-libav::Makefile b/multimedia/ffmpeg/files/patch-libav::Makefile
index 34bf5410ed7e..bc4294226b26 100644
--- a/multimedia/ffmpeg/files/patch-libav::Makefile
+++ b/multimedia/ffmpeg/files/patch-libav::Makefile
@@ -1,9 +1,20 @@
---- libav/Makefile.orig Tue Aug 14 19:32:28 2001
-+++ libav/Makefile Tue Sep 25 15:05:38 2001
-@@ -1,5 +1,5 @@
- include ../config.mak
--CFLAGS= $(OPTFLAGS) -Wall -g -I../libavcodec -DHAVE_AV_CONFIG_H
-+CFLAGS= $(OPTFLAGS) -Wall -I../libavcodec -I$(LOCALBASE)/include -DHAVE_AV_CONFIG_H
-
- OBJS= rm.o mpeg.o asf.o avienc.o jpeg.o swf.o wav.o raw.o \
- avidec.o ffm.o \
+--- libav/Makefile.orig Tue Oct 8 13:54:16 2002
++++ libav/Makefile Tue Oct 8 13:54:30 2002
+@@ -6,7 +6,7 @@
+
+ VPATH=$(SRC_PATH)/libav
+
+-CFLAGS= $(OPTFLAGS) -Wall -g -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
++CFLAGS= $(OPTFLAGS) -Wall -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+
+ OBJS= utils.o cutils.o allformats.o
+
+@@ -17,7 +17,7 @@
+ OBJS+= avio.o aviobuf.o file.o
+
+ ifeq ($(CONFIG_VIDEO4LINUX),yes)
+-OBJS+= grab.o
++OBJS+= grab_bsdbktr.o
+ endif
+
+ ifeq ($(CONFIG_AUDIO_OSS),yes)
diff --git a/multimedia/ffmpeg/files/patch-libav::avformat.h b/multimedia/ffmpeg/files/patch-libav::avformat.h
new file mode 100644
index 000000000000..3199bc4a0bbe
--- /dev/null
+++ b/multimedia/ffmpeg/files/patch-libav::avformat.h
@@ -0,0 +1,9 @@
+--- libav/avformat.h Mon Jul 8 04:38:40 2002
++++ libav/avformat.h Sun Jul 14 15:22:58 2002
+@@ -284,5 +284,5 @@
+ int video_grab_init(void);
+ int audio_init(void);
+
+-extern const char *v4l_device;
++extern const char *video_device;
+ extern const char *audio_device;
diff --git a/multimedia/ffmpeg/files/patch-libavcodec::Makefile b/multimedia/ffmpeg/files/patch-libavcodec::Makefile
index 383195e6f309..d760d0cee046 100644
--- a/multimedia/ffmpeg/files/patch-libavcodec::Makefile
+++ b/multimedia/ffmpeg/files/patch-libavcodec::Makefile
@@ -1,11 +1,22 @@
---- libavcodec/Makefile.orig Tue Sep 25 15:05:58 2001
-+++ libavcodec/Makefile Tue Sep 25 15:06:08 2001
-@@ -1,7 +1,6 @@
- include ../config.mak
+--- libavcodec/Makefile.orig Sun Oct 6 12:26:38 2002
++++ libavcodec/Makefile Wed Oct 9 14:24:34 2002
+@@ -7,8 +7,7 @@
+ VPATH=$(SRC_PATH)/libavcodec
--CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H
+ # NOTE: -I.. is needed to include config.h
+-CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
-LDFLAGS= -g
-+CFLAGS= $(OPTFLAGS) -Wall -DHAVE_AV_CONFIG_H
++CFLAGS= $(OPTFLAGS) -Wall -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
- OBJS= common.o utils.o mpegvideo.o h263.o jrevdct.o jfdctfst.o \
- mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
+ OBJS= common.o utils.o mem.o allcodecs.o \
+ mpegvideo.o h263.o jrevdct.o jfdctfst.o jfdctint.o\
+@@ -167,8 +166,7 @@
+ install: all
+ ifeq ($(BUILD_SHARED),yes)
+ install -d $(prefix)/lib
+- install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
+- ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
++ install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec.so
+ ldconfig || true
+ mkdir -p $(prefix)/include/ffmpeg
+ install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
diff --git a/multimedia/ffmpeg/pkg-plist b/multimedia/ffmpeg/pkg-plist
index cd53f45e0e73..13b2fb707420 100644
--- a/multimedia/ffmpeg/pkg-plist
+++ b/multimedia/ffmpeg/pkg-plist
@@ -1,18 +1,26 @@
bin/ffmpeg
+bin/ffplay
bin/ffserver
etc/ffserver.conf.sample
-include/libavcodec/avcodec.h
-include/libavcodec/common.h
-include/libavcodec/dsputil.h
-lib/libav.a
+include/ffmpeg/avcodec.h
+include/ffmpeg/common.h
+include/ffmpeg/dsputil.h
lib/libavcodec.a
+lib/libavcodec.so
+lib/libavcodec.so.%%SHLIB_VERSION%%
+lib/libavformat.a
+%%PORTDOCS%%share/doc/ffmpeg/COPYING
+%%PORTDOCS%%share/doc/ffmpeg/Changelog
%%PORTDOCS%%share/doc/ffmpeg/FAQ
+%%PORTDOCS%%share/doc/ffmpeg/HOWTO-STREAM
%%PORTDOCS%%share/doc/ffmpeg/README
+%%PORTDOCS%%share/doc/ffmpeg/README.beos
%%PORTDOCS%%share/doc/ffmpeg/README.dev
%%PORTDOCS%%share/doc/ffmpeg/README.tech
%%PORTDOCS%%share/doc/ffmpeg/TODO
+%%PORTDOCS%%share/doc/ffmpeg/VERSION
%%PORTDOCS%%share/doc/ffmpeg/bench.txt
%%PORTDOCS%%share/doc/ffmpeg/ffmpeg.txt
%%PORTDOCS%%share/doc/ffmpeg/ffserver.txt
%%PORTDOCS%%@dirrm share/doc/ffmpeg
-@dirrm include/libavcodec
+@dirrm include/ffmpeg
diff --git a/multimedia/ffmpeg045/Makefile b/multimedia/ffmpeg045/Makefile
index 77f823afa071..234c5083b7f5 100644
--- a/multimedia/ffmpeg045/Makefile
+++ b/multimedia/ffmpeg045/Makefile
@@ -7,10 +7,10 @@
PORTNAME= ffmpeg
PORTVERSION= 0.4.5
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= graphics
-MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
-MASTER_SITE_SUBDIR= ${PORTNAME}
+MASTER_SITES= http://ffmpeg.sourceforge.net/
+DISTNAME= ffmpeg-cvs
MAINTAINER= lioux@FreeBSD.org
@@ -23,31 +23,100 @@ ONLY_FOR_ARCHS= i386
HAS_CONFIGURE= yes
USE_GMAKE= yes
USE_REINPLACE= yes
-MAKE_ARGS= MAKE="${GMAKE}" LOCALBASE="${LOCALBASE}"
CONFIGURE_ARGS= --cc="${CC}" --prefix="${PREFIX}" \
- --disable-grab
+ --make="${GMAKE}" --enable-shared \
+ --extra-cflags="-I${LOCALBASE}/include" \
+ --extra-libs="-L${LOCALBASE}/lib"
+PLIST_SUB= SHLIB_VERSION=${SHLIB_VERSION}
+INSTALLS_SHLIB= yes
-DOC_FILES= README
+SHLIB_VERSION= 0
+#
+DOC_FILES= COPYING Changelog README VERSION
# under subdir doc
DOC_DOCFILES= FAQ README.dev README.tech \
TODO bench.txt ffmpeg.txt \
+ HOWTO-STREAM README.beos \
ffserver.txt
HEADER_FILES= libavcodec/avcodec.h libavcodec/common.h \
libavcodec/dsputil.h
-LIB_FILES= libav/libav.a libavcodec/libavcodec.a
+LIB_FILES= libavcodec/libavcodec.a libav/libavformat.a
+
+.include <bsd.port.pre.mk>
+
+## lib detection
+##
+## lame mp3
+.if exists(${LOCALBASE}/lib/libmp3lame.so.0)
+WITH_MP3=yes
+.endif
+## vorbis
+.if exists(${LOCALBASE}/lib/libvorbisenc.so.2)
+WITH_VORBIS=yes
+.endif
+## support activation
+##
+## disable mmx
.ifdef(WITHOUT_MMX)
CONFIGURE_ARGS+= --disable-mmx
.endif
+## mp3
+.ifdef(WITH_MP3)
+LIB_DEPENDS+= mp3lame.0:${PORTSDIR}/audio/lame
+
+CONFIGURE_ARGS+= --enable-mp3lame
+.endif
+## vorbis
+.ifdef(WITH_VORBIS)
+LIB_DEPENDS+= vorbisenc.2:${PORTSDIR}/audio/libvorbis
+
+CONFIGURE_ARGS+= --enable-vorbis
+.endif
-.ifndef(WITHOUT_MMX)
pre-everything::
+.ifndef(WITHOUT_MMX)
@${ECHO_MSG} "Define WITHOUT_MMX if your system does not support MMX"
.endif
+.ifndef(WITH_MP3)
+ @${ECHO_MSG} 'Define WITH_MP3 to enable lame MP3 codec'
+.endif
+.ifndef(WITH_VORBIS)
+ @${ECHO_MSG} 'Define WITH_VORBIS to enable libvorbisenc VORBIS codec'
+.endif
+.if !(defined(WITH_BKTR_FORMAT) && defined(WITH_BKTR_DEV))
+ @${ECHO_MSG}
+ @${ECHO_MSG} 'If you want to capture from a bktr(4) supported card'
+ @${ECHO_MSG} 'you will probably need to set the input device and format'
+ @${ECHO_MSG} 'You can set WITH_BKTR_FORMAT to NTSC or PAL and you can set'
+ @${ECHO_MSG} 'WITH_BKTR_DEV to 0, 1, 2 or 3 (1 is usually the tuner)'
+ @${ECHO_MSG} 'so for a PAL tuner make WITH_BKTR_FORMAT=PAL WITH_BKTR_DEV=1'
+ @${ECHO_MSG}
+ @${ECHO_MSG} 'Warning: invalid settings will probably dump cores'
+ @${ECHO_MSG}
+.endif
+
+post-extract:
+# install booktree extension
+ @${CP} ${FILESDIR}/grab_bsdbktr.c ${WRKSRC}/libav/
post-patch:
@${REINPLACE_CMD} -e "s!/etc/ffserver.conf!${PREFIX}/etc/ffserver.conf!g" \
${WRKSRC}/ffserver.c
+# malloc.h was deprecated in favor of stdlib.h
+ @${FIND} ${WRKSRC} -type f | \
+ ${XARGS} -n 10 ${REINPLACE_CMD} -e \
+ 's|malloc.h|stdlib.h|'
+.ifdef(WITH_BKTR_FORMAT)
+ @${REINPLACE_CMD} -e \
+ "s!VIDEO_FORMAT NTSC!VIDEO_FORMAT ${WITH_BKTR_FORMAT}!" \
+ ${WRKSRC}/libav/grab_bsdbktr.c
+.endif
+.ifdef(WITH_BKTR_DEV)
+ @${REINPLACE_CMD} -e \
+ "s!VIDEO_INPUT METEOR_INPUT_DEV0!VIDEO_INPUT METEOR_INPUT_DEV${WITH_BKTR_DEV}!" \
+ ${WRKSRC}/libav/grab_bsdbktr.c
+.endif
post-install:
.ifndef(NOPORTDOCS)
@@ -63,13 +132,18 @@ post-install:
${PREFIX}/etc/ffserver.conf.sample
.for file in ${HEADER_FILES}
# fix header references prior to installation
- @${REINPLACE_CMD} -e 's|"common.h"|<libavcodec/common.h>|' \
+ @${REINPLACE_CMD} -e 's|"common.h"|<ffmpeg/common.h>|; \
+ s|"avcodec.h"|<ffmpeg/avcodec.h>|' \
${WRKSRC}/${file}
- @${MKDIR} ${PREFIX}/include/${file:H}
- @${INSTALL_DATA} ${WRKSRC}/${file} ${PREFIX}/include/${file}
+ @${INSTALL_DATA} ${WRKSRC}/${file} \
+ ${PREFIX}/include/ffmpeg/${file:T}
.endfor
.for file in ${LIB_FILES}
@${INSTALL_DATA} ${WRKSRC}/${file} ${PREFIX}/lib/${file:T}
.endfor
+# add shared lib link
+ @${LN} -sf libavcodec.so \
+ ${PREFIX}/lib/libavcodec.so.${SHLIB_VERSION}
+
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/multimedia/ffmpeg045/distinfo b/multimedia/ffmpeg045/distinfo
index 976716f02573..5830545317e7 100644
--- a/multimedia/ffmpeg045/distinfo
+++ b/multimedia/ffmpeg045/distinfo
@@ -1 +1 @@
-MD5 (ffmpeg-0.4.5.tar.gz) = 04e140b29ad8a9f88c2d3fb9e998f883
+MD5 (ffmpeg-cvs.tar.gz) = 1529544a5d5f9c2891be1f53b39510dd
diff --git a/multimedia/ffmpeg045/files/grab_bsdbktr.c b/multimedia/ffmpeg045/files/grab_bsdbktr.c
new file mode 100644
index 000000000000..6f171ea7b3a9
--- /dev/null
+++ b/multimedia/ffmpeg045/files/grab_bsdbktr.c
@@ -0,0 +1,248 @@
+/*
+ * FreeBSD video grab interface
+ * Copyright (c) 2002 Steve O'Hara-Smith
+ * based on
+ * Linux video grab interface
+ * Copyright (c) 2000,2001 Gerard Lantau.
+ * and
+ * simple_grab.c Copyright (c) 1999 Roger Hardiman
+ *
+ * GPL virus inherited:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include "avformat.h"
+#include <machine/ioctl_meteor.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <signal.h>
+
+typedef struct {
+ int fd;
+ int tuner_fd;
+ int frame_format; /* see VIDEO_PALETTE_xxx */
+ int width, height;
+ int frame_rate;
+ int frame_size;
+} VideoData;
+
+const char *video_device = "/dev/bktr0";
+
+#define GRABBER_SETTLE_TIME 3
+#define PAL 1
+#define NTSC 2
+/* PAL is 768 x 576. NTSC is 640 x 480 */
+#define PAL_HEIGHT 576
+#define NTSC_HEIGHT 480
+
+#ifndef VIDEO_FORMAT
+#define VIDEO_FORMAT NTSC
+#endif
+
+#ifndef VIDEO_INPUT
+#define VIDEO_INPUT METEOR_INPUT_DEV0;
+#endif
+
+static UINT8 *video_buf;
+
+static void catchsignal(int signal)
+{
+ return;
+}
+
+static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
+{
+ VideoData *s = s1->priv_data;
+ int width, height;
+ int video_fd;
+ int format = VIDEO_FORMAT;
+ struct meteor_geomet geo;
+ int c;
+ struct sigaction act,old;
+
+ memset(&act,0,sizeof(act));
+ sigemptyset(&act.sa_mask);
+ act.sa_handler = catchsignal;
+ sigaction(SIGUSR1,&act,&old);
+ sigaction(SIGALRM,&act,&old);
+
+ width = s->width;
+ height = s->height;
+
+ s->tuner_fd = open ("/dev/tuner0", O_RDWR);
+
+ video_fd = open(video_device, O_RDWR);
+ if (video_fd < 0) {
+ perror(video_device);
+ return -EIO;
+ }
+ s->fd=video_fd;
+ geo.rows = height;
+ geo.columns = width;
+ geo.frames = 1;
+ geo.oformat = METEOR_GEO_YUV_PACKED; // RGB
+ if ((format == PAL) && (height <= (PAL_HEIGHT/2)))
+ geo.oformat |= METEOR_GEO_ODD_ONLY;
+ if ((format == NTSC) && (height <= (NTSC_HEIGHT/2)))
+ geo.oformat |= METEOR_GEO_ODD_ONLY;
+
+ if (ioctl(video_fd, METEORSETGEO, &geo) < 0) {
+ perror ("METEORSETGEO");
+ return -EIO;
+ }
+
+ switch (format) {
+ case PAL: c = METEOR_FMT_PAL; break;
+ case NTSC: c = METEOR_FMT_NTSC; break;
+ default: c = METEOR_FMT_PAL; break;
+ }
+
+ if (ioctl(video_fd, METEORSFMT, &c) < 0) {
+ perror ("METEORSFMT");
+ return -EIO;
+ }
+
+ c = VIDEO_INPUT;
+ if (ioctl(video_fd, METEORSINPUT, &c) < 0) {
+ perror ("METEORSINPUT");
+ return -EIO;
+ }
+ video_buf = mmap((caddr_t)0, width*height*2, PROT_READ, MAP_SHARED, // RGB
+ video_fd, (off_t) 0);
+ if (video_buf == MAP_FAILED) {
+ perror ("mmap");
+ return -EIO;
+ }
+ c = METEOR_CAP_CONTINOUS;
+ ioctl(s->fd, METEORCAPTUR, &c);
+ c = SIGUSR1;
+ ioctl (s->fd, METEORSSIGNAL, &c);
+ return 0;
+}
+
+static void bf_yuv422_to_yuv420p(UINT8 *lum, UINT8 *cb, UINT8 *cr,
+ UINT8 *src, int width, int height)
+{
+ int x, y;
+ UINT8 *p = src;
+ for(y=0;y<height;y+=2) {
+ for(x=0;x<width;x+=2) {
+ lum[0] = p[1];
+ cb[0] = p[0];
+ lum[1] = p[3];
+ cr[0] = p[2];
+ p += 4;
+ lum += 2;
+ cb++;
+ cr++;
+ }
+ for(x=0;x<width;x+=2) {
+ lum[0] = p[1];
+ lum[1] = p[3];
+ p += 4;
+ lum += 2;
+ }
+ }
+}
+
+/* note: we support only one picture read at a time */
+static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
+{
+ VideoData *s = s1->priv_data;
+ int size, halfsize;
+ sigset_t msig;
+ UINT8 *lum, *cb, *cr;
+
+ size = s->width * s->height;
+ halfsize = size << 1;
+ if (av_new_packet(pkt, size + halfsize) < 0)
+ return -EIO;
+
+ sigemptyset (&msig);
+ sigsuspend (&msig);
+
+ lum = pkt->data;
+ cb = lum + size;
+ cr = cb + size/4;
+
+ bf_yuv422_to_yuv420p (lum, cb, cr, video_buf, s->width, s->height);
+
+ return size + halfsize;
+}
+
+static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap)
+{
+ VideoData *s = s1->priv_data;
+ AVStream *st;
+ int width, height;
+ int frame_rate;
+
+ if (!ap || ap->width <= 0 || ap->height <= 0 || ap->frame_rate <= 0)
+ return -1;
+
+ width = ap->width;
+ height = ap->height;
+ frame_rate = ap->frame_rate;
+ st = av_new_stream(s1, 0);
+ if (!st)
+ return -ENOMEM;
+ s1->priv_data = s;
+ s1->nb_streams = 1;
+ s1->streams[0] = st;
+
+ s->width = width;
+ s->height = height;
+ s->frame_rate = frame_rate;
+ s->frame_size = width*height*2; /*RGB*/
+ st->codec.pix_fmt = PIX_FMT_YUV420P;
+ st->codec.codec_id = CODEC_ID_RAWVIDEO;
+ st->codec.width = width;
+ st->codec.height = height;
+ st->codec.frame_rate = frame_rate;
+
+ return bktr_init(s1, ap);
+}
+
+static int grab_read_close (AVFormatContext *s1)
+{
+ VideoData *s = s1->priv_data;
+
+ int c = METEOR_CAP_STOP_CONT;
+ ioctl(s->fd, METEORCAPTUR, &c);
+ close(s->fd);
+ close(s->tuner_fd);
+ free(s);
+ return 0;
+}
+
+AVInputFormat video_grab_device_format = {
+ "video_grab_device",
+ "video grab",
+ sizeof(VideoData),
+ NULL,
+ grab_read_header,
+ grab_read_packet,
+ grab_read_close,
+ flags: AVFMT_NOFILE,
+};
+
+int video_grab_init(void)
+{
+ av_register_input_format(&video_grab_device_format);
+ return 0;
+}
diff --git a/multimedia/ffmpeg045/files/patch-Makefile b/multimedia/ffmpeg045/files/patch-Makefile
index 2aaebddaa06f..eebc45c27552 100644
--- a/multimedia/ffmpeg045/files/patch-Makefile
+++ b/multimedia/ffmpeg045/files/patch-Makefile
@@ -1,30 +1,26 @@
---- Makefile.orig Wed Aug 15 10:11:45 2001
-+++ Makefile Tue Sep 25 15:10:12 2001
-@@ -3,8 +3,8 @@
- #
- include config.mak
+--- Makefile.orig Sun Sep 1 15:07:34 2002
++++ Makefile Tue Oct 8 13:51:49 2002
+@@ -6,12 +6,12 @@
--CFLAGS= $(OPTFLAGS) -Wall -g -I./libavcodec -I./libav
--LDFLAGS= -g
-+CFLAGS= $(OPTFLAGS) -Wall -I./libavcodec -I./libav -I$(LOCALBASE)/include
-+LDFLAGS= -L$(LOCALBASE)/lib
- ifeq ($(TARGET_GPROF),yes)
- CFLAGS+=-p
- LDFLAGS+=-p
-@@ -19,13 +19,13 @@
- $(MAKE) -C libav all
+ VPATH=$(SRC_PATH)
- ffmpeg: ffmpeg.o libav/libav.a libavcodec/libavcodec.a
-- gcc $(LDFLAGS) -o $@ $^ -lm
-+ $(CC) $(LDFLAGS) -o $@ $^ -lm
+-CFLAGS= $(OPTFLAGS) -Wall -g -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libav -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
++CFLAGS= $(OPTFLAGS) -Wall -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libav -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+ ifeq ($(CONFIG_DARWIN),yes)
+ LDFLAGS+= -g -d
+ FFSLDFLAGS= -Wl,-bind_at_load
+ else
+-LDFLAGS+= -g -Wl,--warn-common
++LDFLAGS+= -Wl,--warn-common
+ FFSLDFLAGS= -Wl,-E
+ endif
+
+@@ -60,7 +60,7 @@
+ ffserver$(EXE): ffserver.o $(DEP_LIBS)
+ $(CC) $(LDFLAGS) $(FFSLDFLAGS) \
+ -o $@ ffserver.o -L./libavcodec -L./libav \
+- -lavformat -lavcodec -ldl $(EXTRALIBS)
++ -lavformat -lavcodec $(EXTRALIBS)
- ffserver: ffserver.o libav/libav.a libavcodec/libavcodec.a
-- gcc $(LDFLAGS) -o $@ $^ -lm
-+ $(CC) $(LDFLAGS) -o $@ $^ -lm -lgnugetopt
-
- %.o: %.c
-- gcc $(CFLAGS) -c -o $@ $<
-+ $(CC) $(CFLAGS) -c -o $@ $<
-
- install: all
- install -s -m 755 $(PROG) $(prefix)/bin
+ ffplay: ffmpeg$(EXE)
+ ln -sf $< $@
diff --git a/multimedia/ffmpeg045/files/patch-ffmpeg.c b/multimedia/ffmpeg045/files/patch-ffmpeg.c
index 093e99aed89b..2242cdb60be1 100644
--- a/multimedia/ffmpeg045/files/patch-ffmpeg.c
+++ b/multimedia/ffmpeg045/files/patch-ffmpeg.c
@@ -1,10 +1,37 @@
---- ffmpeg.c.orig Mon Aug 13 18:23:57 2001
-+++ ffmpeg.c Tue Sep 25 14:47:58 2001
-@@ -35,6 +35,7 @@
+--- ffmpeg.c.orig Thu Oct 10 20:13:52 2002
++++ ffmpeg.c Thu Oct 10 20:14:03 2002
+@@ -36,6 +36,7 @@
+ #include <ctype.h>
- #include "avformat.h"
+#define INT64_C(x) x##LL
#define MAXINT64 INT64_C(0x7fffffffffffffff)
typedef struct {
+@@ -146,7 +147,7 @@
+ const char *audio_device = "none";
+ #endif
+ #ifndef CONFIG_VIDEO4LINUX
+-const char *v4l_device = "none";
++const char *video_device = "none";
+ #endif
+
+ typedef struct AVOutputStream {
+@@ -1601,7 +1602,7 @@
+
+ void opt_video_device(const char *arg)
+ {
+- v4l_device = strdup(arg);
++ video_device = strdup(arg);
+ }
+
+ void opt_audio_device(const char *arg)
+@@ -2099,7 +2100,7 @@
+ /* by now video grab has one stream */
+ ic->streams[0]->r_frame_rate = ap->frame_rate;
+ input_files[nb_input_files] = ic;
+- dump_format(ic, nb_input_files, v4l_device, 0);
++ dump_format(ic, nb_input_files, video_device, 0);
+ nb_input_files++;
+ }
+ if (has_audio) {
diff --git a/multimedia/ffmpeg045/files/patch-ffserver.c b/multimedia/ffmpeg045/files/patch-ffserver.c
index b0b444a8405a..93bd700c5137 100644
--- a/multimedia/ffmpeg045/files/patch-ffserver.c
+++ b/multimedia/ffmpeg045/files/patch-ffserver.c
@@ -1,18 +1,18 @@
---- ffserver.c.orig Tue Sep 25 14:53:44 2001
-+++ ffserver.c Tue Sep 25 14:55:12 2001
+--- ffserver.c.orig Tue Oct 8 13:45:36 2002
++++ ffserver.c Tue Oct 8 13:46:10 2002
@@ -20,7 +20,6 @@
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
+ #include "avformat.h"
+
+ #include <stdarg.h>
-#include <netinet/in.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-@@ -31,6 +30,7 @@
- #include <getopt.h>
+@@ -30,6 +29,7 @@
+ #include <time.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <netinet/in.h>
+ #include <sys/wait.h>
#include <arpa/inet.h>
#include <netdb.h>
- #include <ctype.h>
diff --git a/multimedia/ffmpeg045/files/patch-libav::Makefile b/multimedia/ffmpeg045/files/patch-libav::Makefile
index 34bf5410ed7e..bc4294226b26 100644
--- a/multimedia/ffmpeg045/files/patch-libav::Makefile
+++ b/multimedia/ffmpeg045/files/patch-libav::Makefile
@@ -1,9 +1,20 @@
---- libav/Makefile.orig Tue Aug 14 19:32:28 2001
-+++ libav/Makefile Tue Sep 25 15:05:38 2001
-@@ -1,5 +1,5 @@
- include ../config.mak
--CFLAGS= $(OPTFLAGS) -Wall -g -I../libavcodec -DHAVE_AV_CONFIG_H
-+CFLAGS= $(OPTFLAGS) -Wall -I../libavcodec -I$(LOCALBASE)/include -DHAVE_AV_CONFIG_H
-
- OBJS= rm.o mpeg.o asf.o avienc.o jpeg.o swf.o wav.o raw.o \
- avidec.o ffm.o \
+--- libav/Makefile.orig Tue Oct 8 13:54:16 2002
++++ libav/Makefile Tue Oct 8 13:54:30 2002
+@@ -6,7 +6,7 @@
+
+ VPATH=$(SRC_PATH)/libav
+
+-CFLAGS= $(OPTFLAGS) -Wall -g -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
++CFLAGS= $(OPTFLAGS) -Wall -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+
+ OBJS= utils.o cutils.o allformats.o
+
+@@ -17,7 +17,7 @@
+ OBJS+= avio.o aviobuf.o file.o
+
+ ifeq ($(CONFIG_VIDEO4LINUX),yes)
+-OBJS+= grab.o
++OBJS+= grab_bsdbktr.o
+ endif
+
+ ifeq ($(CONFIG_AUDIO_OSS),yes)
diff --git a/multimedia/ffmpeg045/files/patch-libav::avformat.h b/multimedia/ffmpeg045/files/patch-libav::avformat.h
new file mode 100644
index 000000000000..3199bc4a0bbe
--- /dev/null
+++ b/multimedia/ffmpeg045/files/patch-libav::avformat.h
@@ -0,0 +1,9 @@
+--- libav/avformat.h Mon Jul 8 04:38:40 2002
++++ libav/avformat.h Sun Jul 14 15:22:58 2002
+@@ -284,5 +284,5 @@
+ int video_grab_init(void);
+ int audio_init(void);
+
+-extern const char *v4l_device;
++extern const char *video_device;
+ extern const char *audio_device;
diff --git a/multimedia/ffmpeg045/files/patch-libavcodec::Makefile b/multimedia/ffmpeg045/files/patch-libavcodec::Makefile
index 383195e6f309..d760d0cee046 100644
--- a/multimedia/ffmpeg045/files/patch-libavcodec::Makefile
+++ b/multimedia/ffmpeg045/files/patch-libavcodec::Makefile
@@ -1,11 +1,22 @@
---- libavcodec/Makefile.orig Tue Sep 25 15:05:58 2001
-+++ libavcodec/Makefile Tue Sep 25 15:06:08 2001
-@@ -1,7 +1,6 @@
- include ../config.mak
+--- libavcodec/Makefile.orig Sun Oct 6 12:26:38 2002
++++ libavcodec/Makefile Wed Oct 9 14:24:34 2002
+@@ -7,8 +7,7 @@
+ VPATH=$(SRC_PATH)/libavcodec
--CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H
+ # NOTE: -I.. is needed to include config.h
+-CFLAGS= $(OPTFLAGS) -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
-LDFLAGS= -g
-+CFLAGS= $(OPTFLAGS) -Wall -DHAVE_AV_CONFIG_H
++CFLAGS= $(OPTFLAGS) -Wall -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
- OBJS= common.o utils.o mpegvideo.o h263.o jrevdct.o jfdctfst.o \
- mpegaudio.o ac3enc.o mjpeg.o resample.o dsputil.o \
+ OBJS= common.o utils.o mem.o allcodecs.o \
+ mpegvideo.o h263.o jrevdct.o jfdctfst.o jfdctint.o\
+@@ -167,8 +166,7 @@
+ install: all
+ ifeq ($(BUILD_SHARED),yes)
+ install -d $(prefix)/lib
+- install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec-$(VERSION).so
+- ln -sf libavcodec-$(VERSION).so $(prefix)/lib/libavcodec.so
++ install -s -m 755 $(SLIB) $(prefix)/lib/libavcodec.so
+ ldconfig || true
+ mkdir -p $(prefix)/include/ffmpeg
+ install -m 644 $(VPATH)/avcodec.h $(prefix)/include/ffmpeg/avcodec.h
diff --git a/multimedia/ffmpeg045/pkg-plist b/multimedia/ffmpeg045/pkg-plist
index cd53f45e0e73..13b2fb707420 100644
--- a/multimedia/ffmpeg045/pkg-plist
+++ b/multimedia/ffmpeg045/pkg-plist
@@ -1,18 +1,26 @@
bin/ffmpeg
+bin/ffplay
bin/ffserver
etc/ffserver.conf.sample
-include/libavcodec/avcodec.h
-include/libavcodec/common.h
-include/libavcodec/dsputil.h
-lib/libav.a
+include/ffmpeg/avcodec.h
+include/ffmpeg/common.h
+include/ffmpeg/dsputil.h
lib/libavcodec.a
+lib/libavcodec.so
+lib/libavcodec.so.%%SHLIB_VERSION%%
+lib/libavformat.a
+%%PORTDOCS%%share/doc/ffmpeg/COPYING
+%%PORTDOCS%%share/doc/ffmpeg/Changelog
%%PORTDOCS%%share/doc/ffmpeg/FAQ
+%%PORTDOCS%%share/doc/ffmpeg/HOWTO-STREAM
%%PORTDOCS%%share/doc/ffmpeg/README
+%%PORTDOCS%%share/doc/ffmpeg/README.beos
%%PORTDOCS%%share/doc/ffmpeg/README.dev
%%PORTDOCS%%share/doc/ffmpeg/README.tech
%%PORTDOCS%%share/doc/ffmpeg/TODO
+%%PORTDOCS%%share/doc/ffmpeg/VERSION
%%PORTDOCS%%share/doc/ffmpeg/bench.txt
%%PORTDOCS%%share/doc/ffmpeg/ffmpeg.txt
%%PORTDOCS%%share/doc/ffmpeg/ffserver.txt
%%PORTDOCS%%@dirrm share/doc/ffmpeg
-@dirrm include/libavcodec
+@dirrm include/ffmpeg