diff options
author | Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> | 2003-09-07 23:52:59 +0000 |
---|---|---|
committer | Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> | 2003-09-07 23:52:59 +0000 |
commit | db73464fc28df35e49fd283f4ad75c037f5eccd0 (patch) | |
tree | a4f221ea3dab4d1d9802b2abe9d980f21b365253 /multimedia | |
parent | Upgrade to version 4.12, which contains several new hacks, and updates (diff) |
Update to 0.4.7
Submitted by: Steve O'Hara-Smith <steve@sohara.org>
Notes
Notes:
svn path=/head/; revision=88700
Diffstat (limited to 'multimedia')
-rw-r--r-- | multimedia/ffmpeg-devel/Makefile | 45 | ||||
-rw-r--r-- | multimedia/ffmpeg-devel/distinfo | 2 | ||||
-rw-r--r-- | multimedia/ffmpeg-devel/files/extra-bktr-patch-ffmpeg.c | 37 | ||||
-rw-r--r-- | multimedia/ffmpeg-devel/files/extra-bktr-patch-libavformat::avformat.h | 11 | ||||
-rw-r--r-- | multimedia/ffmpeg-devel/files/grab_bsdbktr.c | 193 | ||||
-rw-r--r-- | multimedia/ffmpeg-devel/files/patch-libavformat::audio.c | 17 | ||||
-rw-r--r-- | multimedia/ffmpeg-devel/pkg-plist | 8 | ||||
-rw-r--r-- | multimedia/ffmpeg/Makefile | 45 | ||||
-rw-r--r-- | multimedia/ffmpeg/distinfo | 2 | ||||
-rw-r--r-- | multimedia/ffmpeg/files/extra-bktr-patch-ffmpeg.c | 37 | ||||
-rw-r--r-- | multimedia/ffmpeg/files/extra-bktr-patch-libavformat::avformat.h | 11 | ||||
-rw-r--r-- | multimedia/ffmpeg/files/grab_bsdbktr.c | 193 | ||||
-rw-r--r-- | multimedia/ffmpeg/files/patch-libavformat::audio.c | 17 | ||||
-rw-r--r-- | multimedia/ffmpeg/pkg-plist | 8 |
14 files changed, 348 insertions, 278 deletions
diff --git a/multimedia/ffmpeg-devel/Makefile b/multimedia/ffmpeg-devel/Makefile index b17bccfff697..6d36f2d3e7e4 100644 --- a/multimedia/ffmpeg-devel/Makefile +++ b/multimedia/ffmpeg-devel/Makefile @@ -6,8 +6,7 @@ # PORTNAME= ffmpeg -PORTVERSION= 0.4.6 -PORTREVISION= 3 +PORTVERSION= 0.4.7 CATEGORIES= multimedia audio net MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ffmpeg @@ -46,14 +45,17 @@ LIB_FILES= libavcodec/libavcodec.a libavformat/libavformat.a WITHOUT_MMX= yes .else # only for i386 -EXTRA_PATCHES+= ${FILESDIR}/extra-bktr-patch-libavformat::Makefile \ - ${FILESDIR}/extra-bktr-patch-libavformat::avformat.h \ - ${FILESDIR}/extra-bktr-patch-ffmpeg.c +EXTRA_PATCHES+= ${FILESDIR}/extra-bktr-patch-libavformat::Makefile .endif ## lib detection ## ## +## SDL +.if exists(${LOCALBASE}/lib/libSDL-1.1.so) +#WITH_SDL=yes +.endif +## imlib2 .if exists(${X11BASE}/lib/libImlib2.so) WITH_IMLIB2=yes .endif @@ -90,6 +92,14 @@ PLIST_SUB+= IMLIB2="@comment " .ifdef(WITHOUT_MMX) CONFIGURE_ARGS+= --disable-mmx .endif +## SDL +.ifdef(WITH_SDL) +USE_SDL= yes + +PLIST_SUB+= SDL="" +.else +PLIST_SUB+= SDL="@comment " +.endif ## mp3 .ifdef(WITH_MP3) LIB_DEPENDS+= mp3lame.0:${PORTSDIR}/audio/lame @@ -121,25 +131,32 @@ CONFIGURE_ARGS+= --enable-vorbis pre-everything:: .ifndef(WITHOUT_LIBA52) @${ECHO_MSG} "You can disable liba52 support by defining WITHOUT_LIBA52" + @${ECHO_MSG} .endif .ifndef(WITHOUT_MMX) @${ECHO_MSG} "Define WITHOUT_MMX if your system does not support MMX" + @${ECHO_MSG} +.endif +.ifndef(WITH_SDL) + @${ECHO_MSG} 'Define WITH_SDL to enable ffplay SDL version' + @${ECHO_MSG} .endif .ifndef(WITH_MP3) @${ECHO_MSG} 'Define WITH_MP3 to enable lame MP3 codec' + @${ECHO_MSG} .endif .ifndef(WITH_OPTIMIZED_CFLAGS) - @${ECHO_MSG} @${ECHO_MSG} 'You can enable additional compilation optimizations' @${ECHO_MSG} 'by defining WITH_OPTIMIZED_CFLAGS' + @${ECHO_MSG} .endif .ifndef(WITHOUT_VHOOK) - @${ECHO_MSG} @${ECHO_MSG} 'You can disable vhook support by defining WITHOUT_VHOOK' + @${ECHO_MSG} .endif .ifndef(WITH_VORBIS) - @${ECHO_MSG} @${ECHO_MSG} 'Define WITH_VORBIS to enable libvorbisenc VORBIS codec' + @${ECHO_MSG} .endif .if ${ARCH} == "i386" .if !(defined(WITH_BKTR_FORMAT) && defined(WITH_BKTR_DEV)) @@ -177,18 +194,26 @@ post-patch: .endif .ifdef(WITH_BKTR_DEV) @${REINPLACE_CMD} -e \ - "s!VIDEO_INPUT METEOR_INPUT_DEV0!VIDEO_INPUT METEOR_INPUT_DEV${WITH_BKTR_DEV}!" \ + "s!idev = 0!idev = ${WITH_BKTR_DEV}!" \ ${WRKSRC}/libavformat/grab_bsdbktr.c .endif .endif # ${ARCH} == i386 # malloc.h was deprecated in favor of stdlib.h @${FIND} ${WRKSRC} -type f | \ ${XARGS} -n 10 ${REINPLACE_CMD} -e \ - 's|malloc.h|stdlib.h|' + 's|malloc\.h|stdlib\.h|' .ifndef(WITHOUT_LIBA52) @${REINPLACE_CMD} -e 's|-ldl||' \ ${WRKSRC}/configure .endif +.ifdef(WITH_SDL) + @${REINPLACE_CMD} -E \ + -e 's|sdl-config|${SDL_CONFIG}|g' \ + ${CONFIGURE_WRKSRC}/${CONFIGURE_SCRIPT} + @${FIND} ${WRKSRC} -type f | \ + ${XARGS} -n 10 ${REINPLACE_CMD} -E \ + -e 's|#include <SDL|#include <SDL11/SDL|' +.endif post-install: .ifndef(NOPORTDOCS) diff --git a/multimedia/ffmpeg-devel/distinfo b/multimedia/ffmpeg-devel/distinfo index ade63a0daf30..24516b0bdb1e 100644 --- a/multimedia/ffmpeg-devel/distinfo +++ b/multimedia/ffmpeg-devel/distinfo @@ -1 +1 @@ -MD5 (ffmpeg-0.4.6.tar.gz) = bdd96d28327d3abe02e886c13e633878 +MD5 (ffmpeg-0.4.7.tar.gz) = bd9ab3e27f6c92fa06286b8f40277994 diff --git a/multimedia/ffmpeg-devel/files/extra-bktr-patch-ffmpeg.c b/multimedia/ffmpeg-devel/files/extra-bktr-patch-ffmpeg.c deleted file mode 100644 index 0ba5924735c1..000000000000 --- a/multimedia/ffmpeg-devel/files/extra-bktr-patch-ffmpeg.c +++ /dev/null @@ -1,37 +0,0 @@ ---- ffmpeg.c.orig Wed Jan 1 20:56:06 2003 -+++ ffmpeg.c Wed Jan 1 20:56:41 2003 -@@ -35,6 +35,7 @@ - #define INFINITY HUGE_VAL - #endif - -+#define INT64_C(x) x##LL - #define MAXINT64 INT64_C(0x7fffffffffffffff) - - typedef struct { -@@ -158,7 +159,7 @@ - const char *audio_device = "none"; - #endif - #ifndef CONFIG_VIDEO4LINUX --const char *v4l_device = "none"; -+const char *video_device = "none"; - #endif - - typedef struct AVOutputStream { -@@ -1842,7 +1843,7 @@ - - void opt_video_device(const char *arg) - { -- v4l_device = strdup(arg); -+ video_device = strdup(arg); - } - - void opt_audio_device(const char *arg) -@@ -2428,7 +2429,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/extra-bktr-patch-libavformat::avformat.h b/multimedia/ffmpeg-devel/files/extra-bktr-patch-libavformat::avformat.h deleted file mode 100644 index 7c3de0a20929..000000000000 --- a/multimedia/ffmpeg-devel/files/extra-bktr-patch-libavformat::avformat.h +++ /dev/null @@ -1,11 +0,0 @@ ---- libavformat/avformat.h.orig Wed Jan 1 21:03:56 2003 -+++ libavformat/avformat.h Wed Jan 1 21:04:02 2003 -@@ -329,7 +329,7 @@ - int video_grab_init(void); - int audio_init(void); - --extern const char *v4l_device; -+extern const char *video_device; - extern const char *audio_device; - - #ifdef HAVE_AV_CONFIG_H diff --git a/multimedia/ffmpeg-devel/files/grab_bsdbktr.c b/multimedia/ffmpeg-devel/files/grab_bsdbktr.c index 2dc397a8d804..81d1850fdc5c 100644 --- a/multimedia/ffmpeg-devel/files/grab_bsdbktr.c +++ b/multimedia/ffmpeg-devel/files/grab_bsdbktr.c @@ -39,8 +39,8 @@ typedef struct { int frame_format; /* see VIDEO_PALETTE_xxx */ int width, height; int frame_rate; - INT64 per_frame; - INT64 last_frame_time; + int frame_rate_base; + int64_t per_frame; } VideoData; const char *video_device = "/dev/bktr0"; @@ -63,11 +63,10 @@ const char *video_device = "/dev/bktr0"; #define VIDEO_FORMAT NTSC #endif -#ifndef VIDEO_INPUT -#define VIDEO_INPUT METEOR_INPUT_DEV0; -#endif +static int bktr_dev[] = { METEOR_DEV0, METEOR_DEV1, METEOR_DEV2, + METEOR_DEV3, METEOR_DEV_SVIDEO }; -static UINT8 *video_buf; +static u_int8_t *video_buf; static int nsignals = 0; static void catchsignal(int signal) { @@ -75,41 +74,65 @@ static void catchsignal(int signal) return; } -static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap) +static int bktr_init (const char *video_device, int width, int height, + int format, u_int8_t **video_buf, int *video_fd, int *tuner_fd, + int idev, double frequency) { - VideoData *s = s1->priv_data; - int width, height, h_max; - int video_fd; - int format = VIDEO_FORMAT; struct meteor_geomet geo; + int h_max; + long ioctl_frequency; + char *arg; int c; struct sigaction act,old; + if (idev < 0 || idev > 4) + { + arg = getenv ("BKTR_DEV"); + if (arg) + idev = atoi (arg); + if (idev < 0 || idev > 4) + idev = 0; + } + + if (format < 1 || format > 6) + { + arg = getenv ("BKTR_FORMAT"); + if (arg) + format = atoi (arg); + if (format < 1 || format > 6) + format = VIDEO_FORMAT; + } + + if (frequency <= 0) + { + arg = getenv ("BKTR_FREQUENCY"); + if (arg) + frequency = atof (arg); + if (frequency <= 0) + frequency = 0.0; + } + 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->last_frame_time = 0; - s->tuner_fd = open ("/dev/tuner0", O_RDONLY); - if (s->tuner_fd < 0) { + *tuner_fd = open ("/dev/tuner0", O_RDONLY); + if (*tuner_fd < 0) { perror("Warning: Tuner not opened continuing"); } - video_fd = open(video_device, O_RDONLY); - if (video_fd < 0) { - perror(video_device); - return -EIO; + *video_fd = open (video_device, O_RDONLY); + if (*video_fd < 0) { + perror (video_device); + return -1; } - s->fd=video_fd; + geo.rows = height; geo.columns = width; geo.frames = 1; - geo.oformat = METEOR_GEO_YUV_422 | METEOR_GEO_YUV_12; +// geo.oformat = METEOR_GEO_YUV_422 | METEOR_GEO_YUV_12; + geo.oformat = METEOR_GEO_YUV_PACKED; switch (format) { case PAL: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI; break; @@ -124,61 +147,89 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap) geo.oformat |= METEOR_GEO_EVEN_ONLY; } - if (ioctl(video_fd, METEORSETGEO, &geo) < 0) { + if (ioctl(*video_fd, METEORSETGEO, &geo) < 0) { perror ("METEORSETGEO"); - return -EIO; + return -1; } - if (ioctl(video_fd, BT848SFMT, &c) < 0) { + if (ioctl(*video_fd, BT848SFMT, &c) < 0) { perror ("BT848SFMT"); - return -EIO; + return -1; } - c = VIDEO_INPUT; - if (ioctl(video_fd, METEORSINPUT, &c) < 0) { + c = bktr_dev[idev]; + if (ioctl(*video_fd, METEORSINPUT, &c) < 0) { perror ("METEORSINPUT"); - return -EIO; + return -1; } - video_buf = mmap((caddr_t)0, width*height*3, PROT_READ, MAP_SHARED, - video_fd, (off_t) 0); - if (video_buf == MAP_FAILED) { + *video_buf = (u_int8_t *) mmap((caddr_t)0, width*height*2, + PROT_READ, MAP_SHARED, *video_fd, (off_t) 0); + if (*video_buf == MAP_FAILED) { perror ("mmap"); - return -EIO; + return -1; + } + if (frequency != 0.0) { + ioctl_frequency = (unsigned long)(frequency*16); + if (ioctl(*tuner_fd, TVTUNER_SETFREQ, &ioctl_frequency)<0) + perror("TVTUNER_SETFREQ"); } c = METEOR_CAP_CONTINOUS; - ioctl(s->fd, METEORCAPTUR, &c); + ioctl(*video_fd, METEORCAPTUR, &c); c = SIGUSR1; - ioctl (s->fd, METEORSSIGNAL, &c); + ioctl (*video_fd, METEORSSIGNAL, &c); return 0; } +static void bktr_getframe(u_int64_t per_frame) +{ + u_int64_t curtime; + static u_int64_t last_frame_time = 0; + + curtime = av_gettime(); + if (!last_frame_time + || ((last_frame_time + per_frame) > curtime)) { + if (!usleep (last_frame_time + per_frame + per_frame/8 - curtime)) { + if (!nsignals) + printf ("\nSLEPT NO signals - %d microseconds late\n", + (int) (av_gettime() - last_frame_time - per_frame)); + } + } + nsignals = 0; + + last_frame_time = curtime; +} + +void bf_memcpy (char *dest, char *src, int size) +{ + while (size -= 2) + { + dest[0] = src[1]; + dest[1] = src[0]; + dest += 2; + src += 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; - UINT64 curtime; size = s->width * s->height; halfsize = size << 1; - if (av_new_packet(pkt, size + halfsize) < 0) + +// if (av_new_packet(pkt, size + halfsize) < 0) + if (av_new_packet(pkt, size + size) < 0) return -EIO; - curtime = av_gettime(); - if (!s->last_frame_time - || ((s->last_frame_time + s->per_frame) > curtime)) { - if (!usleep (s->last_frame_time + s->per_frame + s->per_frame/8 - curtime)) { - if (!nsignals) - printf ("\nSLEPT NO signals - %d microseconds late\n", - av_gettime() - s->last_frame_time - s->per_frame); - } - } - nsignals = 0; + bktr_getframe (s->per_frame); + pkt->pts = av_gettime() & ((1LL << 48) - 1); + bf_memcpy (pkt->data, video_buf, size + size); +// bf_memcpy (pkt->data, video_buf, size + halfsize); - s->last_frame_time = curtime; - pkt->pts = curtime & ((1LL << 48) - 1); - memcpy (pkt->data, video_buf, size + halfsize); - return size + halfsize; +// return size + halfsize; + return size + size; } static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap) @@ -187,6 +238,8 @@ static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap) AVStream *st; int width, height; int frame_rate; + int frame_rate_base; + int format = -1; if (!ap || ap->width <= 0 || ap->height <= 0 || ap->frame_rate <= 0) return -1; @@ -194,26 +247,42 @@ static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap) width = ap->width; height = ap->height; frame_rate = ap->frame_rate; + frame_rate_base = ap->frame_rate_base; + 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->per_frame = (INT64_C(1000000) * FRAME_RATE_BASE) / s->frame_rate; - st->codec.pix_fmt = PIX_FMT_YUV420P; + s->frame_rate_base = frame_rate_base; + s->per_frame = ((int64_t)1000000 * s->frame_rate_base) / s->frame_rate; + + st->codec.codec_type = CODEC_TYPE_VIDEO; +// st->codec.pix_fmt = PIX_FMT_YUV420P; + st->codec.pix_fmt = PIX_FMT_YUV422; st->codec.codec_id = CODEC_ID_RAWVIDEO; st->codec.width = width; st->codec.height = height; st->codec.frame_rate = frame_rate; + st->codec.frame_rate_base = frame_rate_base; + + av_set_pts_info(s1, 48, 1, 1000000); /* 48 bits pts in use */ - av_set_pts_info(s1, 48, 1, 1000000); /* 48 bits pts in us */ + if (ap->standard) { + if (!strcasecmp(ap->standard, "pal")) + format = PAL; + if (!strcasecmp(ap->standard, "secam")) + format = SECAM; + if (!strcasecmp(ap->standard, "ntsc")) + format = NTSC; + } - return bktr_init(s1, ap); + if (bktr_init (video_device, width, height, format, &video_buf, + &(s->fd), &(s->tuner_fd), -1, 0.0) < 0) + return -EIO; + return 0; } static int grab_read_close (AVFormatContext *s1) @@ -224,12 +293,12 @@ static int grab_read_close (AVFormatContext *s1) ioctl(s->fd, METEORCAPTUR, &c); close(s->fd); close(s->tuner_fd); - free(s); + av_free(s); return 0; } AVInputFormat video_grab_device_format = { - "video_grab_device", + "video4linux", "video grab", sizeof(VideoData), NULL, diff --git a/multimedia/ffmpeg-devel/files/patch-libavformat::audio.c b/multimedia/ffmpeg-devel/files/patch-libavformat::audio.c deleted file mode 100644 index 375a58dd7280..000000000000 --- a/multimedia/ffmpeg-devel/files/patch-libavformat::audio.c +++ /dev/null @@ -1,17 +0,0 @@ ---- libavformat/audio.c.orig Wed Feb 5 20:49:08 2003 -+++ libavformat/audio.c Wed Feb 5 20:50:36 2003 -@@ -243,6 +243,14 @@ - if (av_new_packet(pkt, s->frame_size) < 0) - return -EIO; - for(;;) { -+ struct timeval tv; -+ fd_set fds; -+ tv.tv_sec = 0; -+ tv.tv_usec = 30 * 1000; /* 30 msecs -- a bit shorter than 1 frame at 30fps */ -+ FD_ZERO(&fds); -+ FD_SET(s->fd, &fds); /* This will block until data is available or we get a timeout */ -+ (void) select(s->fd + 1, &fds, 0, 0, &tv); -+ - ret = read(s->fd, pkt->data, pkt->size); - if (ret > 0) - break; diff --git a/multimedia/ffmpeg-devel/pkg-plist b/multimedia/ffmpeg-devel/pkg-plist index ee83d16ccff5..d6ebec96d363 100644 --- a/multimedia/ffmpeg-devel/pkg-plist +++ b/multimedia/ffmpeg-devel/pkg-plist @@ -1,14 +1,20 @@ bin/ffmpeg -bin/ffplay +%%SDL%%bin/ffplay bin/ffserver etc/ffserver.conf.sample include/ffmpeg/avcodec.h +include/ffmpeg/avformat.h +include/ffmpeg/avio.h include/ffmpeg/common.h include/ffmpeg/dsputil.h +include/ffmpeg/rtp.h +include/ffmpeg/rtsp.h +include/ffmpeg/rtspcodes.h lib/libavcodec.a lib/libavcodec.so lib/libavcodec.so.%%SHLIB_VERSION%% lib/libavformat.a +%%VHOOK%%lib/vhook/drawtext.so %%VHOOK%%lib/vhook/fish.so %%VHOOK%%%%IMLIB2%%lib/vhook/imlib2.so %%VHOOK%%lib/vhook/null.so diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile index b17bccfff697..6d36f2d3e7e4 100644 --- a/multimedia/ffmpeg/Makefile +++ b/multimedia/ffmpeg/Makefile @@ -6,8 +6,7 @@ # PORTNAME= ffmpeg -PORTVERSION= 0.4.6 -PORTREVISION= 3 +PORTVERSION= 0.4.7 CATEGORIES= multimedia audio net MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ffmpeg @@ -46,14 +45,17 @@ LIB_FILES= libavcodec/libavcodec.a libavformat/libavformat.a WITHOUT_MMX= yes .else # only for i386 -EXTRA_PATCHES+= ${FILESDIR}/extra-bktr-patch-libavformat::Makefile \ - ${FILESDIR}/extra-bktr-patch-libavformat::avformat.h \ - ${FILESDIR}/extra-bktr-patch-ffmpeg.c +EXTRA_PATCHES+= ${FILESDIR}/extra-bktr-patch-libavformat::Makefile .endif ## lib detection ## ## +## SDL +.if exists(${LOCALBASE}/lib/libSDL-1.1.so) +#WITH_SDL=yes +.endif +## imlib2 .if exists(${X11BASE}/lib/libImlib2.so) WITH_IMLIB2=yes .endif @@ -90,6 +92,14 @@ PLIST_SUB+= IMLIB2="@comment " .ifdef(WITHOUT_MMX) CONFIGURE_ARGS+= --disable-mmx .endif +## SDL +.ifdef(WITH_SDL) +USE_SDL= yes + +PLIST_SUB+= SDL="" +.else +PLIST_SUB+= SDL="@comment " +.endif ## mp3 .ifdef(WITH_MP3) LIB_DEPENDS+= mp3lame.0:${PORTSDIR}/audio/lame @@ -121,25 +131,32 @@ CONFIGURE_ARGS+= --enable-vorbis pre-everything:: .ifndef(WITHOUT_LIBA52) @${ECHO_MSG} "You can disable liba52 support by defining WITHOUT_LIBA52" + @${ECHO_MSG} .endif .ifndef(WITHOUT_MMX) @${ECHO_MSG} "Define WITHOUT_MMX if your system does not support MMX" + @${ECHO_MSG} +.endif +.ifndef(WITH_SDL) + @${ECHO_MSG} 'Define WITH_SDL to enable ffplay SDL version' + @${ECHO_MSG} .endif .ifndef(WITH_MP3) @${ECHO_MSG} 'Define WITH_MP3 to enable lame MP3 codec' + @${ECHO_MSG} .endif .ifndef(WITH_OPTIMIZED_CFLAGS) - @${ECHO_MSG} @${ECHO_MSG} 'You can enable additional compilation optimizations' @${ECHO_MSG} 'by defining WITH_OPTIMIZED_CFLAGS' + @${ECHO_MSG} .endif .ifndef(WITHOUT_VHOOK) - @${ECHO_MSG} @${ECHO_MSG} 'You can disable vhook support by defining WITHOUT_VHOOK' + @${ECHO_MSG} .endif .ifndef(WITH_VORBIS) - @${ECHO_MSG} @${ECHO_MSG} 'Define WITH_VORBIS to enable libvorbisenc VORBIS codec' + @${ECHO_MSG} .endif .if ${ARCH} == "i386" .if !(defined(WITH_BKTR_FORMAT) && defined(WITH_BKTR_DEV)) @@ -177,18 +194,26 @@ post-patch: .endif .ifdef(WITH_BKTR_DEV) @${REINPLACE_CMD} -e \ - "s!VIDEO_INPUT METEOR_INPUT_DEV0!VIDEO_INPUT METEOR_INPUT_DEV${WITH_BKTR_DEV}!" \ + "s!idev = 0!idev = ${WITH_BKTR_DEV}!" \ ${WRKSRC}/libavformat/grab_bsdbktr.c .endif .endif # ${ARCH} == i386 # malloc.h was deprecated in favor of stdlib.h @${FIND} ${WRKSRC} -type f | \ ${XARGS} -n 10 ${REINPLACE_CMD} -e \ - 's|malloc.h|stdlib.h|' + 's|malloc\.h|stdlib\.h|' .ifndef(WITHOUT_LIBA52) @${REINPLACE_CMD} -e 's|-ldl||' \ ${WRKSRC}/configure .endif +.ifdef(WITH_SDL) + @${REINPLACE_CMD} -E \ + -e 's|sdl-config|${SDL_CONFIG}|g' \ + ${CONFIGURE_WRKSRC}/${CONFIGURE_SCRIPT} + @${FIND} ${WRKSRC} -type f | \ + ${XARGS} -n 10 ${REINPLACE_CMD} -E \ + -e 's|#include <SDL|#include <SDL11/SDL|' +.endif post-install: .ifndef(NOPORTDOCS) diff --git a/multimedia/ffmpeg/distinfo b/multimedia/ffmpeg/distinfo index ade63a0daf30..24516b0bdb1e 100644 --- a/multimedia/ffmpeg/distinfo +++ b/multimedia/ffmpeg/distinfo @@ -1 +1 @@ -MD5 (ffmpeg-0.4.6.tar.gz) = bdd96d28327d3abe02e886c13e633878 +MD5 (ffmpeg-0.4.7.tar.gz) = bd9ab3e27f6c92fa06286b8f40277994 diff --git a/multimedia/ffmpeg/files/extra-bktr-patch-ffmpeg.c b/multimedia/ffmpeg/files/extra-bktr-patch-ffmpeg.c deleted file mode 100644 index 0ba5924735c1..000000000000 --- a/multimedia/ffmpeg/files/extra-bktr-patch-ffmpeg.c +++ /dev/null @@ -1,37 +0,0 @@ ---- ffmpeg.c.orig Wed Jan 1 20:56:06 2003 -+++ ffmpeg.c Wed Jan 1 20:56:41 2003 -@@ -35,6 +35,7 @@ - #define INFINITY HUGE_VAL - #endif - -+#define INT64_C(x) x##LL - #define MAXINT64 INT64_C(0x7fffffffffffffff) - - typedef struct { -@@ -158,7 +159,7 @@ - const char *audio_device = "none"; - #endif - #ifndef CONFIG_VIDEO4LINUX --const char *v4l_device = "none"; -+const char *video_device = "none"; - #endif - - typedef struct AVOutputStream { -@@ -1842,7 +1843,7 @@ - - void opt_video_device(const char *arg) - { -- v4l_device = strdup(arg); -+ video_device = strdup(arg); - } - - void opt_audio_device(const char *arg) -@@ -2428,7 +2429,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/extra-bktr-patch-libavformat::avformat.h b/multimedia/ffmpeg/files/extra-bktr-patch-libavformat::avformat.h deleted file mode 100644 index 7c3de0a20929..000000000000 --- a/multimedia/ffmpeg/files/extra-bktr-patch-libavformat::avformat.h +++ /dev/null @@ -1,11 +0,0 @@ ---- libavformat/avformat.h.orig Wed Jan 1 21:03:56 2003 -+++ libavformat/avformat.h Wed Jan 1 21:04:02 2003 -@@ -329,7 +329,7 @@ - int video_grab_init(void); - int audio_init(void); - --extern const char *v4l_device; -+extern const char *video_device; - extern const char *audio_device; - - #ifdef HAVE_AV_CONFIG_H diff --git a/multimedia/ffmpeg/files/grab_bsdbktr.c b/multimedia/ffmpeg/files/grab_bsdbktr.c index 2dc397a8d804..81d1850fdc5c 100644 --- a/multimedia/ffmpeg/files/grab_bsdbktr.c +++ b/multimedia/ffmpeg/files/grab_bsdbktr.c @@ -39,8 +39,8 @@ typedef struct { int frame_format; /* see VIDEO_PALETTE_xxx */ int width, height; int frame_rate; - INT64 per_frame; - INT64 last_frame_time; + int frame_rate_base; + int64_t per_frame; } VideoData; const char *video_device = "/dev/bktr0"; @@ -63,11 +63,10 @@ const char *video_device = "/dev/bktr0"; #define VIDEO_FORMAT NTSC #endif -#ifndef VIDEO_INPUT -#define VIDEO_INPUT METEOR_INPUT_DEV0; -#endif +static int bktr_dev[] = { METEOR_DEV0, METEOR_DEV1, METEOR_DEV2, + METEOR_DEV3, METEOR_DEV_SVIDEO }; -static UINT8 *video_buf; +static u_int8_t *video_buf; static int nsignals = 0; static void catchsignal(int signal) { @@ -75,41 +74,65 @@ static void catchsignal(int signal) return; } -static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap) +static int bktr_init (const char *video_device, int width, int height, + int format, u_int8_t **video_buf, int *video_fd, int *tuner_fd, + int idev, double frequency) { - VideoData *s = s1->priv_data; - int width, height, h_max; - int video_fd; - int format = VIDEO_FORMAT; struct meteor_geomet geo; + int h_max; + long ioctl_frequency; + char *arg; int c; struct sigaction act,old; + if (idev < 0 || idev > 4) + { + arg = getenv ("BKTR_DEV"); + if (arg) + idev = atoi (arg); + if (idev < 0 || idev > 4) + idev = 0; + } + + if (format < 1 || format > 6) + { + arg = getenv ("BKTR_FORMAT"); + if (arg) + format = atoi (arg); + if (format < 1 || format > 6) + format = VIDEO_FORMAT; + } + + if (frequency <= 0) + { + arg = getenv ("BKTR_FREQUENCY"); + if (arg) + frequency = atof (arg); + if (frequency <= 0) + frequency = 0.0; + } + 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->last_frame_time = 0; - s->tuner_fd = open ("/dev/tuner0", O_RDONLY); - if (s->tuner_fd < 0) { + *tuner_fd = open ("/dev/tuner0", O_RDONLY); + if (*tuner_fd < 0) { perror("Warning: Tuner not opened continuing"); } - video_fd = open(video_device, O_RDONLY); - if (video_fd < 0) { - perror(video_device); - return -EIO; + *video_fd = open (video_device, O_RDONLY); + if (*video_fd < 0) { + perror (video_device); + return -1; } - s->fd=video_fd; + geo.rows = height; geo.columns = width; geo.frames = 1; - geo.oformat = METEOR_GEO_YUV_422 | METEOR_GEO_YUV_12; +// geo.oformat = METEOR_GEO_YUV_422 | METEOR_GEO_YUV_12; + geo.oformat = METEOR_GEO_YUV_PACKED; switch (format) { case PAL: h_max = PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI; break; @@ -124,61 +147,89 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap) geo.oformat |= METEOR_GEO_EVEN_ONLY; } - if (ioctl(video_fd, METEORSETGEO, &geo) < 0) { + if (ioctl(*video_fd, METEORSETGEO, &geo) < 0) { perror ("METEORSETGEO"); - return -EIO; + return -1; } - if (ioctl(video_fd, BT848SFMT, &c) < 0) { + if (ioctl(*video_fd, BT848SFMT, &c) < 0) { perror ("BT848SFMT"); - return -EIO; + return -1; } - c = VIDEO_INPUT; - if (ioctl(video_fd, METEORSINPUT, &c) < 0) { + c = bktr_dev[idev]; + if (ioctl(*video_fd, METEORSINPUT, &c) < 0) { perror ("METEORSINPUT"); - return -EIO; + return -1; } - video_buf = mmap((caddr_t)0, width*height*3, PROT_READ, MAP_SHARED, - video_fd, (off_t) 0); - if (video_buf == MAP_FAILED) { + *video_buf = (u_int8_t *) mmap((caddr_t)0, width*height*2, + PROT_READ, MAP_SHARED, *video_fd, (off_t) 0); + if (*video_buf == MAP_FAILED) { perror ("mmap"); - return -EIO; + return -1; + } + if (frequency != 0.0) { + ioctl_frequency = (unsigned long)(frequency*16); + if (ioctl(*tuner_fd, TVTUNER_SETFREQ, &ioctl_frequency)<0) + perror("TVTUNER_SETFREQ"); } c = METEOR_CAP_CONTINOUS; - ioctl(s->fd, METEORCAPTUR, &c); + ioctl(*video_fd, METEORCAPTUR, &c); c = SIGUSR1; - ioctl (s->fd, METEORSSIGNAL, &c); + ioctl (*video_fd, METEORSSIGNAL, &c); return 0; } +static void bktr_getframe(u_int64_t per_frame) +{ + u_int64_t curtime; + static u_int64_t last_frame_time = 0; + + curtime = av_gettime(); + if (!last_frame_time + || ((last_frame_time + per_frame) > curtime)) { + if (!usleep (last_frame_time + per_frame + per_frame/8 - curtime)) { + if (!nsignals) + printf ("\nSLEPT NO signals - %d microseconds late\n", + (int) (av_gettime() - last_frame_time - per_frame)); + } + } + nsignals = 0; + + last_frame_time = curtime; +} + +void bf_memcpy (char *dest, char *src, int size) +{ + while (size -= 2) + { + dest[0] = src[1]; + dest[1] = src[0]; + dest += 2; + src += 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; - UINT64 curtime; size = s->width * s->height; halfsize = size << 1; - if (av_new_packet(pkt, size + halfsize) < 0) + +// if (av_new_packet(pkt, size + halfsize) < 0) + if (av_new_packet(pkt, size + size) < 0) return -EIO; - curtime = av_gettime(); - if (!s->last_frame_time - || ((s->last_frame_time + s->per_frame) > curtime)) { - if (!usleep (s->last_frame_time + s->per_frame + s->per_frame/8 - curtime)) { - if (!nsignals) - printf ("\nSLEPT NO signals - %d microseconds late\n", - av_gettime() - s->last_frame_time - s->per_frame); - } - } - nsignals = 0; + bktr_getframe (s->per_frame); + pkt->pts = av_gettime() & ((1LL << 48) - 1); + bf_memcpy (pkt->data, video_buf, size + size); +// bf_memcpy (pkt->data, video_buf, size + halfsize); - s->last_frame_time = curtime; - pkt->pts = curtime & ((1LL << 48) - 1); - memcpy (pkt->data, video_buf, size + halfsize); - return size + halfsize; +// return size + halfsize; + return size + size; } static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap) @@ -187,6 +238,8 @@ static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap) AVStream *st; int width, height; int frame_rate; + int frame_rate_base; + int format = -1; if (!ap || ap->width <= 0 || ap->height <= 0 || ap->frame_rate <= 0) return -1; @@ -194,26 +247,42 @@ static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap) width = ap->width; height = ap->height; frame_rate = ap->frame_rate; + frame_rate_base = ap->frame_rate_base; + 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->per_frame = (INT64_C(1000000) * FRAME_RATE_BASE) / s->frame_rate; - st->codec.pix_fmt = PIX_FMT_YUV420P; + s->frame_rate_base = frame_rate_base; + s->per_frame = ((int64_t)1000000 * s->frame_rate_base) / s->frame_rate; + + st->codec.codec_type = CODEC_TYPE_VIDEO; +// st->codec.pix_fmt = PIX_FMT_YUV420P; + st->codec.pix_fmt = PIX_FMT_YUV422; st->codec.codec_id = CODEC_ID_RAWVIDEO; st->codec.width = width; st->codec.height = height; st->codec.frame_rate = frame_rate; + st->codec.frame_rate_base = frame_rate_base; + + av_set_pts_info(s1, 48, 1, 1000000); /* 48 bits pts in use */ - av_set_pts_info(s1, 48, 1, 1000000); /* 48 bits pts in us */ + if (ap->standard) { + if (!strcasecmp(ap->standard, "pal")) + format = PAL; + if (!strcasecmp(ap->standard, "secam")) + format = SECAM; + if (!strcasecmp(ap->standard, "ntsc")) + format = NTSC; + } - return bktr_init(s1, ap); + if (bktr_init (video_device, width, height, format, &video_buf, + &(s->fd), &(s->tuner_fd), -1, 0.0) < 0) + return -EIO; + return 0; } static int grab_read_close (AVFormatContext *s1) @@ -224,12 +293,12 @@ static int grab_read_close (AVFormatContext *s1) ioctl(s->fd, METEORCAPTUR, &c); close(s->fd); close(s->tuner_fd); - free(s); + av_free(s); return 0; } AVInputFormat video_grab_device_format = { - "video_grab_device", + "video4linux", "video grab", sizeof(VideoData), NULL, diff --git a/multimedia/ffmpeg/files/patch-libavformat::audio.c b/multimedia/ffmpeg/files/patch-libavformat::audio.c deleted file mode 100644 index 375a58dd7280..000000000000 --- a/multimedia/ffmpeg/files/patch-libavformat::audio.c +++ /dev/null @@ -1,17 +0,0 @@ ---- libavformat/audio.c.orig Wed Feb 5 20:49:08 2003 -+++ libavformat/audio.c Wed Feb 5 20:50:36 2003 -@@ -243,6 +243,14 @@ - if (av_new_packet(pkt, s->frame_size) < 0) - return -EIO; - for(;;) { -+ struct timeval tv; -+ fd_set fds; -+ tv.tv_sec = 0; -+ tv.tv_usec = 30 * 1000; /* 30 msecs -- a bit shorter than 1 frame at 30fps */ -+ FD_ZERO(&fds); -+ FD_SET(s->fd, &fds); /* This will block until data is available or we get a timeout */ -+ (void) select(s->fd + 1, &fds, 0, 0, &tv); -+ - ret = read(s->fd, pkt->data, pkt->size); - if (ret > 0) - break; diff --git a/multimedia/ffmpeg/pkg-plist b/multimedia/ffmpeg/pkg-plist index ee83d16ccff5..d6ebec96d363 100644 --- a/multimedia/ffmpeg/pkg-plist +++ b/multimedia/ffmpeg/pkg-plist @@ -1,14 +1,20 @@ bin/ffmpeg -bin/ffplay +%%SDL%%bin/ffplay bin/ffserver etc/ffserver.conf.sample include/ffmpeg/avcodec.h +include/ffmpeg/avformat.h +include/ffmpeg/avio.h include/ffmpeg/common.h include/ffmpeg/dsputil.h +include/ffmpeg/rtp.h +include/ffmpeg/rtsp.h +include/ffmpeg/rtspcodes.h lib/libavcodec.a lib/libavcodec.so lib/libavcodec.so.%%SHLIB_VERSION%% lib/libavformat.a +%%VHOOK%%lib/vhook/drawtext.so %%VHOOK%%lib/vhook/fish.so %%VHOOK%%%%IMLIB2%%lib/vhook/imlib2.so %%VHOOK%%lib/vhook/null.so |