[MPlayer-users] mplayer SVN plays video too fast on FreeBSD

Tom Evans tevans.uk at googlemail.com
Mon Dec 7 15:13:00 CET 2009


Hi all

Nvidia recently released a video driver for FreeBSD 8/amd64 (which was
previously unsupported by nvidia). With this, amd64 users finally got
access to libvdpau.

As such, I wanted to recompile mplayer with support for vdpau.
Unfortunately, the packaged version of mplayer in freebsd is
'mplayer-0.99.11_14' (which comes from MPlayer-1.0rc2.tar.bz2), which
doesn't know about vdpau, so I set about to compile from tip of svn.

So, I checked out mplayer trunk, r29977, and made a few changes to
support compilation on FreeBSD (see attached diff). The program built
and compiled successfully, but every file I play through it has the
video processed way too fast.

It almost looks as though it is trying to benchmark the video by
playing it as fast as possible. A 40 minute TV episode only takes
about 3 minutes to play through! The audio playback was correct, no
distortions.

My configure line for mplayer was:

--enable-png --enable-menu --disable-tv-v4l1 --disable-tv-v4l2 \
--disable-dvdnav --disable-ssse3 --disable-directfb --disable-faac \
--disable-twolame --disable-mencoder --disable-mad --disable-libdv \
--disable-theora --disable-musepack --enable-libdca --enable-speex \
--disable-xanim --disable-live --disable-xmms --disable-jack --disable-nas \
--disable-openal --disable-smb --disable-fribidi --disable-cdparanoia \
--disable-libcdio --disable-ladspa --disable-liblzo
--enable-runtime-cpudetection \
--disable-win32dll --disable-qtx --enable-real
--realcodecsdir=/usr/local/lib/win32 \
--enable-gui --extra-cflags="-I/usr/local/include/freetype2
-I/usr/local/include" \
--enable-freetype --disable-rtc --disable-arts --disable-caca --disable-lirc \
--disable-sdl --disable-svga --disable-aa --disable-esd \
--disable-joystick --extra-libs="-L/usr/local/lib -ldca" \
--prefix=/usr/local --mandir=/usr/local/man --target=amd64-srcbld-freebsd8.0 \
--enable-vdpau

My ~/.mplayer/config looks like:

vo=vdpau,xv
#vo=xv
vc=ffh264vdpau,ffvc1vdpau,ffmpeg12vdpau,ffwmv3vdpau,
cache=65536
fs=1
afm=hwac3

The effect is noticed with vo=vdpau,xv or with vo=xv and vc commented
out. It didn't appear to matter what video was being played, I tried
mkv/x264, avi/xvid and mpeg2/mpeg2ts.

Any ideas?

Cheers

Tom
-------------- next part --------------
Index: libmpcodecs/vd_ffmpeg.c
===================================================================
--- libmpcodecs/vd_ffmpeg.c	(revision 29977)
+++ libmpcodecs/vd_ffmpeg.c	(working copy)
@@ -389,7 +389,7 @@
     }
     /* Pass palette to codec */
     if (sh->bih && (sh->bih->biBitCount <= 8)) {
-        avctx->palctrl = calloc(1, sizeof(AVPaletteControl));
+        avctx->palctrl = av_malloc(sizeof(AVPaletteControl));
         avctx->palctrl->palette_changed = 1;
         if (sh->bih->biSize-sizeof(BITMAPINFOHEADER))
             /* Palette size in biSize */
Index: libao2/ao_oss.c
===================================================================
--- libao2/ao_oss.c	(revision 29977)
+++ libao2/ao_oss.c	(working copy)
@@ -445,6 +445,7 @@
 #if defined(FD_CLOEXEC) && defined(F_SETFD)
   fcntl(audio_fd, F_SETFD, FD_CLOEXEC);
 #endif
+  ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate);
 
   oss_format = format2oss(ao_data.format);
   if(ao_data.format == AF_FORMAT_AC3)
@@ -457,7 +458,6 @@
       int c = ao_data.channels-1;
       ioctl (audio_fd, SNDCTL_DSP_STEREO, &c);
     }
-    ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate);
   }
 }
 
Index: libavutil/bswap.h
===================================================================
--- libavutil/bswap.h	(revision 20756)
+++ libavutil/bswap.h	(working copy)
@@ -30,6 +30,20 @@
 #include "config.h"
 #include "common.h"
 
+
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
+#include <sys/param.h>
+#endif
+
+#ifdef HAVE_BYTESWAP_H
+#include <byteswap.h>
+#elif (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
+#include <sys/endian.h>
+#define bswap_16(x) bswap16(x)
+#define bswap_32(x) bswap32(x)
+#define bswap_64(x) bswap64(x)
+#else
+
 #if   ARCH_ARM
 #   include "arm/bswap.h"
 #elif ARCH_AVR32
@@ -41,8 +55,10 @@
 #elif ARCH_X86
 #   include "x86/bswap.h"
 #endif
+#endif
 
 #ifndef bswap_16
+#error using builtin bswap
 static av_always_inline av_const uint16_t bswap_16(uint16_t x)
 {
     x= (x>>8) | (x<<8);
Index: libavcodec/Makefile
===================================================================
--- libavcodec/Makefile	(revision 20756)
+++ libavcodec/Makefile	(working copy)
@@ -5,6 +5,11 @@
 
 HEADERS = avcodec.h opt.h vdpau.h xvmc.h
 
+ifeq ($(ARCH_X86_64),yes)
+CFLAGS += -DBROKEN_RELOCATIONS
+endif
+
+
 OBJS = allcodecs.o                                                      \
        audioconvert.o                                                   \
        avpacket.o                                                       \
Index: libavcodec/libx264.c
===================================================================
--- libavcodec/libx264.c	(revision 20756)
+++ libavcodec/libx264.c	(working copy)
@@ -84,6 +84,7 @@
                       int bufsize, void *data)
 {
     X264Context *x4 = ctx->priv_data;
+    av_freep(&ctx->extradata);
     AVFrame *frame = data;
     x264_nal_t *nal;
     int nnal, i;


More information about the MPlayer-users mailing list