aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/mplayer.15
-rw-r--r--DOCS/xml/en/bugreports.xml2
-rw-r--r--DOCS/xml/ru/bugreports.xml4
-rw-r--r--Makefile1
-rwxr-xr-xconfigure50
-rw-r--r--cpudetect.c2
-rw-r--r--cpuinfo.c4
-rw-r--r--drivers/3dfx.h2
-rw-r--r--etc/codecs.conf6
-rw-r--r--help/help_mp-hu.h4
-rw-r--r--liba52/liba52_changes.diff3
-rw-r--r--liba52/parse.c2
-rw-r--r--libaf/af.c2
-rw-r--r--libao2/ao_oss.c4
-rw-r--r--libfaad2/common.h2
-rw-r--r--libfaad2/local_changes.diff2
-rw-r--r--libmenu/vf_menu.c2
-rw-r--r--libmpcodecs/dec_audio.c2
-rw-r--r--libmpcodecs/dec_video.c2
-rw-r--r--libmpcodecs/mp_image.c2
-rw-r--r--libmpcodecs/vd.c3
-rw-r--r--libmpcodecs/vd_ffmpeg.c26
-rw-r--r--libmpcodecs/vf.c9
-rw-r--r--libmpcodecs/vf_boxblur.c2
-rw-r--r--libmpcodecs/vf_delogo.c2
-rw-r--r--libmpcodecs/vf_denoise3d.c2
-rw-r--r--libmpcodecs/vf_fspp.c15
-rw-r--r--libmpcodecs/vf_hqdn3d.c2
-rw-r--r--libmpcodecs/vf_il.c2
-rw-r--r--libmpcodecs/vf_kerndeint.c2
-rw-r--r--libmpcodecs/vf_mcdeint.c2
-rw-r--r--libmpcodecs/vf_noise.c2
-rw-r--r--libmpcodecs/vf_ow.c2
-rw-r--r--libmpcodecs/vf_perspective.c2
-rw-r--r--libmpcodecs/vf_pp.c2
-rw-r--r--libmpcodecs/vf_pp7.c2
-rw-r--r--libmpcodecs/vf_qp.c2
-rw-r--r--libmpcodecs/vf_sab.c2
-rw-r--r--libmpcodecs/vf_screenshot.c2
-rw-r--r--libmpcodecs/vf_smartblur.c2
-rw-r--r--libmpcodecs/vf_spp.c2
-rw-r--r--libmpcodecs/vf_swapuv.c2
-rw-r--r--libmpcodecs/vf_unsharp.c2
-rw-r--r--libmpcodecs/vf_uspp.c2
-rw-r--r--libmpcodecs/vf_yadif.c2
-rw-r--r--libmpdemux/demux_ts.c2
-rw-r--r--libmpdemux/muxer_mpeg.c2
-rw-r--r--libmpdemux/parse_mp4.c2
-rw-r--r--libmpdemux/video.c2
-rw-r--r--libvo/sub.c4
-rw-r--r--libvo/video_out.c18
-rw-r--r--libvo/video_out.h4
-rw-r--r--libvo/vo_direct3d.c10
-rw-r--r--libvo/vo_dxr3.c2
-rw-r--r--libvo/vo_gl.c3
-rw-r--r--libvo/vo_gl2.c2
-rw-r--r--libvo/vo_vdpau.c803
-rw-r--r--libvo/vo_vesa.c2
-rw-r--r--libvo/vo_xv.c2
-rw-r--r--libvo/vo_xvmc.c4
-rw-r--r--libvo/x11_common.h1
-rw-r--r--loader/drv.c2
-rw-r--r--loader/dshow/DS_AudioDecoder.c2
-rw-r--r--loader/ext.c2
-rw-r--r--loader/qtx/list.c2
-rw-r--r--loader/qtx/qtxload.c2
-rw-r--r--loader/win32.c2
-rw-r--r--mp3lib/sr1.c5
-rw-r--r--stream/stream.h2
-rw-r--r--stream/stream_dvdnav.c2
-rw-r--r--stream/tvi_dshow.c2
71 files changed, 990 insertions, 94 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index d0920e4a45..af89e6e64f 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -3423,6 +3423,11 @@ Select the driver to use as source to overlay on top of X11.
.PD 1
.
.TP
+.B vdpau (with \-vc ffmpeg12vdpau, ffwmv3vdpau, ffvc1vdpau or ffh264vdpau)
+Video output that uses VDPAU to decode video via hardware.
+Also supports displaying of software-decoded video.
+.
+.TP
.B xvmc (X11 with \-vc ffmpeg12mc only)
Video output driver that uses the XvMC (X Video Motion Compensation)
extension of XFree86 4.x to speed up MPEG-1/2 and VCR2 decoding.
diff --git a/DOCS/xml/en/bugreports.xml b/DOCS/xml/en/bugreports.xml
index d541230f4f..de716463b2 100644
--- a/DOCS/xml/en/bugreports.xml
+++ b/DOCS/xml/en/bugreports.xml
@@ -113,6 +113,8 @@ you need to go back.
earlier version, so if you do not make a backup copy of your original
source tree, you will have to recompile everything in it when you come
back to the present.)
+Alternatively you may use <ulink url="http://ccache.samba.org/">ccache</ulink>
+to speed up compilation.
</para>
<para>
diff --git a/DOCS/xml/ru/bugreports.xml b/DOCS/xml/ru/bugreports.xml
index 1b28ff3592..8a33797b4a 100644
--- a/DOCS/xml/ru/bugreports.xml
+++ b/DOCS/xml/ru/bugreports.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- synced with r28201 -->
+<!-- synced with r28615 -->
<appendix id="bugreports">
<title>Как сообщать об ошибках</title>
@@ -109,6 +109,8 @@ make
(Как правило необходимо выполнять 'make distclean' до перекомпиляции
более ранней версии, поэтому при отсутствии сохраненной копии
Вам придется перекомпилировать весь проект.)
+Также Вы можете использовать <ulink url="http://ccache.samba.org/">ccache</ulink>
+для ускорения компиляции.
</para>
<para>
diff --git a/Makefile b/Makefile
index 5f735a55ea..3a2132c1fd 100644
--- a/Makefile
+++ b/Makefile
@@ -633,6 +633,7 @@ SRCS_MPLAYER-$(TDFXVID) += libvo/vo_tdfx_vid.c
SRCS_MPLAYER-$(TGA) += libvo/vo_tga.c
SRCS_MPLAYER-$(V4L2) += libvo/vo_v4l2.c
SRCS_MPLAYER-$(V4L2) += libao2/ao_v4l2.c
+SRCS_MPLAYER-$(VDPAU) += libvo/vo_vdpau.c
SRCS_MPLAYER-$(VESA) += libvo/gtf.c libvo/vo_vesa.c libvo/vesa_lvo.c
SRCS_MPLAYER-$(VIDIX) += libvo/vo_cvidix.c \
libvo/vosub_vidix.c \
diff --git a/configure b/configure
index 3347a7fcf8..161807bda3 100755
--- a/configure
+++ b/configure
@@ -382,6 +382,7 @@ Video output:
--enable-xmga enable mga_vid X11 video output [autodetect]
--enable-xv enable Xv video output [autodetect]
--enable-xvmc enable XvMC acceleration [disable]
+ --enable-vdpau enable VDPAU acceleration [autodetect]
--enable-vm enable XF86VidMode support [autodetect]
--enable-xinerama enable Xinerama support [autodetect]
--enable-x11 enable X11 video output [autodetect]
@@ -523,7 +524,7 @@ _libavcodec_a=auto
_libamr_nb=auto
_libamr_wb=auto
_libavdecoders_all=`sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' ffmpeg/libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'`
-_libavdecoders=` echo $_libavdecoders_all | sed -e 's/ LIB[A-Z0-9_]*_DECODER//g' -e s/MPEG4AAC_DECODER// -e s/H264_VDPAU_DECODER// -e s/MPEG_VDPAU_DECODER// -e s/MPEG1_VDPAU_DECODER// -e s/VC1_VDPAU_DECODER// -e s/WMV3_VDPAU_DECODER// `
+_libavdecoders=` echo $_libavdecoders_all | sed -e 's/ LIB[A-Z0-9_]*_DECODER//g' -e s/MPEG4AAC_DECODER//`
_libavencoders_all=`sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' ffmpeg/libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'`
_libavencoders=` echo $_libavencoders_all | sed 's/ LIB[A-Z0-9_]*_ENCODER//g'`
_libavparsers_all=`sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' ffmpeg/libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]'`
@@ -552,6 +553,7 @@ _dga1=auto
_dga2=auto
_xv=auto
_xvmc=no #auto when complete
+_vdpau=auto
_sdl=auto
_direct3d=auto
_directx=auto
@@ -880,6 +882,8 @@ for ac_option do
--disable-xv) _xv=no ;;
--enable-xvmc) _xvmc=yes ;;
--disable-xvmc) _xvmc=no ;;
+ --enable-vdpau) _vdpau=yes ;;
+ --disable-vdpau) _vdpau=no ;;
--enable-sdl) _sdl=yes ;;
--disable-sdl) _sdl=no ;;
--enable-direct3d) _direct3d=yes ;;
@@ -1700,7 +1704,7 @@ fi
def_fast_64bit='#define HAVE_FAST_64BIT 0'
-_arch_all='X86 X86_32 X86_64 IA64 SPARC ARM SH4 PPC ALPHA SGI_MIPS PA_RISC S390 S390X VAX BFIN XTENSA GENERIC'
+_arch_all='X86 X86_32 X86_64 IA64 SPARC ARM AVR32 SH4 PPC ALPHA SGI_MIPS PA_RISC S390 S390X VAX BFIN XTENSA GENERIC'
case "$host_arch" in
i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686)
_arch='X86 X86_32'
@@ -2059,6 +2063,13 @@ EOF
iproc='arm'
;;
+ avr32)
+ _arch='AVR32'
+ _target_arch='ARCH_AVR32 = yes'
+ def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
+ iproc='avr32'
+ ;;
+
sh|sh4)
_arch='SH4'
_target_arch='ARCH_SH4 = yes'
@@ -3145,10 +3156,10 @@ cc_check && _malloc=yes
if test "$_malloc" = yes ; then
def_malloc_h='#define HAVE_MALLOC_H 1'
else
- def_malloc_h='#undef HAVE_MALLOC_H'
+ def_malloc_h='#define HAVE_MALLOC_H 0'
fi
# malloc.h emits a warning in FreeBSD and OpenBSD
-freebsd || openbsd || dragonfly && def_malloc_h='#undef HAVE_MALLOC_H'
+freebsd || openbsd || dragonfly && def_malloc_h='#define HAVE_MALLOC_H 0'
echores "$_malloc"
@@ -3164,7 +3175,7 @@ cc_check && _memalign=yes
if test "$_memalign" = yes ; then
def_memalign='#define HAVE_MEMALIGN 1'
else
- def_memalign='#undef HAVE_MEMALIGN'
+ def_memalign='#define HAVE_MEMALIGN 0'
def_map_memalign='#define memalign(a,b) malloc(b)'
darwin || def_memalign_hack='#define CONFIG_MEMALIGN_HACK 1'
fi
@@ -4179,7 +4190,7 @@ else
_novomodules="x11 $_novomodules"
_res_comment="check if the dev(el) packages are installed"
# disable stuff that depends on X
- _xv=no ; _xvmc=no ; _xinerama=no ; _vm=no ; _xf86keysym=no
+ _xv=no ; _xvmc=no ; _xinerama=no ; _vm=no ; _xf86keysym=no ; _vdpau=no
fi
echores "$_x11"
@@ -4290,6 +4301,28 @@ fi
echores "$_xvmc"
+echocheck "VDPAU"
+if test "$_vdpau" = auto ; then
+ _vdpau=no
+ if test "$_dl" = yes ; then
+ cat > $TMPC <<EOF
+#include <vdpau/vdpau_x11.h>
+int main(void) {return 0;}
+EOF
+ cc_check && _vdpau=yes
+ fi
+fi
+if test "$_vdpau" = yes ; then
+ def_vdpau='#define CONFIG_VDPAU 1'
+ _vomodules="vdpau $_vomodules"
+else
+ def_vdpau='#define CONFIG_VDPAU 0'
+ _novomodules="vdpau $_novomodules"
+ _libavdecoders=`echo $_libavdecoders | sed -e s/MPEG_VDPAU_DECODER// -e s/MPEG1_VDPAU_DECODER// -e s/H264_VDPAU_DECODER// -e s/WMV3_VDPAU_DECODER// -e s/VC1_VDPAU_DECODER//`
+fi
+echores "$_vdpau"
+
+
echocheck "Xinerama"
if test "$_xinerama" = auto ; then
cat > $TMPC <<EOF
@@ -8161,6 +8194,7 @@ TWOLAME=$_twolame
UNRAR_EXEC = $_unrar_exec
V4L2 = $_v4l2
VCD = $_vcd
+VDPAU = $_vdpau
VESA = $_vesa
VIDIX = $_vidix
VIDIX_PCIDB = $_vidix_pcidb_val
@@ -8246,6 +8280,7 @@ CONFIG_MUXERS=$_mencoder
CONFIG_POSTPROC = yes
# Prevent building libavcodec/imgresample.c with conflicting symbols
CONFIG_SWSCALE=yes
+CONFIG_VDPAU=$_vdpau
CONFIG_XVMC=$_xvmc
CONFIG_ZLIB=$_zlib
@@ -8606,6 +8641,7 @@ $def_tdfxfb
$def_tdfxvid
$def_tga
$def_v4l2
+$def_vdpau
$def_vesa
$def_vidix
$def_vidix_drv_cyberblade
@@ -8701,6 +8737,8 @@ $def_yasm
#define HAVE_EBX_AVAILABLE 1
#ifndef MP_DEBUG
#define HAVE_EBP_AVAILABLE 1
+#else
+#define HAVE_EBP_AVAILABLE 0
#endif
/* External libraries used through libavcodec. */
diff --git a/cpudetect.c b/cpudetect.c
index 3dd3329d7e..8d306b1c3b 100644
--- a/cpudetect.c
+++ b/cpudetect.c
@@ -4,7 +4,7 @@
CpuCaps gCpuCaps;
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdlib.h>
diff --git a/cpuinfo.c b/cpuinfo.c
index ad9a49c42e..ac49cd7cad 100644
--- a/cpuinfo.c
+++ b/cpuinfo.c
@@ -77,7 +77,7 @@ rdtsc(void)
static const char*
brandname(int i)
{
- const static char* brandmap[] = {
+ static const char* brandmap[] = {
NULL,
"Intel(R) Celeron(R) processor",
"Intel(R) Pentium(R) III processor",
@@ -105,7 +105,7 @@ store32(char *d, unsigned int v)
int
-main(int argc, char **argv)
+main(void)
{
cpuid_regs_t regs, regs_ext;
char idstr[13];
diff --git a/drivers/3dfx.h b/drivers/3dfx.h
index 99d6ef0a75..123541c865 100644
--- a/drivers/3dfx.h
+++ b/drivers/3dfx.h
@@ -66,7 +66,7 @@ struct voodoo_2d_reg_t {
uint32_t lineStipple;
uint32_t lineStyle;
uint32_t pattern0Alias;
- uint32_t pattern1Alias;;
+ uint32_t pattern1Alias;
uint32_t clip1Min;
uint32_t clip1Max;
uint32_t srcFormat;
diff --git a/etc/codecs.conf b/etc/codecs.conf
index 44e78f958f..8c2d4a6506 100644
--- a/etc/codecs.conf
+++ b/etc/codecs.conf
@@ -1629,7 +1629,7 @@ videocodec rv3040win
videocodec rv40
info "Linux RealPlayer 9 RV40"
- status working
+ status buggy
fourcc RV40,rv40
driver realvid
dll "drv4.so.6.0"
@@ -1653,7 +1653,7 @@ videocodec rv40mac
videocodec rv30
info "Linux RealPlayer 8 RV30"
- status working
+ status buggy
fourcc RV30,rv30
driver realvid
dll "drv3.so.6.0"
@@ -1702,7 +1702,7 @@ videocodec ffrv40
videocodec rv20
info "Linux RealPlayer 8 RV20"
- status working
+ status buggy
fourcc RV20,rv20
driver realvid
dll "drv2.so.6.0"
diff --git a/help/help_mp-hu.h b/help/help_mp-hu.h
index a3e7d02e4f..bcea3f21cf 100644
--- a/help/help_mp-hu.h
+++ b/help/help_mp-hu.h
@@ -40,10 +40,10 @@ static char help_text[]=
" < vagy > 1 fájllal előre/hátra lépés a lejátszási listában\n"
" p vagy SPACE pillanatállj (bármely billentyűre továbbmegy)\n"
" q vagy ESC lejátszás vége és kilépés\n"
-" + vagy - audio késleltetése ą 0.1 másodperccel\n"
+" + vagy - audio késleltetése ± 0.1 másodperccel\n"
" o OSD-mód váltása: nincs / keresősáv / keresősáv + idő\n"
" * vagy / hangerő fel/le\n"
-" x vagy z felirat késleltetése ą 0.1 másodperccel\n"
+" x vagy z felirat késleltetése ± 0.1 másodperccel\n"
" r vagy t felirat pozíciójának megváltoztatása, lásd -vf expand-ot is\n"
"\n"
" * * * A MANPAGE TOVÁBBI RÉSZLETEKET, OPCIÓKAT, BILLENTYŰKET TARTALMAZ! * * *\n"
diff --git a/liba52/liba52_changes.diff b/liba52/liba52_changes.diff
index 9a559a5036..0e9e71c53f 100644
--- a/liba52/liba52_changes.diff
+++ b/liba52/liba52_changes.diff
@@ -2354,7 +2354,8 @@
+#include "mm_accel.h"
+#include "libavutil/avutil.h"
- #ifdef HAVE_MEMALIGN
+-#ifdef HAVE_MEMALIGN
++#if HAVE_MEMALIGN
/* some systems have memalign() but no declaration for it */
void * memalign (size_t align, size_t size);
-#else
diff --git a/liba52/parse.c b/liba52/parse.c
index 92d38b482f..fff01aed5b 100644
--- a/liba52/parse.c
+++ b/liba52/parse.c
@@ -39,7 +39,7 @@
#include "mm_accel.h"
#include "libavutil/avutil.h"
-#ifdef HAVE_MEMALIGN
+#if HAVE_MEMALIGN
/* some systems have memalign() but no declaration for it */
void * memalign (size_t align, size_t size);
#endif
diff --git a/libaf/af.c b/libaf/af.c
index 77fda8e320..7333896882 100644
--- a/libaf/af.c
+++ b/libaf/af.c
@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <string.h>
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c
index 44f0c7d857..a98d5d1922 100644
--- a/libao2/ao_oss.c
+++ b/libao2/ao_oss.c
@@ -454,6 +454,8 @@ static void reset(void){
#endif
oss_format = format2oss(ao_data.format);
+ if(ao_data.format == AF_FORMAT_AC3)
+ ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate);
ioctl (audio_fd, SNDCTL_DSP_SETFMT, &oss_format);
if(ao_data.format != AF_FORMAT_AC3) {
if (ao_data.channels > 2)
@@ -479,7 +481,7 @@ static void audio_resume(void)
int fillcnt;
reset();
fillcnt = get_space() - prepause_space;
- if (fillcnt > 0) {
+ if (fillcnt > 0 && !(ao_data.format & AF_FORMAT_SPECIAL_MASK)) {
void *silence = calloc(fillcnt, 1);
play(silence, fillcnt, 0);
free(silence);
diff --git a/libfaad2/common.h b/libfaad2/common.h
index 29a30d089e..576e9ca115 100644
--- a/libfaad2/common.h
+++ b/libfaad2/common.h
@@ -69,7 +69,7 @@ extern "C" {
/* Use if target platform has address generators with autoincrement */
//#define PREFER_POINTERS
-#if defined(_WIN32_WCE) || defined(__arm__)
+#if defined(_WIN32_WCE) || defined(__arm__) || defined(__avr32__)
#define FIXED_POINT
#endif
diff --git a/libfaad2/local_changes.diff b/libfaad2/local_changes.diff
index a6400eb0b8..0e3fe95d41 100644
--- a/libfaad2/local_changes.diff
+++ b/libfaad2/local_changes.diff
@@ -52,7 +52,7 @@
//#define PREFER_POINTERS
-#ifdef _WIN32_WCE
-+#if defined(_WIN32_WCE) || defined(__arm__)
++#if defined(_WIN32_WCE) || defined(__arm__) || defined(__avr32__)
#define FIXED_POINT
#endif
diff --git a/libmenu/vf_menu.c b/libmenu/vf_menu.c
index f5ae5ea70d..5112586e48 100644
--- a/libmenu/vf_menu.c
+++ b/libmenu/vf_menu.c
@@ -24,7 +24,7 @@
#include <stdlib.h>
#include <string.h>
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/dec_audio.c b/libmpcodecs/dec_audio.c
index 947b47bbfc..79073d03e3 100644
--- a/libmpcodecs/dec_audio.c
+++ b/libmpcodecs/dec_audio.c
@@ -19,7 +19,7 @@
#include "libaf/af.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c
index 49ee002bf4..7faf2ac396 100644
--- a/libmpcodecs/dec_video.c
+++ b/libmpcodecs/dec_video.c
@@ -2,7 +2,7 @@
#include "options.h"
#include <stdio.h>
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdlib.h>
diff --git a/libmpcodecs/mp_image.c b/libmpcodecs/mp_image.c
index 809acce221..fd1b3c3997 100644
--- a/libmpcodecs/mp_image.c
+++ b/libmpcodecs/mp_image.c
@@ -5,7 +5,7 @@
#include <stdlib.h>
#include <string.h>
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c
index 86b9f0c511..22bdddc909 100644
--- a/libmpcodecs/vd.c
+++ b/libmpcodecs/vd.c
@@ -336,7 +336,8 @@ mp_image_t *mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,
mp_image_t *mpi =
vf_get_image(sh->vfilter, sh->codec->outfmt[sh->outfmtidx], mp_imgtype,
mp_imgflag, w, h);
- mpi->x = mpi->y = 0;
+ if (mpi)
+ mpi->x = mpi->y = 0;
return mpi;
}
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 9e3aae2d08..c70da3a9f3 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -215,15 +215,24 @@ static int init(sh_video_t *sh){
if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_ROQ)
ctx->do_dr1=1;
+ if (lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
+ ctx->do_dr1=1;
ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64;
ctx->ip_count= ctx->b_count= 0;
ctx->pic = avcodec_alloc_frame();
ctx->avctx = avcodec_alloc_context();
avctx = ctx->avctx;
+ avctx->opaque = sh;
+#if CONFIG_VDPAU
+ if(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU){
+ avctx->get_format = get_format;
+ avctx->draw_horiz_band = draw_slice;
+ avctx->slice_flags = SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD;
+ }
+#endif /* CONFIG_VDPAU */
#if CONFIG_XVMC
-
if(lavc_codec->capabilities & CODEC_CAP_HWACCEL){
mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedCodec);
assert(ctx->do_dr1);//these are must to!
@@ -529,7 +538,7 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
return avctx->get_buffer(avctx, pic);
}
- if (IMGFMT_IS_XVMC(ctx->best_csp)) {
+ if (IMGFMT_IS_XVMC(ctx->best_csp) || IMGFMT_IS_VDPAU(ctx->best_csp)) {
type = MP_IMGTYPE_NUMBERED | (0xffff << 16);
} else
if (!pic->buffer_hints) {
@@ -559,6 +568,9 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
avctx->draw_horiz_band= draw_slice;
} else
avctx->draw_horiz_band= NULL;
+ if(IMGFMT_IS_VDPAU(mpi->imgfmt)) {
+ avctx->draw_horiz_band= draw_slice;
+ }
#if CONFIG_XVMC
if(IMGFMT_IS_XVMC(mpi->imgfmt)) {
struct xvmc_pix_fmt *render = mpi->priv; //same as data[2]
@@ -718,7 +730,6 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){
//ffmpeg interlace (mpeg2) bug have been fixed. no need of -noslices
if (!dr1)
avctx->draw_horiz_band=NULL;
- avctx->opaque=sh;
if(ctx->vo_initialized && !(flags&3) && !dr1){
mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE |
(ctx->do_slices?MP_IMGFLAG_DRAW_CALLBACK:0),
@@ -864,7 +875,7 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){
return mpi;
}
-#if CONFIG_XVMC
+#if CONFIG_XVMC || CONFIG_VDPAU
static enum PixelFormat get_format(struct AVCodecContext *avctx,
const enum PixelFormat *fmt){
enum PixelFormat selected_format = fmt[0];
@@ -874,7 +885,7 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx,
for(i=0;fmt[i]!=PIX_FMT_NONE;i++){
imgfmt = pixfmt2imgfmt(fmt[i]);
- if(!IMGFMT_IS_XVMC(imgfmt)) continue;
+ if(!IMGFMT_IS_XVMC(imgfmt) && !IMGFMT_IS_VDPAU(imgfmt)) continue;
mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_TryingPixfmt, i);
if(init_vo(sh, fmt[i]) >= 0) {
selected_format = fmt[i];
@@ -882,7 +893,7 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx,
}
}
imgfmt = pixfmt2imgfmt(selected_format);
- if(IMGFMT_IS_XVMC(imgfmt)) {
+ if(IMGFMT_IS_XVMC(imgfmt) || IMGFMT_IS_VDPAU(imgfmt)) {
vd_ffmpeg_ctx *ctx = sh->context;
avctx->get_buffer= get_buffer;
avctx->release_buffer= release_buffer;
@@ -894,5 +905,4 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx,
}
return selected_format;
}
-
-#endif /* CONFIG_XVMC */
+#endif /* CONFIG_XVMC || CONFIG_VDPAU */
diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c
index c2b88b5584..445e631c21 100644
--- a/libmpcodecs/vf.c
+++ b/libmpcodecs/vf.c
@@ -3,7 +3,7 @@
#include <string.h>
#include "config.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
@@ -319,7 +319,6 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype,
// keep buffer allocation status & color flags only:
// mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT);
mpi->flags&=MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_TYPE_DISPLAYED|MP_IMGFLAGMASK_COLORS;
- mpi->flags |= MP_IMGFLAG_IN_USE;
// accept restrictions & draw_slice flags only:
mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK);
if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
@@ -346,6 +345,11 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype,
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
// non-direct and not yet allocated image. allocate it!
+ if (!mpi->bpp) { // no way we can allocate this
+ mp_msg(MSGT_DECVIDEO, MSGL_FATAL,
+ "vf_get_image: Tried to allocate a format that can not be allocated!\n");
+ return NULL;
+ }
// check if codec prefer aligned stride:
if(mp_imgflag&MP_IMGFLAG_PREFER_ALIGNED_STRIDE){
@@ -426,6 +430,7 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype,
mpi->qscale = NULL;
}
+ mpi->flags |= MP_IMGFLAG_IN_USE;
// printf("\rVF_MPI: %p %p %p %d %d %d \n",
// mpi->planes[0],mpi->planes[1],mpi->planes[2],
// mpi->stride[0],mpi->stride[1],mpi->stride[2]);
diff --git a/libmpcodecs/vf_boxblur.c b/libmpcodecs/vf_boxblur.c
index bad900f45c..58d6c42f18 100644
--- a/libmpcodecs/vf_boxblur.c
+++ b/libmpcodecs/vf_boxblur.c
@@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_delogo.c b/libmpcodecs/vf_delogo.c
index 666a5b8690..c9ce73c9cd 100644
--- a/libmpcodecs/vf_delogo.c
+++ b/libmpcodecs/vf_delogo.c
@@ -30,7 +30,7 @@
#include "mp_msg.h"
#include "cpudetect.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_denoise3d.c b/libmpcodecs/vf_denoise3d.c
index 12bf22f5a2..7451715012 100644
--- a/libmpcodecs/vf_denoise3d.c
+++ b/libmpcodecs/vf_denoise3d.c
@@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_fspp.c b/libmpcodecs/vf_fspp.c
index 5ba6188d15..a72699d2d2 100644
--- a/libmpcodecs/vf_fspp.c
+++ b/libmpcodecs/vf_fspp.c
@@ -43,13 +43,7 @@
#include "mp_msg.h"
#include "cpudetect.h"
-#include "libavutil/internal.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/mem.h"
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
@@ -58,6 +52,12 @@
#include "vf.h"
#include "libvo/fastmemcpy.h"
+#include "libavutil/internal.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
+#include "libavcodec/avcodec.h"
+#include "libavcodec/dsputil.h"
+
#undef free
#undef malloc
@@ -690,7 +690,6 @@ const vf_info_t vf_info_fspp = {
//Specific spp's dct, idct and threshold functions
//I'd prefer to have them in the separate file.
-#include "mangle.h"
//#define MANGLE(a) #a
//typedef int16_t DCTELEM; //! only int16_t
diff --git a/libmpcodecs/vf_hqdn3d.c b/libmpcodecs/vf_hqdn3d.c
index 4764c32077..cfd491503b 100644
--- a/libmpcodecs/vf_hqdn3d.c
+++ b/libmpcodecs/vf_hqdn3d.c
@@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_il.c b/libmpcodecs/vf_il.c
index 089b14684e..b37c50a66c 100644
--- a/libmpcodecs/vf_il.c
+++ b/libmpcodecs/vf_il.c
@@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_kerndeint.c b/libmpcodecs/vf_kerndeint.c
index cdc26883eb..f90f430315 100644
--- a/libmpcodecs/vf_kerndeint.c
+++ b/libmpcodecs/vf_kerndeint.c
@@ -28,7 +28,7 @@
#include "config.h"
#include "mp_msg.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_mcdeint.c b/libmpcodecs/vf_mcdeint.c
index 6983aa5163..1c589847aa 100644
--- a/libmpcodecs/vf_mcdeint.c
+++ b/libmpcodecs/vf_mcdeint.c
@@ -65,7 +65,7 @@ Known Issues:
#undef free
#undef malloc
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_noise.c b/libmpcodecs/vf_noise.c
index aab612c2b8..f797121973 100644
--- a/libmpcodecs/vf_noise.c
+++ b/libmpcodecs/vf_noise.c
@@ -28,7 +28,7 @@
#include "mp_msg.h"
#include "cpudetect.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_ow.c b/libmpcodecs/vf_ow.c
index 74f546b082..d2717e130a 100644
--- a/libmpcodecs/vf_ow.c
+++ b/libmpcodecs/vf_ow.c
@@ -36,7 +36,7 @@
#include "mp_msg.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_perspective.c b/libmpcodecs/vf_perspective.c
index fd7fe4885d..e99c8dbf6e 100644
--- a/libmpcodecs/vf_perspective.c
+++ b/libmpcodecs/vf_perspective.c
@@ -28,7 +28,7 @@
#include "config.h"
#include "mp_msg.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_pp.c b/libmpcodecs/vf_pp.c
index c910595c4a..1012112660 100644
--- a/libmpcodecs/vf_pp.c
+++ b/libmpcodecs/vf_pp.c
@@ -8,7 +8,7 @@
#include "mp_msg.h"
#include "cpudetect.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_pp7.c b/libmpcodecs/vf_pp7.c
index 31d6d653b4..fed2b83fae 100644
--- a/libmpcodecs/vf_pp7.c
+++ b/libmpcodecs/vf_pp7.c
@@ -30,7 +30,7 @@
#include "mp_msg.h"
#include "cpudetect.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_qp.c b/libmpcodecs/vf_qp.c
index 98aeab7535..4287ed66bc 100644
--- a/libmpcodecs/vf_qp.c
+++ b/libmpcodecs/vf_qp.c
@@ -36,7 +36,7 @@
#include "libavcodec/avcodec.h"
#include "libavcodec/eval.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_sab.c b/libmpcodecs/vf_sab.c
index 61a5a7bc32..5074e45b3e 100644
--- a/libmpcodecs/vf_sab.c
+++ b/libmpcodecs/vf_sab.c
@@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_screenshot.c b/libmpcodecs/vf_screenshot.c
index 8471285345..cded6ad1dd 100644
--- a/libmpcodecs/vf_screenshot.c
+++ b/libmpcodecs/vf_screenshot.c
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <string.h>
diff --git a/libmpcodecs/vf_smartblur.c b/libmpcodecs/vf_smartblur.c
index 82265416cc..78ab70a6ce 100644
--- a/libmpcodecs/vf_smartblur.c
+++ b/libmpcodecs/vf_smartblur.c
@@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_spp.c b/libmpcodecs/vf_spp.c
index aa18534966..a18df801a3 100644
--- a/libmpcodecs/vf_spp.c
+++ b/libmpcodecs/vf_spp.c
@@ -46,7 +46,7 @@
#undef free
#undef malloc
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_swapuv.c b/libmpcodecs/vf_swapuv.c
index d466e2154e..e25e744daf 100644
--- a/libmpcodecs/vf_swapuv.c
+++ b/libmpcodecs/vf_swapuv.c
@@ -27,7 +27,7 @@
#include "config.h"
#include "mp_msg.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_unsharp.c b/libmpcodecs/vf_unsharp.c
index 9f2a7d4b98..d4db10248a 100644
--- a/libmpcodecs/vf_unsharp.c
+++ b/libmpcodecs/vf_unsharp.c
@@ -28,7 +28,7 @@
#include "mp_msg.h"
#include "cpudetect.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_uspp.c b/libmpcodecs/vf_uspp.c
index a0fca1503b..e1e6a443c4 100644
--- a/libmpcodecs/vf_uspp.c
+++ b/libmpcodecs/vf_uspp.c
@@ -32,7 +32,7 @@
#include "libavcodec/avcodec.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpcodecs/vf_yadif.c b/libmpcodecs/vf_yadif.c
index 6f324dc4fa..828ca29dd7 100644
--- a/libmpcodecs/vf_yadif.c
+++ b/libmpcodecs/vf_yadif.c
@@ -30,7 +30,7 @@
#include "mp_msg.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
diff --git a/libmpdemux/demux_ts.c b/libmpdemux/demux_ts.c
index 94de6fbc28..3d15281644 100644
--- a/libmpdemux/demux_ts.c
+++ b/libmpdemux/demux_ts.c
@@ -322,7 +322,7 @@ static void ts_add_stream(demuxer_t * demuxer, ES_stream_t *es)
sh_video_t *sh = new_sh_video_vid(demuxer, priv->last_vid, es->pid);
if(sh)
{
- sh->format = IS_VIDEO(es->type) ? es->type : es->subtype;;
+ sh->format = IS_VIDEO(es->type) ? es->type : es->subtype;
sh->ds = demuxer->video;
priv->ts.streams[es->pid].id = priv->last_vid;
diff --git a/libmpdemux/muxer_mpeg.c b/libmpdemux/muxer_mpeg.c
index 7e88686483..a4504caa99 100644
--- a/libmpdemux/muxer_mpeg.c
+++ b/libmpdemux/muxer_mpeg.c
@@ -538,7 +538,7 @@ static void write_mpeg2_scr(unsigned char *b, uint64_t ts)
scr_ext = ts % 300ULL;
ts /= 300ULL;
ts &= 0x1FFFFFFFFULL; //33 bits
- t1 = (ts >> 30) & 0x7;;
+ t1 = (ts >> 30) & 0x7;
t2 = (ts >> 15) & 0x7fff;
t3 = ts & 0x7fff;
diff --git a/libmpdemux/parse_mp4.c b/libmpdemux/parse_mp4.c
index 6e4441a17c..82b00a060c 100644
--- a/libmpdemux/parse_mp4.c
+++ b/libmpdemux/parse_mp4.c
@@ -23,7 +23,7 @@
#include <stdio.h>
#include <inttypes.h>
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdlib.h>
diff --git a/libmpdemux/video.c b/libmpdemux/video.c
index 41a3d7d006..58bcc6ad76 100644
--- a/libmpdemux/video.c
+++ b/libmpdemux/video.c
@@ -3,7 +3,7 @@
#include "config.h"
#include <stdio.h>
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdlib.h>
diff --git a/libvo/sub.c b/libvo/sub.c
index 47bfdac2e8..987ab76ba0 100644
--- a/libvo/sub.c
+++ b/libvo/sub.c
@@ -21,7 +21,7 @@
#include <string.h>
#include "config.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
@@ -1242,7 +1242,7 @@ struct osd_state *osd_create(void)
#ifdef CONFIG_DVDNAV
new_osd_obj(OSDTYPE_DVDNAV);
#endif
-#if CONFIG_TV_TELETEXT
+#ifdef CONFIG_TV_TELETEXT
new_osd_obj(OSDTYPE_TELETEXT);
#endif
#ifdef CONFIG_FREETYPE
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 6d177ecabe..e81faee69d 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -75,6 +75,7 @@ extern struct vo_driver video_out_xmga;
extern struct vo_driver video_out_x11;
extern struct vo_driver video_out_xover;
extern struct vo_driver video_out_xvmc;
+extern struct vo_driver video_out_vdpau;
extern struct vo_driver video_out_xv;
extern struct vo_driver video_out_gl;
extern struct vo_driver video_out_gl2;
@@ -157,6 +158,9 @@ const struct vo_driver *video_out_drivers[] =
#ifdef CONFIG_3DFX
&video_out_3dfx,
#endif
+#if CONFIG_VDPAU
+ &video_out_vdpau,
+#endif
#ifdef CONFIG_XV
&video_out_xv,
#endif
@@ -444,8 +448,13 @@ static void src_dst_split_scaling(int src_size, int dst_size, int scaled_src_siz
* Can be extended to take future cropping support into account.
*
* \param crop specifies the cropping border size in the left, right, top and bottom members, may be NULL
+ * \param borders the border values as e.g. EOSD (ASS) and properly placed DVD highlight support requires,
+ * may be NULL and only left and top are currently valid.
*/
-void calc_src_dst_rects(struct vo *vo, int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, struct vo_rect *crop) {
+void calc_src_dst_rects(struct vo *vo, int src_width, int src_height,
+ struct vo_rect *src, struct vo_rect *dst,
+ struct vo_rect *borders, const struct vo_rect *crop)
+{
static const struct vo_rect no_crop = {0, 0, 0, 0, 0, 0};
int scaled_width = 0;
int scaled_height = 0;
@@ -458,11 +467,18 @@ void calc_src_dst_rects(struct vo *vo, int src_width, int src_height, struct vo_
dst->top = 0; dst->bottom = vo->dheight;
src->left = 0; src->right = src_width;
src->top = 0; src->bottom = src_height;
+ if (borders) {
+ borders->left = 0; borders->top = 0;
+ }
if (vo_fs) {
aspect(vo, &scaled_width, &scaled_height, A_ZOOM);
panscan_calc(vo);
scaled_width += vo->panscan_x;
scaled_height += vo->panscan_y;
+ if (borders) {
+ borders->left = (vo->dwidth - scaled_width ) / 2;
+ borders->top = (vo->dheight - scaled_height) / 2;
+ }
src_dst_split_scaling(src_width, vo->dwidth, scaled_width,
&src->left, &src->right, &dst->left, &dst->right);
src_dst_split_scaling(src_height, vo->dheight, scaled_height,
diff --git a/libvo/video_out.h b/libvo/video_out.h
index 64d4e1bb77..c2f7daa859 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -321,6 +321,8 @@ int lookup_keymap_table(const struct keymap *map, int key);
struct vo_rect {
int left, right, top, bottom, width, height;
};
-void calc_src_dst_rects(struct vo *vo, int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, struct vo_rect *crop);
+void calc_src_dst_rects(struct vo *vo, int src_width, int src_height,
+ struct vo_rect *src, struct vo_rect *dst,
+ struct vo_rect *borders, const struct vo_rect *crop);
#endif /* MPLAYER_VIDEO_OUT_H */
diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c
index ef1d0ba9dc..c0f79d45d4 100644
--- a/libvo/vo_direct3d.c
+++ b/libvo/vo_direct3d.c
@@ -63,6 +63,8 @@ static struct global_priv {
fullscreen */
int src_width; /**< Source (movie) width */
int src_height; /**< Source (movie) heigth */
+ int border_x; /**< horizontal border value for OSD */
+ int border_y; /**< vertical border value for OSD */
D3DFORMAT movie_src_fmt; /**< Movie colorspace format (depends on
the movie's codec) */
@@ -149,7 +151,8 @@ static void calc_fs_rect(void)
{
struct vo_rect src_rect;
struct vo_rect dst_rect;
- calc_src_dst_rects(priv->src_width, priv->src_height, &src_rect, &dst_rect, NULL);
+ struct vo_rect borders;
+ calc_src_dst_rects(priv->src_width, priv->src_height, &src_rect, &dst_rect, &borders, NULL);
priv->fs_movie_rect.left = dst_rect.left;
priv->fs_movie_rect.right = dst_rect.right;
@@ -159,6 +162,8 @@ static void calc_fs_rect(void)
priv->fs_panscan_rect.right = src_rect.right;
priv->fs_panscan_rect.top = src_rect.top;
priv->fs_panscan_rect.bottom = src_rect.bottom;
+ priv->border_x = borders.left;
+ priv->border_y = borders.top;
mp_msg(MSGT_VO, MSGL_V,
"<vo_direct3d>Fullscreen movie rectangle: t: %ld, l: %ld, r: %ld, b:%ld\n",
@@ -1027,7 +1032,8 @@ static void draw_osd(void)
/* required for if subs are in the boarder region */
priv->is_clear_needed = 1;
- vo_draw_text(priv->osd_width, priv->osd_height, draw_alpha);
+ vo_draw_text_ext(priv->osd_width, priv->osd_height, priv->border_x, priv->border_y,
+ priv->border_x, priv->border_y, priv->src_width, priv->src_height, draw_alpha);
if (!priv->device_texture_sys)
{
diff --git a/libvo/vo_dxr3.c b/libvo/vo_dxr3.c
index 74250b382c..e9474a0eb2 100644
--- a/libvo/vo_dxr3.c
+++ b/libvo/vo_dxr3.c
@@ -37,7 +37,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include "fastmemcpy.h"
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 8b19e30d21..73ab5dbf82 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -155,6 +155,7 @@ static void resize(int x,int y){
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
+ ass_border_x = ass_border_y = 0;
if (vo_fs && use_aspect) {
int new_w, new_h;
GLdouble scale_x, scale_y;
@@ -1137,7 +1138,7 @@ static int control(uint32_t request, void *data)
resize(vo_dwidth, vo_dheight);
return VO_TRUE;
case VOCTRL_BORDER:
- vo_gl_border(global_vo);
+ vo_gl_border();
resize(vo_dwidth, vo_dheight);
return VO_TRUE;
case VOCTRL_GET_PANSCAN:
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c
index 0b7393a6ef..66099e16d0 100644
--- a/libvo/vo_gl2.c
+++ b/libvo/vo_gl2.c
@@ -897,7 +897,7 @@ static int control(uint32_t request, void *data)
resize(&vo_dwidth, &vo_dheight);
return VO_TRUE;
case VOCTRL_BORDER:
- vo_gl_border(global_vo);
+ vo_gl_border();
return VO_TRUE;
case VOCTRL_GET_PANSCAN:
return VO_TRUE;
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
new file mode 100644
index 0000000000..41dafaa169
--- /dev/null
+++ b/libvo/vo_vdpau.c
@@ -0,0 +1,803 @@
+/*
+ * VDPAU video output driver
+ *
+ * Copyright (C) 2008 NVIDIA
+ *
+ * This file is part of MPlayer.
+ *
+ * MPlayer 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.
+ *
+ * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/**
+ * \defgroup VDPAU_Presentation VDPAU Presentation
+ * \ingroup Decoder
+ *
+ * Actual decoding and presentation are implemented here.
+ * All necessary frame information is collected through
+ * the "vdpau_render_state" structure after parsing all headers
+ * etc. in libavcodec for different codecs.
+ *
+ * @{
+ */
+
+#include <stdio.h>
+#include <dlfcn.h>
+
+#include "config.h"
+#include "mp_msg.h"
+#include "video_out.h"
+#include "video_out_internal.h"
+#include "x11_common.h"
+#include "aspect.h"
+#include "sub.h"
+
+#include "libavcodec/vdpau.h"
+
+#include "gui/interface.h"
+
+#include "libavutil/common.h"
+
+static vo_info_t info = {
+ "VDPAU with X11",
+ "vdpau",
+ "Rajib Mahapatra <rmahapatra@nvidia.com> and others",
+ ""
+};
+
+LIBVO_EXTERN(vdpau)
+
+#define CHECK_ST_ERROR(message) \
+ if (vdp_st != VDP_STATUS_OK) { \
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] %s: %s\n", \
+ message, vdp_get_error_string(vdp_st)); \
+ return -1; \
+ }
+
+#define CHECK_ST_WARNING(message) \
+ if (vdp_st != VDP_STATUS_OK) \
+ mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] %s: %s\n", \
+ message, vdp_get_error_string(vdp_st));
+
+/* number of video and output surfaces */
+#define NUM_OUTPUT_SURFACES 3
+#define MAX_VIDEO_SURFACES 50
+
+/* number of palette entries */
+#define PALETTE_SIZE 256
+
+/*
+ * Global variable declaration - VDPAU specific
+ */
+
+/* Declaration for all variables of win_x11_init_vdpau_procs() and
+ * win_x11_init_vdpau_flip_queue() functions
+ */
+static VdpDevice vdp_device;
+static VdpDeviceCreateX11 *vdp_device_create;
+static VdpGetProcAddress *vdp_get_proc_address;
+
+static VdpPresentationQueueTarget vdp_flip_target;
+static VdpPresentationQueue vdp_flip_queue;
+
+static VdpDeviceDestroy *vdp_device_destroy;
+static VdpVideoSurfaceCreate *vdp_video_surface_create;
+static VdpVideoSurfaceDestroy *vdp_video_surface_destroy;
+
+static VdpGetErrorString *vdp_get_error_string;
+
+/* May be used in software filtering/postprocessing options
+ * in MPlayer (./mplayer -vf ..) if we copy video_surface data to
+ * system memory.
+ */
+static VdpVideoSurfacePutBitsYCbCr *vdp_video_surface_put_bits_y_cb_cr;
+static VdpOutputSurfacePutBitsNative *vdp_output_surface_put_bits_native;
+
+static VdpOutputSurfaceCreate *vdp_output_surface_create;
+static VdpOutputSurfaceDestroy *vdp_output_surface_destroy;
+
+/* VideoMixer puts video_surface data on displayable output_surface. */
+static VdpVideoMixerCreate *vdp_video_mixer_create;
+static VdpVideoMixerDestroy *vdp_video_mixer_destroy;
+static VdpVideoMixerRender *vdp_video_mixer_render;
+
+static VdpPresentationQueueTargetDestroy *vdp_presentation_queue_target_destroy;
+static VdpPresentationQueueCreate *vdp_presentation_queue_create;
+static VdpPresentationQueueDestroy *vdp_presentation_queue_destroy;
+static VdpPresentationQueueDisplay *vdp_presentation_queue_display;
+static VdpPresentationQueueBlockUntilSurfaceIdle *vdp_presentation_queue_block_until_surface_idle;
+static VdpPresentationQueueTargetCreateX11 *vdp_presentation_queue_target_create_x11;
+
+/* output_surfaces[2] is used in composite-picture. */
+static VdpOutputSurfaceRenderOutputSurface *vdp_output_surface_render_output_surface;
+static VdpOutputSurfacePutBitsIndexed *vdp_output_surface_put_bits_indexed;
+
+static VdpDecoderCreate *vdp_decoder_create;
+static VdpDecoderDestroy *vdp_decoder_destroy;
+static VdpDecoderRender *vdp_decoder_render;
+
+static void *vdpau_lib_handle;
+static VdpOutputSurface output_surfaces[NUM_OUTPUT_SURFACES];
+static int output_surface_width, output_surface_height;
+
+static VdpVideoMixer video_mixer;
+
+static VdpDecoder decoder;
+static int decoder_max_refs;
+
+static VdpRect src_rect_vid;
+static VdpRect out_rect_vid;
+static int border_x, border_y;
+
+static struct vdpau_render_state surface_render[MAX_VIDEO_SURFACES];
+static int surface_num;
+static int vid_surface_num;
+static uint32_t vid_width, vid_height;
+static uint32_t image_format;
+static const VdpChromaType vdp_chroma_type = VDP_CHROMA_TYPE_420;
+
+/* draw_osd */
+static unsigned char *index_data;
+static int index_data_size;
+static uint32_t palette[PALETTE_SIZE];
+
+/*
+ * X11 specific
+ */
+static int visible_buf;
+static int int_pause;
+
+static void video_to_output_surface(void)
+{
+ VdpTime dummy;
+ VdpStatus vdp_st;
+ VdpOutputSurface output_surface = output_surfaces[surface_num];
+ if (vid_surface_num < 0)
+ return;
+
+ vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue,
+ output_surface,
+ &dummy);
+ CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle")
+
+ vdp_st = vdp_video_mixer_render(video_mixer, VDP_INVALID_HANDLE, 0,
+ VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME,
+ 0, NULL, surface_render[vid_surface_num].surface, 0, NULL, &src_rect_vid,
+ output_surface,
+ NULL, &out_rect_vid, 0, NULL);
+ CHECK_ST_WARNING("Error when calling vdp_video_mixer_render")
+}
+
+static void resize(void)
+{
+ VdpStatus vdp_st;
+ int i;
+ struct vo_rect src_rect;
+ struct vo_rect dst_rect;
+ struct vo_rect borders;
+ calc_src_dst_rects(vid_width, vid_height, &src_rect, &dst_rect, &borders, NULL);
+ out_rect_vid.x0 = dst_rect.left;
+ out_rect_vid.x1 = dst_rect.right;
+ out_rect_vid.y0 = dst_rect.top;
+ out_rect_vid.y1 = dst_rect.bottom;
+ src_rect_vid.x0 = src_rect.left;
+ src_rect_vid.x1 = src_rect.right;
+ src_rect_vid.y0 = src_rect.top;
+ src_rect_vid.y1 = src_rect.bottom;
+ border_x = borders.left;
+ border_y = borders.top;
+#ifdef CONFIG_FREETYPE
+ // adjust font size to display size
+ force_load_font = 1;
+#endif
+ vo_osd_changed(OSDTYPE_OSD);
+
+ if (output_surface_width < vo_dwidth || output_surface_height < vo_dheight) {
+ if (output_surface_width < vo_dwidth) {
+ output_surface_width += output_surface_width >> 1;
+ output_surface_width = FFMAX(output_surface_width, vo_dwidth);
+ }
+ if (output_surface_height < vo_dheight) {
+ output_surface_height += output_surface_height >> 1;
+ output_surface_height = FFMAX(output_surface_height, vo_dheight);
+ }
+ // Creation of output_surfaces
+ for (i = 0; i < NUM_OUTPUT_SURFACES; i++) {
+ if (output_surfaces[i] != VDP_INVALID_HANDLE)
+ vdp_output_surface_destroy(output_surfaces[i]);
+ vdp_st = vdp_output_surface_create(vdp_device, VDP_RGBA_FORMAT_B8G8R8A8,
+ output_surface_width, output_surface_height,
+ &output_surfaces[i]);
+ CHECK_ST_WARNING("Error when calling vdp_output_surface_create")
+ mp_msg(MSGT_VO, MSGL_DBG2, "OUT CREATE: %u\n", output_surfaces[i]);
+ }
+ }
+ video_to_output_surface();
+ if (visible_buf)
+ flip_page();
+}
+
+/* Initialize vdp_get_proc_address, called from preinit() */
+static int win_x11_init_vdpau_procs(void)
+{
+ VdpStatus vdp_st;
+
+ struct vdp_function {
+ const int id;
+ void *pointer;
+ };
+
+ const struct vdp_function *dsc;
+
+ static const struct vdp_function vdp_func[] = {
+ {VDP_FUNC_ID_GET_ERROR_STRING, &vdp_get_error_string},
+ {VDP_FUNC_ID_DEVICE_DESTROY, &vdp_device_destroy},
+ {VDP_FUNC_ID_VIDEO_SURFACE_CREATE, &vdp_video_surface_create},
+ {VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, &vdp_video_surface_destroy},
+ {VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR,
+ &vdp_video_surface_put_bits_y_cb_cr},
+ {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE,
+ &vdp_output_surface_put_bits_native},
+ {VDP_FUNC_ID_OUTPUT_SURFACE_CREATE, &vdp_output_surface_create},
+ {VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY, &vdp_output_surface_destroy},
+ {VDP_FUNC_ID_VIDEO_MIXER_CREATE, &vdp_video_mixer_create},
+ {VDP_FUNC_ID_VIDEO_MIXER_DESTROY, &vdp_video_mixer_destroy},
+ {VDP_FUNC_ID_VIDEO_MIXER_RENDER, &vdp_video_mixer_render},
+ {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY,
+ &vdp_presentation_queue_target_destroy},
+ {VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE, &vdp_presentation_queue_create},
+ {VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY,
+ &vdp_presentation_queue_destroy},
+ {VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY,
+ &vdp_presentation_queue_display},
+ {VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE,
+ &vdp_presentation_queue_block_until_surface_idle},
+ {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11,
+ &vdp_presentation_queue_target_create_x11},
+ {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE,
+ &vdp_output_surface_render_output_surface},
+ {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED,
+ &vdp_output_surface_put_bits_indexed},
+ {VDP_FUNC_ID_DECODER_CREATE, &vdp_decoder_create},
+ {VDP_FUNC_ID_DECODER_RENDER, &vdp_decoder_render},
+ {VDP_FUNC_ID_DECODER_DESTROY, &vdp_decoder_destroy},
+ {0, NULL}
+ };
+
+ vdp_st = vdp_device_create(mDisplay, mScreen,
+ &vdp_device, &vdp_get_proc_address);
+ if (vdp_st != VDP_STATUS_OK) {
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling vdp_device_create_x11: %i\n", vdp_st);
+ return -1;
+ }
+
+ for (dsc = vdp_func; dsc->pointer; dsc++) {
+ vdp_st = vdp_get_proc_address(vdp_device, dsc->id, dsc->pointer);
+ if (vdp_st != VDP_STATUS_OK) {
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling vdp_get_proc_address(function id %d): %s\n", dsc->id, vdp_get_error_string ? vdp_get_error_string(vdp_st) : "?");
+ return -1;
+ }
+ }
+ return 0;
+}
+
+/* Initialize vdpau_flip_queue, called from config() */
+static int win_x11_init_vdpau_flip_queue(void)
+{
+ VdpStatus vdp_st;
+
+ vdp_st = vdp_presentation_queue_target_create_x11(vdp_device, vo_window,
+ &vdp_flip_target);
+ CHECK_ST_ERROR("Error when calling vdp_presentation_queue_target_create_x11")
+
+ vdp_st = vdp_presentation_queue_create(vdp_device, vdp_flip_target,
+ &vdp_flip_queue);
+ CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create")
+
+ return 0;
+}
+
+static int create_vdp_mixer(VdpChromaType vdp_chroma_type) {
+#define VDP_NUM_MIXER_PARAMETER 3
+ VdpStatus vdp_st;
+ static const VdpVideoMixerParameter parameters[VDP_NUM_MIXER_PARAMETER] = {
+ VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH,
+ VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT,
+ VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE
+ };
+ const void *const parameter_values[VDP_NUM_MIXER_PARAMETER] = {
+ &vid_width,
+ &vid_height,
+ &vdp_chroma_type
+ };
+
+ vdp_st = vdp_video_mixer_create(vdp_device, 0, 0,
+ VDP_NUM_MIXER_PARAMETER,
+ parameters, parameter_values,
+ &video_mixer);
+ CHECK_ST_ERROR("Error when calling vdp_video_mixer_create")
+
+ return 0;
+}
+
+// Free everything specific to a certain video file
+static void free_video_specific(void) {
+ int i;
+ VdpStatus vdp_st;
+
+ if (decoder != VDP_INVALID_HANDLE)
+ vdp_decoder_destroy(decoder);
+ decoder = VDP_INVALID_HANDLE;
+ decoder_max_refs = -1;
+
+ for (i = 0; i < MAX_VIDEO_SURFACES; i++) {
+ if (surface_render[i].surface != VDP_INVALID_HANDLE) {
+ vdp_st = vdp_video_surface_destroy(surface_render[i].surface);
+ CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy")
+ }
+ surface_render[i].surface = VDP_INVALID_HANDLE;
+ }
+
+ if (video_mixer != VDP_INVALID_HANDLE)
+ vdp_st = vdp_video_mixer_destroy(video_mixer);
+ CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy")
+ video_mixer = VDP_INVALID_HANDLE;
+}
+
+/*
+ * connect to X server, create and map window, initialize all
+ * VDPAU objects, create different surfaces etc.
+ */
+static int config(uint32_t width, uint32_t height, uint32_t d_width,
+ uint32_t d_height, uint32_t flags, char *title,
+ uint32_t format)
+{
+ XVisualInfo vinfo;
+ XSetWindowAttributes xswa;
+ XWindowAttributes attribs;
+ unsigned long xswamask;
+ int depth;
+
+#ifdef CONFIG_XF86VM
+ int vm = flags & VOFLAG_MODESWITCHING;
+#endif
+
+ image_format = format;
+
+ int_pause = 0;
+ visible_buf = 0;
+
+#ifdef CONFIG_GUI
+ if (use_gui)
+ guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize our window
+ else
+#endif
+ {
+#ifdef CONFIG_XF86VM
+ if (vm)
+ vo_vm_switch();
+ else
+#endif
+ XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs);
+ depth = attribs.depth;
+ if (depth != 15 && depth != 16 && depth != 24 && depth != 32)
+ depth = 24;
+ XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo);
+
+ xswa.background_pixel = 0;
+ xswa.border_pixel = 0;
+ xswamask = CWBackPixel | CWBorderPixel;
+
+ vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height,
+ flags, CopyFromParent, "vdpau", title);
+ XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
+
+#ifdef CONFIG_XF86VM
+ if (vm) {
+ /* Grab the mouse pointer in our window */
+ if (vo_grabpointer)
+ XGrabPointer(mDisplay, vo_window, True, 0,
+ GrabModeAsync, GrabModeAsync,
+ vo_window, None, CurrentTime);
+ XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime);
+ }
+#endif
+ }
+
+ if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0)
+ vo_fs = 1;
+
+ /* -----VDPAU related code here -------- */
+
+ free_video_specific();
+
+ if (vdp_flip_queue == VDP_INVALID_HANDLE && win_x11_init_vdpau_flip_queue())
+ return -1;
+
+ // video width and height
+ vid_width = width;
+ vid_height = height;
+
+ if (create_vdp_mixer(vdp_chroma_type))
+ return -1;
+
+ surface_num = 0;
+ vid_surface_num = -1;
+ resize();
+
+ return 0;
+}
+
+static void check_events(void)
+{
+ int e = vo_x11_check_events(mDisplay);
+
+ if (e & VO_EVENT_RESIZE)
+ resize();
+
+ if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause) {
+ /* did we already draw a buffer */
+ if (visible_buf) {
+ /* redraw the last visible buffer */
+ VdpStatus vdp_st;
+ vdp_st = vdp_presentation_queue_display(vdp_flip_queue,
+ output_surfaces[surface_num],
+ vo_dwidth, vo_dheight,
+ 0);
+ CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
+ }
+ }
+}
+
+static void draw_osd_I8A8(int x0,int y0, int w,int h, unsigned char *src,
+ unsigned char *srca, int stride)
+{
+ VdpOutputSurface output_surface = output_surfaces[surface_num];
+ VdpStatus vdp_st;
+ int i, j;
+ int pitch;
+ int index_data_size_required;
+ VdpRect output_indexed_rect_vid;
+ VdpOutputSurfaceRenderBlendState blend_state;
+
+ if (!w || !h)
+ return;
+
+ index_data_size_required = 2*w*h;
+ if (index_data_size < index_data_size_required) {
+ index_data = realloc(index_data, index_data_size_required);
+ index_data_size = index_data_size_required;
+ }
+
+ // index_data creation, component order - I, A, I, A, .....
+ for (i = 0; i < h; i++)
+ for (j = 0; j < w; j++) {
+ index_data[i*2*w + j*2] = src [i*stride+j];
+ index_data[i*2*w + j*2 + 1] = -srca[i*stride+j];
+ }
+
+ output_indexed_rect_vid.x0 = x0;
+ output_indexed_rect_vid.y0 = y0;
+ output_indexed_rect_vid.x1 = x0 + w;
+ output_indexed_rect_vid.y1 = y0 + h;
+
+ pitch = w*2;
+
+ // write source_data to output_surfaces[2].
+ vdp_st = vdp_output_surface_put_bits_indexed(output_surfaces[2],
+ VDP_INDEXED_FORMAT_I8A8,
+ (const void *const*)&index_data,
+ &pitch,
+ &output_indexed_rect_vid,
+ VDP_COLOR_TABLE_FORMAT_B8G8R8X8,
+ (void *)palette);
+ CHECK_ST_WARNING("Error when calling vdp_output_surface_put_bits_indexed")
+
+ blend_state.struct_version = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION;
+ blend_state.blend_factor_source_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE;
+ blend_state.blend_factor_source_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE;
+ blend_state.blend_factor_destination_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
+ blend_state.blend_factor_destination_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
+ blend_state.blend_equation_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD;
+ blend_state.blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD;
+
+ vdp_st = vdp_output_surface_render_output_surface(output_surface,
+ &output_indexed_rect_vid,
+ output_surfaces[2],
+ &output_indexed_rect_vid,
+ NULL,
+ &blend_state,
+ VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
+ CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface")
+}
+
+static void draw_osd(void)
+{
+ mp_msg(MSGT_VO, MSGL_DBG2, "DRAW_OSD\n");
+
+ vo_draw_text_ext(vo_dwidth, vo_dheight, border_x, border_y, border_x, border_y,
+ vid_width, vid_height, draw_osd_I8A8);
+}
+
+static void flip_page(void)
+{
+ VdpStatus vdp_st;
+ mp_msg(MSGT_VO, MSGL_DBG2, "\nFLIP_PAGE VID:%u -> OUT:%u\n",
+ surface_render[vid_surface_num].surface, output_surfaces[surface_num]);
+
+ vdp_st = vdp_presentation_queue_display(vdp_flip_queue, output_surfaces[surface_num],
+ vo_dwidth, vo_dheight,
+ 0);
+ CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
+
+ surface_num = !surface_num;
+ visible_buf = 1;
+}
+
+static int draw_slice(uint8_t *image[], int stride[], int w, int h,
+ int x, int y)
+{
+ VdpStatus vdp_st;
+ struct vdpau_render_state *rndr = (struct vdpau_render_state *)image[0];
+ int max_refs = image_format == IMGFMT_VDPAU_H264 ? rndr->info.h264.num_ref_frames : 2;
+ if (!IMGFMT_IS_VDPAU(image_format))
+ return VO_FALSE;
+ if (decoder == VDP_INVALID_HANDLE || decoder_max_refs < max_refs) {
+ VdpDecoderProfile vdp_decoder_profile;
+ if (decoder != VDP_INVALID_HANDLE)
+ vdp_decoder_destroy(decoder);
+ decoder = VDP_INVALID_HANDLE;
+ switch (image_format) {
+ case IMGFMT_VDPAU_MPEG1:
+ vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG1;
+ break;
+ case IMGFMT_VDPAU_MPEG2:
+ vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG2_MAIN;
+ break;
+ case IMGFMT_VDPAU_H264:
+ vdp_decoder_profile = VDP_DECODER_PROFILE_H264_HIGH;
+ break;
+ case IMGFMT_VDPAU_WMV3:
+ vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_MAIN;
+ break;
+ case IMGFMT_VDPAU_VC1:
+ vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_ADVANCED;
+ break;
+ }
+ vdp_st = vdp_decoder_create(vdp_device, vdp_decoder_profile, vid_width, vid_height, max_refs, &decoder);
+ CHECK_ST_WARNING("Failed creating VDPAU decoder");
+ decoder_max_refs = max_refs;
+ }
+ vdp_st = vdp_decoder_render(decoder, rndr->surface, (void *)&rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers);
+ CHECK_ST_WARNING("Failed VDPAU decoder rendering");
+ return VO_TRUE;
+}
+
+
+static int draw_frame(uint8_t *src[])
+{
+ return VO_ERROR;
+}
+
+static struct vdpau_render_state *get_surface(int number)
+{
+ if (number > MAX_VIDEO_SURFACES)
+ return NULL;
+ if (surface_render[number].surface == VDP_INVALID_HANDLE) {
+ VdpStatus vdp_st;
+ vdp_st = vdp_video_surface_create(vdp_device, vdp_chroma_type,
+ vid_width, vid_height,
+ &surface_render[number].surface);
+ CHECK_ST_WARNING("Error when calling vdp_video_surface_create")
+ if (vdp_st != VDP_STATUS_OK)
+ return NULL;
+ }
+ mp_msg(MSGT_VO, MSGL_DBG2, "VID CREATE: %u\n", surface_render[number].surface);
+ return &surface_render[number];
+}
+
+static uint32_t draw_image(mp_image_t *mpi)
+{
+ if (IMGFMT_IS_VDPAU(image_format)) {
+ struct vdpau_render_state *rndr = mpi->priv;
+ vid_surface_num = rndr - surface_render;
+ } else if (!(mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)) {
+ VdpStatus vdp_st;
+ void *destdata[3] = {mpi->planes[0], mpi->planes[2], mpi->planes[1]};
+ struct vdpau_render_state *rndr = get_surface(0);
+ vid_surface_num = rndr - surface_render;
+ vdp_st = vdp_video_surface_put_bits_y_cb_cr(rndr->surface,
+ VDP_YCBCR_FORMAT_YV12,
+ (const void *const*)destdata,
+ mpi->stride); // pitch
+ CHECK_ST_ERROR("Error when calling vdp_video_surface_put_bits_y_cb_cr")
+ }
+
+ video_to_output_surface();
+ return VO_TRUE;
+}
+
+static uint32_t get_image(mp_image_t *mpi)
+{
+ struct vdpau_render_state *rndr;
+
+ // no dr for non-decoding for now
+ if (!IMGFMT_IS_VDPAU(image_format)) return VO_FALSE;
+ if (mpi->type != MP_IMGTYPE_NUMBERED) return VO_FALSE;
+
+ rndr = get_surface(mpi->number);
+ if (!rndr) {
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] no surfaces available in get_image\n");
+ // TODO: this probably breaks things forever, provide a dummy buffer?
+ return VO_FALSE;
+ }
+ mpi->flags |= MP_IMGFLAG_DIRECT;
+ mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = 0;
+ mpi->planes[0] = mpi->planes[1] = mpi->planes[2] = NULL;
+ // hack to get around a check and to avoid a special-case in vd_ffmpeg.c
+ mpi->planes[0] = (void *)rndr;
+ mpi->num_planes = 1;
+ mpi->priv = rndr;
+ return VO_TRUE;
+}
+
+static int query_format(uint32_t format)
+{
+ switch (format) {
+ case IMGFMT_YV12:
+ case IMGFMT_VDPAU_MPEG1:
+ case IMGFMT_VDPAU_MPEG2:
+ case IMGFMT_VDPAU_H264:
+ case IMGFMT_VDPAU_WMV3:
+ case IMGFMT_VDPAU_VC1:
+ return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD;
+ }
+ return 0;
+}
+
+static void DestroyVdpauObjects(void)
+{
+ int i;
+ VdpStatus vdp_st;
+
+ free_video_specific();
+
+ vdp_st = vdp_presentation_queue_destroy(vdp_flip_queue);
+ CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy")
+
+ vdp_st = vdp_presentation_queue_target_destroy(vdp_flip_target);
+ CHECK_ST_WARNING("Error when calling vdp_presentation_queue_target_destroy")
+
+ for (i = 0; i < NUM_OUTPUT_SURFACES; i++) {
+ vdp_st = vdp_output_surface_destroy(output_surfaces[i]);
+ output_surfaces[i] = VDP_INVALID_HANDLE;
+ CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy")
+ }
+
+ vdp_st = vdp_device_destroy(vdp_device);
+ CHECK_ST_WARNING("Error when calling vdp_device_destroy")
+}
+
+static void uninit(void)
+{
+ if (!vo_config_count)
+ return;
+ visible_buf = 0;
+
+ /* Destroy all vdpau objects */
+ DestroyVdpauObjects();
+
+ free(index_data);
+ index_data = NULL;
+
+#ifdef CONFIG_XF86VM
+ vo_vm_close();
+#endif
+ vo_x11_uninit();
+
+ dlclose(vdpau_lib_handle);
+}
+
+static int preinit(const char *arg)
+{
+ int i;
+ static const char *vdpaulibrary = "libvdpau.so.1";
+ static const char *vdpau_device_create = "vdp_device_create_x11";
+
+ if (arg) {
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Unknown subdevice: %s\n", arg);
+ return ENOSYS;
+ }
+
+ vdpau_lib_handle = dlopen(vdpaulibrary, RTLD_LAZY);
+ if (!vdpau_lib_handle) {
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Could not open dynamic library %s\n",
+ vdpaulibrary);
+ return -1;
+ }
+ vdp_device_create = dlsym(vdpau_lib_handle, vdpau_device_create);
+ if (!vdp_device_create) {
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Could not find function %s in %s\n",
+ vdpau_device_create, vdpaulibrary);
+ return -1;
+ }
+ if (!vo_init() || win_x11_init_vdpau_procs())
+ return -1;
+
+ decoder = VDP_INVALID_HANDLE;
+ for (i = 0; i < MAX_VIDEO_SURFACES; i++)
+ surface_render[i].surface = VDP_INVALID_HANDLE;
+ video_mixer = VDP_INVALID_HANDLE;
+ for (i = 0; i < NUM_OUTPUT_SURFACES; i++)
+ output_surfaces[i] = VDP_INVALID_HANDLE;
+ vdp_flip_queue = VDP_INVALID_HANDLE;
+ output_surface_width = output_surface_height = -1;
+
+ // full grayscale palette.
+ for (i = 0; i < PALETTE_SIZE; ++i)
+ palette[i] = (i << 16) | (i << 8) | i;
+ index_data = NULL;
+ index_data_size = 0;
+
+ return 0;
+}
+
+static int control(uint32_t request, void *data)
+{
+ switch (request) {
+ case VOCTRL_PAUSE:
+ return (int_pause = 1);
+ case VOCTRL_RESUME:
+ return (int_pause = 0);
+ case VOCTRL_QUERY_FORMAT:
+ return query_format(*(uint32_t *)data);
+ case VOCTRL_GET_IMAGE:
+ return get_image(data);
+ case VOCTRL_DRAW_IMAGE:
+ return draw_image(data);
+ case VOCTRL_GUISUPPORT:
+ return VO_TRUE;
+ case VOCTRL_BORDER:
+ vo_x11_border();
+ resize();
+ return VO_TRUE;
+ case VOCTRL_FULLSCREEN:
+ vo_x11_fullscreen();
+ resize();
+ return VO_TRUE;
+ case VOCTRL_GET_PANSCAN:
+ return VO_TRUE;
+ case VOCTRL_SET_PANSCAN:
+ resize();
+ return VO_TRUE;
+ case VOCTRL_SET_EQUALIZER: {
+ struct voctrl_set_equalizer_args *args = data;
+ return vo_x11_set_equalizer(args->name, args->value);
+ }
+ case VOCTRL_GET_EQUALIZER:
+ {
+ struct voctrl_get_equalizer_args *args = data;
+ return vo_x11_get_equalizer(args->name, args->valueptr);
+ }
+ case VOCTRL_ONTOP:
+ vo_x11_ontop();
+ return VO_TRUE;
+ case VOCTRL_UPDATE_SCREENINFO:
+ update_xinerama_info();
+ return VO_TRUE;
+ }
+ return VO_NOTIMPL;
+}
+
+/* @} */
diff --git a/libvo/vo_vesa.c b/libvo/vo_vesa.c
index a5c3c899f3..8b9e05a731 100644
--- a/libvo/vo_vesa.c
+++ b/libvo/vo_vesa.c
@@ -30,7 +30,7 @@
#include "help_mp.h"
#include "gtf.h"
#include <stdio.h>
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdlib.h>
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index c6bbcdf347..fc6f0b99d9 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -186,7 +186,7 @@ static void resize(struct vo *vo)
struct xvctx *ctx = vo->priv;
calc_src_dst_rects(vo, ctx->image_width, ctx->image_height, &ctx->src_rect,
- &ctx->dst_rect, NULL);
+ &ctx->dst_rect, NULL, NULL);
struct vo_rect *dst = &ctx->dst_rect;
vo_x11_clearwindow_part(vo, vo->x11->window, dst->width, dst->height, 1);
vo_xv_draw_colorkey(vo, dst->left, dst->top, dst->width, dst->height);
diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c
index 709967fb41..4e42fe4128 100644
--- a/libvo/vo_xvmc.c
+++ b/libvo/vo_xvmc.c
@@ -529,7 +529,7 @@ int vm = flags & VOFLAG_MODESWITCHING;
surface_render[i].data_blocks = data_blocks.blocks;
surface_render[i].mv_blocks = mv_blocks.macro_blocks;
surface_render[i].allocated_mv_blocks = numblocks;
- surface_render[i].allocated_data_blocks = numblocks*blocks_per_macroblock;;
+ surface_render[i].allocated_data_blocks = numblocks*blocks_per_macroblock;
surface_render[i].idct = (surface_info.mc_type & XVMC_IDCT) == XVMC_IDCT;
surface_render[i].unsigned_intra = (surface_info.flags & XVMC_INTRA_UNSIGNED) == XVMC_INTRA_UNSIGNED;
surface_render[i].p_surface = &surface_array[i];
@@ -943,7 +943,7 @@ int i;
if(p_render_surface == NULL)
return;
- calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL);
+ calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL, NULL);
if(draw_ck)
vo_xv_draw_colorkey(dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height);
diff --git a/libvo/x11_common.h b/libvo/x11_common.h
index 872e84e174..08248b57a5 100644
--- a/libvo/x11_common.h
+++ b/libvo/x11_common.h
@@ -202,6 +202,7 @@ void xscreensaver_heartbeat(struct vo_x11_state *x11);
#define vo_x11_classhint(display, window, name) vo_x11_classhint(global_vo, window, name)
#define vo_x11_setlayer(display, window, layer) vo_x11_setlayer(global_vo, window, layer)
#define xv_setup_colorkeyhandling(a, b) xv_setup_colorkeyhandling(global_vo, a, b)
+#define vo_x11_border() vo_x11_border(global_vo)
#define mDisplay global_vo->x11->display
#define vo_depthonscreen global_vo->x11->depthonscreen
diff --git a/loader/drv.c b/loader/drv.c
index b8fecf7467..e3fb4da116 100644
--- a/loader/drv.c
+++ b/loader/drv.c
@@ -7,7 +7,7 @@
#include "debug.h"
#include <stdio.h>
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdlib.h>
diff --git a/loader/dshow/DS_AudioDecoder.c b/loader/dshow/DS_AudioDecoder.c
index 2ac48cd25e..645c8b517b 100644
--- a/loader/dshow/DS_AudioDecoder.c
+++ b/loader/dshow/DS_AudioDecoder.c
@@ -184,7 +184,7 @@ int DS_AudioDecoder_GetSrcSize(DS_AudioDecoder *this, int dest_size)
{
double efficiency =(double) this->in_fmt.nAvgBytesPerSec
/ (this->in_fmt.nSamplesPerSec*this->in_fmt.nBlockAlign);
- int frames = (int)(dest_size*efficiency);;
+ int frames = (int)(dest_size*efficiency);
if (frames < 1)
frames = 1;
diff --git a/loader/ext.c b/loader/ext.c
index 495afb9aac..0486f7c09b 100644
--- a/loader/ext.c
+++ b/loader/ext.c
@@ -14,7 +14,7 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <unistd.h>
diff --git a/loader/qtx/list.c b/loader/qtx/list.c
index 34e93dccc5..4669067d30 100644
--- a/loader/qtx/list.c
+++ b/loader/qtx/list.c
@@ -18,7 +18,7 @@ void* GetProcAddress(void* handle,char* func);
#define __cdecl __attribute__((__cdecl__))
#define APIENTRY
-int main(int argc, char *argv[]){
+int main(void) {
void *handler;
ComponentDescription desc;
Component (*FindNextComponent)(Component prev,ComponentDescription* desc);
diff --git a/loader/qtx/qtxload.c b/loader/qtx/qtxload.c
index 0fb13aa9a4..8767559aa1 100644
--- a/loader/qtx/qtxload.c
+++ b/loader/qtx/qtxload.c
@@ -33,7 +33,7 @@ unsigned int* x_table[0x00001837];
static OSErr (*InitializeQTML)(long flags);
-int main(int argc, char *argv[]){
+int main(void) {
void *handler;
void *handler2;
void* theqtdp=NULL;
diff --git a/loader/win32.c b/loader/win32.c
index 172a91afa9..2ee9f1ea7e 100644
--- a/loader/win32.c
+++ b/loader/win32.c
@@ -53,7 +53,7 @@ for DLL to know too much about its environment.
#include <ctype.h>
#include <pthread.h>
#include <errno.h>
-#ifdef HAVE_MALLOC_H
+#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <time.h>
diff --git a/mp3lib/sr1.c b/mp3lib/sr1.c
index aadb22c388..9aa4dec827 100644
--- a/mp3lib/sr1.c
+++ b/mp3lib/sr1.c
@@ -19,8 +19,6 @@
#include "mpg123.h"
#include "huffman.h"
#include "mp3.h"
-#include "libavutil/common.h"
-#include "libavutil/internal.h"
#include "mpbswap.h"
#include "cpudetect.h"
//#include "liba52/mm_accel.h"
@@ -28,6 +26,9 @@
#include "libvo/fastmemcpy.h"
+#include "libavutil/common.h"
+#include "libavutil/internal.h"
+
#undef fprintf
#undef printf
diff --git a/stream/stream.h b/stream/stream.h
index 87cda3637a..46e580028a 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -225,7 +225,7 @@ inline static int stream_read(stream_t *s,char* mem,int total){
inline static unsigned char* stream_read_line(stream_t *s,unsigned char* mem, int max) {
int len;
- unsigned char* end,*ptr = mem;;
+ unsigned char* end,*ptr = mem;
do {
len = s->buf_len-s->buf_pos;
// try to fill the buffer
diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c
index 403016b372..85d86713c2 100644
--- a/stream/stream_dvdnav.c
+++ b/stream/stream_dvdnav.c
@@ -733,7 +733,7 @@ int mp_dvdnav_aid_from_lang(stream_t *stream, unsigned char *language) {
dvdnav_priv_t * priv = stream->priv;
int k;
uint8_t lg;
- uint16_t lang, lcode;;
+ uint16_t lang, lcode;
while(language && strlen(language)>=2) {
lcode = (language[0] << 8) | (language[1]);
diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c
index e06f4dc346..4a524852cd 100644
--- a/stream/tvi_dshow.c
+++ b/stream/tvi_dshow.c
@@ -3312,7 +3312,7 @@ static int control(priv_t * priv, int cmd, void *arg)
if (!priv->chains[1]->arpmt[0])
return TVI_CONTROL_FALSE;
- samplerate = *(int *) arg;;
+ samplerate = *(int *) arg;
for (i = 0; priv->chains[1]->arpmt[i]; i++)
if (check_audio_format