diff -ruN gstreamer-ffmpeg.orig/Makefile gstreamer-ffmpeg/Makefile
--- gstreamer-ffmpeg.orig/Makefile	Mon Aug  2 22:02:46 2004
+++ gstreamer-ffmpeg/Makefile	Tue Aug  3 22:48:16 2004
@@ -6,8 +6,7 @@
 #
 
 PORTNAME=	gstreamer
-PORTVERSION=	0.8.0
-PORTREVISION=	2
+PORTVERSION=	0.8.1
 CATEGORIES=	multimedia
 MASTER_SITES=	http://gstreamer.freedesktop.org/src/gst-ffmpeg/
 PKGNAMESUFFIX=	-ffmpeg
@@ -30,12 +29,15 @@
 		LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib"
 PLIST_SUB=	\
 		VERSION="${GST_VERSION}"
-INSTALLS_SHLIB=	yes
 
 PKG_CONFIG?="${LOCALBASE}/bin/pkg-config"
 GST_VERSION=${PORTVERSION:C/..$//}
 
 .include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 500000
+EXTRA_PATCHES=	${PATCHDIR}/extra-patch-gst-libs_ext_ffmpeg_libavformat_nut.c
+.endif
 
 post-patch:
 	@${REINPLACE_CMD} -E -e \
diff -ruN gstreamer-ffmpeg.orig/distinfo gstreamer-ffmpeg/distinfo
--- gstreamer-ffmpeg.orig/distinfo	Mon Apr  5 06:06:42 2004
+++ gstreamer-ffmpeg/distinfo	Tue Aug  3 22:47:49 2004
@@ -1,2 +1,2 @@
-MD5 (gst-ffmpeg-0.8.0.tar.bz2) = 26dd962c37e886cbc3be167680a44ee4
-SIZE (gst-ffmpeg-0.8.0.tar.bz2) = 1558194
+MD5 (gst-ffmpeg-0.8.1.tar.bz2) = f020b9f394fec2712964cd11ac46b43d
+SIZE (gst-ffmpeg-0.8.1.tar.bz2) = 1590668
diff -ruN gstreamer-ffmpeg.orig/files/extra-patch-gst-libs_ext_ffmpeg_libavformat_nut.c gstreamer-ffmpeg/files/extra-patch-gst-libs_ext_ffmpeg_libavformat_nut.c
--- gstreamer-ffmpeg.orig/files/extra-patch-gst-libs_ext_ffmpeg_libavformat_nut.c	Thu Jan  1 01:00:00 1970
+++ gstreamer-ffmpeg/files/extra-patch-gst-libs_ext_ffmpeg_libavformat_nut.c	Tue Aug  3 22:47:49 2004
@@ -0,0 +1,12 @@
+--- gst-libs/ext/ffmpeg/libavformat/nut.c.orig	Wed Apr 14 20:38:02 2004
++++ gst-libs/ext/ffmpeg/libavformat/nut.c	Sun Jul 11 18:14:19 2004
+@@ -59,6 +59,9 @@
+ #define FLAG_FULL_PTS        4
+ #define FLAG_KEY_FRAME      32
+ 
++// UINT64_MAX isn't defined on FreeBSD 4.x borrow it from 5.x
++#define UINT64_MAX      0xffffffffffffffffULL
++
+ typedef struct {
+     uint8_t flags;
+     uint8_t stream_id_plus1;
diff -ruN gstreamer-ffmpeg.orig/files/patch-ext_ffmpeg_gstffmpegcodecmap.c gstreamer-ffmpeg/files/patch-ext_ffmpeg_gstffmpegcodecmap.c
--- gstreamer-ffmpeg.orig/files/patch-ext_ffmpeg_gstffmpegcodecmap.c	Mon Apr  5 06:06:42 2004
+++ gstreamer-ffmpeg/files/patch-ext_ffmpeg_gstffmpegcodecmap.c	Thu Jan  1 01:00:00 1970
@@ -1,31 +0,0 @@
---- ext/ffmpeg/gstffmpegcodecmap.c.orig	Fri Feb  6 15:29:09 2004
-+++ ext/ffmpeg/gstffmpegcodecmap.c	Fri Feb  6 15:40:14 2004
-@@ -44,13 +44,13 @@
- 	"width",     G_TYPE_INT,   context->width,	      	\
- 	"height",    G_TYPE_INT,   context->height,	  	\
- 	"framerate", G_TYPE_DOUBLE, 1. * context->frame_rate /  \
--				   context->frame_rate_base,    \
-+				   context->frame_rate_base ,    \
- 	##props, NULL)	  					\
-     :	  							\
-     gst_caps_new_simple (mimetype,			      	\
- 	"width",     GST_TYPE_INT_RANGE, 16, 4096,      	\
- 	"height",    GST_TYPE_INT_RANGE, 16, 4096,	      	\
--	"framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE,	\
-+	"framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE ,	\
- 	##props, NULL)
- 
- /* same for audio - now with channels/sample rate
-@@ -60,10 +60,10 @@
-     (context != NULL) ?					      	\
-     gst_caps_new_simple (mimetype,	      			\
- 	"rate", G_TYPE_INT, context->sample_rate,		\
--	"channels", G_TYPE_INT, context->channels,		\
-+	"channels", G_TYPE_INT, context->channels ,		\
- 	##props, NULL)						\
-     :								\
--    gst_caps_new_simple (mimetype,	      			\
-+    gst_caps_new_simple (mimetype ,	      			\
- 	##props, NULL)
- 
- /* Convert a FFMPEG codec ID and optional AVCodecContext
diff -ruN gstreamer-ffmpeg.orig/files/patch-gst-libs_ext_ffmpeg_libavformat_mov.c gstreamer-ffmpeg/files/patch-gst-libs_ext_ffmpeg_libavformat_mov.c
--- gstreamer-ffmpeg.orig/files/patch-gst-libs_ext_ffmpeg_libavformat_mov.c	Thu Jan  1 01:00:00 1970
+++ gstreamer-ffmpeg/files/patch-gst-libs_ext_ffmpeg_libavformat_mov.c	Tue Aug  3 22:47:49 2004
@@ -0,0 +1,18 @@
+--- gst-libs/ext/ffmpeg/libavformat/mov.c.orig	Fri Apr 30 20:41:45 2004
++++ gst-libs/ext/ffmpeg/libavformat/mov.c	Sun Jul 11 18:21:15 2004
+@@ -998,6 +998,7 @@
+             else if( st->codec.codec_tag == MKTAG( 'm', 'p', '4', 'a' ))
+             {
+                 /* Handle mp4 audio tag */
++                MOV_atom_t a = { format, url_ftell(pb), size - (20 + 20 + 8) };
+                 get_be32(pb); /* version */
+                 get_be32(pb);
+                 st->codec.channels = get_be16(pb); /* channels */
+@@ -1006,7 +1007,6 @@
+                 st->codec.sample_rate = get_be16(pb); /* sample rate, not always correct */
+                 get_be16(pb);
+                 c->mp4=1;
+-                MOV_atom_t a = { format, url_ftell(pb), size - (20 + 20 + 8) };
+                 mov_read_default(c, pb, a);
+                 /* Get correct sample rate from extradata */
+                 if(st->codec.extradata_size) {
diff -ruN gstreamer-ffmpeg.orig/pkg-plist gstreamer-ffmpeg/pkg-plist
--- gstreamer-ffmpeg.orig/pkg-plist	Mon Apr  5 06:06:42 2004
+++ gstreamer-ffmpeg/pkg-plist	Tue Aug  3 22:48:35 2004
@@ -1,3 +1,4 @@
-@unexec %D/bin/gst-register 2>/dev/null || true
-lib/gstreamer-%%VERSION%%/libgstffmpeg.so
 @exec %D/bin/gst-register 2>/dev/null || true
+lib/gstreamer-%%VERSION%%/libgstffmpeg.so
+@unexec %D/bin/gst-register 2>/dev/null || true
+