aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile9
-rwxr-xr-xTOOLS/osxbundle.py89
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/Info.plist248
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/MacOS/.gitkeep0
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/MacOS/lib/.gitkeep0
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/PkgInfo1
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/Resources/audio.icnsbin0 -> 64076 bytes
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icnsbin0 -> 142486 bytes
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/Resources/movie.icnsbin0 -> 157126 bytes
-rw-r--r--TOOLS/osxbundle/mpv.app/Contents/Resources/subtitles.icnsbin0 -> 63323 bytes
-rwxr-xr-xTOOLS/osxbundle/version.sh15
-rwxr-xr-xconfigure4
-rw-r--r--etc/codecs.conf16
-rw-r--r--etc/mpv-icon-source.svg556
-rw-r--r--fmt-conversion.c2
-rw-r--r--libmpcodecs/img_format.c2
-rw-r--r--libmpcodecs/img_format.h3
-rw-r--r--libmpcodecs/mp_image.c7
-rw-r--r--libmpcodecs/vd.c51
-rw-r--r--libmpcodecs/vd_ffmpeg.c3
-rw-r--r--libmpcodecs/vd_internal.h48
-rw-r--r--libmpcodecs/vf.c13
-rw-r--r--libmpcodecs/vf_dlopen.c2
-rw-r--r--libmpcodecs/vf_expand.c13
-rw-r--r--libvo/cocoa_common.h12
-rw-r--r--libvo/cocoa_common.m537
-rw-r--r--libvo/gl_common.c31
-rw-r--r--libvo/gl_common.h2
-rw-r--r--libvo/gl_header_fixes.h12
-rw-r--r--libvo/video_out.h1
-rw-r--r--libvo/vo_corevideo.m14
-rw-r--r--libvo/vo_direct3d.c9
-rw-r--r--libvo/vo_opengl.c12
-rw-r--r--libvo/vo_opengl_old.c18
-rw-r--r--libvo/vo_vdpau.c57
-rw-r--r--libvo/vo_xv.c10
-rw-r--r--mplayer.c22
-rw-r--r--osdep/mpv.exe.manifest (renamed from osdep/mplayer.exe.manifest)0
-rw-r--r--osdep/mpv.rc (renamed from osdep/mplayer.rc)0
-rw-r--r--sub/osd_libass.c4
41 files changed, 1389 insertions, 435 deletions
diff --git a/.gitignore b/.gitignore
index 45b6ab2b9b..56bc6b1fa6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@
/config.mak
/config.log
/mpv
+/mpv.app
/version.h
/codecs.conf.h
/input/input_conf.h
diff --git a/Makefile b/Makefile
index 7e566f06de..ffa73a8781 100644
--- a/Makefile
+++ b/Makefile
@@ -278,7 +278,7 @@ COMMON_LIBS += $(COMMON_LIBS-yes)
OBJS_COMMON += $(addsuffix .o, $(basename $(SRCS_COMMON)))
OBJS_MPLAYER += $(addsuffix .o, $(basename $(SRCS_MPLAYER)))
-OBJS_MPLAYER-$(PE_EXECUTABLE) += osdep/mplayer-rc.o
+OBJS_MPLAYER-$(PE_EXECUTABLE) += osdep/mpv-rc.o
OBJS_MPLAYER += $(OBJS_MPLAYER-yes)
MPLAYER_DEPS = $(OBJS_MPLAYER) $(OBJS_COMMON) $(COMMON_LIBS)
@@ -406,9 +406,9 @@ checkheaders: $(ALLHEADERS:.h=.ho)
###### dependency declarations / specific CFLAGS ######
-version.c osdep/mplayer-rc.o: version.h
+version.c osdep/mpv-rc.o: version.h
-osdep/mplayer-rc.o: osdep/mplayer.exe.manifest
+osdep/mpv-rc.o: osdep/mpv.exe.manifest
###### installation / clean / generic rules #######
@@ -481,6 +481,9 @@ TAGS:
tags:
$(RM) $@; find . -name '*.[chS]' -o -name '*.asm' | xargs ctags -a
+osxbundle:
+ @TOOLS/osxbundle.py mpv
+
-include $(DEP_FILES)
.PHONY: all locales *install*
diff --git a/TOOLS/osxbundle.py b/TOOLS/osxbundle.py
new file mode 100755
index 0000000000..9f2f29d88b
--- /dev/null
+++ b/TOOLS/osxbundle.py
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+
+import os
+import re
+import shutil
+import sys
+
+def sh(command):
+ return os.popen(command).read()
+
+def dylib_lst(input_file):
+ return sh("otool -L %s | grep -e '\t' | awk '{ print $1 }'" % input_file)
+
+sys_re = re.compile("/System")
+exe_re = re.compile("@executable_path")
+binary_name = sys.argv[1]
+
+def is_user_lib(libname, input_file):
+ return not sys_re.match(libname) and \
+ not exe_re.match(libname) and \
+ not "libobjc" in libname and \
+ not "libSystem" in libname and \
+ not "libgcc" in libname and \
+ not os.path.basename(input_file) in libname and \
+ not libname == ''
+
+def user_dylib_lst(input_file):
+ return [lib for lib in dylib_lst(input_file).split("\n") if
+ is_user_lib(lib, input_file)]
+
+def bundle_name():
+ return "%s.app" % binary_name
+
+def target_plist():
+ return os.path.join(bundle_name(), 'Contents', 'Info.plist')
+
+def target_directory():
+ return os.path.join(bundle_name(), 'Contents', 'MacOS')
+
+def target_binary():
+ return os.path.join(target_directory(), binary_name)
+
+def copy_bundle():
+ if os.path.isdir(bundle_name()):
+ shutil.rmtree(bundle_name())
+ shutil.copytree(
+ os.path.join('TOOLS', 'osxbundle', bundle_name()),
+ bundle_name())
+
+def copy_binary():
+ shutil.copy(binary_name, target_binary())
+
+def run_install_name_tool(target_file, dylib_path, destination_directory):
+ new_dylib_path = os.path.join("@executable_path", "lib",
+ os.path.basename(dylib_path))
+
+ sh("install_name_tool -change %s %s %s" % \
+ (dylib_path, new_dylib_path, target_file))
+ sh("install_name_tool -id %s %s" % \
+ (new_dylib_path, os.path.join(destination_directory,
+ os.path.basename(dylib_path))))
+
+def cp_dylibs(target_file, destination_directory):
+ for dylib_path in user_dylib_lst(target_file):
+ dylib_destination_path = os.path.join(destination_directory,
+ os.path.basename(dylib_path))
+ shutil.copy(dylib_path, dylib_destination_path)
+ os.chmod(dylib_destination_path, 0o755)
+ cp_dylibs(dylib_destination_path, destination_directory)
+
+def fix_dylibs_paths(target_file, destination_directory):
+ for dylib_path in user_dylib_lst(target_file):
+ dylib_destination_path = os.path.join(destination_directory,
+ os.path.basename(dylib_path))
+ run_install_name_tool(target_file, dylib_path, destination_directory)
+ fix_dylibs_paths(dylib_destination_path, destination_directory)
+
+def apply_plist_template(plist_file, version):
+ sh("sed -i -e 's/{{VERSION}}/%s/g' %s" % (version, plist_file))
+
+version = sh("TOOLS/osxbundle/version.sh").strip()
+
+print("Creating Mac OS X application bundle (version: %s)..." % version)
+
+copy_bundle()
+copy_binary()
+apply_plist_template(target_plist(), version)
+cp_dylibs(sys.argv[1], os.path.join(target_directory(), "lib"))
+fix_dylibs_paths(target_binary(), os.path.join(target_directory(), "lib"))
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Info.plist b/TOOLS/osxbundle/mpv.app/Contents/Info.plist
new file mode 100644
index 0000000000..472542fe92
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/Info.plist
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>AAC</string>
+ <string>AC3</string>
+ <string>AIFF</string>
+ <string>M4A</string>
+ <string>MKA</string>
+ <string>MP3</string>
+ <string>OGG</string>
+ <string>PCM</string>
+ <string>VAW</string>
+ <string>WAV</string>
+ <string>WAW</string>
+ <string>WMA</string>
+ <string>aac</string>
+ <string>ac3</string>
+ <string>aiff</string>
+ <string>m4a</string>
+ <string>mka</string>
+ <string>mp3</string>
+ <string>ogg</string>
+ <string>pcm</string>
+ <string>vaw</string>
+ <string>wav</string>
+ <string>waw</string>
+ <string>wma</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>audio.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Audio file</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSTypeIsPackage</key>
+ <false/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>XML</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>*</string>
+ <string>*</string>
+ <string>3GP</string>
+ <string>3IV</string>
+ <string>3gp</string>
+ <string>3iv</string>
+ <string>ASF</string>
+ <string>AVI</string>
+ <string>CPK</string>
+ <string>DAT</string>
+ <string>DIVX</string>
+ <string>DV</string>
+ <string>FLAC</string>
+ <string>FLI</string>
+ <string>FLV</string>
+ <string>H264</string>
+ <string>I263</string>
+ <string>M2TS</string>
+ <string>M4V</string>
+ <string>MKV</string>
+ <string>MOV</string>
+ <string>MP2</string>
+ <string>MP4</string>
+ <string>MPEG</string>
+ <string>MPG</string>
+ <string>MPG2</string>
+ <string>MPG4</string>
+ <string>NSV</string>
+ <string>NUT</string>
+ <string>NUV</string>
+ <string>OGG</string>
+ <string>OGM</string>
+ <string>QT</string>
+ <string>RM</string>
+ <string>RMVB</string>
+ <string>VCD</string>
+ <string>VFW</string>
+ <string>VOB</string>
+ <string>WMV</string>
+ <string>asf</string>
+ <string>avi</string>
+ <string>cpk</string>
+ <string>dat</string>
+ <string>divx</string>
+ <string>dv</string>
+ <string>flac</string>
+ <string>fli</string>
+ <string>flv</string>
+ <string>h264</string>
+ <string>i263</string>
+ <string>m2ts</string>
+ <string>m4v</string>
+ <string>mkv</string>
+ <string>mov</string>
+ <string>mp2</string>
+ <string>mp4</string>
+ <string>mpeg</string>
+ <string>mpg</string>
+ <string>mpg2</string>
+ <string>mpg4</string>
+ <string>nsv</string>
+ <string>nut</string>
+ <string>nuv</string>
+ <string>ogg</string>
+ <string>ogm</string>
+ <string>qt</string>
+ <string>rm</string>
+ <string>rmvb</string>
+ <string>vcd</string>
+ <string>vfw</string>
+ <string>vob</string>
+ <string>wmv</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>movie.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Movie file</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSTypeIsPackage</key>
+ <false/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>XML</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>AQT</string>
+ <string>ASS</string>
+ <string>JSS</string>
+ <string>RT</string>
+ <string>SMI</string>
+ <string>SRT</string>
+ <string>SSA</string>
+ <string>SUB</string>
+ <string>TXT</string>
+ <string>UTF</string>
+ <string>aqt</string>
+ <string>ass</string>
+ <string>jss</string>
+ <string>rt</string>
+ <string>smi</string>
+ <string>srt</string>
+ <string>ssa</string>
+ <string>sub</string>
+ <string>txt</string>
+ <string>utf</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>subtitles.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>Subtitles file</string>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSTypeIsPackage</key>
+ <false/>
+ <key>NSPersistentStoreTypeKey</key>
+ <string>XML</string>
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+ <string>mpv</string>
+ <key>CFBundleIconFile</key>
+ <string>icon</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.mpv-player.standalone</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>mpv</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>{{VERSION}}</string>
+ <key>NSHighResolutionCapable</key>
+ <true/>
+ <key>CFBundleURLTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>CFBundleURLName</key>
+ <string>Real Time (Streaming) Protocol</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>rtp</string>
+ <string>rtsp</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>CFBundleURLName</key>
+ <string>File over HTTP/FTP/UDP</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>icyx</string>
+ <string>udp</string>
+ <string>ftp</string>
+ <string>http_proxy</string>
+ <string>http</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>CFBundleURLName</key>
+ <string>Microsoft Media Services</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>mms</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>CFBundleURLName</key>
+ <string>Cuesheet</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>cue</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>CFBundleURLName</key>
+ <string>CD/DVD Media</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>dvdnav</string>
+ <string>dvd</string>
+ <string>vcd</string>
+ </array>
+ </dict>
+ </array>
+ </dict>
+</plist>
diff --git a/TOOLS/osxbundle/mpv.app/Contents/MacOS/.gitkeep b/TOOLS/osxbundle/mpv.app/Contents/MacOS/.gitkeep
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/MacOS/.gitkeep
diff --git a/TOOLS/osxbundle/mpv.app/Contents/MacOS/lib/.gitkeep b/TOOLS/osxbundle/mpv.app/Contents/MacOS/lib/.gitkeep
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/MacOS/lib/.gitkeep
diff --git a/TOOLS/osxbundle/mpv.app/Contents/PkgInfo b/TOOLS/osxbundle/mpv.app/Contents/PkgInfo
new file mode 100644
index 0000000000..bd04210fb4
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/PkgInfo
@@ -0,0 +1 @@
+APPL???? \ No newline at end of file
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Resources/audio.icns b/TOOLS/osxbundle/mpv.app/Contents/Resources/audio.icns
new file mode 100644
index 0000000000..239b9bab12
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/Resources/audio.icns
Binary files differ
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns b/TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns
new file mode 100644
index 0000000000..eb056f5a15
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns
Binary files differ
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Resources/movie.icns b/TOOLS/osxbundle/mpv.app/Contents/Resources/movie.icns
new file mode 100644
index 0000000000..8c495894a4
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/Resources/movie.icns
Binary files differ
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Resources/subtitles.icns b/TOOLS/osxbundle/mpv.app/Contents/Resources/subtitles.icns
new file mode 100644
index 0000000000..f4c7270691
--- /dev/null
+++ b/TOOLS/osxbundle/mpv.app/Contents/Resources/subtitles.icns
Binary files differ
diff --git a/TOOLS/osxbundle/version.sh b/TOOLS/osxbundle/version.sh
new file mode 100755
index 0000000000..ff6bb1b5fd
--- /dev/null
+++ b/TOOLS/osxbundle/version.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# Extract revision number from file used by daily tarball snapshots
+# or from "git describe" output
+git_revision=$(cat snapshot_version 2> /dev/null)
+test $git_revision || test ! -d .git || \
+git_revision=`git describe --match "v[0-9]*" --always`
+git_revision=$(expr "$git_revision" : v*'\(.*\)')
+test $git_revision || git_revision=UNKNOWN
+
+# releases extract the version number from the VERSION file
+version=$(cat VERSION 2> /dev/null)
+test $version || version=$git_revision
+
+echo $version
diff --git a/configure b/configure
index a8753ec3b0..3af45d6798 100755
--- a/configure
+++ b/configure
@@ -1980,10 +1980,10 @@ int main(void) {
}
EOF
_cocoa=no
- cc_check -framework Cocoa -framework OpenGL && _cocoa=yes
+ cc_check -framework IOKit -framework Cocoa -framework OpenGL && _cocoa=yes
fi
if test "$_cocoa" = yes ; then
- libs_mplayer="$libs_mplayer -framework Cocoa -framework OpenGL"
+ libs_mplayer="$libs_mplayer -framework IOKit -framework Cocoa -framework OpenGL"
def_cocoa='#define CONFIG_COCOA 1'
else
def_cocoa='#undef CONFIG_COCOA'
diff --git a/etc/codecs.conf b/etc/codecs.conf
index ab9267c5a9..9d4e8c9e0c 100644
--- a/etc/codecs.conf
+++ b/etc/codecs.conf
@@ -732,6 +732,22 @@ videocodec ffh264crystalhd
driver ffmpeg
dll h264_crystalhd
+videocodec ffh264vda
+ info "FFmpeg H.264 (VDA)"
+ status working
+ fourcc H264,h264
+ fourcc X264,x264
+ fourcc avc1,AVC1
+ fourcc davc,DAVC
+ fourcc vvvc ; only one sample using this fourcc
+ fourcc ai55,ai15 ; flip4mac avc intra
+ fourcc ai1q,ai5q ; flip4mac avc intra
+ fourcc ai12 ;AVC Intra 100 / 1080
+ format 0x10000005
+ driver ffmpeg
+ dll h264_vda
+ out YUY2,UYVY,YV12,NV12
+
videocodec ffsvq3
info "FFmpeg Sorenson Video v3 (SVQ3)"
status working
diff --git a/etc/mpv-icon-source.svg b/etc/mpv-icon-source.svg
new file mode 100644
index 0000000000..6d0453bc5f
--- /dev/null
+++ b/etc/mpv-icon-source.svg
@@ -0,0 +1,556 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="512"
+ height="512"
+ id="svg2985"
+ version="1.1"
+ inkscape:version="0.48.2 r9819"
+ sodipodi:docname="icon-mplayer3.svg"
+ inkscape:export-filename="/Users/pigoz/Documents/mplayer-icons/compiled/icon-mplayer2.png"
+ inkscape:export-xdpi="85.699997"
+ inkscape:export-ydpi="85.699997"
+ enable-background="new">
+ <defs
+ id="defs2987">
+ <linearGradient
+ id="linearGradient5632">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop5634" />
+ <stop
+ style="stop-color:#646464;stop-opacity:1;"
+ offset="1"
+ id="stop5636" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3979">
+ <stop
+ style="stop-color:#d2d2d2;stop-opacity:1;"
+ offset="0"
+ id="stop3981" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="1"
+ id="stop3983" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3877">
+ <stop
+ style="stop-color:#3cc8ff;stop-opacity:1;"
+ offset="0"
+ id="stop3879" />
+ <stop
+ id="stop3885"
+ offset="1"
+ style="stop-color:#14b4ff;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3857"
+ osb:paint="solid">
+ <stop
+ style="stop-color:#03062a;stop-opacity:1;"
+ offset="0"
+ id="stop3859" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3943">
+ <stop
+ id="stop3772"
+ offset="0"
+ style="stop-color:#44c8fd;stop-opacity:1;" />
+ <stop
+ style="stop-color:#284aef;stop-opacity:1;"
+ offset="0.46829268"
+ id="stop3788" />
+ <stop
+ style="stop-color:#06082a;stop-opacity:1;"
+ offset="1"
+ id="stop3947" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3877"
+ id="radialGradient3929"
+ gradientUnits="userSpaceOnUse"
+ cx="256.71875"
+ cy="256.15625"
+ fx="256.71875"
+ fy="256.15625"
+ r="235"
+ gradientTransform="translate(6.6751888,0)" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3877"
+ id="radialGradient3932"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(6.6751888,0)"
+ cx="256.71875"
+ cy="256.15625"
+ fx="256.71875"
+ fy="256.15625"
+ r="235" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3979"
+ id="linearGradient3924"
+ x1="256.12192"
+ y1="491.25339"
+ x2="256.12192"
+ y2="11.186499"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3943"
+ id="radialGradient3943"
+ cx="227.08333"
+ cy="218.25"
+ fx="227.08333"
+ fy="218.25"
+ r="197.08333"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3877"
+ id="radialGradient3964"
+ gradientUnits="userSpaceOnUse"
+ cx="258.69565"
+ cy="381.56522"
+ fx="258.69565"
+ fy="381.56522"
+ r="169.56522" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3979-0"
+ id="linearGradient3985"
+ x1="259.45453"
+ y1="256.90909"
+ x2="259.45453"
+ y2="38.000004"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="translate(0,2)" />
+ <linearGradient
+ id="linearGradient3979-0">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0.01960784;"
+ offset="0"
+ id="stop3981-1" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0.86274511;"
+ offset="1"
+ id="stop3983-0" />
+ </linearGradient>
+ <linearGradient
+ y2="38.000004"
+ x2="259.45453"
+ y1="256.90909"
+ x1="259.45453"
+ gradientTransform="translate(0,2)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient4907"
+ xlink:href="#linearGradient3979-0"
+ inkscape:collect="always" />
+ <filter
+ inkscape:collect="always"
+ id="filter5485">
+ <feGaussianBlur
+ inkscape:collect="always"
+ stdDeviation="6.7826086"
+ id="feGaussianBlur5487" />
+ </filter>
+ <filter
+ inkscape:collect="always"
+ id="filter5501">
+ <feGaussianBlur
+ inkscape:collect="always"
+ stdDeviation="3.3913043"
+ id="feGaussianBlur5503" />
+ </filter>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3943-7"
+ id="radialGradient3943-9"
+ cx="227.08333"
+ cy="218.25"
+ fx="227.08333"
+ fy="218.25"
+ r="197.08333"
+ gradientUnits="userSpaceOnUse" />
+ <linearGradient
+ id="linearGradient3943-7">
+ <stop
+ id="stop3772-1"
+ offset="0"
+ style="stop-color:#44c8fd;stop-opacity:1;" />
+ <stop
+ style="stop-color:#284aef;stop-opacity:1;"
+ offset="0.46829268"
+ id="stop3788-5" />
+ <stop
+ style="stop-color:#06082a;stop-opacity:1;"
+ offset="1"
+ id="stop3947-6" />
+ </linearGradient>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath5607">
+ <path
+ sodipodi:type="arc"
+ style="fill:#000000;fill-opacity:0.74509804;stroke:none"
+ id="path5609"
+ sodipodi:cx="227.08333"
+ sodipodi:cy="218.25"
+ sodipodi:rx="197.08333"
+ sodipodi:ry="197.08333"
+ d="M 424.16666,218.25 A 197.08333,197.08333 0 1 1 30,218.25 a 197.08333,197.08333 0 1 1 394.16666,0 z"
+ transform="matrix(1.2962957,0,0,1.2962957,-37.866811,203.33677)"
+ mask="none" />
+ </clipPath>
+ <clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath5611">
+ <path
+ sodipodi:type="arc"
+ style="fill:#000000;fill-opacity:0.74509804;stroke:none"
+ id="path5613"
+ sodipodi:cx="227.08333"
+ sodipodi:cy="218.25"
+ sodipodi:rx="197.08333"
+ sodipodi:ry="197.08333"
+ d="M 424.16666,218.25 A 197.08333,197.08333 0 1 1 30,218.25 a 197.08333,197.08333 0 1 1 394.16666,0 z"
+ transform="matrix(0.91114848,0,0,0.91114848,50.372646,143.15146)"
+ mask="none" />
+ </clipPath>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5632"
+ id="linearGradient5657"
+ gradientUnits="userSpaceOnUse"
+ x1="280.81955"
+ y1="224.967"
+ x2="280.81955"
+ y2="438.65695"
+ gradientTransform="translate(0,2)" />
+ <filter
+ inkscape:collect="always"
+ id="filter5667">
+ <feGaussianBlur
+ inkscape:collect="always"
+ stdDeviation="0.32939063"
+ id="feGaussianBlur5669" />
+ </filter>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5632-0"
+ id="linearGradient5657-3"
+ gradientUnits="userSpaceOnUse"
+ x1="280.81955"
+ y1="224.967"
+ x2="280.81955"
+ y2="438.65695"
+ gradientTransform="translate(0,2)" />
+ <linearGradient
+ id="linearGradient5632-0">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop5634-4" />
+ <stop
+ style="stop-color:#646464;stop-opacity:1;"
+ offset="1"
+ id="stop5636-0" />
+ </linearGradient>
+ <filter
+ inkscape:collect="always"
+ id="filter5717">
+ <feGaussianBlur
+ inkscape:collect="always"
+ stdDeviation="4.2775091"
+ id="feGaussianBlur5719" />
+ </filter>
+ <filter
+ inkscape:collect="always"
+ id="filter5729">
+ <feBlend
+ inkscape:collect="always"
+ mode="darken"
+ in2="BackgroundImage"
+ id="feBlend5731" />
+ </filter>
+ <filter
+ inkscape:collect="always"
+ id="filter5737">
+ <feGaussianBlur
+ inkscape:collect="always"
+ stdDeviation="2.9374501"
+ id="feGaussianBlur5739" />
+ </filter>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3877"
+ id="radialGradient5741"
+ gradientUnits="userSpaceOnUse"
+ cx="258.69565"
+ cy="381.56522"
+ fx="258.69565"
+ fy="381.56522"
+ r="169.56522" />
+ <filter
+ inkscape:collect="always"
+ id="filter5784">
+ <feGaussianBlur
+ inkscape:collect="always"
+ stdDeviation="10.173913"
+ id="feGaussianBlur5786" />
+ </filter>
+ <filter
+ inkscape:collect="always"
+ id="filter5792">
+ <feGaussianBlur
+ inkscape:collect="always"
+ stdDeviation="8.4782608"
+ id="feGaussianBlur5794" />
+ </filter>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3877"
+ id="radialGradient5796"
+ gradientUnits="userSpaceOnUse"
+ cx="258.69565"
+ cy="381.56522"
+ fx="258.69565"
+ fy="381.56522"
+ r="169.56522" />
+ <filter
+ inkscape:collect="always"
+ id="filter5845"
+ x="-0.16900845"
+ width="1.3380169"
+ y="-0.20256461"
+ height="1.4051292">
+ <feGaussianBlur
+ inkscape:collect="always"
+ stdDeviation="21.923266"
+ id="feGaussianBlur5847" />
+ </filter>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.59"
+ inkscape:cx="247.81648"
+ inkscape:cy="251.19615"
+ inkscape:current-layer="layer9"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ inkscape:window-width="1629"
+ inkscape:window-height="1006"
+ inkscape:window-x="47"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0" />
+ <metadata
+ id="metadata2990">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="shadow"
+ id="g4931"
+ inkscape:groupmode="layer"
+ style="filter:url(#filter5729)"
+ sodipodi:insensitive="true">
+ <path
+ transform="matrix(1.0008681,0,0,1.0008681,-0.32354214,1.8790597)"
+ d="m 500.88873,255.89879 a 244.78751,244.78751 0 1 1 -489.575009,0 244.78751,244.78751 0 1 1 489.575009,0 z"
+ sodipodi:ry="244.78751"
+ sodipodi:rx="244.78751"
+ sodipodi:cy="255.89879"
+ sodipodi:cx="256.10123"
+ id="path4933"
+ style="fill:#000000;fill-opacity:0.74509804;stroke:none;filter:url(#filter5737)"
+ sodipodi:type="arc" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="chrome"
+ sodipodi:insensitive="true">
+ <path
+ sodipodi:type="arc"
+ style="fill:url(#linearGradient3924);fill-opacity:1;stroke:none"
+ id="path3148"
+ sodipodi:cx="256.10123"
+ sodipodi:cy="255.89879"
+ sodipodi:rx="244.78751"
+ sodipodi:ry="244.78751"
+ d="m 500.88873,255.89879 a 244.78751,244.78751 0 1 1 -489.575009,0 244.78751,244.78751 0 1 1 489.575009,0 z"
+ transform="matrix(1.0008681,0,0,1.0008681,-0.32354214,-0.12094033)" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer3"
+ inkscape:label="base-glass"
+ sodipodi:insensitive="true">
+ <path
+ sodipodi:type="arc"
+ style="fill:url(#radialGradient3943);fill-opacity:1;stroke:none"
+ id="path3927"
+ sodipodi:cx="227.08333"
+ sodipodi:cy="218.25"
+ sodipodi:rx="197.08333"
+ sodipodi:ry="197.08333"
+ d="M 424.16666,218.25 A 197.08333,197.08333 0 1 1 30,218.25 a 197.08333,197.08333 0 1 1 394.16666,0 z"
+ transform="matrix(1.1467231,0,0,1.1467231,-4.401693,5.727699)"
+ mask="none" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer4"
+ inkscape:label="glows"
+ sodipodi:insensitive="true"
+ style="display:inline">
+ <path
+ sodipodi:type="arc"
+ style="fill:url(#radialGradient5741);fill-opacity:1;stroke:none;filter:url(#filter5501)"
+ id="path3946"
+ sodipodi:cx="258.69565"
+ sodipodi:cy="381.56522"
+ sodipodi:rx="169.56522"
+ sodipodi:ry="169.56522"
+ d="m 428.26086,381.56522 a 169.56522,169.56522 0 1 1 -339.130428,0 169.56522,169.56522 0 1 1 339.130428,0 z"
+ transform="matrix(1.2585469,0,0,1.2585469,-67.79803,-174.43515)"
+ clip-path="url(#clipPath5611)" />
+ <path
+ transform="matrix(0.88461539,0,0,0.88461539,29.095871,-174.14716)"
+ d="m 428.26086,381.56522 a 169.56522,169.56522 0 1 1 -339.130428,0 169.56522,169.56522 0 1 1 339.130428,0 z"
+ sodipodi:ry="169.56522"
+ sodipodi:rx="169.56522"
+ sodipodi:cy="381.56522"
+ sodipodi:cx="258.69565"
+ id="path3962"
+ style="fill:url(#radialGradient3964);fill-opacity:1;stroke:none;filter:url(#filter5485)"
+ sodipodi:type="arc"
+ clip-path="url(#clipPath5607)" />
+ </g>
+ <g
+ inkscape:label="glows2"
+ id="g5762"
+ inkscape:groupmode="layer"
+ style="opacity:0.73999999;display:inline"
+ sodipodi:insensitive="true">
+ <path
+ clip-path="url(#clipPath5611)"
+ transform="matrix(1.2585469,0,0,1.2585469,-67.79803,-174.43515)"
+ d="m 428.26086,381.56522 a 169.56522,169.56522 0 1 1 -339.130428,0 169.56522,169.56522 0 1 1 339.130428,0 z"
+ sodipodi:ry="169.56522"
+ sodipodi:rx="169.56522"
+ sodipodi:cy="381.56522"
+ sodipodi:cx="258.69565"
+ id="path5764"
+ style="fill:url(#radialGradient5796);fill-opacity:1;stroke:none;filter:url(#filter5792)"
+ sodipodi:type="arc" />
+ <path
+ clip-path="url(#clipPath5607)"
+ sodipodi:type="arc"
+ style="fill:url(#radialGradient3964);fill-opacity:1;stroke:none;filter:url(#filter5784)"
+ id="path5766"
+ sodipodi:cx="258.69565"
+ sodipodi:cy="381.56522"
+ sodipodi:rx="169.56522"
+ sodipodi:ry="169.56522"
+ d="m 428.26086,381.56522 a 169.56522,169.56522 0 1 1 -339.130428,0 169.56522,169.56522 0 1 1 339.130428,0 z"
+ transform="matrix(0.88461539,0,0,0.88461539,29.095871,-174.14716)" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer9"
+ inkscape:label="glow3"
+ style="opacity:0.7">
+ <path
+ sodipodi:type="arc"
+ style="fill:#23c8ff;fill-opacity:1;stroke:none;filter:url(#filter5845)"
+ id="path5799"
+ sodipodi:cx="260.0629"
+ sodipodi:cy="345.01886"
+ sodipodi:rx="155.66037"
+ sodipodi:ry="129.87421"
+ d="m 415.72327,345.01886 a 155.66037,129.87421 0 1 1 -311.32074,0 155.66037,129.87421 0 1 1 311.32074,0 z"
+ transform="matrix(0.92027607,0,0,0.82232826,17.588582,32.614052)"
+ inkscape:export-filename="/Users/pigoz/Documents/mplayer-icons/compiled/path5799.png"
+ inkscape:export-xdpi="85.699997"
+ inkscape:export-ydpi="85.699997" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer8"
+ inkscape:label="gloss-clipping"
+ sodipodi:insensitive="true" />
+ <g
+ inkscape:groupmode="layer"
+ id="layer6"
+ inkscape:label="play"
+ sodipodi:insensitive="true">
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:none;filter:url(#filter5717)"
+ inkscape:transform-center-x="-31.26597"
+ inkscape:transform-center-y="-0.032805761"
+ d="m 190.37028,382.72523 0,-120.00058 0,-120.0006 93.87484,60.04949 93.87489,60.04951 -93.87489,59.95109 z"
+ id="path3999-1"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccccc"
+ inkscape:export-filename="/Users/pigoz/Documents/icon-mplayer.png"
+ inkscape:export-xdpi="85.699997"
+ inkscape:export-ydpi="85.699997" />
+ <path
+ style="fill:url(#linearGradient5657);fill-opacity:1;stroke:#000000;stroke-width:6;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ inkscape:transform-center-x="-29.755544"
+ inkscape:transform-center-y="-0.03121957"
+ d="m 194.68911,375.82668 0,-114.20348 0,-114.2035 89.33985,57.14856 89.33989,57.14858 -89.33989,57.05492 z"
+ id="path3999"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccccc"
+ inkscape:export-filename="/Users/pigoz/Documents/icon-mplayer.png"
+ inkscape:export-xdpi="85.699997"
+ inkscape:export-ydpi="85.699997" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer5"
+ inkscape:label="white-gloss"
+ style="opacity:0.9137931;display:inline"
+ sodipodi:insensitive="true">
+ <path
+ style="fill:url(#linearGradient4907);fill-opacity:1;stroke:none;display:inline;filter:url(#filter5667)"
+ d="M 256,42.90625 C 142.67988,42.90625 49.723058,129.38336 40.3125,239.5 98.19077,257.96934 164.46733,270.1875 258,270.1875 c 96.86848,0 137.8965,-5.8873 213.8125,-29.4375 C 463.00354,130.03648 369.74992,42.90625 256,42.90625 z"
+ id="path3950"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="scscs"
+ inkscape:export-filename="/Users/pigoz/Documents/icon-mplayer.png"
+ inkscape:export-xdpi="85.699997"
+ inkscape:export-ydpi="85.699997"
+ transform="matrix(0.99524152,0,0,0.99524152,0.95307007,-2.3236889)" />
+ </g>
+</svg>
diff --git a/fmt-conversion.c b/fmt-conversion.c
index 9e1154d318..9f14565317 100644
--- a/fmt-conversion.c
+++ b/fmt-conversion.c
@@ -101,6 +101,8 @@ static const struct {
{IMGFMT_444P, PIX_FMT_YUVJ444P},
{IMGFMT_440P, PIX_FMT_YUVJ440P},
+ {IMGFMT_BGR0, PIX_FMT_BGR0},
+
{IMGFMT_VDPAU_MPEG1, PIX_FMT_VDPAU_MPEG1},
{IMGFMT_VDPAU_MPEG2, PIX_FMT_VDPAU_MPEG2},
{IMGFMT_VDPAU_H264, PIX_FMT_VDPAU_H264},
diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c
index 7f82f95db2..1084a8f9a1 100644
--- a/libmpcodecs/img_format.c
+++ b/libmpcodecs/img_format.c
@@ -191,10 +191,10 @@ struct mp_imgfmt_entry mp_imgfmt_list[] = {
{"argb", IMGFMT_ARGB},
{"bgra", IMGFMT_BGRA},
{"abgr", IMGFMT_ABGR},
+ {"bgr0", IMGFMT_BGR0},
{"gbrp", IMGFMT_GBRP},
{"mjpeg", IMGFMT_MJPEG},
{"mjpg", IMGFMT_MJPEG},
- {"mpes", IMGFMT_MPEGPES},
{"vdpau_h264", IMGFMT_VDPAU_H264},
{"vdpau_mpeg1", IMGFMT_VDPAU_MPEG1},
{"vdpau_mpeg2", IMGFMT_VDPAU_MPEG2},
diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h
index 42e601a270..b488734f02 100644
--- a/libmpcodecs/img_format.h
+++ b/libmpcodecs/img_format.h
@@ -101,6 +101,8 @@
#define IMGFMT_RGB_DEPTH(fmt) ((fmt)&0x3F)
#define IMGFMT_BGR_DEPTH(fmt) ((fmt)&0x3F)
+// AV_PIX_FMT_BGR0
+#define IMGFMT_BGR0 0x1DC70000
/* Planar YUV Formats */
@@ -196,7 +198,6 @@
#define IMGFMT_UYVP 0x50565955 // 10-bit UYVY
/* Compressed Formats */
-#define IMGFMT_MPEGPES (('M'<<24)|('P'<<16)|('E'<<8)|('S'))
#define IMGFMT_MJPEG (('M')|('J'<<8)|('P'<<16)|('G'<<24))
// VDPAU specific format.
diff --git a/libmpcodecs/mp_image.c b/libmpcodecs/mp_image.c
index f01e416b01..b7c9017188 100644
--- a/libmpcodecs/mp_image.c
+++ b/libmpcodecs/mp_image.c
@@ -120,7 +120,7 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
mpi->flags&=~(MP_IMGFLAG_PLANAR|MP_IMGFLAG_YUV|MP_IMGFLAG_SWAPPED);
mpi->imgfmt=out_fmt;
// compressed formats
- if(out_fmt == IMGFMT_MPEGPES || IMGFMT_IS_HWACCEL(out_fmt)){
+ if(IMGFMT_IS_HWACCEL(out_fmt)){
mpi->bpp=0;
return;
}
@@ -140,6 +140,11 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
mpi->flags|=MP_IMGFLAG_SWAPPED;
return;
}
+ switch (out_fmt) {
+ case IMGFMT_BGR0:
+ mpi->bpp = 32;
+ return;
+ }
mpi->num_planes=3;
if (out_fmt == IMGFMT_GBRP) {
mpi->bpp=24;
diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c
index 48e2b0627e..511665aeac 100644
--- a/libmpcodecs/vd.c
+++ b/libmpcodecs/vd.c
@@ -60,8 +60,7 @@ int mpcodecs_config_vo2(sh_video_t *sh, int w, int h,
unsigned int out_fmt = 0;
int screen_size_x = 0;
int screen_size_y = 0;
- vf_instance_t *vf = sh->vfilter, *sc = NULL;
- int palette = 0;
+ vf_instance_t *vf = sh->vfilter;
int vocfg_flags = 0;
if (w)
@@ -125,58 +124,14 @@ int mpcodecs_config_vo2(sh_video_t *sh, int w, int h,
sh->output_flags = flags;
if (flags & VFCAP_CSP_SUPPORTED_BY_HW)
break;
- } else if (!palette
- && !(flags &
- (VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_CSP_SUPPORTED))
- && (out_fmt == IMGFMT_RGB8 || out_fmt == IMGFMT_BGR8)) {
- sh->outfmtidx = j; // pass index to the control() function this way
- if (sh->vd_driver->control(sh, VDCTRL_QUERY_FORMAT, &out_fmt) !=
- CONTROL_FALSE)
- palette = 1;
}
}
if (j < 0) {
// TODO: no match - we should use conversion...
- if (strcmp(vf->info->name, "scale") && palette != -1) {
+ if (strcmp(vf->info->name, "scale")) {
mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "Could not find matching colorspace - retrying with -vf scale...\n");
- sc = vf = vf_open_filter(opts, vf, "scale", NULL);
- goto csp_again;
- } else if (palette == 1) {
- mp_msg(MSGT_DECVIDEO, MSGL_V, "vd: Trying -vf palette...\n");
- palette = -1;
- vf = vf_open_filter(opts, vf, "palette", NULL);
+ vf = vf_open_filter(opts, vf, "scale", NULL);
goto csp_again;
- } else {
- // sws failed, if the last filter (vf_vo) support MPEGPES try
- // to append vf_lavc
- vf_instance_t *vo, *vp = NULL, *ve, *vpp = NULL;
- // Remove the scale filter if we added it ourselves
- if (vf == sc) {
- ve = vf;
- vf = vf->next;
- vf_uninit_filter(ve);
- }
- // Find the last filter (vf_vo)
- for (vo = vf; vo->next; vo = vo->next) {
- vpp = vp;
- vp = vo;
- }
- if (vo->query_format(vo, IMGFMT_MPEGPES)
- && (!vp || (vp && strcmp(vp->info->name, "lavc")))) {
- ve = vf_open_filter(opts, vo, "lavc", NULL);
- if (vp)
- vp->next = ve;
- else
- vf = ve;
- goto csp_again;
- }
- if (vp && !strcmp(vp->info->name,"lavc")) {
- if (vpp)
- vpp->next = vo;
- else
- vf = vo;
- vf_uninit_filter(vp);
- }
}
mp_tmsg(MSGT_CPLAYER, MSGL_WARN,
"The selected video_out device is incompatible with this codec.\n"\
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index d36e4122a0..343a26d8d3 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -583,9 +583,6 @@ static void release_buffer(struct AVCodecContext *avctx, AVFrame *pic)
}
if (mpi) {
- // Palette support: free palette buffer allocated in get_buffer
- if (mpi->bpp == 8)
- av_freep(&mpi->planes[1]);
// release mpi (in case MPI_IMGTYPE_NUMBERED is used, e.g. for VDPAU)
mpi->usage_count--;
}
diff --git a/libmpcodecs/vd_internal.h b/libmpcodecs/vd_internal.h
deleted file mode 100644
index b4d74a6a48..0000000000
--- a/libmpcodecs/vd_internal.h
+++ /dev/null
@@ -1,48 +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.
- */
-
-#ifndef MPLAYER_VD_INTERNAL_H
-#define MPLAYER_VD_INTERNAL_H
-
-#include "codec-cfg.h"
-#include "img_format.h"
-
-#include "stream/stream.h"
-#include "libmpdemux/demuxer.h"
-#include "libmpdemux/stheader.h"
-
-#include "vd.h"
-
-extern int divx_quality;
-
-// prototypes:
-//static vd_info_t info;
-static int control(sh_video_t *sh,int cmd,void* arg,...);
-static int init(sh_video_t *sh);
-static void uninit(sh_video_t *sh);
-static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags);
-
-#define LIBVD_EXTERN(x) const vd_functions_t mpcodecs_vd_##x = {\
- &info,\
- init,\
- uninit,\
- control,\
- decode\
-};
-
-#endif /* MPLAYER_VD_INTERNAL_H */
diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c
index 9ea17f978c..39a720a893 100644
--- a/libmpcodecs/vf.c
+++ b/libmpcodecs/vf.c
@@ -250,6 +250,8 @@ mp_image_t *vf_get_image(vf_instance_t *vf, unsigned int outfmt,
break;
}
if (mpi) {
+ int missing_palette = !(mpi->flags & MP_IMGFLAG_RGB_PALETTE) &&
+ (mp_imgflag & MP_IMGFLAG_RGB_PALETTE);
mpi->type = mp_imgtype;
mpi->w = vf->w;
mpi->h = vf->h;
@@ -261,11 +263,15 @@ mp_image_t *vf_get_image(vf_instance_t *vf, unsigned int outfmt,
MP_IMGFLAG_DRAW_CALLBACK | MP_IMGFLAG_RGB_PALETTE);
if (!vf->draw_slice)
mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK;
- if (mpi->width != w2 || mpi->height != h) {
+ if (mpi->width != w2 || mpi->height != h || missing_palette) {
if (mpi->flags & MP_IMGFLAG_ALLOCATED) {
- if (mpi->width < w2 || mpi->height < h) {
+ if (mpi->width < w2 || mpi->height < h || missing_palette) {
// need to re-allocate buffer memory:
av_free(mpi->planes[0]);
+ if (mpi->flags & MP_IMGFLAG_RGB_PALETTE)
+ av_free(mpi->planes[1]);
+ for (int n = 0; n < MP_MAX_PLANES; n++)
+ mpi->planes[n] = NULL;
mpi->flags &= ~MP_IMGFLAG_ALLOCATED;
mp_msg(MSGT_VFILTER, MSGL_V,
"vf.c: have to REALLOCATE buffer memory :(\n");
@@ -355,11 +361,8 @@ mp_image_t *vf_get_image(vf_instance_t *vf, unsigned int outfmt,
//============================================================================
-// By default vf doesn't accept MPEGPES
static int vf_default_query_format(struct vf_instance *vf, unsigned int fmt)
{
- if (fmt == IMGFMT_MPEGPES)
- return 0;
return vf_next_query_format(vf, fmt);
}
diff --git a/libmpcodecs/vf_dlopen.c b/libmpcodecs/vf_dlopen.c
index 71da4f1636..183b31be84 100644
--- a/libmpcodecs/vf_dlopen.c
+++ b/libmpcodecs/vf_dlopen.c
@@ -281,7 +281,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
static int query_format(struct vf_instance *vf, unsigned int fmt)
{
- if (IMGFMT_IS_HWACCEL(fmt) || fmt == IMGFMT_MJPEG || fmt == IMGFMT_MPEGPES)
+ if (IMGFMT_IS_HWACCEL(fmt))
return 0; // these can't really be filtered
if (fmt == IMGFMT_RGB8 || fmt == IMGFMT_BGR8)
return 0; // we don't have palette support, sorry
diff --git a/libmpcodecs/vf_expand.c b/libmpcodecs/vf_expand.c
index b8ac9f728d..ff13a8501e 100644
--- a/libmpcodecs/vf_expand.c
+++ b/libmpcodecs/vf_expand.c
@@ -48,7 +48,6 @@ static struct vf_priv_s {
int exp_x,exp_y;
double aspect;
int round;
- int passthrough;
int first_slice;
} const vf_priv_dflt = {
-1,-1,
@@ -57,7 +56,6 @@ static struct vf_priv_s {
-1,-1,
0.,
1,
- 0,
0
};
@@ -69,10 +67,6 @@ static int config(struct vf_instance *vf,
{
struct MPOpts *opts = vf->opts;
mp_image_t test_mpi;
- if(outfmt == IMGFMT_MPEGPES) {
- vf->priv->passthrough = 1;
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
- }
mp_image_setfmt(&test_mpi, outfmt);
if (outfmt == IMGFMT_IF09 || !test_mpi.bpp) return 0;
vf->priv->exp_x = vf->priv->cfg_exp_x;
@@ -261,13 +255,6 @@ static void clear_borders(struct vf_instance *vf, int w, int h)
}
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- if (vf->priv->passthrough) {
- mp_image_t *dmpi = vf_get_image(vf->next, IMGFMT_MPEGPES,
- MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h);
- dmpi->planes[0]=mpi->planes[0];
- return vf_next_put_image(vf,dmpi, pts);
- }
-
if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
vf->dmpi=mpi->priv;
if(!vf->dmpi) { mp_tmsg(MSGT_VFILTER, MSGL_WARN, "Why do we get NULL??\n"); return 0; }
diff --git a/libvo/cocoa_common.h b/libvo/cocoa_common.h
index 943a5fb8ba..079e497441 100644
--- a/libvo/cocoa_common.h
+++ b/libvo/cocoa_common.h
@@ -22,6 +22,8 @@
#include "video_out.h"
+struct vo_cocoa_state;
+
bool vo_cocoa_gui_running(void);
void *vo_cocoa_glgetaddr(const char *s);
@@ -35,17 +37,19 @@ int vo_cocoa_create_window(struct vo *vo, uint32_t d_width,
uint32_t d_height, uint32_t flags,
int gl3profile);
-void vo_cocoa_swap_buffers(void);
+void vo_cocoa_swap_buffers(struct vo *vo);
int vo_cocoa_check_events(struct vo *vo);
void vo_cocoa_fullscreen(struct vo *vo);
void vo_cocoa_ontop(struct vo *vo);
+void vo_cocoa_pause(struct vo *vo);
+void vo_cocoa_resume(struct vo *vo);
// returns an int to conform to the gl extensions from other platforms
int vo_cocoa_swap_interval(int enabled);
-void *vo_cocoa_cgl_context(void);
-void *vo_cocoa_cgl_pixel_format(void);
+void *vo_cocoa_cgl_context(struct vo *vo);
+void *vo_cocoa_cgl_pixel_format(struct vo *vo);
-int vo_cocoa_cgl_color_size(void);
+int vo_cocoa_cgl_color_size(struct vo *vo);
#endif /* MPLAYER_COCOA_COMMON_H */
diff --git a/libvo/cocoa_common.m b/libvo/cocoa_common.m
index 331072afcf..b220da8798 100644
--- a/libvo/cocoa_common.m
+++ b/libvo/cocoa_common.m
@@ -18,9 +18,8 @@
*/
#import <Cocoa/Cocoa.h>
-#import <OpenGL/OpenGL.h>
-#import <QuartzCore/QuartzCore.h>
#import <CoreServices/CoreServices.h> // for CGDisplayHideCursor
+#import <IOKit/pwr_mgt/IOPMLib.h>
#include <dlfcn.h>
#include "cocoa_common.h"
@@ -62,13 +61,22 @@
@end
#endif
-@interface GLMPlayerWindow : NSWindow <NSWindowDelegate>
-- (BOOL) canBecomeKeyWindow;
-- (BOOL) canBecomeMainWindow;
-- (void) fullscreen;
-- (void) mouseEvent:(NSEvent *)theEvent;
-- (void) mulSize:(float)multiplier;
-- (void) setContentSize:(NSSize)newSize keepCentered:(BOOL)keepCentered;
+// add power management assertion not available on OSX versions prior to 10.7
+#ifndef kIOPMAssertionTypePreventUserIdleDisplaySleep
+#define kIOPMAssertionTypePreventUserIdleDisplaySleep \
+ CFSTR("PreventUserIdleDisplaySleep")
+#endif
+
+@interface GLMPlayerWindow : NSWindow <NSWindowDelegate> {
+ struct vo *_vo;
+}
+- (void)setVideoOutput:(struct vo *)vo;
+- (BOOL)canBecomeKeyWindow;
+- (BOOL)canBecomeMainWindow;
+- (void)fullscreen;
+- (void)mouseEvent:(NSEvent *)theEvent;
+- (void)mulSize:(float)multiplier;
+- (void)setContentSize:(NSSize)newSize keepCentered:(BOOL)keepCentered;
@end
@interface GLMPlayerOpenGLView : NSView
@@ -94,44 +102,39 @@ struct vo_cocoa_state {
NSString *window_title;
- NSInteger windowed_window_level;
+ NSInteger window_level;
NSInteger fullscreen_window_level;
- int last_screensaver_update;
-
int display_cursor;
int cursor_timer;
int cursor_autohide_delay;
bool did_resize;
bool out_fs_resize;
-};
-struct vo_cocoa_state *s;
+ IOPMAssertionID power_mgmt_assertion;
+};
-struct vo *l_vo;
+static int _instances = 0;
-// local function definitions
-struct vo_cocoa_state *vo_cocoa_init_state(void);
-void vo_set_level(int ontop);
-void update_screen_info(void);
-void resize_window(struct vo *vo);
-void vo_cocoa_display_cursor(int requested_state);
-void create_menu(void);
+static void create_menu(void);
-struct vo_cocoa_state *vo_cocoa_init_state(void)
+static struct vo_cocoa_state *vo_cocoa_init_state(struct vo *vo)
{
- struct vo_cocoa_state *s = talloc_ptrtype(NULL, s);
+ struct vo_cocoa_state *s = talloc_ptrtype(vo, s);
*s = (struct vo_cocoa_state){
+ .pool = [[NSAutoreleasePool alloc] init],
.did_resize = NO,
.current_video_size = {0,0},
.previous_video_size = {0,0},
- .windowed_mask = NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask,
+ .windowed_mask = NSTitledWindowMask|NSClosableWindowMask|
+ NSMiniaturizableWindowMask|NSResizableWindowMask,
.fullscreen_mask = NSBorderlessWindowMask,
- .fullscreen_window_level = NSNormalWindowLevel + 1,
.windowed_frame = {{0,0},{0,0}},
.out_fs_resize = NO,
.display_cursor = 1,
+ .cursor_autohide_delay = vo->opts->cursor_autohide_delay,
+ .power_mgmt_assertion = kIOPMNullAssertionID,
};
return s;
}
@@ -145,7 +148,7 @@ static bool supports_hidpi(NSView *view)
bool vo_cocoa_gui_running(void)
{
- return !!s;
+ return _instances > 0;
}
void *vo_cocoa_glgetaddr(const char *s)
@@ -161,21 +164,45 @@ void *vo_cocoa_glgetaddr(const char *s)
return ret;
}
+static void enable_power_management(struct vo *vo)
+{
+ struct vo_cocoa_state *s = vo->cocoa;
+ if (!s->power_mgmt_assertion) return;
+ IOPMAssertionRelease(s->power_mgmt_assertion);
+ s->power_mgmt_assertion = kIOPMNullAssertionID;
+}
+
+static void disable_power_management(struct vo *vo)
+{
+ struct vo_cocoa_state *s = vo->cocoa;
+ if (s->power_mgmt_assertion) return;
+
+ CFStringRef assertion_type = kIOPMAssertionTypeNoDisplaySleep;
+ if (is_osx_version_at_least(10, 7, 0))
+ assertion_type = kIOPMAssertionTypePreventUserIdleDisplaySleep;
+
+ IOPMAssertionCreateWithName(assertion_type, kIOPMAssertionLevelOn,
+ CFSTR("org.mplayer2.power_mgmt"), &s->power_mgmt_assertion);
+}
+
int vo_cocoa_init(struct vo *vo)
{
- s = vo_cocoa_init_state();
- s->pool = [[NSAutoreleasePool alloc] init];
- s->cursor_autohide_delay = vo->opts->cursor_autohide_delay;
+ vo->cocoa = vo_cocoa_init_state(vo);
+ _instances++;
+
NSApplicationLoad();
NSApp = [NSApplication sharedApplication];
[NSApp setActivationPolicy: NSApplicationActivationPolicyRegular];
+ disable_power_management(vo);
return 1;
}
void vo_cocoa_uninit(struct vo *vo)
{
+ struct vo_cocoa_state *s = vo->cocoa;
CGDisplayShowCursor(kCGDirectMainDisplay);
+ enable_power_management(vo);
[NSApp setPresentationOptions:NSApplicationPresentationDefault];
[s->window release];
@@ -185,22 +212,34 @@ void vo_cocoa_uninit(struct vo *vo)
[s->pool release];
s->pool = nil;
- talloc_free(s);
- s = nil;
+ _instances--;
+}
+
+void vo_cocoa_pause(struct vo *vo)
+{
+ enable_power_management(vo);
}
-static int current_screen_has_dock_or_menubar(void)
+void vo_cocoa_resume(struct vo *vo)
{
+ disable_power_management(vo);
+}
+
+static int current_screen_has_dock_or_menubar(struct vo *vo)
+{
+ struct vo_cocoa_state *s = vo->cocoa;
NSRect f = s->screen_frame;
NSRect vf = [s->screen_handle visibleFrame];
return f.size.height > vf.size.height || f.size.width > vf.size.width;
}
-void update_screen_info(void)
+static void update_screen_info(struct vo *vo)
{
+ struct vo_cocoa_state *s = vo->cocoa;
s->screen_array = [NSScreen screens];
if (xinerama_screen >= (int)[s->screen_array count]) {
- mp_msg(MSGT_VO, MSGL_INFO, "[cocoa] Device ID %d does not exist, falling back to main device\n", xinerama_screen);
+ mp_msg(MSGT_VO, MSGL_INFO, "[cocoa] Device ID %d does not exist, "
+ "falling back to main device\n", xinerama_screen);
xinerama_screen = -1;
}
@@ -216,8 +255,10 @@ void update_screen_info(void)
void vo_cocoa_update_xinerama_info(struct vo *vo)
{
- update_screen_info();
- aspect_save_screenres(vo, s->screen_frame.size.width, s->screen_frame.size.height);
+ struct vo_cocoa_state *s = vo->cocoa;
+ update_screen_info(vo);
+ aspect_save_screenres(vo, s->screen_frame.size.width,
+ s->screen_frame.size.height);
}
int vo_cocoa_change_attributes(struct vo *vo)
@@ -225,8 +266,9 @@ int vo_cocoa_change_attributes(struct vo *vo)
return 0;
}
-void resize_window(struct vo *vo)
+static void resize_window(struct vo *vo)
{
+ struct vo_cocoa_state *s = vo->cocoa;
NSView *view = [s->window contentView];
NSRect frame;
@@ -241,106 +283,147 @@ void resize_window(struct vo *vo)
[s->glContext update];
}
-void vo_set_level(int ontop)
+static void vo_set_level(struct vo *vo, int ontop)
{
+ struct vo_cocoa_state *s = vo->cocoa;
if (ontop) {
- s->windowed_window_level = NSNormalWindowLevel + 1;
+ s->window_level = NSNormalWindowLevel + 1;
} else {
- s->windowed_window_level = NSNormalWindowLevel;
+ s->window_level = NSNormalWindowLevel;
}
if (!vo_fs)
- [s->window setLevel:s->windowed_window_level];
+ [s->window setLevel:s->window_level];
}
void vo_cocoa_ontop(struct vo *vo)
{
struct MPOpts *opts = vo->opts;
opts->vo_ontop = !opts->vo_ontop;
- vo_set_level(opts->vo_ontop);
+ vo_set_level(vo, opts->vo_ontop);
}
-int vo_cocoa_create_window(struct vo *vo, uint32_t d_width,
- uint32_t d_height, uint32_t flags,
- int gl3profile)
+static void update_state_sizes(struct vo_cocoa_state *s,
+ uint32_t d_width, uint32_t d_height)
{
- struct MPOpts *opts = vo->opts;
if (s->current_video_size.width > 0 || s->current_video_size.height > 0)
s->previous_video_size = s->current_video_size;
s->current_video_size = NSMakeSize(d_width, d_height);
+}
- if (!(s->window || s->glContext)) { // keep using the same window
- s->window = [[GLMPlayerWindow alloc] initWithContentRect:NSMakeRect(0, 0, d_width, d_height)
- styleMask:s->windowed_mask
- backing:NSBackingStoreBuffered defer:NO];
-
- GLMPlayerOpenGLView *glView = [[GLMPlayerOpenGLView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];
-
- // check for HiDPI support and enable it (available on 10.7 +)
- if (supports_hidpi(glView))
- [glView setWantsBestResolutionOpenGLSurface:YES];
-
- int i = 0;
- NSOpenGLPixelFormatAttribute attr[32];
- if (is_osx_version_at_least(10, 7, 0)) {
- attr[i++] = NSOpenGLPFAOpenGLProfile;
- attr[i++] = (gl3profile ? NSOpenGLProfileVersion3_2Core : NSOpenGLProfileVersionLegacy);
- } else if(gl3profile) {
- mp_msg(MSGT_VO, MSGL_ERR,
- "[cocoa] Invalid pixel format attribute "
- "(GL3 is not supported on OSX versions prior to 10.7)\n");
- return -1;
- }
- attr[i++] = NSOpenGLPFADoubleBuffer; // double buffered
- attr[i] = (NSOpenGLPixelFormatAttribute)0;
-
- s->pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attr] autorelease];
- if (!s->pixelFormat) {
- mp_msg(MSGT_VO, MSGL_ERR,
- "[cocoa] Invalid pixel format attribute "
- "(GL3 not supported?)\n");
- return -1;
- }
- s->glContext = [[NSOpenGLContext alloc] initWithFormat:s->pixelFormat shareContext:nil];
+static int create_window(struct vo *vo, uint32_t d_width, uint32_t d_height,
+ uint32_t flags, int gl3profile)
+{
+ struct vo_cocoa_state *s = vo->cocoa;
+ struct MPOpts *opts = vo->opts;
+
+ const NSRect window_rect = NSMakeRect(0, 0, d_width, d_height);
+ const NSRect glview_rect = NSMakeRect(0, 0, 100, 100);
+
+ s->window =
+ [[GLMPlayerWindow alloc] initWithContentRect:window_rect
+ styleMask:s->windowed_mask
+ backing:NSBackingStoreBuffered
+ defer:NO];
+
+ GLMPlayerOpenGLView *glView =
+ [[GLMPlayerOpenGLView alloc] initWithFrame:glview_rect];
+
+ // check for HiDPI support and enable it (available on 10.7 +)
+ if (supports_hidpi(glView))
+ [glView setWantsBestResolutionOpenGLSurface:YES];
+
+ int i = 0;
+ NSOpenGLPixelFormatAttribute attr[32];
+ if (is_osx_version_at_least(10, 7, 0)) {
+ attr[i++] = NSOpenGLPFAOpenGLProfile;
+ if (gl3profile) {
+ attr[i++] = NSOpenGLProfileVersion3_2Core;
+ } else {
+ attr[i++] = NSOpenGLProfileVersionLegacy;
+ }
+ } else if(gl3profile) {
+ mp_msg(MSGT_VO, MSGL_ERR,
+ "[cocoa] Invalid pixel format attribute "
+ "(GL3 is not supported on OSX versions prior to 10.7)\n");
+ return -1;
+ }
+ attr[i++] = NSOpenGLPFADoubleBuffer; // double buffered
+ attr[i] = (NSOpenGLPixelFormatAttribute)0;
+
+ s->pixelFormat =
+ [[[NSOpenGLPixelFormat alloc] initWithAttributes:attr] autorelease];
+ if (!s->pixelFormat) {
+ mp_msg(MSGT_VO, MSGL_ERR,
+ "[cocoa] Invalid pixel format attribute "
+ "(GL3 not supported?)\n");
+ return -1;
+ }
+ s->glContext =
+ [[NSOpenGLContext alloc] initWithFormat:s->pixelFormat
+ shareContext:nil];
+
+ create_menu();
+
+ [s->window setContentView:glView];
+ [glView release];
+ [s->window setAcceptsMouseMovedEvents:YES];
+ [s->glContext setView:glView];
+ [s->glContext makeCurrentContext];
+
+ [NSApp setDelegate:s->window];
+ [s->window setDelegate:s->window];
+ [s->window setContentSize:s->current_video_size];
+ [s->window setContentAspectRatio:s->current_video_size];
+ [s->window center];
+
+ if (flags & VOFLAG_HIDDEN) {
+ [s->window orderOut:nil];
+ } else {
+ [s->window makeKeyAndOrderFront:nil];
+ [NSApp activateIgnoringOtherApps:YES];
+ }
- create_menu();
+ if (flags & VOFLAG_FULLSCREEN)
+ vo_cocoa_fullscreen(vo);
- [s->window setContentView:glView];
- [glView release];
- [s->window setAcceptsMouseMovedEvents:YES];
- [s->glContext setView:glView];
- [s->glContext makeCurrentContext];
+ vo_set_level(vo, opts->vo_ontop);
- [NSApp setDelegate:s->window];
- [s->window setDelegate:s->window];
- [s->window setContentSize:s->current_video_size];
- [s->window setContentAspectRatio:s->current_video_size];
- [s->window center];
+ return 0;
+}
+
+static void update_window(struct vo *vo)
+{
+ struct vo_cocoa_state *s = vo->cocoa;
- if (flags & VOFLAG_HIDDEN) {
- [s->window orderOut:nil];
+ if (s->current_video_size.width != s->previous_video_size.width ||
+ s->current_video_size.height != s->previous_video_size.height) {
+ if (vo_fs) {
+ // we will resize as soon as we get out of fullscreen
+ s->out_fs_resize = YES;
} else {
- [s->window makeKeyAndOrderFront:nil];
- [NSApp activateIgnoringOtherApps:YES];
+ // only if we are not in fullscreen and the video size did
+ // change we resize the window and set a new aspect ratio
+ [s->window setContentSize:s->current_video_size
+ keepCentered:YES];
+ [s->window setContentAspectRatio:s->current_video_size];
}
+ }
+}
+
+int vo_cocoa_create_window(struct vo *vo, uint32_t d_width,
+ uint32_t d_height, uint32_t flags,
+ int gl3profile)
+{
+ struct vo_cocoa_state *s = vo->cocoa;
- if (flags & VOFLAG_FULLSCREEN)
- vo_cocoa_fullscreen(vo);
+ update_state_sizes(s, d_width, d_height);
- vo_set_level(opts->vo_ontop);
+ if (!(s->window || s->glContext)) {
+ if (create_window(vo, d_width, d_height, flags, gl3profile) < 0)
+ return -1;
} else {
- if (s->current_video_size.width != s->previous_video_size.width ||
- s->current_video_size.height != s->previous_video_size.height) {
- if (vo_fs) {
- // we will resize as soon as we get out of fullscreen
- s->out_fs_resize = YES;
- } else {
- // only if we are not in fullscreen and the video size did change
- // we actually resize the window and set a new aspect ratio
- [s->window setContentSize:s->current_video_size keepCentered:YES];
- [s->window setContentAspectRatio:s->current_video_size];
- }
- }
+ update_window(vo);
}
resize_window(vo);
@@ -348,19 +431,22 @@ int vo_cocoa_create_window(struct vo *vo, uint32_t d_width,
if (s->window_title)
[s->window_title release];
- s->window_title = [[NSString alloc] initWithUTF8String:vo_get_window_title(vo)];
+ s->window_title =
+ [[NSString alloc] initWithUTF8String:vo_get_window_title(vo)];
[s->window setTitle: s->window_title];
return 0;
}
-void vo_cocoa_swap_buffers()
+void vo_cocoa_swap_buffers(struct vo *vo)
{
+ struct vo_cocoa_state *s = vo->cocoa;
[s->glContext flushBuffer];
}
-void vo_cocoa_display_cursor(int requested_state)
+static void vo_cocoa_display_cursor(struct vo *vo, int requested_state)
{
+ struct vo_cocoa_state *s = vo->cocoa;
if (requested_state) {
if (!vo_fs || s->cursor_autohide_delay > -2) {
s->display_cursor = requested_state;
@@ -376,30 +462,22 @@ void vo_cocoa_display_cursor(int requested_state)
int vo_cocoa_check_events(struct vo *vo)
{
+ struct vo_cocoa_state *s = vo->cocoa;
NSEvent *event;
- float curTime = TickCount()/60;
- int msCurTime = (int) (curTime * 1000);
+ int ms_time = (int) ([[NSProcessInfo processInfo] systemUptime] * 1000);
// automatically hide mouse cursor
if (vo_fs && s->display_cursor &&
- (msCurTime - s->cursor_timer >= s->cursor_autohide_delay)) {
- vo_cocoa_display_cursor(0);
- s->cursor_timer = msCurTime;
- }
-
- //update activity every 30 seconds to prevent
- //screensaver from starting up.
- if ((int)curTime - s->last_screensaver_update >= 30 || s->last_screensaver_update == 0)
- {
- UpdateSystemActivity(UsrActivity);
- s->last_screensaver_update = (int)curTime;
+ (ms_time - s->cursor_timer >= s->cursor_autohide_delay)) {
+ vo_cocoa_display_cursor(vo, 0);
+ s->cursor_timer = ms_time;
}
event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil
inMode:NSEventTrackingRunLoopMode dequeue:YES];
if (event == nil)
return 0;
- l_vo = vo;
+ [s->window setVideoOutput:vo];
[NSApp sendEvent:event];
if (s->did_resize) {
@@ -420,30 +498,33 @@ int vo_cocoa_check_events(struct vo *vo)
void vo_cocoa_fullscreen(struct vo *vo)
{
+ struct vo_cocoa_state *s = vo->cocoa;
[s->window fullscreen];
resize_window(vo);
}
int vo_cocoa_swap_interval(int enabled)
{
- [s->glContext setValues:&enabled forParameter:NSOpenGLCPSwapInterval];
+ [[NSOpenGLContext currentContext] setValues:&enabled
+ forParameter:NSOpenGLCPSwapInterval];
return 0;
}
-void *vo_cocoa_cgl_context(void)
+void *vo_cocoa_cgl_context(struct vo *vo)
{
+ struct vo_cocoa_state *s = vo->cocoa;
return [s->glContext CGLContextObj];
}
-void *vo_cocoa_cgl_pixel_format(void)
+void *vo_cocoa_cgl_pixel_format(struct vo *vo)
{
- return CGLGetPixelFormat(vo_cocoa_cgl_context());
+ return CGLGetPixelFormat(vo_cocoa_cgl_context(vo));
}
-int vo_cocoa_cgl_color_size(void)
+int vo_cocoa_cgl_color_size(struct vo *vo)
{
GLint value;
- CGLDescribePixelFormat(vo_cocoa_cgl_pixel_format(), 0,
+ CGLDescribePixelFormat(vo_cocoa_cgl_pixel_format(vo), 0,
kCGLPFAColorSize, &value);
switch (value) {
case 32:
@@ -459,10 +540,9 @@ int vo_cocoa_cgl_color_size(void)
static NSMenuItem *new_menu_item(NSMenu *parent_menu, NSString *title,
SEL action, NSString *key_equivalent)
{
- NSMenuItem *new_item = [[NSMenuItem alloc]
- initWithTitle:title
- action:action
- keyEquivalent:key_equivalent];
+ NSMenuItem *new_item =
+ [[NSMenuItem alloc] initWithTitle:title action:action
+ keyEquivalent:key_equivalent];
[parent_menu addItem:new_item];
return [new_item autorelease];
}
@@ -470,10 +550,9 @@ static NSMenuItem *new_menu_item(NSMenu *parent_menu, NSString *title,
static NSMenuItem *new_main_menu_item(NSMenu *parent_menu, NSMenu *child_menu,
NSString *title)
{
- NSMenuItem *new_item = [[NSMenuItem alloc]
- initWithTitle:title
- action:nil
- keyEquivalent:@""];
+ NSMenuItem *new_item =
+ [[NSMenuItem alloc] initWithTitle:title action:nil
+ keyEquivalent:@""];
[new_item setSubmenu:child_menu];
[parent_menu addItem:new_item];
return [new_item autorelease];
@@ -506,26 +585,33 @@ void create_menu()
}
@implementation GLMPlayerWindow
+- (void)setVideoOutput:(struct vo *)vo
+{
+ _vo = vo;
+}
-- (void) windowDidResize:(NSNotification *) notification
+- (void)windowDidResize:(NSNotification *) notification
{
- if (l_vo)
+ if (_vo) {
+ struct vo_cocoa_state *s = _vo->cocoa;
s->did_resize = YES;
+ }
}
-- (void) fullscreen
+- (void)fullscreen
{
+ struct vo_cocoa_state *s = _vo->cocoa;
if (!vo_fs) {
- update_screen_info();
- if (current_screen_has_dock_or_menubar())
- [NSApp setPresentationOptions:NSApplicationPresentationHideDock|NSApplicationPresentationHideMenuBar];
+ update_screen_info(_vo);
+ if (current_screen_has_dock_or_menubar(_vo))
+ [NSApp setPresentationOptions:NSApplicationPresentationHideDock|
+ NSApplicationPresentationHideMenuBar];
s->windowed_frame = [self frame];
[self setHasShadow:NO];
[self setStyleMask:s->fullscreen_mask];
[self setFrame:s->screen_frame display:YES animate:NO];
- [self setLevel:s->fullscreen_window_level];
vo_fs = VO_TRUE;
- vo_cocoa_display_cursor(0);
+ vo_cocoa_display_cursor(_vo, 0);
[self setMovableByWindowBackground: NO];
} else {
[NSApp setPresentationOptions:NSApplicationPresentationDefault];
@@ -538,42 +624,44 @@ void create_menu()
s->out_fs_resize = NO;
}
[self setContentAspectRatio:s->current_video_size];
- [self setLevel:s->windowed_window_level];
vo_fs = VO_FALSE;
- vo_cocoa_display_cursor(1);
+ vo_cocoa_display_cursor(_vo, 1);
[self setMovableByWindowBackground: YES];
}
}
-- (BOOL) canBecomeMainWindow { return YES; }
-- (BOOL) canBecomeKeyWindow { return YES; }
-- (BOOL) acceptsFirstResponder { return YES; }
-- (BOOL) becomeFirstResponder { return YES; }
-- (BOOL) resignFirstResponder { return YES; }
-- (BOOL) windowShouldClose:(id)sender
+- (BOOL)canBecomeMainWindow { return YES; }
+- (BOOL)canBecomeKeyWindow { return YES; }
+- (BOOL)acceptsFirstResponder { return YES; }
+- (BOOL)becomeFirstResponder { return YES; }
+- (BOOL)resignFirstResponder { return YES; }
+- (BOOL)windowShouldClose:(id)sender
{
- mplayer_put_key(l_vo->key_fifo, KEY_CLOSE_WIN);
+ mplayer_put_key(_vo->key_fifo, KEY_CLOSE_WIN);
// We have to wait for MPlayer to handle this,
// otherwise we are in trouble if the
// KEY_CLOSE_WIN handler is disabled
return NO;
}
-- (BOOL) isMovableByWindowBackground
+- (BOOL)isMovableByWindowBackground
{
- // this is only valid as a starting value. it will be rewritten in the -fullscreen method.
+ // this is only valid as a starting value. it will be rewritten in the
+ // -fullscreen method.
return !vo_fs;
}
-- (void) handleQuitEvent:(NSAppleEventDescriptor*)e withReplyEvent:(NSAppleEventDescriptor*)r
+- (void)handleQuitEvent:(NSAppleEventDescriptor*)e
+ withReplyEvent:(NSAppleEventDescriptor*)r
{
- mplayer_put_key(l_vo->key_fifo, KEY_CLOSE_WIN);
+ mplayer_put_key(_vo->key_fifo, KEY_CLOSE_WIN);
}
-- (void) keyDown:(NSEvent *)theEvent
+- (void)keyDown:(NSEvent *)theEvent
{
unsigned char charcode;
- if (([theEvent modifierFlags] & NSRightAlternateKeyMask) == NSRightAlternateKeyMask)
+ if (([theEvent modifierFlags] & NSRightAlternateKeyMask) ==
+ NSRightAlternateKeyMask)
charcode = *[[theEvent characters] UTF8String];
else
charcode = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
@@ -585,64 +673,65 @@ void create_menu()
key |= KEY_MODIFIER_SHIFT;
if ([theEvent modifierFlags] & NSControlKeyMask)
key |= KEY_MODIFIER_CTRL;
- if (([theEvent modifierFlags] & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask)
+ if (([theEvent modifierFlags] & NSLeftAlternateKeyMask) ==
+ NSLeftAlternateKeyMask)
key |= KEY_MODIFIER_ALT;
if ([theEvent modifierFlags] & NSCommandKeyMask)
key |= KEY_MODIFIER_META;
- mplayer_put_key(l_vo->key_fifo, key);
+ mplayer_put_key(_vo->key_fifo, key);
}
}
-- (void) mouseMoved: (NSEvent *) theEvent
+- (void)mouseMoved: (NSEvent *) theEvent
{
if (vo_fs)
- vo_cocoa_display_cursor(1);
+ vo_cocoa_display_cursor(_vo, 1);
}
-- (void) mouseDragged:(NSEvent *)theEvent
+- (void)mouseDragged:(NSEvent *)theEvent
{
[self mouseEvent: theEvent];
}
-- (void) mouseDown:(NSEvent *)theEvent
+- (void)mouseDown:(NSEvent *)theEvent
{
[self mouseEvent: theEvent];
}
-- (void) mouseUp:(NSEvent *)theEvent
+- (void)mouseUp:(NSEvent *)theEvent
{
[self mouseEvent: theEvent];
}
-- (void) rightMouseDown:(NSEvent *)theEvent
+- (void)rightMouseDown:(NSEvent *)theEvent
{
[self mouseEvent: theEvent];
}
-- (void) rightMouseUp:(NSEvent *)theEvent
+- (void)rightMouseUp:(NSEvent *)theEvent
{
[self mouseEvent: theEvent];
}
-- (void) otherMouseDown:(NSEvent *)theEvent
+- (void)otherMouseDown:(NSEvent *)theEvent
{
[self mouseEvent: theEvent];
}
-- (void) otherMouseUp:(NSEvent *)theEvent
+- (void)otherMouseUp:(NSEvent *)theEvent
{
[self mouseEvent: theEvent];
}
-- (void) scrollWheel:(NSEvent *)theEvent
+- (void)scrollWheel:(NSEvent *)theEvent
{
if ([theEvent deltaY] > 0)
- mplayer_put_key(l_vo->key_fifo, MOUSE_BTN3);
+ mplayer_put_key(_vo->key_fifo, MOUSE_BTN3);
else
- mplayer_put_key(l_vo->key_fifo, MOUSE_BTN4);
+ mplayer_put_key(_vo->key_fifo, MOUSE_BTN4);
}
-- (void) mouseEvent:(NSEvent *)theEvent
+- (void)mouseEvent:(NSEvent *)theEvent
{
if ([theEvent buttonNumber] >= 0 && [theEvent buttonNumber] <= 9) {
int buttonNumber = [theEvent buttonNumber];
@@ -653,43 +742,39 @@ void create_menu()
case NSLeftMouseDown:
case NSRightMouseDown:
case NSOtherMouseDown:
- mplayer_put_key(l_vo->key_fifo, (MOUSE_BTN0 + buttonNumber) | MP_KEY_DOWN);
+ mplayer_put_key(_vo->key_fifo,
+ (MOUSE_BTN0 + buttonNumber) | MP_KEY_DOWN);
// Looks like Cocoa doesn't create MouseUp events when we are
// doing the second click in a double click. Put in the key_fifo
// the key that would be put from the MouseUp handling code.
if([theEvent clickCount] == 2)
- mplayer_put_key(l_vo->key_fifo, MOUSE_BTN0 + buttonNumber);
+ mplayer_put_key(_vo->key_fifo, MOUSE_BTN0 + buttonNumber);
break;
case NSLeftMouseUp:
case NSRightMouseUp:
case NSOtherMouseUp:
- mplayer_put_key(l_vo->key_fifo, MOUSE_BTN0 + buttonNumber);
+ mplayer_put_key(_vo->key_fifo, MOUSE_BTN0 + buttonNumber);
break;
}
}
}
-- (void) applicationWillBecomeActive:(NSNotification *)aNotification
+- (void)applicationWillBecomeActive:(NSNotification *)aNotification
{
- if (vo_fs) {
- [s->window makeKeyAndOrderFront:s->window];
- [s->window setLevel:s->fullscreen_window_level];
- if (current_screen_has_dock_or_menubar())
- [NSApp setPresentationOptions:NSApplicationPresentationHideDock|
- NSApplicationPresentationHideMenuBar];
+ if (vo_fs && current_screen_has_dock_or_menubar(_vo)) {
+ [NSApp setPresentationOptions:NSApplicationPresentationHideDock|
+ NSApplicationPresentationHideMenuBar];
}
}
-- (void) applicationWillResignActive:(NSNotification *)aNotification
+- (void)applicationWillResignActive:(NSNotification *)aNotification
{
if (vo_fs) {
[NSApp setPresentationOptions:NSApplicationPresentationDefault];
- [s->window setLevel:s->windowed_window_level];
- [s->window orderBack:s->window];
}
}
-- (void) applicationDidFinishLaunching:(NSNotification*)notification
+- (void)applicationDidFinishLaunching:(NSNotification*)notification
{
// Install an event handler so the Quit menu entry works
// The proper way using NSApp setDelegate: and
@@ -702,19 +787,21 @@ void create_menu()
andEventID:kAEQuitApplication];
}
-- (void) normalSize
+- (void)normalSize
{
+ struct vo_cocoa_state *s = _vo->cocoa;
if (!vo_fs)
- [self setContentSize:s->current_video_size keepCentered:YES];
+ [self setContentSize:s->current_video_size keepCentered:YES];
}
-- (void) halfSize { [self mulSize:0.5f];}
+- (void)halfSize { [self mulSize:0.5f];}
-- (void) doubleSize { [self mulSize:2.0f];}
+- (void)doubleSize { [self mulSize:2.0f];}
-- (void) mulSize:(float)multiplier
+- (void)mulSize:(float)multiplier
{
if (!vo_fs) {
+ struct vo_cocoa_state *s = _vo->cocoa;
NSSize size = [[self contentView] frame].size;
size.width = s->current_video_size.width * (multiplier);
size.height = s->current_video_size.height * (multiplier);
@@ -722,33 +809,41 @@ void create_menu()
}
}
-- (void) setContentSize:(NSSize)ns keepCentered:(BOOL)keepCentered
+- (void)setCenteredContentSize:(NSSize)ns
{
- if (keepCentered) {
- NSRect nf = [self frame];
- NSRect vf = [[self screen] visibleFrame];
- int title_height = nf.size.height - [[self contentView] bounds].size.height;
- double ratio = (double)ns.width / (double)ns.height;
-
- // clip the new size to the visibleFrame's size if needed
- if (ns.width > vf.size.width || ns.height + title_height > vf.size.height) {
- ns = vf.size;
- ns.height -= title_height; // make space for the title bar
-
- if (ns.width > ns.height) {
- ns.height = ((double)ns.width * 1/ratio + 0.5);
- } else {
- ns.width = ((double)ns.height * ratio + 0.5);
- }
+ NSRect nf = [self frame];
+ NSRect vf = [[self screen] visibleFrame];
+ NSRect cb = [[self contentView] bounds];
+ int title_height = nf.size.height - cb.size.height;
+ double ratio = (double)ns.width / (double)ns.height;
+
+ // clip the new size to the visibleFrame's size if needed
+ if (ns.width > vf.size.width || ns.height + title_height > vf.size.height) {
+ ns = vf.size;
+ ns.height -= title_height; // make space for the title bar
+
+ if (ns.width > ns.height) {
+ ns.height = ((double)ns.width * 1/ratio + 0.5);
+ } else {
+ ns.width = ((double)ns.height * ratio + 0.5);
}
+ }
- int dw = nf.size.width - ns.width;
- int dh = nf.size.height - ns.height - title_height;
+ int dw = nf.size.width - ns.width;
+ int dh = nf.size.height - ns.height - title_height;
- nf.origin.x += dw / 2;
- nf.origin.y += dh / 2;
+ nf.origin.x += dw / 2;
+ nf.origin.y += dh / 2;
- [self setFrame: NSMakeRect(nf.origin.x, nf.origin.y, ns.width, ns.height + title_height) display:YES animate:NO];
+ NSRect new_frame =
+ NSMakeRect(nf.origin.x, nf.origin.y, ns.width, ns.height + title_height);
+ [self setFrame:new_frame display:YES animate:NO];
+}
+
+- (void)setContentSize:(NSSize)ns keepCentered:(BOOL)keepCentered
+{
+ if (keepCentered) {
+ [self setCenteredContentSize:ns];
} else {
[self setContentSize:ns];
}
@@ -756,7 +851,7 @@ void create_menu()
@end
@implementation GLMPlayerOpenGLView
-- (void) drawRect: (NSRect)rect
+- (void)drawRect: (NSRect)rect
{
[[NSColor clearColor] set];
NSRectFill([self bounds]);
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 055b386639..90d6ffaa40 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -1996,9 +1996,9 @@ static bool create_window_cocoa(struct MPGLContext *ctx, uint32_t d_width,
getFunctions(ctx->gl, (void *)vo_cocoa_glgetaddr, NULL, gl3);
if (gl3) {
- ctx->depth_r = vo_cocoa_cgl_color_size();
- ctx->depth_g = vo_cocoa_cgl_color_size();
- ctx->depth_b = vo_cocoa_cgl_color_size();
+ ctx->depth_r = vo_cocoa_cgl_color_size(ctx->vo);
+ ctx->depth_g = vo_cocoa_cgl_color_size(ctx->vo);
+ ctx->depth_b = vo_cocoa_cgl_color_size(ctx->vo);
}
if (!ctx->gl->SwapInterval)
@@ -2025,22 +2025,7 @@ static void releaseGlContext_cocoa(MPGLContext *ctx)
static void swapGlBuffers_cocoa(MPGLContext *ctx)
{
- vo_cocoa_swap_buffers();
-}
-
-static int cocoa_check_events(struct vo *vo)
-{
- return vo_cocoa_check_events(vo);
-}
-
-static void cocoa_update_xinerama_info(struct vo *vo)
-{
- vo_cocoa_update_xinerama_info(vo);
-}
-
-static void cocoa_fullscreen(struct vo *vo)
-{
- vo_cocoa_fullscreen(vo);
+ vo_cocoa_swap_buffers(ctx->vo);
}
#endif
@@ -2532,11 +2517,13 @@ MPGLContext *mpgl_init(enum MPGLType type, struct vo *vo)
ctx->create_window_gl3 = create_window_cocoa_gl3;
ctx->releaseGlContext = releaseGlContext_cocoa;
ctx->swapGlBuffers = swapGlBuffers_cocoa;
- ctx->check_events = cocoa_check_events;
- ctx->update_xinerama_info = cocoa_update_xinerama_info;
- ctx->fullscreen = cocoa_fullscreen;
+ ctx->check_events = vo_cocoa_check_events;
+ ctx->update_xinerama_info = vo_cocoa_update_xinerama_info;
+ ctx->fullscreen = vo_cocoa_fullscreen;
ctx->ontop = vo_cocoa_ontop;
ctx->vo_init = vo_cocoa_init;
+ ctx->pause = vo_cocoa_pause;
+ ctx->resume = vo_cocoa_resume;
ctx->vo_uninit = vo_cocoa_uninit;
break;
#endif
diff --git a/libvo/gl_common.h b/libvo/gl_common.h
index d9f227c6aa..9816566097 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -217,6 +217,8 @@ typedef struct MPGLContext {
uint32_t d_height, uint32_t flags);
// optional
+ void (*pause)(struct vo *vo);
+ void (*resume)(struct vo *vo);
void (*ontop)(struct vo *vo);
void (*border)(struct vo *vo);
void (*update_xinerama_info)(struct vo *vo);
diff --git a/libvo/gl_header_fixes.h b/libvo/gl_header_fixes.h
index ebdbbb35b4..d149a9970a 100644
--- a/libvo/gl_header_fixes.h
+++ b/libvo/gl_header_fixes.h
@@ -243,3 +243,15 @@
#define GL_FRAMEBUFFER_SRGB 0x8DB9
#endif
#endif
+
+// FreeBSD 10.0-CURRENT lacks the GLX_ARB_create_context extension completely
+#ifndef GLX_CONTEXT_MAJOR_VERSION_ARB
+#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
+#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
+#define GLX_CONTEXT_FLAGS_ARB 0x2094
+#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
+#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001
+#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
+#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
+#endif
diff --git a/libvo/video_out.h b/libvo/video_out.h
index efe3624b52..5c8e10a008 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -250,6 +250,7 @@ struct vo {
struct MPOpts *opts;
struct vo_x11_state *x11;
struct vo_w32_state *w32;
+ struct vo_cocoa_state *cocoa;
struct mp_fifo *key_fifo;
struct encode_lavc_context *encode_lavc_ctx;
struct input_ctx *input_ctx;
diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m
index fb9350cc47..c05863145c 100644
--- a/libvo/vo_corevideo.m
+++ b/libvo/vo_corevideo.m
@@ -226,8 +226,8 @@ static uint32_t draw_image(struct vo *vo, mp_image_t *mpi)
CVReturn error;
if (!p->textureCache || !p->pixelBuffer) {
- error = CVOpenGLTextureCacheCreate(NULL, 0, vo_cocoa_cgl_context(),
- vo_cocoa_cgl_pixel_format(), 0, &p->textureCache);
+ error = CVOpenGLTextureCacheCreate(NULL, 0, vo_cocoa_cgl_context(vo),
+ vo_cocoa_cgl_pixel_format(vo), 0, &p->textureCache);
if(error != kCVReturnSuccess)
mp_msg(MSGT_VO, MSGL_ERR,"[vo_corevideo] Failed to create OpenGL"
" texture Cache(%d)\n", error);
@@ -395,6 +395,16 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_ONTOP:
p->mpglctx->ontop(vo);
return VO_TRUE;
+ case VOCTRL_PAUSE:
+ if (!p->mpglctx->pause)
+ break;
+ p->mpglctx->pause(vo);
+ return VO_TRUE;
+ case VOCTRL_RESUME:
+ if (!p->mpglctx->resume)
+ break;
+ p->mpglctx->resume(vo);
+ return VO_TRUE;
case VOCTRL_FULLSCREEN:
p->mpglctx->fullscreen(vo);
resize(vo, vo->dwidth, vo->dheight);
diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c
index bbcce41ca1..2fa71d0d70 100644
--- a/libvo/vo_direct3d.c
+++ b/libvo/vo_direct3d.c
@@ -145,8 +145,6 @@ typedef struct d3d_priv {
fullscreen */
int src_width; /**< Source (movie) width */
int src_height; /**< Source (movie) heigth */
- int src_d_width; /**< Source (movie) aspect corrected width */
- int src_d_height; /**< Source (movie) aspect corrected heigth */
int border_x; /**< horizontal border value for OSD */
int border_y; /**< vertical border value for OSD */
int image_format; /**< mplayer image format */
@@ -1546,9 +1544,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
return VO_ERROR;
}
- priv->src_d_width = d_width;
- priv->src_d_height = d_height;
-
if ((priv->image_format != format)
|| (priv->src_width != width)
|| (priv->src_height != height))
@@ -1806,8 +1801,8 @@ static mp_image_t *get_screenshot(d3d_priv *priv)
return NULL;
}
- image->w = priv->src_d_width;
- image->h = priv->src_d_height;
+ image->w = priv->vo->aspdat.prew;
+ image->h = priv->vo->aspdat.preh;
return image;
}
diff --git a/libvo/vo_opengl.c b/libvo/vo_opengl.c
index 8b1b6aaa35..92a280f49b 100644
--- a/libvo/vo_opengl.c
+++ b/libvo/vo_opengl.c
@@ -1773,6 +1773,16 @@ static int control(struct vo *vo, uint32_t request, void *data)
break;
p->glctx->ontop(vo);
return VO_TRUE;
+ case VOCTRL_PAUSE:
+ if (!p->glctx->pause)
+ break;
+ p->glctx->pause(vo);
+ return VO_TRUE;
+ case VOCTRL_RESUME:
+ if (!p->glctx->resume)
+ break;
+ p->glctx->resume(vo);
+ return VO_TRUE;
case VOCTRL_FULLSCREEN:
p->glctx->fullscreen(vo);
resize(p);
@@ -2348,7 +2358,7 @@ static const char help_text[] =
" assumed to be in sRGB.\n"
" pbo\n"
" Enable use of PBOs. This is faster, but can sometimes lead to\n"
-" sparodic and temporary image corruption.\n"
+" sporadic and temporary image corruption.\n"
" dither-depth=<n>\n"
" Positive non-zero values select the target bit depth.\n"
" -1: Disable any dithering done by mpv.\n"
diff --git a/libvo/vo_opengl_old.c b/libvo/vo_opengl_old.c
index e83d45a692..f9262e417d 100644
--- a/libvo/vo_opengl_old.c
+++ b/libvo/vo_opengl_old.c
@@ -73,8 +73,6 @@ struct gl_priv {
uint32_t image_width;
uint32_t image_height;
uint32_t image_format;
- uint32_t image_d_width;
- uint32_t image_d_height;
int many_fmts;
int have_texture_rg;
int ati_hack;
@@ -497,8 +495,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
p->image_height = height;
p->image_width = width;
p->image_format = format;
- p->image_d_width = d_width;
- p->image_d_height = d_height;
p->is_yuv = mp_get_chroma_shift(p->image_format, &xs, &ys, NULL) > 0;
p->is_yuv |= (xs << 8) | (ys << 16);
glFindFormat(format, p->have_texture_rg, NULL, &p->texfmt, &p->gl_format,
@@ -829,8 +825,8 @@ static mp_image_t *get_screenshot(struct vo *vo)
image->width = p->image_width;
image->height = p->image_height;
- image->w = p->image_d_width;
- image->h = p->image_d_height;
+ image->w = vo->aspdat.prew;
+ image->h = vo->aspdat.preh;
return image;
}
@@ -1134,6 +1130,16 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_REDRAW_FRAME:
do_render(vo);
return true;
+ case VOCTRL_PAUSE:
+ if (!p->glctx->pause)
+ break;
+ p->glctx->pause(vo);
+ return VO_TRUE;
+ case VOCTRL_RESUME:
+ if (!p->glctx->resume)
+ break;
+ p->glctx->resume(vo);
+ return VO_TRUE;
case VOCTRL_SCREENSHOT: {
struct voctrl_screenshot_args *args = data;
if (args->full_window)
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
index 1d4bf8adf7..ba0e0993a2 100644
--- a/libvo/vo_vdpau.c
+++ b/libvo/vo_vdpau.c
@@ -106,8 +106,8 @@ struct vdpctx {
uint64_t last_vdp_time;
unsigned int last_sync_update;
- /* an extra last output surface is used for OSD and screenshots */
VdpOutputSurface output_surfaces[MAX_OUTPUT_SURFACES];
+ VdpOutputSurface screenshot_surface;
int num_output_surfaces;
struct buffered_video_surface {
VdpVideoSurface surface;
@@ -152,7 +152,6 @@ struct vdpctx {
bool dropped_frame;
uint64_t dropped_time;
uint32_t vid_width, vid_height;
- uint32_t vid_d_width, vid_d_height;
uint32_t image_format;
VdpChromaType vdp_chroma_type;
VdpYCbCrFormat vdp_pixel_format;
@@ -390,20 +389,17 @@ static void resize(struct vo *vo)
int flip_offset_ms = vo_fs ? vc->flip_offset_fs : vc->flip_offset_window;
vo->flip_queue_offset = flip_offset_ms / 1000.;
- int min_output_width = FFMAX(vo->dwidth, vc->vid_width);
- int min_output_height = FFMAX(vo->dheight, vc->vid_height);
-
- if (vc->output_surface_width < min_output_width
- || vc->output_surface_height < min_output_height) {
- if (vc->output_surface_width < min_output_width) {
+ if (vc->output_surface_width < vo->dwidth
+ || vc->output_surface_height < vo->dheight) {
+ if (vc->output_surface_width < vo->dwidth) {
vc->output_surface_width += vc->output_surface_width >> 1;
vc->output_surface_width = FFMAX(vc->output_surface_width,
- min_output_width);
+ vo->dwidth);
}
- if (vc->output_surface_height < min_output_height) {
+ if (vc->output_surface_height < vo->dheight) {
vc->output_surface_height += vc->output_surface_height >> 1;
vc->output_surface_height = FFMAX(vc->output_surface_height,
- min_output_height);
+ vo->dheight);
}
// Creation of output_surfaces
for (int i = 0; i < vc->num_output_surfaces; i++)
@@ -705,6 +701,12 @@ static void free_video_specific(struct vo *vo)
CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy");
}
vc->video_mixer = VDP_INVALID_HANDLE;
+
+ if (vc->screenshot_surface != VDP_INVALID_HANDLE) {
+ vdp_st = vdp->output_surface_destroy(vc->screenshot_surface);
+ CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy");
+ }
+ vc->screenshot_surface = VDP_INVALID_HANDLE;
}
static int create_vdp_decoder(struct vo *vo, int max_refs)
@@ -800,6 +802,7 @@ static void mark_vdpau_objects_uninitialized(struct vo *vo)
vc->flip_target = VDP_INVALID_HANDLE;
for (int i = 0; i < MAX_OUTPUT_SURFACES; i++)
vc->output_surfaces[i] = VDP_INVALID_HANDLE;
+ vc->screenshot_surface = VDP_INVALID_HANDLE;
vc->vdp_device = VDP_INVALID_HANDLE;
for (int i = 0; i < MAX_OSD_PARTS; i++) {
struct osd_bitmap_surface *sfc = &vc->osd_surfaces[i];
@@ -869,8 +872,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
vc->image_format = format;
vc->vid_width = width;
vc->vid_height = height;
- vc->vid_d_width = d_width;
- vc->vid_d_height = d_height;
free_video_specific(vo);
if (IMGFMT_IS_VDPAU(vc->image_format) && !create_vdp_decoder(vo, 2))
@@ -1358,12 +1359,12 @@ static void draw_image(struct vo *vo, mp_image_t *mpi, double pts)
// warning: the size and pixel format of surface must match that of the
// surfaces in vc->output_surfaces
static struct mp_image *read_output_surface(struct vdpctx *vc,
- VdpOutputSurface surface)
+ VdpOutputSurface surface,
+ int width, int height)
{
VdpStatus vdp_st;
struct vdp_functions *vdp = vc->vdp;
- struct mp_image *image = alloc_mpi(vc->output_surface_width,
- vc->output_surface_height, IMGFMT_BGR32);
+ struct mp_image *image = alloc_mpi(width, height, IMGFMT_BGR32);
void *dst_planes[] = { image->planes[0] };
uint32_t dst_pitches[] = { image->stride[0] };
@@ -1377,19 +1378,27 @@ static struct mp_image *read_output_surface(struct vdpctx *vc,
static struct mp_image *get_screenshot(struct vo *vo)
{
struct vdpctx *vc = vo->priv;
+ VdpStatus vdp_st;
+ struct vdp_functions *vdp = vc->vdp;
- VdpOutputSurface screenshot_surface =
- vc->output_surfaces[vc->num_output_surfaces];
+ if (vc->screenshot_surface == VDP_INVALID_HANDLE) {
+ vdp_st = vdp->output_surface_create(vc->vdp_device,
+ OUTPUT_RGBA_FORMAT,
+ vc->vid_width, vc->vid_height,
+ &vc->screenshot_surface);
+ CHECK_ST_WARNING("Error when calling vdp_output_surface_create");
+ }
VdpRect rc = { .x1 = vc->vid_width, .y1 = vc->vid_height };
- render_video_to_output_surface(vo, screenshot_surface, &rc);
+ render_video_to_output_surface(vo, vc->screenshot_surface, &rc);
- struct mp_image *image = read_output_surface(vc, screenshot_surface);
+ struct mp_image *image = read_output_surface(vc, vc->screenshot_surface,
+ vc->vid_width, vc->vid_height);
image->width = vc->vid_width;
image->height = vc->vid_height;
- image->w = vc->vid_d_width;
- image->h = vc->vid_d_height;
+ image->w = vo->aspdat.prew;
+ image->h = vo->aspdat.preh;
return image;
}
@@ -1399,7 +1408,9 @@ static struct mp_image *get_window_screenshot(struct vo *vo)
struct vdpctx *vc = vo->priv;
int last_surface = WRAP_ADD(vc->surface_num, -1, vc->num_output_surfaces);
VdpOutputSurface screen = vc->output_surfaces[last_surface];
- struct mp_image *image = read_output_surface(vo->priv, screen);
+ struct mp_image *image = read_output_surface(vo->priv, screen,
+ vc->output_surface_width,
+ vc->output_surface_height);
image->width = image->w = vo->dwidth;
image->height = image->h = vo->dheight;
return image;
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 8095490f4a..390c1753b6 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -76,8 +76,6 @@ struct xvctx {
uint32_t image_width;
uint32_t image_height;
uint32_t image_format;
- uint32_t image_d_width;
- uint32_t image_d_height;
int is_paused;
struct vo_rect src_rect;
struct vo_rect dst_rect;
@@ -123,8 +121,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
ctx->image_height = height;
ctx->image_width = width;
ctx->image_format = format;
- ctx->image_d_width = d_width;
- ctx->image_d_height = d_height;
if ((ctx->max_width != 0 && ctx->max_height != 0)
&& (ctx->image_width > ctx->max_width
@@ -426,8 +422,8 @@ static mp_image_t *get_screenshot(struct vo *vo)
// try to get an image without OSD
int id = ctx->have_image_copy ? ctx->num_buffers : ctx->visible_buf;
struct mp_image img = get_xv_buffer(vo, id);
- img.w = ctx->image_d_width;
- img.h = ctx->image_d_height;
+ img.w = vo->aspdat.prew;
+ img.h = vo->aspdat.preh;
return talloc_memdup(NULL, &img, sizeof(img));
}
@@ -462,7 +458,7 @@ static uint32_t draw_image(struct vo *vo, mp_image_t *mpi)
static int query_format(struct xvctx *ctx, uint32_t format)
{
uint32_t i;
- int flag = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_OSD | VFCAP_ACCEPT_STRIDE; // FIXME! check for DOWN
+ int flag = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_ACCEPT_STRIDE; // FIXME! check for DOWN
/* check image formats */
for (i = 0; i < ctx->formats; i++) {
diff --git a/mplayer.c b/mplayer.c
index e078561f68..38aeaebbe6 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1106,19 +1106,11 @@ static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame)
saddf(line, width, ":");
// Playback position
- double cur = MP_NOPTS_VALUE;
- if (mpctx->sh_audio && a_pos != MP_NOPTS_VALUE) {
- cur = a_pos;
- } else if (mpctx->sh_video && mpctx->video_pts != MP_NOPTS_VALUE) {
- cur = mpctx->video_pts;
- }
- if (cur != MP_NOPTS_VALUE) {
- saddf(line, width, " %.1f ", cur);
- saddf(line, width, "(");
- sadd_hhmmssff(line, width, cur, mpctx->opts.osd_fractions);
- saddf(line, width, ")");
- } else
- saddf(line, width, " ???");
+ double cur = get_current_time(mpctx);
+ saddf(line, width, " %.1f ", cur);
+ saddf(line, width, "(");
+ sadd_hhmmssff(line, width, cur, mpctx->opts.osd_fractions);
+ saddf(line, width, ")");
double len = get_time_length(mpctx);
if (len >= 0) {
@@ -2845,7 +2837,9 @@ double get_current_time(struct MPContext *mpctx)
double apts = playing_audio_pts(mpctx);
if (apts != MP_NOPTS_VALUE)
return apts;
- return mpctx->last_seek_pts;
+ if (mpctx->last_seek_pts != MP_NOPTS_VALUE)
+ return mpctx->last_seek_pts;
+ return 0;
}
int get_percent_pos(struct MPContext *mpctx)
diff --git a/osdep/mplayer.exe.manifest b/osdep/mpv.exe.manifest
index c924377c4b..c924377c4b 100644
--- a/osdep/mplayer.exe.manifest
+++ b/osdep/mpv.exe.manifest
diff --git a/osdep/mplayer.rc b/osdep/mpv.rc
index ec04346f9d..ec04346f9d 100644
--- a/osdep/mplayer.rc
+++ b/osdep/mpv.rc
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index 5f17f2fa6f..11173dad7a 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -125,7 +125,7 @@ static char *mangle_ass(const char *in)
char *res = talloc_strdup(NULL, "");
while (*in) {
// As used by osd_get_function_sym().
- if (in[0] == '\xFF') {
+ if (in[0] == '\xFF' && in[1]) {
res = talloc_strdup_append_buffer(res, ASS_USE_OSD_FONT);
res = append_utf8_buffer(res, OSD_CODEPOINTS + in[1]);
res = talloc_strdup_append_buffer(res, "{\\r}");
@@ -137,7 +137,7 @@ static char *mangle_ass(const char *in)
res = talloc_strndup_append_buffer(res, in, 1);
// Break ASS escapes with U+2060 WORD JOINER
if (*in == '\\')
- append_utf8_buffer(res, 0x2060);
+ res = append_utf8_buffer(res, 0x2060);
in++;
}
return res;