MPlayer-dev-eng
Threads by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1999 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
April 2024
- 5 participants
- 8 discussions
Hello,
Debian ships a desktop file with an updated list of MIME types; the
list was derived from VLC but I cross check it against the list of
SMplayer and they are roughly equivalent.
Please consider to apply upstream, patch is attached
Thanks,
Lorenzo
2
1
From: "Vladimir D. Seleznev" <vseleznv(a)altlinux.org>
shmget(2) is not subject of umask(2), so it's better to use more proper
perms for it.
---
MPlayer/gui/wm/ws.c | 2 +-
MPlayer/libvo/vo_x11.c | 2 +-
MPlayer/libvo/vo_xv.c | 2 +-
MPlayer/libvo/vo_xvmc.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/MPlayer/gui/wm/ws.c b/MPlayer/gui/wm/ws.c
index b211db5959..474154fc3c 100644
--- a/MPlayer/gui/wm/ws.c
+++ b/MPlayer/gui/wm/ws.c
@@ -1357,7 +1357,7 @@ void wsImageCreate(wsWindow *win, int w, int h)
mplayer(MPLAYER_EXIT_GUI, EXIT_ERROR, 0);
}
- win->Shminfo.shmid = shmget(IPC_PRIVATE, win->xImage->bytes_per_line * win->xImage->height, IPC_CREAT | 0777);
+ win->Shminfo.shmid = shmget(IPC_PRIVATE, win->xImage->bytes_per_line * win->xImage->height, IPC_CREAT | 0600);
if (win->Shminfo.shmid < 0) {
XDestroyImage(win->xImage);
diff --git a/MPlayer/libvo/vo_x11.c b/MPlayer/libvo/vo_x11.c
index 58e1762de7..6b81980023 100644
--- a/MPlayer/libvo/vo_x11.c
+++ b/MPlayer/libvo/vo_x11.c
@@ -150,7 +150,7 @@ static void getMyXImage(void)
}
Shminfo[0].shmid = shmget(IPC_PRIVATE,
myximage->bytes_per_line *
- myximage->height, IPC_CREAT | 0777);
+ myximage->height, IPC_CREAT | 0600);
if (Shminfo[0].shmid < 0)
{
XDestroyImage(myximage);
diff --git a/MPlayer/libvo/vo_xv.c b/MPlayer/libvo/vo_xv.c
index ebc1dbb23d..a3ec393e16 100644
--- a/MPlayer/libvo/vo_xv.c
+++ b/MPlayer/libvo/vo_xv.c
@@ -279,7 +279,7 @@ static void allocate_xvimage(int foo)
&Shminfo[foo]);
Shminfo[foo].shmid =
- shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777);
+ shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0600);
Shminfo[foo].shmaddr = (char *) shmat(Shminfo[foo].shmid, 0, 0);
Shminfo[foo].readOnly = False;
diff --git a/MPlayer/libvo/vo_xvmc.c b/MPlayer/libvo/vo_xvmc.c
index 48f3ede440..31104f4dd4 100644
--- a/MPlayer/libvo/vo_xvmc.c
+++ b/MPlayer/libvo/vo_xvmc.c
@@ -203,7 +203,7 @@ static int allocate_xvimage(int xvimage_width,int xvimage_height,int xv_format)
if (!xvimage->data_size)
goto shmgetfail;
- Shminfo.shmid = shmget(IPC_PRIVATE, xvimage->data_size, IPC_CREAT | 0777);
+ Shminfo.shmid = shmget(IPC_PRIVATE, xvimage->data_size, IPC_CREAT | 0600);
if (Shminfo.shmid == -1)
goto shmgetfail;
Shminfo.shmaddr = (char *) shmat(Shminfo.shmid, 0, 0);
--
2.33.7
3
2
The functionality was removed from FFmpeg for years.
With the recent FFmpeg 7 release it was completely removed from
FFmpeg, so --enable-xvmc in MPlayer now results in build errors.
This removal was discussed with Ivan who developed and
XvMC support and maintained it for the last two decades.
---
Please test (e.g. test the build on your setup) if you can.
Comments and review welcome as always :)
I intend to commit this weekend on Saturday or Sunday if
there are no problems with the patch.
DOCS/man/en/mplayer.1 | 52 +-
DOCS/tech/MAINTAINERS | 1 -
DOCS/tech/TODO | 1 -
Makefile | 1 -
TOOLS/coverity.sh | 2 +-
codec-cfg.c | 3 -
configure | 43 --
etc/codecs.conf | 43 --
help/help_mp-en.h | 3 -
libmpcodecs/img_format.c | 2 -
libmpcodecs/img_format.h | 10 +-
libmpcodecs/vd_ffmpeg.c | 27 +-
libvo/video_out.c | 5 -
libvo/vo_xvmc.c | 1381 --------------------------------------
14 files changed, 12 insertions(+), 1562 deletions(-)
delete mode 100644 libvo/vo_xvmc.c
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index 792b30c51..87ebcc779 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -296,7 +296,7 @@ Show filename on the OSD.
Show progression bar, elapsed time and total duration on the OSD.
.IPs "! and @"
Seek to the beginning of the previous/next chapter.
-.IPs "D (\-vo xvmc, \-vo vdpau, \-vf yadif, \-vf kerndeint only)"
+.IPs "D (\-vo vdpau, \-vf yadif, \-vf kerndeint only)"
Activate/deactivate deinterlacer.
.IPs "A"
Cycle through the available DVD angles.
@@ -949,15 +949,13 @@ only video (you can think of that as infinite fps).
Changes the colorkey to an RGB value of your choice.
0x000000 is black and 0xffffff is white.
Only supported by the cvidix, fbdev, svga, vesa, winvidix, xmga, xvidix,
-xover, xv (see \-vo xv:ck), xvmc (see \-vo xv:ck) and directx video output
-drivers.
+xover, xv (see \-vo xv:ck) and directx video output drivers.
.
.TP
.B \-nocolorkey
Disables colorkeying.
Only supported by the cvidix, fbdev, svga, vesa, winvidix, xmga, xvidix,
-xover, xv (see \-vo xv:ck), xvmc (see \-vo xv:ck) and directx video output
-drivers.
+xover, xv (see \-vo xv:ck) and directx video output drivers.
.
.TP
.B \-correct\-pts (EXPERIMENTAL)
@@ -1218,7 +1216,7 @@ Display the main menu at MPlayer startup.
Permit MPlayer to receive pointer events reported by the video
output driver.
Necessary to select the buttons in DVD menus.
-Supported for X11-based VOs (x11, xv, xvmc, etc) and the gl, gl_tiled, direct3d and
+Supported for X11-based VOs (x11, xv, etc) and the gl, gl_tiled, direct3d and
corevideo VOs.
.
.TP
@@ -3554,10 +3552,10 @@ y coordinates are relative to the top-left corner of the window rather
than the screen.
The coordinates are relative to the screen given with \-screen for
the video output drivers that fully support \-screen (direct3d, gl, gl_tiled,
-vdpau, x11, xv, xvmc, corevideo).
+vdpau, x11, xv, corevideo).
.br
.I NOTE:
-This option is only supported by the x11, xmga, xv, xvmc, xvidix,
+This option is only supported by the x11, xmga, xv, xvidix,
gl, gl_tiled, direct3d, directx, fbdev, sdl, dfxfb and corevideo
video output drivers.
.sp 1
@@ -3670,14 +3668,14 @@ E.g.\& \-panscanrange \-3 allows a zoom factor of up to 4.
This feature is experimental.
.
.TP
-.B \-border\-pos\-x <0.0\-1.0> (-vo gl,xv,xvmc,vdpau,direct3d only, default 0.5)
+.B \-border\-pos\-x <0.0\-1.0> (-vo gl,xv,vdpau,direct3d only, default 0.5)
When black borders are added to adjust for aspect, this determines where they are placed.
0.0 places borders on the right, 1.0 on the left.
Values outside the range 0.0 \- 1.0 will add extra black borders on one side
and remove part of the image on the other side.
.
.TP
-.B \-border\-pos\-y <0.0\-1.0> (-vo gl,xv,xvmc,vdpau,direct3d only, default 0.5)
+.B \-border\-pos\-y <0.0\-1.0> (-vo gl,xv,vdpau,direct3d only, default 0.5)
As \-border\-pos\-x but for top/bottom borders.
0.0 places borders on the bottom, 1.0 on the top.
.
@@ -3986,38 +3984,6 @@ if image format BGRA is actually used.)
.PD 1
.
.TP
-.B xvmc (X11 with FFmpeg MPEG-1/2 decoder 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.
-.PD 0
-.RSs
-.IPs adaptor=<number>
-Select a specific XVideo adaptor (check xvinfo results).
-.IPs port=<number>
-Select a specific XVideo port.
-.IPs (no)benchmark
-Disables image display.
-Necessary for proper benchmarking of drivers that change
-image buffers on monitor retrace only (nVidia).
-Default is not to disable image display (nobenchmark).
-.IPs (no)bobdeint
-Very simple deinterlacer.
-Might not look better than \-vf tfields=1,
-but it is the only deinterlacer for xvmc (default: nobobdeint).
-.IPs (no)queue
-Queue frames for display to allow more parallel work of the video hardware.
-May add a small (not noticeable) constant A/V desync (default: noqueue).
-.IPs (no)sleep
-Use sleep function while waiting for rendering to finish
-(not recommended on Linux) (default: nosleep).
-.IPs ck=cur|use|set
-Same as \-vo xv:ck (see \-vo xv).
-.IPs ck-method=man|bg|auto
-Same as \-vo xv:ck-method (see \-vo xv).
-.RE
-.PD 1
-.
-.TP
.B dga (X11 only)
Play video through the XFree86 Direct Graphics Access extension.
Considered obsolete.
@@ -5068,7 +5034,7 @@ Disable automatic movie aspect ratio compensation.
.B "\-field\-dominance <\-1\-1>"
Set first field for interlaced content.
Useful for deinterlacers that double the framerate: \-vf tfields=1,
-\-vf yadif=1, \-vo vdpau:deint and \-vo xvmc:bobdeint.
+\-vf yadif=1 and \-vo vdpau:deint.
.PD 0
.RSs
.IPs \-1
diff --git a/DOCS/tech/MAINTAINERS b/DOCS/tech/MAINTAINERS
index 8b114814b..5a99f7da5 100644
--- a/DOCS/tech/MAINTAINERS
+++ b/DOCS/tech/MAINTAINERS
@@ -190,7 +190,6 @@ libvo drivers:
* vo_xover.c - Alban Bedel
* vo_xv.c - Alexander Strasser
* vo_xvidix.c - None
- * vo_xvmc.c - Ivan Kalvachev
* vo_yuv4mpeg.c - Robert Kesterson
* vo_zr.c - Rik Snel
* vo_zr2.c - Rik Snel
diff --git a/DOCS/tech/TODO b/DOCS/tech/TODO
index 9ac3b77c4..6aba66504 100644
--- a/DOCS/tech/TODO
+++ b/DOCS/tech/TODO
@@ -52,7 +52,6 @@ mencoder:
- stop/resume
DOCS:
-- merge iive's XvMC docs into video.xml
- enhance and merge the FAQ with the wiki FAQ
- split man page into mplayer.1 and mencoder.1
diff --git a/Makefile b/Makefile
index 94ef50367..b6c60398b 100644
--- a/Makefile
+++ b/Makefile
@@ -591,7 +591,6 @@ SRCS_MPLAYER-$(X11) += libvo/vo_x11.c libvo/vo_xover.c \
SRCS_MPLAYER-$(XMGA) += libvo/vo_xmga.c
SRCS_MPLAYER-$(XV) += libvo/vo_xv.c
SRCS_MPLAYER-$(XVIDIX) += libvo/vo_xvidix.c
-SRCS_MPLAYER-$(XVMC) += libvo/vo_xvmc.c
SRCS_MPLAYER-$(XVR100) += libvo/vo_xvr100.c
SRCS_MPLAYER-$(YUV4MPEG) += libvo/vo_yuv4mpeg.c
SRCS_MPLAYER-$(ZR) += libvo/jpeg_enc.c libvo/vo_zr.c libvo/vo_zr2.c
diff --git a/TOOLS/coverity.sh b/TOOLS/coverity.sh
index 62a28ee5c..ce0b7c4cb 100755
--- a/TOOLS/coverity.sh
+++ b/TOOLS/coverity.sh
@@ -1,4 +1,4 @@
-MPLAYER_COV_OPTS="--enable-xvmc --enable-menu --enable-gui --enable-mga --enable-bl --enable-joystick --enable-radio --enable-s3fb --enable-tdfxfb --enable-tdfxvid --enable-wii --yasm=nasm"
+MPLAYER_COV_OPTS="--enable-menu --enable-gui --enable-mga --enable-bl --enable-joystick --enable-radio --enable-s3fb --enable-tdfxfb --enable-tdfxvid --enable-wii --yasm=nasm"
rm -rf cov-int MPlayer.tgz
make distclean
svn up
diff --git a/codec-cfg.c b/codec-cfg.c
index 6494f65d9..9a69e0bb3 100644
--- a/codec-cfg.c
+++ b/codec-cfg.c
@@ -254,9 +254,6 @@ static const struct {
{"ZRMJPEGIT", IMGFMT_ZRMJPEGIT},
{"ZRMJPEGIB", IMGFMT_ZRMJPEGIB},
- {"IDCT_MPEG2", IMGFMT_XVMC_IDCT_MPEG2},
- {"MOCO_MPEG2", IMGFMT_XVMC_MOCO_MPEG2},
-
{"VDPAU_MPEG1", IMGFMT_VDPAU_MPEG1},
{"VDPAU_MPEG2", IMGFMT_VDPAU_MPEG2},
{"VDPAU_H264", IMGFMT_VDPAU_H264},
diff --git a/configure b/configure
index d53e1cdf9..83d8e6f88 100755
--- a/configure
+++ b/configure
@@ -498,7 +498,6 @@ Video output:
--enable-mga enable mga_vid video output [autodetect]
--enable-xmga enable mga_vid X11 video output [autodetect]
--enable-xv enable Xv video output [autodetect]
- --enable-xvmc enable XvMC acceleration [disable]
--enable-vda enable VDA acceleration [autodetect]
--enable-vdpau enable VDPAU acceleration [autodetect]
--enable-vm enable XF86VidMode support [autodetect]
@@ -617,7 +616,6 @@ Use these options if autodetection fails:
--extra-libs=FLAGS extra linker flags
--extra-libs-mplayer=FLAGS extra linker flags for MPlayer
--extra-libs-mencoder=FLAGS extra linker flags for MEncoder
- --with-xvmclib=NAME adapter-specific library name (e.g. XvMCNVIDIA)
--with-freetype-config=PATH path to freetype-config
--with-sdl-config=PATH path to sdl*-config
@@ -699,7 +697,6 @@ _xss=auto
_dga1=auto
_dga2=auto
_xv=auto
-_xvmc=no #auto when complete
_vda=auto
_vdpau=auto
_sdl=auto
@@ -933,10 +930,6 @@ for ac_option do
--with-install=*)
_install=$(option_value $ac_option)
;;
- --with-xvmclib=*)
- _xvmclib=$(option_value $ac_option)
- ;;
-
--with-sdl-config=*)
_sdlconfig=$(option_value $ac_option)
;;
@@ -1051,8 +1044,6 @@ for ac_option do
--disable-xss) _xss=no ;;
--enable-xv) _xv=yes ;;
--disable-xv) _xv=no ;;
- --enable-xvmc) _xvmc=yes ;;
- --disable-xvmc) _xvmc=no ;;
--enable-vda) _vda=yes ;;
--disable-vda) _vda=no ;;
--enable-vdpau) _vdpau=yes ;;
@@ -5046,37 +5037,6 @@ fi
echores "$_xv"
-echocheck "XvMC"
-if test "$_xvmc" != no && test "$_xv" = yes ; then
- _xvmc=no
- cat > $TMPC <<EOF
-#include <X11/Xlib.h>
-#include <X11/extensions/Xvlib.h>
-#include <X11/extensions/XvMClib.h>
-int main(void) {
- XvMCQueryExtension(0, 0, 0);
- XvMCCreateContext(0, 0, 0, 0, 0, 0, 0);
- return 0; }
-EOF
- for ld_tmp in $_xvmclib XvMCNVIDIA XvMCW I810XvMC ; do
- cc_check -lXvMC -l$ld_tmp && _xvmc=yes && _xvmclib="$ld_tmp" && break
- done
-fi
-if test "$_xvmc" = yes ; then
- def_xvmc='#define CONFIG_XVMC 1'
- libs_mplayer="$libs_mplayer -lXvMC"
- test -n "$_xvmclib" && libs_mplayer="$libs_mplayer -l$_xvmclib"
- vomodules="xvmc $vomodules"
- res_comment="using $_xvmclib"
- libavhwaccels="$libavhwaccels MPEG1_XVMC_HWACCEL MPEG2_XVMC_HWACCEL"
-else
- def_xvmc='#define CONFIG_XVMC 0'
- novomodules="xvmc $novomodules"
- libavdecoders=$(filter_out_component decoder 'MPEG_XVMC')
-fi
-echores "$_xvmc"
-
-
echocheck "Video Decode Acceleration (VDA)"
if test "$_vda" = auto ; then
_vda=no
@@ -8887,7 +8847,6 @@ XMMS_PLUGINS = $_xmms
XV = $_xv
XVID4 = $_xvid
XVIDIX = $xvidix
-XVMC = $_xvmc
XVR100 = $_xvr100
YUV4MPEG = $_yuv4mpeg
ZR = $_zr
@@ -9061,7 +9020,6 @@ CONFIG_RTPDEC = $networking
CONFIG_VF_LAVFI = $_vf_lavfi
CONFIG_VDA = $_vda
CONFIG_VDPAU = $_vdpau
-CONFIG_XVMC = $_xvmc
CONFIG_ZLIB = $_zlib
HAVE_GNU_AS = $gnu_as
@@ -9472,7 +9430,6 @@ $def_xinerama
$def_xmga
$def_xss
$def_xv
-$def_xvmc
$def_xvr100
$def_yuv4mpeg
$def_zr
diff --git a/etc/codecs.conf b/etc/codecs.conf
index bbee21963..521a6a036 100644
--- a/etc/codecs.conf
+++ b/etc/codecs.conf
@@ -459,8 +459,6 @@ videocodec ffmpeg1
driver ffmpeg
dll "mpeg1video"
out YV12,I420,IYUV
- out IDCT_MPEG2
- out MOCO_MPEG2
videocodec ffmpeg2
info "FFmpeg MPEG-2"
@@ -502,8 +500,6 @@ videocodec ffmpeg2
dll "mpeg2video"
out YV12,I420,IYUV
out 422P,444P
- out IDCT_MPEG2
- out MOCO_MPEG2
; for backward compatibility
videocodec ffmpeg12
@@ -550,8 +546,6 @@ videocodec ffmpeg12
dll "mpegvideo"
out YV12,I420,IYUV
out 422P,444P
- out IDCT_MPEG2
- out MOCO_MPEG2
videocodec mpeg12
info "MPEG-1 or 2 (libmpeg2)"
@@ -593,43 +587,6 @@ videocodec mpeg12
out YV12,I420,IYUV
out 422P
-videocodec ffmpeg12mc
- info "FFmpeg MPEG-1/2 (XvMC) - deprecated, just use ffmpeg12"
- status buggy
- format 0x10000001 ; MPEG-1
- format 0x10000002 ; MPEG-2
- fourcc mpg1,mpg2,MPG2
- fourcc "DVR "
- fourcc PIM1 ; Pinnacle hardware-MPEG-1
- fourcc PIM2 ; Pinnacle hardware-MPEG-2
- fourcc VCR2
- fourcc MPEG
- fourcc mx5p ; MPEG IMX 625/50 (50 Mb/s)
- fourcc MMES,mmes ; matrox mpeg2 in avi
- fourcc hdv1,hdv2,hdv3
- fourcc hdv4,hdv5,hdv6
- fourcc hdv7,hdv8,hdv9
- fourcc hdva,xdhd,xdh2
- fourcc xdv1,xdv2,xdv3
- fourcc xdv4,xdv5,xdv6
- fourcc xdv7,xdv8,xdv9
- fourcc xdva,xdvb,xdvc
- fourcc xdvd,xdve,xdvf
- fourcc xd5a,xd5b,xd5c
- fourcc xd5d,xd5e,xd5f
- fourcc xd59,xd54,xd55
- fourcc xd51
- fourcc mx5n,mx4n,mx4p
- fourcc mx3n,mx3p
- fourcc AVmp
- fourcc mp2v,mpgv
- fourcc m2v1,m1v1
- fourcc "m1v "
- fourcc LMP2 ; Lead mpeg2 in avi
- driver ffmpeg
- dll "mpegvideo_xvmc"
- out IDCT_MPEG2
- out MOCO_MPEG2
videocodec ffmpeg1vdpau
info "FFmpeg MPEG-1 (VDPAU)"
diff --git a/help/help_mp-en.h b/help/help_mp-en.h
index 58192f1e2..2ddb77be0 100644
--- a/help/help_mp-en.h
+++ b/help/help_mp-en.h
@@ -1636,10 +1636,7 @@ static const char help_text[] = MSGTR_Help;
#define MSGTR_MPCODECS_ArithmeticMeanOfQP "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n"
#define MSGTR_MPCODECS_DRIFailure "[VD_FFMPEG] DRI failure.\n"
#define MSGTR_MPCODECS_CouldntAllocateImageForCodec "[VD_FFMPEG] Couldn't allocate image for codec.\n"
-#define MSGTR_MPCODECS_XVMCAcceleratedMPEG2 "[VD_FFMPEG] XVMC-accelerated MPEG-2.\n"
#define MSGTR_MPCODECS_TryingPixfmt "[VD_FFMPEG] Trying pixfmt=%d.\n"
-#define MSGTR_MPCODECS_McGetBufferShouldWorkOnlyWithXVMC "[VD_FFMPEG] The mc_get_buffer should work only with XVMC acceleration!!"
-#define MSGTR_MPCODECS_OnlyBuffersAllocatedByVoXvmcAllowed "[VD_FFMPEG] Only buffers allocated by vo_xvmc allowed.\n"
// libmpcodecs/ve_lavc.c
#define MSGTR_MPCODECS_HighQualityEncodingSelected "[VE_LAVC] High quality encoding selected (non-realtime)!\n"
diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c
index 8e0889372..1fd21f6d1 100644
--- a/libmpcodecs/img_format.c
+++ b/libmpcodecs/img_format.c
@@ -139,8 +139,6 @@ const char *vo_format_name(int format)
case IMGFMT_ZRMJPEGNI: return "Zoran MJPEG non-interlaced";
case IMGFMT_ZRMJPEGIT: return "Zoran MJPEG top field first";
case IMGFMT_ZRMJPEGIB: return "Zoran MJPEG bottom field first";
- case IMGFMT_XVMC_MOCO_MPEG2: return "MPEG1/2 Motion Compensation";
- case IMGFMT_XVMC_IDCT_MPEG2: return "MPEG1/2 Motion Compensation and IDCT";
case IMGFMT_VDPAU_MPEG1: return "MPEG1 VDPAU acceleration";
case IMGFMT_VDPAU_MPEG2: return "MPEG2 VDPAU acceleration";
case IMGFMT_VDPAU_H264: return "H.264 VDPAU acceleration";
diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h
index 5609ec5e3..fdba0c0a7 100644
--- a/libmpcodecs/img_format.h
+++ b/libmpcodecs/img_format.h
@@ -284,14 +284,6 @@ static inline int normalize_yuvp16(int fmt) {
#define IMGFMT_ZRMJPEGIT (('Z'<<24)|('R'<<16)|('I'<<8)|('T'))
#define IMGFMT_ZRMJPEGIB (('Z'<<24)|('R'<<16)|('I'<<8)|('B'))
-// I think that this code could not be used by any other codec/format
-#define IMGFMT_XVMC 0x1DC70000
-#define IMGFMT_XVMC_MASK 0xFFFF0000
-#define IMGFMT_IS_XVMC(fmt) (((fmt)&IMGFMT_XVMC_MASK)==IMGFMT_XVMC)
-//these are chroma420
-#define IMGFMT_XVMC_MOCO_MPEG2 (IMGFMT_XVMC|0x02)
-#define IMGFMT_XVMC_IDCT_MPEG2 (IMGFMT_XVMC|0x82)
-
// VDPAU specific format.
#define IMGFMT_VDPAU 0x1DC80000
#define IMGFMT_VDPAU_MASK 0xFFFF0000
@@ -304,7 +296,7 @@ static inline int normalize_yuvp16(int fmt) {
#define IMGFMT_VDPAU_MPEG4 (IMGFMT_VDPAU|0x06)
#define IMGFMT_VDPAU_HEVC (IMGFMT_VDPAU|0x07)
-#define IMGFMT_IS_HWACCEL(fmt) (IMGFMT_IS_VDPAU(fmt) || IMGFMT_IS_XVMC(fmt))
+#define IMGFMT_IS_HWACCEL(fmt) (IMGFMT_IS_VDPAU(fmt))
typedef struct {
void* data;
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 1588f8817..b112a2669 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -71,10 +71,6 @@ LIBVD_EXTERN(ffmpeg)
#error palette too large, adapt libmpcodecs/vf.c:vf_get_image
#endif
-#if CONFIG_XVMC
-#include "libavcodec/xvmc.h"
-#endif
-
typedef struct {
AVCodecContext *avctx;
AVFrame *pic;
@@ -191,11 +187,6 @@ static int control(sh_video_t *sh, int cmd, void *arg, ...){
if(ctx->best_csp == IMGFMT_YV12) return CONTROL_TRUE;// u/v swap
if(ctx->best_csp == IMGFMT_422P && !ctx->do_dr1) return CONTROL_TRUE;// half stride
break;
-#if CONFIG_XVMC
- case IMGFMT_XVMC_IDCT_MPEG2:
- case IMGFMT_XVMC_MOCO_MPEG2:
- if(avctx->pix_fmt == AV_PIX_FMT_XVMC) return CONTROL_TRUE;
-#endif
}
return CONTROL_FALSE;
}
@@ -301,8 +292,7 @@ static void set_format_params(struct AVCodecContext *avctx,
ctx->do_dr1 = 1;
ctx->nonref_dr = 0;
avctx->get_buffer2 = get_buffer2;
- mp_msg(MSGT_DECVIDEO, MSGL_V, IMGFMT_IS_XVMC(imgfmt) ?
- MSGTR_MPCODECS_XVMCAcceleratedMPEG2 :
+ mp_msg(MSGT_DECVIDEO, MSGL_V,
"[VD_FFMPEG] VDPAU accelerated decoding\n");
if (ctx->use_vdpau) {
avctx->draw_horiz_band = NULL;
@@ -741,21 +731,6 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic, int isreference){
mpi->planes[3] = surface;
}
#endif
-#if CONFIG_XVMC
- if(IMGFMT_IS_XVMC(mpi->imgfmt)) {
- struct xvmc_pix_fmt *render = mpi->priv; //same as data[2]
- if(!(mpi->flags & MP_IMGFLAG_DIRECT)) {
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MPCODECS_OnlyBuffersAllocatedByVoXvmcAllowed);
- assert(0);
- return -1;//!!fixme check error conditions in ffmpeg
- }
- if(mp_msg_test(MSGT_DECVIDEO, MSGL_DBG5))
- mp_msg(MSGT_DECVIDEO, MSGL_DBG5, "vd_ffmpeg::get_buffer (xvmc render=%p)\n", render);
- assert(render != 0);
- assert(render->xvmc_id == AV_XVMC_ID);
- avctx->draw_horiz_band= draw_slice;
- }
-#endif
pic->data[0]= mpi->planes[0];
pic->data[1]= mpi->planes[1];
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 0bb452070..345703765 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -100,7 +100,6 @@ char *vo_wintitle;
extern const vo_functions_t video_out_mga;
extern const vo_functions_t video_out_xmga;
extern const vo_functions_t video_out_x11;
-extern const vo_functions_t video_out_xvmc;
extern const vo_functions_t video_out_vdpau;
extern const vo_functions_t video_out_xv;
extern const vo_functions_t video_out_gl_nosw;
@@ -274,10 +273,6 @@ const vo_functions_t* const video_out_drivers[] =
&video_out_winvidix,
#endif
&video_out_cvidix,
-#endif
- // should not be auto-selected
-#if CONFIG_XVMC
- &video_out_xvmc,
#endif
&video_out_null,
&video_out_mpegpes,
diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c
deleted file mode 100644
index c5ee6a0ad..000000000
--- a/libvo/vo_xvmc.c
+++ /dev/null
@@ -1,1381 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "video_out.h"
-#define NO_DRAW_FRAME
-#include "video_out_internal.h"
-#include "osdep/timer.h"
-#include "libmpcodecs/vf.h"
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xatom.h>
-
-#ifdef HAVE_SHM
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <X11/extensions/XShm.h>
-#endif
-
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvlib.h>
-#include <X11/extensions/XvMClib.h>
-
-#include "x11_common.h"
-#include "libavcodec/avcodec.h"
-#include "libavcodec/xvmc.h"
-
-#include "sub/sub.h"
-#include "aspect.h"
-
-#include "subopt-helper.h"
-
-#include "libavutil/common.h"
-
-//no chance for xinerama to be supported in the near future
-#undef CONFIG_XINERAMA
-
-#undef NDEBUG
-#include <assert.h>
-
-
-static int benchmark;
-static int use_sleep;
-static int first_frame;//draw colorkey on first frame
-static int use_queue;
-static int xv_port_request = 0;
-static int xv_adaptor = -1;
-static int bob_deinterlace;
-static int top_field_first;
-
-static int image_width,image_height;
-static int image_format;
-
-#define NO_SUBPICTURE 0
-#define OVERLAY_SUBPICTURE 1
-#define BLEND_SUBPICTURE 2
-#define BACKEND_SUBPICTURE 3
-
-static int subpicture_mode;
-static int subpicture_alloc;
-static XvMCSubpicture subpicture;
-static XvImageFormatValues subpicture_info;
-static int subpicture_clear_color;//transparent color for the subpicture or color key for overlay
-
-static XvMCSurfaceInfo surface_info;
-static XvMCContext ctx;
-static XvMCBlockArray data_blocks;
-static XvMCMacroBlockArray mv_blocks;
-
-#define MAX_SURFACES 8
-static int number_of_surfaces=0;
-static XvMCSurface surface_array[MAX_SURFACES];
-struct xvmc_render{
- struct xvmc_pix_fmt shared;
-#define STATE_DISPLAY_PENDING 1 /** the surface should be shown, the video driver manipulates this */
-#define STATE_PREDICTION 2 /** the surface is needed for prediction, the codec manipulates this */
-#define STATE_OSD_SOURCE 4 /** the surface is needed for subpicture rendering */
- int state;
- void *p_osd_target_surface_render;
- mp_image_t *mpi;
-};
-static struct xvmc_render *surface_render;
-
-static struct xvmc_render *p_render_surface_to_show = NULL;
-static struct xvmc_render *p_render_surface_visible = NULL;
-
-//display queue, kinda render ahead
-static struct xvmc_render *show_queue[MAX_SURFACES];
-static int free_element;
-
-
-static void (*draw_osd_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride);
-static void (*clear_osd_fnc)(int x0,int y0, int w,int h);
-static void (*init_osd_fnc)(void);
-
-static void draw_osd_AI44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride);
-static void draw_osd_IA44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride);
-static void clear_osd_subpic(int x0,int y0, int w,int h);
-static void init_osd_yuv_pal(void);
-
-
-static const struct{
- int id;//id as xvimages or as mplayer RGB|{8,15,16,24,32}
- void (* init_func_ptr)(void);
- void (* draw_func_ptr)(int, int, int, int, unsigned char *, unsigned char *, int);
- void (* clear_func_ptr)(int, int, int, int);
- } osd_render[]={
- {0x34344149,init_osd_yuv_pal,draw_osd_AI44,clear_osd_subpic},
- {0x34344941,init_osd_yuv_pal,draw_osd_IA44,clear_osd_subpic},
- {0,NULL,NULL,NULL}
- };
-
-static void xvmc_free(void);
-static void xvmc_clean_surfaces(void);
-static int count_free_surfaces(void);
-static struct xvmc_render *find_free_surface(void);
-
-static const vo_info_t info = {
- "XVideo Motion Compensation",
- "xvmc",
- "Ivan Kalvachev <iive(a)users.sf.net>",
- ""
-};
-
-const LIBVO_EXTERN(xvmc);
-
-//shm stuff from vo_xv
-#ifdef HAVE_SHM
-static XShmSegmentInfo Shminfo;
-static int Shmem_Flag;
-#endif
-static XvImage * xvimage;
-
-static void add_state(struct xvmc_render *cur_render, int flags)
-{
- int bit;
- if (cur_render->mpi) {
- for (bit = 1; flags >= bit; bit <<= 1) {
- if (flags & ~cur_render->state & bit)
- cur_render->mpi->usage_count++;
- }
- }
- cur_render->state |= flags;
-}
-
-static void remove_state(struct xvmc_render *cur_render, int flags)
-{
- int bit;
- if (cur_render->mpi) {
- for (bit = 1; flags >= bit; bit <<= 1) {
- if (flags & cur_render->state & bit)
- cur_render->mpi->usage_count--;
- }
- }
- cur_render->state &= ~flags;
-}
-
-static int in_use(struct xvmc_render *cur_render)
-{
- return cur_render->state || (cur_render->mpi && cur_render->mpi->usage_count);
-}
-
-static int allocate_xvimage(int xvimage_width,int xvimage_height,int xv_format)
-{
- /*
- * allocate XvImages.
- */
-#ifdef HAVE_SHM
- if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag = 1;
- else
- {
- Shmem_Flag = 0;
- mp_msg(MSGT_VO,MSGL_WARN, "Shared memory not supported\nReverting to normal Xv\n" );
- }
- if ( Shmem_Flag )
- {
- xvimage = (XvImage *) XvShmCreateImage(mDisplay, xv_port, xv_format,
- NULL, xvimage_width, xvimage_height, &Shminfo);
- if (!xvimage)
- goto noshmimage;
- if (!xvimage->data_size)
- goto shmgetfail;
-
- Shminfo.shmid = shmget(IPC_PRIVATE, xvimage->data_size, IPC_CREAT | SHM_R | SHM_W);
- if (Shminfo.shmid == -1)
- goto shmgetfail;
- Shminfo.shmaddr = (char *) shmat(Shminfo.shmid, 0, 0);
- if (Shminfo.shmaddr == (void *)-1)
- goto shmatfail;
- Shminfo.readOnly = False;
-
- xvimage->data = Shminfo.shmaddr;
- if (!XShmAttach(mDisplay, &Shminfo))
- goto shmattachfail;
- XSync(mDisplay, False);
- shmctl(Shminfo.shmid, IPC_RMID, 0);
- return 0;
-shmattachfail:
- shmdt(Shminfo.shmaddr);
-shmatfail:
- shmctl(Shminfo.shmid, IPC_RMID, 0);
-shmgetfail:
- XFree(xvimage);
- xvimage = NULL;
-noshmimage:
- Shmem_Flag = 0;
- }
-#endif
-
- xvimage = (XvImage *) XvCreateImage(mDisplay, xv_port, xv_format, NULL, xvimage_width, xvimage_height);
- if (!xvimage) return -1;
- if (!xvimage->data_size)
- {
- mp_msg(MSGT_VO, MSGL_WARN,
- "XServer's XvCreateImage implementation is buggy (returned 0-sized image)\n" );
- XFree(xvimage);
- xvimage = NULL;
- return -1;
- }
- xvimage->data = malloc(xvimage->data_size);
- XSync(mDisplay,False);
-// memset(xvimage->data,128,xvimage->data_size);
- return 0;
-}
-
-static void deallocate_xvimage(void)
-{
-#ifdef HAVE_SHM
- if ( Shmem_Flag )
- {
- XShmDetach( mDisplay,&Shminfo );
- shmdt( Shminfo.shmaddr );
- }
- else
-#endif
- {
- free(xvimage->data);
- xvimage->data = NULL;
- }
- XFree(xvimage);
- xvimage = NULL;
-
- XSync(mDisplay, False);
- return;
-}
-//end of vo_xv shm/xvimage code
-
-static int xvmc_check_surface_format(uint32_t format, XvMCSurfaceInfo * surf_info){
- if ( format == IMGFMT_XVMC_IDCT_MPEG2 ){
- if( surf_info->mc_type != (XVMC_IDCT|XVMC_MPEG_2) ) return -1;
- if( surf_info->chroma_format != XVMC_CHROMA_FORMAT_420 ) return -1;
- return 0;
- }
- if ( format == IMGFMT_XVMC_MOCO_MPEG2 ){
- if(surf_info->mc_type != XVMC_MPEG_2) return -1;
- if(surf_info->chroma_format != XVMC_CHROMA_FORMAT_420) return -1;
- return 0;
- }
-return -1;//fail
-}
-
-//print all info needed to add new format
-static void print_xvimage_format_values(XvImageFormatValues *xifv){
- int i;
- const int msgl=MSGL_DBG4;
-
- mp_msg(MSGT_VO,msgl,"Format_ID = 0x%X\n",xifv->id);
-
- mp_msg(MSGT_VO,msgl," type = ");
- if(xifv->type == XvRGB) mp_msg(MSGT_VO,msgl,"RGB\n");
- else if(xifv->type == XvYUV) mp_msg(MSGT_VO,msgl,"YUV\n");
- else mp_msg(MSGT_VO,msgl,"Unknown\n");
-
- mp_msg(MSGT_VO,msgl," byte_order = ");
- if(xifv->byte_order == LSBFirst) mp_msg(MSGT_VO,msgl,"LSB First\n");
- else if(xifv->byte_order == MSBFirst) mp_msg(MSGT_VO,msgl,"MSB First\n");
- else mp_msg(MSGT_VO,msgl,"Unknown\n");//yes Linux support other types too
-
- mp_msg(MSGT_VO,msgl," guid = ");
- for(i=0;i<16;i++)
- mp_msg(MSGT_VO,msgl,"%02X ",(unsigned char)xifv->guid[i]);
- mp_msg(MSGT_VO,msgl,"\n");
-
- mp_msg(MSGT_VO,msgl," bits_per_pixel = %d\n",xifv->bits_per_pixel);
-
- mp_msg(MSGT_VO,msgl," format = ");
- if(xifv->format == XvPacked) mp_msg(MSGT_VO,msgl,"XvPacked\n");
- else if(xifv->format == XvPlanar) mp_msg(MSGT_VO,msgl,"XvPlanar\n");
- else mp_msg(MSGT_VO,msgl,"Unknown\n");
-
- mp_msg(MSGT_VO,msgl," num_planes = %d\n",xifv->num_planes);
-
- if(xifv->type == XvRGB){
- mp_msg(MSGT_VO,msgl," red_mask = %0X\n", xifv->red_mask);
- mp_msg(MSGT_VO,msgl," green_mask = %0X\n",xifv->green_mask);
- mp_msg(MSGT_VO,msgl," blue_mask = %0X\n", xifv->blue_mask);
- }
- if(xifv->type == XvYUV){
- mp_msg(MSGT_VO,msgl," y_sample_bits = %d\n u_sample_bits = %d\n v_sample_bits = %d\n",
- xifv->y_sample_bits,xifv->u_sample_bits,xifv->v_sample_bits);
- mp_msg(MSGT_VO,msgl," horz_y_period = %d\n horz_u_period = %d\n horz_v_period = %d\n",
- xifv->horz_y_period,xifv->horz_u_period,xifv->horz_v_period);
- mp_msg(MSGT_VO,msgl," vert_y_period = %d\n vert_u_period = %d\n vert_v_period = %d\n",
- xifv->vert_y_period,xifv->vert_u_period,xifv->vert_v_period);
-
- mp_msg(MSGT_VO,msgl," component_order = ");
- for(i=0;i<32;i++)
- if(xifv->component_order[i]>=32)
- mp_msg(MSGT_VO,msgl,"%c",xifv->component_order[i]);
- mp_msg(MSGT_VO,msgl,"\n");
-
- mp_msg(MSGT_VO,msgl," scanline = ");
- if(xifv->scanline_order == XvTopToBottom) mp_msg(MSGT_VO,msgl,"XvTopToBottom\n");
- else if(xifv->scanline_order == XvBottomToTop) mp_msg(MSGT_VO,msgl,"XvBottomToTop\n");
- else mp_msg(MSGT_VO,msgl,"Unknown\n");
- }
- mp_msg(MSGT_VO,msgl,"\n");
-}
-
-// WARNING This function may changes xv_port and surface_info!
-static int xvmc_find_surface_by_format(int format,int width,int height,
- XvMCSurfaceInfo * surf_info,int query){
- int rez;
- XvAdaptorInfo * ai;
- int num_adaptors,i;
- unsigned long p;
- int s,mc_surf_num;
- XvMCSurfaceInfo * mc_surf_list;
-
- rez = XvQueryAdaptors(mDisplay,DefaultRootWindow(mDisplay),&num_adaptors,&ai);
- if( rez != Success ) return -1;
- mp_msg(MSGT_VO,MSGL_DBG3,"vo_xvmc: Querying %d adaptors\n",num_adaptors);
- for(i=0; i<num_adaptors; i++)
- {
- /* check if adaptor number has been specified */
- if (xv_adaptor != -1 && xv_adaptor != i)
- continue;
- mp_msg(MSGT_VO,MSGL_DBG3,"vo_xvmc: Querying adaptor #%d\n",i);
- if( ai[i].type == 0 ) continue;// we need at least dummy type!
-//probing ports
- for(p=ai[i].base_id; p<ai[i].base_id+ai[i].num_ports; p++)
- {
- mp_msg(MSGT_VO,MSGL_DBG3,"vo_xvmc: probing port #%ld\n",p);
- mc_surf_list = XvMCListSurfaceTypes(mDisplay,p,&mc_surf_num);
- if( mc_surf_list == NULL || mc_surf_num == 0){
- mp_msg(MSGT_VO,MSGL_DBG3,"vo_xvmc: No XvMC supported. \n");
- continue;
- }
- mp_msg(MSGT_VO,MSGL_DBG3,"vo_xvmc: XvMC list have %d surfaces\n",mc_surf_num);
-//we have XvMC list!
- for(s=0; s<mc_surf_num; s++)
- {
- if( width > mc_surf_list[s].max_width ) continue;
- if( height > mc_surf_list[s].max_height ) continue;
- if( xvmc_check_surface_format(format,&mc_surf_list[s])<0 ) continue;
-//we have match!
- /* respect the users wish */
- if ( xv_port_request != 0 && xv_port_request != p )
- {
- continue;
- }
-
- if(!query){
- rez = XvGrabPort(mDisplay,p,CurrentTime);
- if(rez != Success){
- mp_msg(MSGT_VO,MSGL_DBG3,"vo_xvmc: Fail to grab port %ld\n",p);
- continue;
- }
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: Using Xv Adaptor #%d (%s)\n", i, ai[i].name);
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: Port %ld grabed\n",p);
- xv_port = p;
- }
- goto surface_found;
- }//for mc surf
- XFree(mc_surf_list);//if mc_surf_num==0 is list==NULL ?
- }//for ports
- }//for adaptors
- XvFreeAdaptorInfo(ai);
-
- if(!query) mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: Could not find free matching surface. Sorry.\n");
- return 0;
-
-// somebody know cleaner way to escape from 3 internal loops?
-surface_found:
- XvFreeAdaptorInfo(ai);
-
- memcpy(surf_info,&mc_surf_list[s],sizeof(XvMCSurfaceInfo));
- mp_msg(MSGT_VO, query?MSGL_INFO:MSGL_DBG3,
- "vo_xvmc: Found matching surface with id=%X on %ld port at %d adapter\n",
- mc_surf_list[s].surface_type_id,p,i);
- return mc_surf_list[s].surface_type_id;
-}
-
-static uint32_t xvmc_draw_image(mp_image_t *mpi){
- struct xvmc_render *rndr;
-
- assert(mpi!=NULL);
- assert(mpi->flags &MP_IMGFLAG_DIRECT);
-// assert(mpi->flags &MP_IMGFLAGS_DRAWBACK);
-
- rndr = (struct xvmc_render*)mpi->priv; //there is copy in plane[2]
- assert( rndr != NULL );
- assert( rndr->shared.xvmc_id == AV_XVMC_ID );
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: draw_image(show rndr=%p)\n",rndr);
-// the surface have passed vf system without been skiped, it will be displayed
- add_state(rndr, STATE_DISPLAY_PENDING);
- p_render_surface_to_show = rndr;
- top_field_first = mpi->fields & MP_IMGFIELD_TOP_FIRST;
- return VO_TRUE;
-}
-
-static int preinit(const char *arg){
- int xv_version,xv_release,xv_request_base,xv_event_base,xv_error_base;
- int mc_eventBase,mc_errorBase;
- int mc_ver,mc_rev;
- strarg_t ck_src_arg = { 0, NULL };
- strarg_t ck_method_arg = { 0, NULL };
- const opt_t subopts [] =
- {
- /* name arg type arg var test */
- { "port", OPT_ARG_INT, &xv_port_request, int_pos },
- { "adaptor", OPT_ARG_INT, &xv_adaptor, int_non_neg },
- { "ck", OPT_ARG_STR, &ck_src_arg, xv_test_ck },
- { "ck-method", OPT_ARG_STR, &ck_method_arg, xv_test_ckm },
- { "benchmark", OPT_ARG_BOOL, &benchmark, NULL },
- { "sleep", OPT_ARG_BOOL, &use_sleep, NULL },
- { "queue", OPT_ARG_BOOL, &use_queue, NULL },
- { "bobdeint", OPT_ARG_BOOL, &bob_deinterlace, NULL },
- { NULL }
- };
-
- //Obtain display handler
- if (!vo_init()) return -1;//vo_xv
-
- //XvMC is subdivision of XVideo
- if (Success != XvQueryExtension(mDisplay,&xv_version,&xv_release,&xv_request_base,
- &xv_event_base,&xv_error_base) ){
- mp_msg(MSGT_VO,MSGL_ERR,"Sorry, Xv(MC) not supported by this X11 version/driver\n");
- mp_msg(MSGT_VO,MSGL_ERR,"********** Try with -vo x11 or -vo sdl ***********\n");
- return -1;
- }
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: X-Video extension %d.%d\n",xv_version,xv_release);
-
- if( True != XvMCQueryExtension(mDisplay,&mc_eventBase,&mc_errorBase) ){
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: No X-Video MotionCompensation Extension on %s\n",
- XDisplayName(NULL));
- return -1;
- }
-
- if(Success == XvMCQueryVersion(mDisplay, &mc_ver, &mc_rev) ){
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: X-Video MotionCompensation Extension version %i.%i\n",
- mc_ver,mc_rev);
- }
- else{
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: Error querying version info!\n");
- return -1;
- }
- surface_render = NULL;
- xv_port = 0;
- number_of_surfaces = 0;
- subpicture_alloc = 0;
-
- benchmark = 0; //disable PutImageto allow faster display than screen refresh
- use_sleep = 0;
- use_queue = 0;
- bob_deinterlace = 0;
-
- /* parse suboptions */
- if ( subopt_parse( arg, subopts ) != 0 )
- {
- return -1;
- }
-
- xv_setup_colorkeyhandling( ck_method_arg.str, ck_src_arg.str );
-
- return 0;
-}
-
-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){
- int i,mode_id,rez;
- int numblocks,blocks_per_macroblock;//bpmb we have 6,8,12
-
-//from vo_xv
- XVisualInfo vinfo;
- XSetWindowAttributes xswa;
- XWindowAttributes attribs;
- unsigned long xswamask;
- int depth;
-#ifdef CONFIG_XF86VM
- int vm = flags & VOFLAG_MODESWITCHING;
-#endif
-//end of vo_xv
-
- if( !IMGFMT_IS_XVMC(format) )
- {
- assert(0);//should never happen, abort on debug or
- return 1;//return error on relese
- }
-
-// Find free port that supports MC, by querying adaptors
- if( xv_port != 0 || number_of_surfaces != 0 ){
- if( height==image_height && width==image_width && image_format==format){
- xvmc_clean_surfaces();
- goto skip_surface_allocation;
- }
- xvmc_free();
- };
- numblocks=((width+15)/16)*((height+15)/16);
-// Find Supported Surface Type
- mode_id = xvmc_find_surface_by_format(format,width,height,&surface_info,0);//false=1 to grab port, not query
- if ( mode_id == 0 )
- {
- return -1;
- }
-
- mp_msg(MSGT_VO,MSGL_DBG4, "vo_xvmc: XvMCCreateContext(mDisplay %p, xv_port=%d, mode_id=0x%08x, width=%d, height=%d, XVMC_DIRECT=%d,ctx=%p)\n",
- mDisplay, xv_port,mode_id,width,height,XVMC_DIRECT,&ctx);
-
- rez = XvMCCreateContext(mDisplay, xv_port,mode_id,width,height,XVMC_DIRECT,&ctx);
- if( rez != Success ){
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: XvMCCreateContext failed with error %d\n",rez);
- return -1;
- }
- if( ctx.flags & XVMC_DIRECT ){
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: Allocated Direct Context\n");
- }else{
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: Allocated Indirect Context!\n");
- }
-
-
- blocks_per_macroblock = 6;
- if(surface_info.chroma_format == XVMC_CHROMA_FORMAT_422)
- blocks_per_macroblock = 8;
- if(surface_info.chroma_format == XVMC_CHROMA_FORMAT_444)
- blocks_per_macroblock = 12;
-
- rez = XvMCCreateBlocks(mDisplay,&ctx,numblocks*blocks_per_macroblock,&data_blocks);
- if( rez != Success ){
- XvMCDestroyContext(mDisplay,&ctx);
- return -1;
- }
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: data_blocks allocated\n");
-
- rez = XvMCCreateMacroBlocks(mDisplay,&ctx,numblocks,&mv_blocks);
- if( rez != Success ){
- XvMCDestroyBlocks(mDisplay,&data_blocks);
- XvMCDestroyContext(mDisplay,&ctx);
- return -1;
- }
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: mv_blocks allocated\n");
-
- if(surface_render==NULL)
- surface_render = malloc(MAX_SURFACES * sizeof(struct xvmc_render)); //easy mem debug
- memset(surface_render, 0, MAX_SURFACES * sizeof(struct xvmc_render));
-
- for(i=0; i<MAX_SURFACES; i++){
- rez=XvMCCreateSurface(mDisplay,&ctx,&surface_array[i]);
- if( rez != Success )
- break;
- surface_render[i].shared.xvmc_id = AV_XVMC_ID;
- surface_render[i].shared.data_blocks = data_blocks.blocks;
- surface_render[i].shared.mv_blocks = mv_blocks.macro_blocks;
- surface_render[i].shared.allocated_mv_blocks = numblocks;
- surface_render[i].shared.allocated_data_blocks = numblocks*blocks_per_macroblock;
- surface_render[i].shared.idct = (surface_info.mc_type & XVMC_IDCT) == XVMC_IDCT;
- surface_render[i].shared.unsigned_intra = (surface_info.flags & XVMC_INTRA_UNSIGNED) == XVMC_INTRA_UNSIGNED;
- surface_render[i].shared.p_surface = &surface_array[i];
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: surface[%d] = %p .rndr=%p\n",
- i,&surface_array[i], &surface_render[i]);
- }
- number_of_surfaces = i;
- if( number_of_surfaces < 4 ){// +2 I or P and +2 for B (to avoid visible motion drawing)
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: Unable to allocate at least 4 Surfaces\n");
- uninit();
- return -1;
- }
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: Motion Compensation context allocated - %d surfaces\n",
- number_of_surfaces);
-
- //debug
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: idct=%d unsigned_intra=%d\n",
- (surface_info.mc_type & XVMC_IDCT) == XVMC_IDCT,
- (surface_info.flags & XVMC_INTRA_UNSIGNED) == XVMC_INTRA_UNSIGNED);
-
-// Find way to display OSD & subtitle
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: looking for OSD support\n");
- subpicture_mode = NO_SUBPICTURE;
- if(surface_info.flags & XVMC_OVERLAID_SURFACE)
- subpicture_mode = OVERLAY_SUBPICTURE;
-
- if(surface_info.subpicture_max_width != 0 &&
- surface_info.subpicture_max_height != 0 ){
- int s,k,num_subpic;
-
- XvImageFormatValues * xvfmv;
- xvfmv = XvMCListSubpictureTypes(mDisplay, xv_port,
- surface_info.surface_type_id, &num_subpic);
-
- if(num_subpic != 0 && xvfmv != NULL){
- if( mp_msg_test(MSGT_VO,MSGL_DBG4) ){//Print all subpicture types for debug
- for(s=0;s<num_subpic;s++)
- print_xvimage_format_values(&xvfmv[s]);
- }
-
- for(s=0;s<num_subpic;s++){
- for(k=0;osd_render[k].draw_func_ptr!=NULL;k++){
- if(xvfmv[s].id == osd_render[k].id)
- {
- init_osd_fnc = osd_render[k].init_func_ptr;
- draw_osd_fnc = osd_render[k].draw_func_ptr;
- clear_osd_fnc = osd_render[k].clear_func_ptr;
-
- subpicture_mode = BLEND_SUBPICTURE;
- subpicture_info = xvfmv[s];
- mp_msg(MSGT_VO,MSGL_INFO," Subpicture id 0x%08X\n",subpicture_info.id);
- goto found_subpic;
- }
- }
- }
-found_subpic:
- XFree(xvfmv);
- }
- //Blend2 supicture is always possible, blend1 only at backend
- if( (subpicture_mode == BLEND_SUBPICTURE) &&
- (surface_info.flags & XVMC_BACKEND_SUBPICTURE) )
- {
- subpicture_mode = BACKEND_SUBPICTURE;
- }
-
- }
-
- switch(subpicture_mode){
- case NO_SUBPICTURE:
- mp_msg(MSGT_VO,MSGL_WARN,"vo_xvmc: No OSD support for this mode\n");
- break;
- case OVERLAY_SUBPICTURE:
- mp_msg(MSGT_VO,MSGL_WARN,"vo_xvmc: OSD support via color key tricks\n");
- mp_msg(MSGT_VO,MSGL_WARN,"vo_xvmc: not yet implemented:(\n");
- break;
- case BLEND_SUBPICTURE:
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: OSD support by additional frontend rendering\n");
- break;
- case BACKEND_SUBPICTURE:
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: OSD support by backend rendering (fast)\n");
- break;
- }
-
-//take keycolor value and choose method for handling it
- if ( !vo_xv_init_colorkey() )
- {
- return -1; // bail out, colorkey setup failed
- }
-
- vo_xv_enable_vsync();//it won't break anything
-
-//taken from vo_xv
- image_height = height;
- image_width = width;
-
-skip_surface_allocation:
-
- {
-#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.border_pixel = 0;
- xswamask = CWBorderPixel;
- if (xv_ck_info.method == CK_METHOD_BACKGROUND){
- xswa.background_pixel = xv_colorkey;
- xswamask |= CWBackPixel;
- }
-
- vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height, flags,
- CopyFromParent, "xvmc", 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
- }
-
-//end vo_xv
-
- /* store image dimesions for displaying */
- p_render_surface_visible = NULL;
- p_render_surface_to_show = NULL;
-
- free_element = 0;
- first_frame = 1;
-
- image_format=format;
- return 0;
-}
-
-static void init_osd_yuv_pal(void) {
- char * palette;
- int rez;
- int i,j;
- int snum,seb;
- int Y,U,V;
-
- subpicture_clear_color = 0;
-
- if(subpicture.num_palette_entries > 0){
-
- snum = subpicture.num_palette_entries;
- seb = subpicture.entry_bytes;
- palette = malloc(snum*seb);//check fail
- if(palette == NULL) return;
- for(i=0; i<snum; i++){
- // 0-black max-white the other are gradients
- Y = i*(1 << subpicture_info.y_sample_bits)/snum;//snum=2;->(0),(1*(1<<1)/2)
- U = 1 << (subpicture_info.u_sample_bits - 1);
- V = 1 << (subpicture_info.v_sample_bits - 1);
- for(j=0; j<seb; j++)
- switch(subpicture.component_order[j]){
- case 'U': palette[i*seb+j] = U; break;
- case 'V': palette[i*seb+j] = V; break;
- case 'Y':
- default:
- palette[i*seb+j] = Y; break;
- }
- }
- rez = XvMCSetSubpicturePalette(mDisplay, &subpicture, palette);
- if(rez!=Success){
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: Setting palette failed.\n");
- }
- free(palette);
- }
-}
-
-static void clear_osd_subpic(int x0, int y0, int w, int h){
- int rez;
-
- rez=XvMCClearSubpicture(mDisplay, &subpicture,
- x0, y0, w,h,
- subpicture_clear_color);
- if(rez != Success)
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: XvMCClearSubpicture failed!\n");
-}
-
-static void OSD_init(void) {
- unsigned short osd_height, osd_width;
- int rez;
-
- if(subpicture_alloc){
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: destroying subpicture\n");
- XvMCDestroySubpicture(mDisplay,&subpicture);
- deallocate_xvimage();
- subpicture_alloc = 0;
- }
-
-/* if(surface_info.flags & XVMC_SUBPICTURE_INDEPENDENT_SCALING){
- osd_width = vo_dwidth;
- osd_height = vo_dheight;
- }else*/
- {
- osd_width = image_width;
- osd_height = image_height;
- }
-
- if(osd_width > surface_info.subpicture_max_width)
- osd_width = surface_info.subpicture_max_width;
- if(osd_height > surface_info.subpicture_max_height)
- osd_height = surface_info.subpicture_max_height;
- if(osd_width == 0 || osd_height == 0)
- return;//if called before window size is known
-
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: creating subpicture (%d,%d) format %X\n",
- osd_width,osd_height,subpicture_info.id);
-
- rez = XvMCCreateSubpicture(mDisplay,&ctx,&subpicture,
- osd_width,osd_height,subpicture_info.id);
- if(rez != Success){
- subpicture_mode = NO_SUBPICTURE;
- mp_msg(MSGT_VO,MSGL_WARN,"vo_xvmc: Create Subpicture failed, OSD disabled\n");
- return;
- }
- if( mp_msg_test(MSGT_VO,MSGL_DBG4) ){
- int i;
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: Created Subpicture:\n");
- mp_msg(MSGT_VO,MSGL_DBG4," xvimage_id=0x%X\n",subpicture.xvimage_id);
- mp_msg(MSGT_VO,MSGL_DBG4," width=%d\n",subpicture.width);
- mp_msg(MSGT_VO,MSGL_DBG4," height=%d\n",subpicture.height);
- mp_msg(MSGT_VO,MSGL_DBG4," num_palette_entries=0x%X\n",subpicture.num_palette_entries);
- mp_msg(MSGT_VO,MSGL_DBG4," entry_bytes=0x%X\n",subpicture.entry_bytes);
-
- mp_msg(MSGT_VO,MSGL_DBG4," component_order=\"");
- for(i=0; i<4; i++)
- if(subpicture.component_order[i] >= 32)
- mp_msg(MSGT_VO,MSGL_DBG4,"%c", subpicture.component_order[i]);
- mp_msg(MSGT_VO,MSGL_DBG4,"\"\n");
- }
-
- //call init for the surface type
- init_osd_fnc();//init palete,clear color etc ...
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: clearing subpicture\n");
- clear_osd_fnc(0, 0, subpicture.width, subpicture.height);
-
- if (allocate_xvimage(subpicture.width, subpicture.height, subpicture_info.id))
- {
- subpicture_mode = NO_SUBPICTURE;
- mp_msg(MSGT_VO,MSGL_WARN, "vo_xvmc: OSD disabled\n");
- return;
- }
- subpicture_alloc = 1;
-}
-
-static void draw_osd_IA44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
- int ox,oy;
- int rez;
-
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc:composite AI44 subpicture (%d,%d - %d,%d)\n",x0,y0,w,h);
-
- for(ox=0; ox<w; ox++){
- for(oy=0; oy<h; oy++){
- xvimage->data[oy*xvimage->width+ox] = (src[oy*stride+ox]>>4) | ((0-srca[oy*stride+ox])&0xf0);
- }
- }
- rez = XvMCCompositeSubpicture(mDisplay, &subpicture, xvimage, 0, 0,
- w,h,x0,y0);
- if(rez != Success){
- mp_msg(MSGT_VO,MSGL_WARN,"vo_xvmc: composite subpicture failed\n");
- assert(0);
- }
-}
-
-static void draw_osd_AI44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
- int ox,oy;
- int rez;
-
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc:composite AI44 subpicture (%d,%d - %d,%d)\n",x0,y0,w,h);
-
- for(ox=0; ox<w; ox++){
- for(oy=0; oy<h; oy++){
- xvimage->data[oy*xvimage->width+ox] = (src[oy*stride+ox]&0xf0) | (((0-srca[oy*stride+ox])>>4)&0xf);
- }
- }
- rez = XvMCCompositeSubpicture(mDisplay, &subpicture, xvimage, 0, 0,
- w,h,x0,y0);
- if(rez != Success){
- mp_msg(MSGT_VO,MSGL_WARN,"vo_xvmc: composite subpicture failed\n");
- assert(0);
- }
-}
-
-static void draw_osd(void){
- struct xvmc_render *osd_rndr;
- int osd_has_changed;
- int have_osd_to_draw;
- int rez;
-
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: draw_osd ,OSD_mode=%d, surface_to_show=%p\n",
- subpicture_mode,p_render_surface_to_show);
-
- if(subpicture_mode == BLEND_SUBPICTURE ||
- subpicture_mode == BACKEND_SUBPICTURE ){
-
- if(!subpicture_alloc) //allocate subpicture when dimensions are known
- OSD_init();
- if(!subpicture_alloc)
- return;//dimensions still unknown.
-
- osd_has_changed = vo_update_osd(subpicture.width, subpicture.height);
- have_osd_to_draw = vo_osd_check_range_update(0, 0, subpicture.width,
- subpicture.height);
-
- if(!have_osd_to_draw)
- return;//nothing to draw,no subpic, no blend
-
- if(osd_has_changed){
- //vo_remove_text(subpicture.width, subpicture.height,clear_osd_fnc)
- clear_osd_fnc(0,0,subpicture.width,subpicture.height);
- vo_draw_text(subpicture.width, subpicture.height, draw_osd_fnc);
- }
- XvMCSyncSubpicture(mDisplay,&subpicture);//todo usleeep wait!
-
- if(subpicture_mode == BLEND_SUBPICTURE){
- osd_rndr = find_free_surface();
- if(osd_rndr == NULL)
- return;// no free surface to draw OSD in
-
- rez = XvMCBlendSubpicture2(mDisplay,
- p_render_surface_to_show->shared.p_surface, osd_rndr->shared.p_surface,
- &subpicture,
- 0, 0, subpicture.width, subpicture.height,
- 0, 0, image_width, image_height);
- if(rez!=Success){
- mp_msg(MSGT_VO,MSGL_WARN,"vo_xvmc: BlendSubpicture failed rez=%d\n",rez);
- assert(0);
- return;
- }
-// XvMCFlushSurface(mDisplay,osd_rndr->p_surface);//fixme- should I?
-
- //When replaceing the surface with osd one, save the flags too!
- osd_rndr->shared.picture_structure = p_render_surface_to_show->shared.picture_structure;
-//add more if needed osd_rndr-> = p_render_surface_to_show->;
-
- add_state(p_render_surface_to_show, STATE_OSD_SOURCE);
- remove_state(p_render_surface_to_show, STATE_DISPLAY_PENDING);
- p_render_surface_to_show->p_osd_target_surface_render = osd_rndr;
-
- p_render_surface_to_show = osd_rndr;
- add_state(p_render_surface_to_show, STATE_DISPLAY_PENDING);
-
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc:draw_osd: surface_to_show changed to %p\n",osd_rndr);
- }//endof if(BLEND)
- if(subpicture_mode == BACKEND_SUBPICTURE){
- rez = XvMCBlendSubpicture(mDisplay,
- p_render_surface_to_show->shared.p_surface,
- &subpicture,
- 0, 0, subpicture.width, subpicture.height,
- 0, 0, image_width, image_height);
-
- }
-
- }//if(BLEND||BACKEND)
-}
-
-static void xvmc_sync_surface(XvMCSurface * srf){
- int status,rez;
-
- rez = XvMCGetSurfaceStatus(mDisplay,srf,&status);
- assert(rez==Success);
- if((status & XVMC_RENDERING) == 0)
- return;//surface is already complete
- if(use_sleep){
- rez = XvMCFlushSurface(mDisplay, srf);
- assert(rez==Success);
-
- do{
- usec_sleep(1000);//1ms (may be 20ms on linux)
- XvMCGetSurfaceStatus(mDisplay,srf,&status);
- } while (status & XVMC_RENDERING);
- return;//done
- }
-
- XvMCSyncSurface(mDisplay, srf);
-}
-
-static void put_xvmc_image(struct xvmc_render *p_render_surface,
- int draw_ck){
- int rez;
- struct vo_rect src_rect, dst_rect;
- int i;
-
- if(p_render_surface == NULL)
- return;
-
- 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);
-
- if(benchmark)
- return;
-
- for (i = 1; i <= bob_deinterlace + 1; i++) {
- int field = top_field_first ? i : i ^ 3;
- rez = XvMCPutSurface(mDisplay, p_render_surface->shared.p_surface,
- vo_window,
- src_rect.left, src_rect.top, src_rect.width, src_rect.height,
- dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height,
- bob_deinterlace ? field : 3);
- if(rez != Success){
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: PutSurface failer, critical error %d!\n",rez);
- assert(0);
- }
- }
- XFlush(mDisplay);
-}
-
-static void flip_page(void){
- int i,cfs;
-
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: flip_page show(rndr=%p)\n\n",p_render_surface_to_show);
-
- if(p_render_surface_to_show == NULL) return;
- assert( p_render_surface_to_show->shared.xvmc_id == AV_XVMC_ID );
-//fixme assert( p_render_surface_to_show != p_render_surface_visible);
-
- if(use_queue){
- // fill the queue until only n free surfaces remain
- // after that start displaying
- cfs = count_free_surfaces();
- show_queue[free_element++] = p_render_surface_to_show;
- if(cfs > 3){//well have 3 free surfaces after add queue
- if(free_element > 1)//a little voodoo magic
- xvmc_sync_surface(show_queue[0]->shared.p_surface);
- return;
- }
- p_render_surface_to_show=show_queue[0];
- mp_msg(MSGT_VO,MSGL_DBG5,"vo_xvmc: flip_queue free_element=%d\n",free_element);
- free_element--;
- for(i=0; i<free_element; i++){
- show_queue[i] = show_queue[i+1];
- }
- show_queue[free_element] = NULL;
- }
-
-// make sure the rendering is done
- xvmc_sync_surface(p_render_surface_to_show->shared.p_surface);
-
-//the visible surface won't be displayed anymore, mark it as free
- if(p_render_surface_visible != NULL)
- remove_state(p_render_surface_visible, STATE_DISPLAY_PENDING);
-
-//!!fixme assert(p_render_surface_to_show->state & STATE_DISPLAY_PENDING);
-
- //show it, displaying is always vsynced, so skip it for benchmark
- put_xvmc_image(p_render_surface_to_show,first_frame);
- first_frame=0;//make sure we won't draw it anymore
-
- p_render_surface_visible = p_render_surface_to_show;
- p_render_surface_to_show = NULL;
-}
-
-static void check_events(void){
- int e=vo_x11_check_events(mDisplay);
-
- if(e&VO_EVENT_RESIZE)
- {
- e |= VO_EVENT_EXPOSE;
- }
- if ( e & VO_EVENT_EXPOSE )
- {
- put_xvmc_image(p_render_surface_visible,1);
- }
-}
-
-static void xvmc_free(void){
- int i;
-
- if( subpicture_alloc ){
-
- XvMCDestroySubpicture(mDisplay,&subpicture);
- deallocate_xvimage();
-
- subpicture_alloc = 0;
-
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: subpicture destroyed\n");
- }
-
- if( number_of_surfaces ){
-
- XvMCDestroyMacroBlocks(mDisplay,&mv_blocks);
- XvMCDestroyBlocks(mDisplay,&data_blocks);
-
- for(i=0; i<number_of_surfaces; i++)
- {
- XvMCHideSurface(mDisplay,&surface_array[i]);//it doesn't hurt, I hope
- XvMCDestroySurface(mDisplay,&surface_array[i]);
-
- if( (surface_render[i].state != 0) &&
- (p_render_surface_visible != &surface_render[i]) )
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc::uninit surface_render[%d].status=%d\n",i,
- surface_render[i].state);
- }
-
- memset(surface_render, 0, MAX_SURFACES * sizeof(struct xvmc_render)); //for debugging
- free(surface_render);surface_render=NULL;
-
- XvMCDestroyContext(mDisplay,&ctx);
- number_of_surfaces = 0;
-
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: Context sucessfuly freed\n");
- }
-
-
- if( xv_port !=0 ){
- XvUngrabPort(mDisplay,xv_port,CurrentTime);
- xv_port = 0;
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: xv_port sucessfuly ungrabed\n");
- }
-}
-
-static void uninit(void){
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: uninit called\n");
- xvmc_free();
- //from vo_xv
-#ifdef CONFIG_XF86VM
- vo_vm_close();
-#endif
- vo_x11_uninit();
-}
-
-static int query_format(uint32_t format){
- uint32_t flags;
- XvMCSurfaceInfo qsurface_info;
- int mode_id;
-
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: query_format=%X\n",format);
-
- if(!IMGFMT_IS_XVMC(format)) return 0;// no caps supported
- mode_id = xvmc_find_surface_by_format(format, 16, 16, &qsurface_info, 1);//true=1 - querying
-
- if( mode_id == 0 ) return 0;
-
- flags = VFCAP_CSP_SUPPORTED |
- VFCAP_CSP_SUPPORTED_BY_HW |
- VFCAP_ACCEPT_STRIDE;
-
- if( (qsurface_info.subpicture_max_width != 0) &&
- (qsurface_info.subpicture_max_height != 0) )
- flags|=VFCAP_OSD;
- return flags;
-}
-
-
-static int draw_slice(uint8_t *image[], int stride[],
- int w, int h, int x, int y){
- struct xvmc_render *rndr;
- int rez;
-
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: draw_slice y=%d\n",y);
-
- rndr = (struct xvmc_render*)image[2]; //this is copy of priv-ate
- assert( rndr != NULL );
- assert( rndr->shared.xvmc_id == AV_XVMC_ID );
-
- rez = XvMCRenderSurface(mDisplay,&ctx,rndr->shared.picture_structure,
- rndr->shared.p_surface,
- rndr->shared.p_past_surface,
- rndr->shared.p_future_surface,
- rndr->shared.flags,
- rndr->shared.filled_mv_blocks_num,rndr->shared.start_mv_blocks_num,
- &mv_blocks,&data_blocks);
- if(rez != Success)
- {
- int i;
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc::slice: RenderSirface returned %d\n",rez);
-
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc::slice: pict=%d,flags=%x,start_blocks=%d,num_blocks=%d\n",
- rndr->shared.picture_structure,rndr->shared.flags,rndr->shared.start_mv_blocks_num,
- rndr->shared.filled_mv_blocks_num);
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc::slice: this_surf=%p, past_surf=%p, future_surf=%p\n",
- rndr->shared.p_surface,rndr->shared.p_past_surface,rndr->shared.p_future_surface);
-
- for(i=0; i<rndr->shared.filled_mv_blocks_num; i++){
- XvMCMacroBlock* testblock;
- testblock = &mv_blocks.macro_blocks[i];
-
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc::slice: mv_block - x=%d,y=%d,mb_type=0x%x,mv_type=0x%x,mv_field_select=%d\n",
- testblock->x,testblock->y,testblock->macroblock_type,
- testblock->motion_type,testblock->motion_vertical_field_select);
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc::slice: dct_type=%d,data_index=0x%x,cbp=%d,pad0=%d\n",
- testblock->dct_type,testblock->index,testblock->coded_block_pattern,
- testblock->pad0);
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc::slice: PMV[0][0][0/1]=(%d,%d)\n",
- testblock->PMV[0][0][0],testblock->PMV[0][0][1]);
- }
- }
- assert(rez==Success);
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: flush surface\n");
- rez = XvMCFlushSurface(mDisplay, rndr->shared.p_surface);
- assert(rez==Success);
-
-// rndr->start_mv_blocks_num += rndr->filled_mv_blocks_num;
- rndr->shared.start_mv_blocks_num = 0;
- rndr->shared.filled_mv_blocks_num = 0;
-
- rndr->shared.next_free_data_block_num = 0;
-
- return VO_TRUE;
-}
-
-//XvMCHide hides the surface on next retrace, so
-//check if the surface is not still displaying
-static void check_osd_source(struct xvmc_render *src_rndr) {
- struct xvmc_render *osd_rndr;
- int stat;
-
- //If this is source surface, check does the OSD rendering is compleate
- if(src_rndr->state & STATE_OSD_SOURCE){
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: OSD surface=%p querying\n",src_rndr);
- osd_rndr = src_rndr->p_osd_target_surface_render;
- XvMCGetSurfaceStatus(mDisplay, osd_rndr->shared.p_surface, &stat);
- if(!(stat & XVMC_RENDERING))
- remove_state(src_rndr, STATE_OSD_SOURCE);
- }
-}
-static int count_free_surfaces(void) {
- int i,num;
-
- num=0;
- for(i=0; i<number_of_surfaces; i++){
- check_osd_source(&surface_render[i]);
- if(!in_use(surface_render + i))
- num++;
- }
- return num;
-}
-
-static struct xvmc_render *find_free_surface(void) {
- int i,t;
- int stat;
- struct xvmc_render *visible_rndr;
-
- visible_rndr = NULL;
- for(i=0; i<number_of_surfaces; i++){
-
- check_osd_source(&surface_render[i]);
- if( !in_use(surface_render + i)){
- XvMCGetSurfaceStatus(mDisplay, surface_render[i].shared.p_surface,&stat);
- if( (stat & XVMC_DISPLAYING) == 0 )
- return &surface_render[i];
- visible_rndr = &surface_render[i];// remember it, use as last resort
- }
- }
-
- //all surfaces are busy, but there is one that will be free
- //on next monitor retrace, we just have to wait
- if(visible_rndr != NULL){
- mp_msg(MSGT_VO,MSGL_INFO,"vo_xvmc: waiting retrace\n");
- for(t=0;t<1000;t++){
- usec_sleep(1000);//1ms
- XvMCGetSurfaceStatus(mDisplay, visible_rndr->shared.p_surface,&stat);
- if( (stat & XVMC_DISPLAYING) == 0 )
- return visible_rndr;
- }
- }
-//todo remove when stable
- mp_msg(MSGT_VO,MSGL_WARN,"vo_xvmc: no free surfaces, this should not happen in g1\n");
- for(i=0;i<number_of_surfaces;i++)
- mp_msg(MSGT_VO,MSGL_WARN,"vo_xvmc: surface[%d].state=%d\n",i,surface_render[i].state);
- return NULL;
-}
-
-static void xvmc_clean_surfaces(void){
- int i;
-
- for(i=0; i<number_of_surfaces; i++){
-
- remove_state(surface_render + i, STATE_DISPLAY_PENDING | STATE_OSD_SOURCE);
- surface_render[i].p_osd_target_surface_render=NULL;
- if(surface_render[i].state != 0){
- mp_msg(MSGT_VO,MSGL_WARN,"vo_xvmc: surface[%d].state=%d\n",
- i,surface_render[i].state);
- }
- }
- free_element=0;//clean up the queue
-}
-
-static uint32_t get_image(mp_image_t *mpi){
- struct xvmc_render *rndr;
-
- rndr = find_free_surface();
-
- if(rndr == NULL){
- mp_msg(MSGT_VO,MSGL_ERR,"vo_xvmc: get_image failed\n");
- return VO_FALSE;
- }
-
-assert(rndr->shared.start_mv_blocks_num == 0);
-assert(rndr->shared.filled_mv_blocks_num == 0);
-assert(rndr->shared.next_free_data_block_num == 0);
-
- mpi->flags |= MP_IMGFLAG_DIRECT;
-//keep strides 0 to avoid field manipulations
- mpi->stride[0] = 0;
- mpi->stride[1] = 0;
- mpi->stride[2] = 0;
-
-// these are shared!! so watch out
-// do call RenderSurface before overwriting
- mpi->planes[0] = (char*)data_blocks.blocks;
- mpi->planes[1] = (char*)mv_blocks.macro_blocks;
- mpi->priv =
- mpi->planes[2] = (char*)rndr;
-
- rndr->shared.picture_structure = 0;
- rndr->shared.flags = 0;
- rndr->state = 0;
- rndr->mpi = mpi;
- rndr->shared.start_mv_blocks_num = 0;
- rndr->shared.filled_mv_blocks_num = 0;
- rndr->shared.next_free_data_block_num = 0;
-
- mp_msg(MSGT_VO,MSGL_DBG4,"vo_xvmc: get_image: rndr=%p (surface=%p) \n",
- rndr,rndr->shared.p_surface);
-return VO_TRUE;
-}
-
-static int control(uint32_t request, void *data)
-{
- switch (request){
- case VOCTRL_GET_DEINTERLACE:
- *(int*)data = bob_deinterlace;
- return VO_TRUE;
- case VOCTRL_SET_DEINTERLACE:
- bob_deinterlace = *(int*)data;
- return VO_TRUE;
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t*)data));
- case VOCTRL_DRAW_IMAGE:
- return xvmc_draw_image((mp_image_t *)data);
- case VOCTRL_GET_IMAGE:
- return get_image((mp_image_t *)data);
- //vo_xv
- case VOCTRL_GUISUPPORT:
- return VO_TRUE;
- case VOCTRL_ONTOP:
- vo_x11_ontop();
- return VO_TRUE;
- case VOCTRL_FULLSCREEN:
- vo_x11_fullscreen();
- // indended, fallthrough to update panscan on fullscreen/windowed switch
- case VOCTRL_SET_PANSCAN:
- if ( ( vo_fs && ( vo_panscan != vo_panscan_amount ) ) || ( !vo_fs && vo_panscan_amount ) )
- {
- int old_y = vo_panscan_y;
- panscan_calc();
-
- if(old_y != vo_panscan_y)
- {
- //this also draws the colorkey
- put_xvmc_image(p_render_surface_visible,1);
- }
- }
- return VO_TRUE;
- case VOCTRL_GET_PANSCAN:
- if ( !vo_config_count || !vo_fs ) return VO_FALSE;
- return VO_TRUE;
- case VOCTRL_SET_EQUALIZER:
- {
- vf_equalizer_t *eq=data;
- return vo_xv_set_eq(xv_port, eq->item, eq->value);
- }
-
- case VOCTRL_GET_EQUALIZER:
- {
- vf_equalizer_t *eq=data;
- return vo_xv_get_eq(xv_port, eq->item, &eq->value);
- }
- case VOCTRL_UPDATE_SCREENINFO:
- update_xinerama_info();
- return VO_TRUE;
- }
- return VO_NOTIMPL;
-}
--
2
2
While fixing ch_layout in af_lavcresample, I've noticed that libaf
inserts two format change filters - one before lavcresample to do
float->s16le and one after to do s16le->float. Since swresample
handles float point sample format natively, it should be both faster
and better quality to use it.
If float point sample format is requested by libaf at initialization,
use swresample float point sample format for the conversion.
Adjust internal buffer size calculations to use a variable (bps).
Store the used format in the filter context structure to avoid
unnecessary reinitialization.
The "if()" has a strange alignment, because I plan on making more
cosmetics with that statement, in separate commit.
Please test.
I plan on committing it this weekend, unless there are some unresolved issues.
Best Regards
Ivan Kalvachev
iive
3
4
DO NOT USE FOR NON-DEVELOPMENT: This is just to get the ball rolling
This change very likely contains errors. It was just to get the source
compiling again in one longish session...
See also: https://gcc.gnu.org/gcc-14/porting_to.html
---
As always testing and comments very welcome!
I guess not supporting GCC 14 initially would be another way forward,
but fear it's not a good idea.
DISCLAIMER:
1. There are **very likely** mistakes in this patch!
2. It's mostly what I could manage to do in one longish sitting
to get MPlayer to build with GCC 14.
3. I might have touched some warnings by accident because we have
so many of them accumulated and I might have forgotten to
actually search to the next error :(
PS.
If we actually build with GCC 14 we could also look into current
clang. Didn't work for me when I tried...
configure | 8 ++++----
libaf/af_lavcresample.c | 2 +-
libmpcodecs/ad_spdif.c | 4 ++--
libmpcodecs/vd_ffmpeg.c | 4 ++--
libmpcodecs/vf_pp.c | 2 +-
libmpcodecs/vf_scale.c | 6 +++---
libmpcodecs/vf_screenshot.c | 4 ++--
libmpdemux/demux_film.c | 2 +-
libmpdemux/demux_lavf.c | 2 +-
libmpdemux/muxer_avi.c | 26 +++++++++++++-------------
libmpdemux/muxer_lavf.c | 2 +-
libvo/gl_common.c | 2 +-
libvo/vo_aa.c | 4 ++--
libvo/vo_matrixview.c | 2 +-
libvo/vo_x11.c | 2 +-
loader/qtx/qtxsdk/components.h | 2 +-
mp_msg.c | 2 +-
mplayer.c | 2 +-
sub/spudec.c | 2 +-
sub/sub.c | 2 +-
20 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/configure b/configure
index abc6e07ea..197ee26e8 100755
--- a/configure
+++ b/configure
@@ -9858,10 +9858,10 @@ print_enabled_filters(){
print_enabled_components libavcodec/codec_list.c FFCodec codec_list $libavdecoders $libavencoders
print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $libavparsers
print_enabled_components libavcodec/bsf_list.c FFBitStreamFilter bitstream_filters $libavbsfs
-print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list ""
-print_enabled_components libavdevice/outdev_list.c AVOutputFormat outdev_list ""
-print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $libavdemuxers
-print_enabled_components libavformat/muxer_list.c AVOutputFormat muxer_list $libavmuxers
+print_enabled_components libavdevice/indev_list.c FFInputFormat indev_list ""
+print_enabled_components libavdevice/outdev_list.c FFOutputFormat outdev_list ""
+print_enabled_components libavformat/demuxer_list.c FFInputFormat demuxer_list $libavdemuxers
+print_enabled_components libavformat/muxer_list.c FFOutputFormat muxer_list $libavmuxers
print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $libavprotocols
print_enabled_filters libavfilter/filter_list.c AVFilter filter_list $libavfilters
diff --git a/libaf/af_lavcresample.c b/libaf/af_lavcresample.c
index 642f6401a..c09a32df7 100644
--- a/libaf/af_lavcresample.c
+++ b/libaf/af_lavcresample.c
@@ -160,7 +160,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
memcpy(s->in[0], in, in_len);
- ret = swr_convert(s->swrctx, &s->tmp[0], out_len/chans/2, &s->in[0], in_len/chans/2);
+ ret = swr_convert(s->swrctx, &s->tmp[0], out_len/chans/2, (const uint8_t * const *)&s->in[0], in_len/chans/2);
if (ret < 0) return NULL;
out_len= ret*chans*2;
diff --git a/libmpcodecs/ad_spdif.c b/libmpcodecs/ad_spdif.c
index 4cdf2c77a..926d94051 100644
--- a/libmpcodecs/ad_spdif.c
+++ b/libmpcodecs/ad_spdif.c
@@ -54,7 +54,7 @@ static int read_packet(void *p, uint8_t *buf, int buf_size)
return 0;
}
-static int write_packet(void *p, uint8_t *buf, int buf_size)
+static int write_packet(void *p, const uint8_t *buf, int buf_size)
{
int len;
struct spdifContext *ctx = p;
@@ -131,7 +131,7 @@ static int init(sh_audio_t *sh)
// FORCE USE DTS-HD
if (lavf_ctx->streams[0]->codecpar->codec_id == AV_CODEC_ID_DTS)
av_dict_set(&opts, "dtshd_rate", "768000" /* 192000*4 */, 0);
- if ((res = avformat_write_header(lavf_ctx, opts)) < 0) {
+ if ((res = avformat_write_header(lavf_ctx, &opts)) < 0) {
av_dict_free(&opts);
if (res == AVERROR_PATCHWELCOME)
mp_msg(MSGT_DECAUDIO,MSGL_INFO,
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 1588f8817..bcf92a6a2 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -219,7 +219,7 @@ static int vdpau_render_wrapper(AVCodecContext *s, AVFrame *f,
sh_video_t *sh = s->opaque;
struct vdpau_frame_data data;
uint8_t *planes[4] = {(void *)&data};
- data.surface = (VdpVideoSurface)mpi->priv;
+ data.surface = (VdpVideoSurface)(uintptr_t)mpi->priv;
data.info = info;
data.bitstream_buffers_used = count;
data.bitstream_buffers = buffers;
@@ -738,7 +738,7 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic, int isreference){
if (ctx->use_vdpau) {
VdpVideoSurface surface = (VdpVideoSurface)mpi->priv;
avctx->draw_horiz_band= NULL;
- mpi->planes[3] = surface;
+ mpi->planes[3] = (void *)(uintptr_t)surface;
}
#endif
#if CONFIG_XVMC
diff --git a/libmpcodecs/vf_pp.c b/libmpcodecs/vf_pp.c
index 9721554d0..954c076da 100644
--- a/libmpcodecs/vf_pp.c
+++ b/libmpcodecs/vf_pp.c
@@ -142,7 +142,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts, double
if(vf->priv->pp || !(mpi->flags&MP_IMGFLAG_DIRECT)){
// do the postprocessing! (or copy if no DR)
- pp_postprocess(mpi->planes ,mpi->stride,
+ pp_postprocess((const unsigned char **)mpi->planes ,mpi->stride,
vf->dmpi->planes,vf->dmpi->stride,
(mpi->w+7)&(~7),mpi->h,
mpi->qscale, mpi->qstride,
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c
index e48a2ad45..e8304faf4 100644
--- a/libmpcodecs/vf_scale.c
+++ b/libmpcodecs/vf_scale.c
@@ -439,14 +439,14 @@ static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src
int src_stride2[MP_MAX_PLANES]={2*src_stride[0], 2*src_stride[1], 2*src_stride[2], 2*src_stride[3]};
int dst_stride2[MP_MAX_PLANES]={2*dst_stride[0], 2*dst_stride[1], 2*dst_stride[2], 2*dst_stride[3]};
- sws_scale(sws1, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
+ sws_scale(sws1, (const uint8_t * const *)src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
for(i=0; i<MP_MAX_PLANES; i++){
src2[i] += src_stride[i];
dst2[i] += dst_stride[i];
}
- sws_scale(sws2, src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
+ sws_scale(sws2, (const uint8_t * const *)src2, src_stride2, y>>1, h>>1, dst2, dst_stride2);
}else{
- sws_scale(sws1, src2, src_stride, y, h, dst, dst_stride);
+ sws_scale(sws1, (const uint8_t * const *)src2, src_stride, y, h, dst, dst_stride);
}
}
diff --git a/libmpcodecs/vf_screenshot.c b/libmpcodecs/vf_screenshot.c
index e8b87fa91..0996dcc74 100644
--- a/libmpcodecs/vf_screenshot.c
+++ b/libmpcodecs/vf_screenshot.c
@@ -60,7 +60,7 @@ static void draw_slice(struct vf_instance *vf, unsigned char** src,
int* stride, int w,int h, int x, int y)
{
if (vf->priv->store_slices) {
- sws_scale(vf->priv->ctx, src, stride, y, h, vf->priv->pic->data, vf->priv->pic->linesize);
+ sws_scale(vf->priv->ctx, (const uint8_t * const *)src, stride, y, h, vf->priv->pic->data, vf->priv->pic->linesize);
}
vf_next_draw_slice(vf,src,stride,w,h,x,y);
}
@@ -158,7 +158,7 @@ static void scale_image(struct vf_priv_s* priv, mp_image_t *mpi)
if (!priv->pic->data[0])
priv->pic->data[0] = av_malloc(priv->pic->linesize[0]*priv->dh);
- sws_scale(priv->ctx, mpi->planes, mpi->stride, 0, mpi->height, priv->pic->data, priv->pic->linesize);
+ sws_scale(priv->ctx, (const uint8_t * const *)mpi->planes, mpi->stride, 0, mpi->height, priv->pic->data, priv->pic->linesize);
}
static void start_slice(struct vf_instance *vf, mp_image_t *mpi)
diff --git a/libmpdemux/demux_film.c b/libmpdemux/demux_film.c
index fdb391ddd..b351368e4 100644
--- a/libmpdemux/demux_film.c
+++ b/libmpdemux/demux_film.c
@@ -157,7 +157,7 @@ static int demux_film_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
free(buf);
}
else {/* for 16bit */
- unsigned short* tmp = dp->buffer;
+ unsigned short* tmp = (unsigned short *)dp->buffer;
unsigned short* buf = malloc(film_chunk.chunk_size);
for(i = 0; i < film_chunk.chunk_size/4; i++) {
buf[i*2] = tmp[i];
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index 06a9e15cc..60b15f0f6 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -378,7 +378,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
}
case AVMEDIA_TYPE_VIDEO:{
AVDictionaryEntry *rot = av_dict_get(st->metadata, "rotate", NULL, 0);
- const int32_t *disp_matrix = av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
+ const int32_t *disp_matrix = (const int32_t *)av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
sh_video_t* sh_video;
BITMAPINFOHEADER *bih;
sh_video=new_sh_video_vid(demuxer, i, priv->video_streams);
diff --git a/libmpdemux/muxer_avi.c b/libmpdemux/muxer_avi.c
index 78a666770..912e6cde2 100644
--- a/libmpdemux/muxer_avi.c
+++ b/libmpdemux/muxer_avi.c
@@ -142,8 +142,8 @@ static muxer_stream_t* avifile_new_stream(muxer_t *muxer,int type){
static void write_avi_chunk(stream_t *stream,unsigned int id,int len,void* data){
int le_len = le2me_32(len);
int le_id = le2me_32(id);
- stream_write_buffer(stream, &le_id, 4);
- stream_write_buffer(stream, &le_len, 4);
+ stream_write_buffer(stream, (unsigned char *)&le_id, 4);
+ stream_write_buffer(stream, (unsigned char *)&le_len, 4);
if(len>0){
if(data){
@@ -176,9 +176,9 @@ static void write_avi_list(stream_t *stream, unsigned int id, int len)
list_id = le2me_32(list_id);
le_len = le2me_32(len);
le_id = le2me_32(id);
- stream_write_buffer(stream, &list_id, 4);
- stream_write_buffer(stream, &le_len, 4);
- stream_write_buffer(stream, &le_id, 4);
+ stream_write_buffer(stream, (unsigned char *)&list_id, 4);
+ stream_write_buffer(stream, (unsigned char *)&le_len, 4);
+ stream_write_buffer(stream, (unsigned char *)&le_id, 4);
}
static void avifile_odml_new_riff(muxer_t *muxer)
@@ -199,7 +199,7 @@ static void avifile_odml_new_riff(muxer_t *muxer)
riff[0]=le2me_32(mmioFOURCC('R','I','F','F'));
riff[1]=0;
riff[2]=le2me_32(mmioFOURCC('A','V','I','X'));
- stream_write_buffer(muxer->stream, riff, 12);
+ stream_write_buffer(muxer->stream, (unsigned char *)riff, 12);
write_avi_list(muxer->stream,listtypeAVIMOVIE,0);
@@ -251,12 +251,12 @@ static void avifile_write_header(muxer_t *muxer){
movilen = le2me_32(rifflen - 12);
rifflen = le2me_32(rifflen);
stream_seek(muxer->stream, vsi->riffofs[i]+4);
- stream_write_buffer(muxer->stream,&rifflen,4);
+ stream_write_buffer(muxer->stream,(unsigned char *)&rifflen,4);
/* fixup movi length */
if (i > 0) {
stream_seek(muxer->stream, vsi->riffofs[i]+16);
- stream_write_buffer(muxer->stream,&movilen,4);
+ stream_write_buffer(muxer->stream,(unsigned char *)&movilen,4);
}
}
@@ -269,7 +269,7 @@ static void avifile_write_header(muxer_t *muxer){
riff[0]=le2me_32(riff[0]);
riff[1]=le2me_32(riff[1]);
riff[2]=le2me_32(riff[2]);
- stream_write_buffer(muxer->stream,&riff,12);
+ stream_write_buffer(muxer->stream,(unsigned char *)&riff,12);
}
// update AVI header:
@@ -406,7 +406,7 @@ static void avifile_write_header(muxer_t *muxer){
idxhdr[6] = 0;
idxhdr[7] = 0;
- stream_write_buffer(muxer->stream,idxhdr,sizeof(idxhdr));
+ stream_write_buffer(muxer->stream,(unsigned char *)idxhdr,sizeof(idxhdr));
for (j=0; j<n; j++) {
struct avi_odmlsuperidx_entry *entry = &si->superidx[j];
unsigned int data[4];
@@ -414,7 +414,7 @@ static void avifile_write_header(muxer_t *muxer){
data[1] = le2me_32(entry->ofs >> 32);
data[2] = le2me_32(entry->len);
data[3] = le2me_32(entry->duration);
- stream_write_buffer(muxer->stream,data,sizeof(data));
+ stream_write_buffer(muxer->stream,(unsigned char *)data,sizeof(data));
}
}
}
@@ -642,13 +642,13 @@ static void avifile_odml_write_index(muxer_t *muxer){
si->superidx[j].ofs = stream_tell(muxer->stream);
si->superidx[j].duration = duration;
- stream_write_buffer(muxer->stream, idxhdr,sizeof(idxhdr));
+ stream_write_buffer(muxer->stream, (unsigned char *)idxhdr,sizeof(idxhdr));
for (k=0; k<entries_per_subidx && idxpos<si->idxpos; k++) {
unsigned int entry[2];
entry[0] = le2me_32(si->idx[idxpos].ofs - start);
entry[1] = le2me_32(si->idx[idxpos].len | si->idx[idxpos].flags);
idxpos++;
- stream_write_buffer(muxer->stream, entry, sizeof(entry));
+ stream_write_buffer(muxer->stream, (unsigned char *)entry, sizeof(entry));
}
}
}
diff --git a/libmpdemux/muxer_lavf.c b/libmpdemux/muxer_lavf.c
index 19fa9e956..a78c1c366 100644
--- a/libmpdemux/muxer_lavf.c
+++ b/libmpdemux/muxer_lavf.c
@@ -77,7 +77,7 @@ const m_option_t lavfopts_conf[] = {
{NULL, NULL, 0, 0, 0, 0, NULL}
};
-static int mp_write(void *opaque, uint8_t *buf, int size)
+static int mp_write(void *opaque, const uint8_t *buf, int size)
{
muxer_t *muxer = opaque;
return stream_write_buffer(muxer->stream, buf, size);
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index f59309bde..42d08123d 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -2239,7 +2239,7 @@ static XVisualInfo *getWindowVisualInfo(Window win) {
XVisualInfo vinfo_template;
int tmp;
if (!XGetWindowAttributes(mDisplay, win, &xw_attr))
- return DefaultVisual(mDisplay, 0);
+ vinfo_template.visualid = XVisualIDFromVisual(DefaultVisual(mDisplay, 0));
vinfo_template.visualid = XVisualIDFromVisual(xw_attr.visual);
return XGetVisualInfo(mDisplay, VisualIDMask, &vinfo_template, &tmp);
}
diff --git a/libvo/vo_aa.c b/libvo/vo_aa.c
index dc805be5b..4d5bcaad4 100644
--- a/libvo/vo_aa.c
+++ b/libvo/vo_aa.c
@@ -357,7 +357,7 @@ draw_frame(uint8_t *src[]) {
break;
}
- sws_scale(sws,src,stride,0,src_height,image,image_stride);
+ sws_scale(sws,(const uint8_t * const *)src,stride,0,src_height,image,image_stride);
/* Now 'ASCIInate' the image */
if (fast)
@@ -377,7 +377,7 @@ draw_slice(uint8_t *src[], int stride[],
int dx2 = screen_x + ((x+w) * screen_w / src_width);
int dy2 = screen_y + ((y+h) * screen_h / src_height);
- sws_scale(sws,src,stride,y,h,image,image_stride);
+ sws_scale(sws,(const uint8_t * const *)src,stride,y,h,image,image_stride);
/* Now 'ASCIInate' the image */
if (fast)
diff --git a/libvo/vo_matrixview.c b/libvo/vo_matrixview.c
index ee2735b1c..716f1c2a1 100644
--- a/libvo/vo_matrixview.c
+++ b/libvo/vo_matrixview.c
@@ -170,7 +170,7 @@ static void flip_page(void)
static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
{
- sws_scale(sws, src, stride, y, h, map_image, map_stride);
+ sws_scale(sws, (const uint8_t * const *)src, stride, y, h, map_image, map_stride);
return 0;
}
diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c
index c3ec528a4..c3381ef8f 100644
--- a/libvo/vo_x11.c
+++ b/libvo/vo_x11.c
@@ -492,7 +492,7 @@ static int draw_slice(uint8_t * src[], int stride[], int w, int h,
dst[0] += dstStride[0] * (image_height - 1);
dstStride[0] = -dstStride[0];
}
- sws_scale(swsContext, src, stride, y, h, dst, dstStride);
+ sws_scale(swsContext, (const uint8_t * const *)src, stride, y, h, dst, dstStride);
return 0;
}
diff --git a/loader/qtx/qtxsdk/components.h b/loader/qtx/qtxsdk/components.h
index 5ad7572d8..177ddc430 100644
--- a/loader/qtx/qtxsdk/components.h
+++ b/loader/qtx/qtxsdk/components.h
@@ -780,7 +780,7 @@ static inline void dump_CodecDecompressParams(void* xxx){
printf("dstrect: %d;%d - %d;%d\n",cd->dstRect.top,cd->dstRect.left,cd->dstRect.bottom,cd->dstRect.right);
printf("wantedDestinationPixelTypes=%p\n",cd->wantedDestinationPixelTypes);
if(cd->wantedDestinationPixelTypes){
- unsigned int* p=cd->wantedDestinationPixelTypes;
+ unsigned int* p=(unsigned int*)cd->wantedDestinationPixelTypes;
while(p[0]){
printf(" 0x%08X %p\n",p[0],&p[0]);
++p;
diff --git a/mp_msg.c b/mp_msg.c
index 67bcc067d..3b059801a 100644
--- a/mp_msg.c
+++ b/mp_msg.c
@@ -70,7 +70,7 @@ const char* filename_recode(const char* filename)
filename_len = strlen(filename);
max_path = MSGSIZE_MAX - 4;
precoded = recoded_filename;
- if (iconv(inv_msgiconv, &filename, &filename_len,
+ if (iconv(inv_msgiconv, (char **)&filename, &filename_len,
&precoded, &max_path) == (size_t)(-1) && errno == E2BIG) {
precoded[0] = precoded[1] = precoded[2] = '.';
precoded += 3;
diff --git a/mplayer.c b/mplayer.c
index b4411cef2..a8c4ef17d 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -3536,7 +3536,7 @@ goto_enable_cache:
break;
if ((mpctx->demuxer->file_format == DEMUXER_TYPE_AVI || mpctx->demuxer->file_format == DEMUXER_TYPE_ASF || mpctx->demuxer->file_format == DEMUXER_TYPE_MOV)
&& stream_dump_type == 2)
- stream_write_buffer(os, &in_size, 4);
+ stream_write_buffer(os, (unsigned char *)&in_size, 4);
if (in_size > 0) {
stream_write_buffer(os, start, in_size);
stream_dump_progress(in_size, mpctx->stream);
diff --git a/sub/spudec.c b/sub/spudec.c
index eefc235d4..515e88b96 100644
--- a/sub/spudec.c
+++ b/sub/spudec.c
@@ -899,7 +899,7 @@ static void sws_spu_image(unsigned char *d1, unsigned char *d2, int dw, int dh,
ctx=sws_getContext(sw, sh, AV_PIX_FMT_GRAY8, dw, dh, AV_PIX_FMT_GRAY8, SWS_GAUSS, &filter, NULL, NULL);
sws_scale(ctx,&s1,&ss,0,sh,&d1,&ds);
for (i=ss*sh-1; i>=0; i--) s2[i] = -s2[i];
- sws_scale(ctx,&s2,&ss,0,sh,&d2,&ds);
+ sws_scale(ctx,(const uint8_t * const *)&s2,&ss,0,sh,&d2,&ds);
for (i=ds*dh-1; i>=0; i--) d2[i] = -d2[i];
sws_freeContext(ctx);
}
diff --git a/sub/sub.c b/sub/sub.c
index 142242179..c03302992 100644
--- a/sub/sub.c
+++ b/sub/sub.c
@@ -727,7 +727,7 @@ static inline void vo_update_text_sub(mp_osd_obj_t *obj, int dxs, int dys)
// reading the subtitle words from vo_sub->text[]
while (*t) {
if (sub_utf8)
- c = utf8_get_char(&t);
+ c = utf8_get_char((const char**)&t);
else if ((c = *t++) >= 0x80 && sub_unicode)
c = (c<<8) + *t++;
if (k==MAX_UCS){
--
2
5
Someone asked webmaster@ about donations, and our donation link is long dead.
Is there anyone who wants to run donations for the project?
someone remind me to remove those old donation buttons too....
-compn
2
1
Hi all,
I said it on the MPlayer user list already, I'm currently working on fixing the build after recent FFmpeg major bumps.
I will post patches asap and would be very grateful for prompt feedback from testing and review.
Just trying to avoid duplicate work. If anyone wants to help please email me privately.
Best regards,
Alexander
4
37
08 Apr '24
Just like the rest of FFmpeg 7.x swresample library doesn't accept
"number of channels" as separate parameter anymore and requires it to
be part of channel layout structure that also describes the audio
speakers layout.
While Alexander Strasser's (beastd) patch series mostly fix this kind
of change in other parts of the code, here it remained unnoticed
because it doesn't cause compilation failure.
The existing af_lavcresample code uses av_opt_set*() and because of
that the errors are returned at runtime.
Since lavresample is automatically inserted to change the sample rate
(e.g. 44100->48000) it caused some videos to lose sound entirely.
To fix it, I'm just getting the default channel layout for the given
number of channels. It's the simplest code that makes it work.
This together with the change of ad_ffmpeg.c patch let's me play
everything so far.
Best Regards
Ivan Kalvachev
2
2