From 861d427aefdfc73284d95d8b9f4fade20ef8ac21 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Tue, 21 Aug 2012 18:03:30 +0900 Subject: [PATCH] upload tizen2.0 source --- COPYING | 20 + ChangeLog | 609 +++++++++++++++++ INSTALL | 290 ++++++++ Makefile.am | 44 ++ README | 23 + XvMC_API.txt | 1292 ++++++++++++++++++++++++++++++++++++ configure.ac | 60 ++ include/Makefile.am | 1 + include/X11/Makefile.am | 1 + include/X11/extensions/Makefile.am | 2 + include/X11/extensions/XvMClib.h | 214 ++++++ packaging/libXvMC.spec | 68 ++ src/Makefile.am | 16 + src/XvMC.c | 597 +++++++++++++++++ src/XvMClibint.h | 79 +++ wrapper/Makefile.am | 22 + wrapper/XvMCWrapper.c | 781 ++++++++++++++++++++++ xvmc.pc.in | 12 + 18 files changed, 4131 insertions(+) create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 README create mode 100644 XvMC_API.txt create mode 100644 configure.ac create mode 100644 include/Makefile.am create mode 100644 include/X11/Makefile.am create mode 100644 include/X11/extensions/Makefile.am create mode 100644 include/X11/extensions/XvMClib.h create mode 100644 packaging/libXvMC.spec create mode 100644 src/Makefile.am create mode 100644 src/XvMC.c create mode 100644 src/XvMClibint.h create mode 100644 wrapper/Makefile.am create mode 100644 wrapper/XvMCWrapper.c create mode 100644 xvmc.pc.in diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..0b161ed --- /dev/null +++ b/COPYING @@ -0,0 +1,20 @@ +Copyright (c) 2004 The Unichrome project. All rights reserved. + + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..c3ea8ef --- /dev/null +++ b/ChangeLog @@ -0,0 +1,609 @@ +commit bcc4c4f3b7ad3c880e97f27951c97cb7ba856658 +Author: Alan Coopersmith +Date: Wed Mar 7 21:31:11 2012 -0800 + + libXvMC 1.0.7 + + Signed-off-by: Alan Coopersmith + +commit 4091e8b8b80e00b8abafdd630e5af8cab22d9054 +Author: Alan Coopersmith +Date: Thu Nov 10 21:47:20 2011 -0800 + + Fix gcc -Wwrite-strings warnings + + Signed-off-by: Alan Coopersmith + +commit 5d4953233392d22b8c92e64c23b5aa20df86e17c +Author: Alan Coopersmith +Date: Fri Sep 16 22:56:49 2011 -0700 + + Strip trailing whitespace + + Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' + git diff -w & git diff -b show no diffs from this change + + Signed-off-by: Alan Coopersmith + +commit 4f64c8dd12786f6b0ef1e4c8c8d992d43de6f895 +Author: Gaetan Nadon +Date: Sat Mar 5 11:56:54 2011 -0500 + + config: use Automake defaults when checking for library functions. + + Which follows a uniform naming convention. + + Reviewed-by: Julien Cristau + Signed-off-by: Gaetan Nadon + +commit a37fab2dde1cb4ea0fb93ed811b14b2be9e52566 +Author: Gaetan Nadon +Date: Sat Mar 5 11:18:21 2011 -0500 + + config: move wrapper in its own directory + + This prevents the use of per-target compiler flags. + Makefiles are simpler. + The -D flags for the wrapper are moved with pre-precessor flags. + + Signed-off-by: Gaetan Nadon + +commit 3b4040904d8fd5b8c7a20b0b187d70a00dd452ef +Author: Gaetan Nadon +Date: Mon Mar 7 10:30:12 2011 -0500 + + Fix whitespace issues + + Signed-off-by: Gaetan Nadon + +commit ac00a51c3106188aebc98ce5f480768dcd95da5f +Author: Gaetan Nadon +Date: Wed Feb 2 11:43:45 2011 -0500 + + config: comment, minor upgrade, quote and layout configure.ac + + Group statements per section as per Autoconf standard layout + Quote statements where appropriate. + Autoconf recommends not using dnl instead of # for comments + + Use AC_CONFIG_FILES to replace the deprecated AC_OUTPUT with parameters. + Add AC_CONFIG_SRCDIR([Makefile.am]) + Update minimum version of util-macros to at least 1.8. + + This helps automated maintenance and release activities. + Details can be found in http://wiki.x.org/wiki/NewModuleGuidelines + +commit bdd949b7d163bd9542eed89cf8fdb42197f86975 +Author: Gaetan Nadon +Date: Fri Jan 28 19:41:37 2011 -0500 + + config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS + + Signed-off-by: Gaetan Nadon + +commit 97d0572191368f47854c795e524610e529787c85 +Author: Alan Coopersmith +Date: Fri Aug 13 22:00:11 2010 -0700 + + libXvMC 1.0.6 + + Signed-off-by: Alan Coopersmith + +commit 9d2e636fa0fe21bfa483c18fa7ca63368a05ef35 +Author: Alan Coopersmith +Date: Fri Aug 13 22:01:39 2010 -0700 + + Remove unnecessary statements from configure.ac + + Signed-off-by: Alan Coopersmith + +commit 4d78d748cbf4a393ef12222c44b5f7adb2d3539f +Author: Jesse Adkins +Date: Mon Jul 12 20:04:46 2010 -0700 + + Purge cvs tags. + + Signed-off-by: Jesse Adkins + Signed-off-by: Alan Coopersmith + +commit e003c948a51af2d89a23fb697ec44aab970ce853 +Author: Fernando Carrijo +Date: Thu Jul 1 07:06:17 2010 -0300 + + Purge macro NEED_REPLIES + + Signed-off-by: Fernando Carrijo + Acked-by: Tiago Vignatti + Reviewed-by: Alan Coopersmith + +commit bea7d18c45b8d09c27a7e8c181b6efd27c4a36d7 +Author: Gaetan Nadon +Date: Mon Mar 29 14:53:49 2010 -0400 + + config: remove the pkgconfig pc.in file from EXTRA_DIST + + Automake always includes it in the tarball. + + Signed-off-by: Gaetan Nadon + +commit 92e902daab4eeb0acddd4e0def2d6009459e3220 +Author: Gaetan Nadon +Date: Thu Jan 14 10:06:05 2010 -0500 + + COPYING: replace stub with actual copyright notices + + Refer to: XvMCWrapper.c + Copyright (c) 2004 The Unichrome project. + + Signed-off-by: Gaetan Nadon + +commit 52c17bfbe2a50c9117ad92843f34e94be4f09c5e +Author: Alan Coopersmith +Date: Fri Dec 11 12:54:03 2009 -0800 + + Bug 25592: Use $(docdir) for XvMC_API.txt install path + + Bumps minimum autoconf version required to 2.60 for $(docdir) + + Signed-off-by: Alan Coopersmith + Reviewed-by: Dan Nicholson + +commit c53bfd6679f842a5a061904740d86932bbbda6c6 +Author: Gaetan Nadon +Date: Fri Nov 27 20:56:04 2009 -0500 + + Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES + + Now that the INSTALL file is generated. + Allows running make maintainer-clean. + +commit a75f52662c22048dc80a9f8d310364c458da470c +Author: Gaetan Nadon +Date: Wed Oct 28 14:09:10 2009 -0400 + + INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 + + Add missing INSTALL file. Use standard GNU file on building tarball + README may have been updated + Remove AUTHORS file as it is empty and no content available yet. + Remove NEWS file as it is empty and no content available yet. + +commit 9c441d4a5438caa37dd413ab2acbb4a117125e44 +Author: Gaetan Nadon +Date: Tue Oct 27 15:07:26 2009 -0400 + + Deploy the new XORG_DEFAULT_OPTIONS #24242 + + This macro aggregate a number of existing macros that sets commmon + X.Org components configuration options. It shields the configuration file from + future changes. + +commit 3a75ec2dda5f065e4d3eca15653c652690f4aa38 +Author: Gaetan Nadon +Date: Mon Oct 26 22:08:43 2009 -0400 + + Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432 + + ChangeLog filename is known to Automake and requires no further + coding in the makefile. + +commit 5eccd90ff407b9f780b4a0d6d1e48e0891f56594 +Author: Gaetan Nadon +Date: Thu Oct 22 12:34:19 2009 -0400 + + .gitignore: use common defaults with custom section # 24239 + + Using common defaults will reduce errors and maintenance. + Only the very small or inexistent custom section need periodic maintenance + when the structure of the component changes. Do not edit defaults. + +commit 276759b34432cea1f6c7eda995d65140b72169c0 +Author: Jeremy Huddleston +Date: Wed Oct 21 12:47:26 2009 -0700 + + This is not a GNU project, so declare it foreign. + + On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote: + > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote: + > > I noticed an INSTALL file in xlsclients and libXvMC today, and it + > > was quite annoying to work around since 'autoreconf -fvi' replaces + > > it and git wants to commit it. Should these files even be in git? + > > Can I nuke them for the betterment of humanity and since they get + > > created by autoreconf anyways? + > + > See https://bugs.freedesktop.org/show_bug.cgi?id=24206 + + As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with + AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation + of the INSTALL file. It is also part of the 24206 solution. + + Signed-off-by: Jeremy Huddleston + +commit efaafb5e74c7484f7e1c0f6f0fc34d75a0f7c14d +Author: Jeremy Huddleston +Date: Tue Oct 20 14:42:03 2009 -0700 + + Include XvMClib.h + + This fixes compilation breakage after 9190399907610486001f3676945958dbab4b837a in videoproto + + Found by tinderbox + + Signed-off-by: Jeremy Huddleston + +commit 4c41a40c3e4344c67cda020fbc2eb479ba06fc9e +Author: Alan Coopersmith +Date: Tue Oct 6 13:20:36 2009 -0700 + + libXvMC 1.0.5 + + Signed-off-by: Alan Coopersmith + +commit 459a6ac9876b86533b17c996200a8a492e32841c +Author: Alan Coopersmith +Date: Tue Oct 6 13:19:45 2009 -0700 + + Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS + + Signed-off-by: Alan Coopersmith + +commit 8a5876f71cbad2a02eb6c47772cf46c17bc1f451 +Author: Alan Coopersmith +Date: Thu Oct 1 23:14:51 2009 -0700 + + Move XvMC_API.txt from xorg-docs + + Signed-off-by: Alan Coopersmith + +commit c0ba39fd18a56adbbe7e2e4a1655aa1aaf5c1ed6 +Author: Alan Coopersmith +Date: Mon Feb 2 20:34:37 2009 -0800 + + Add README with pointers to mailing list, bugzilla & git repos + + Signed-off-by: Alan Coopersmith + +commit 608a6db5a76c3638457e40a4bae7debb5318b905 +Author: Paulo Cesar Pereira de Andrade +Date: Mon Feb 2 14:17:21 2009 -0200 + + Janitor: make distcheck, compiler warnings, .gitignore. + +commit ae3564600219fb27e094805cc45991685d2e5504 +Author: Paulo Cesar Pereira de Andrade +Date: Fri Mar 14 02:01:31 2008 -0300 + + Add missing prototypes to XvMClibint.h + + This is done just to not generate compile warnings about functions without + prototype, but at some time the comment in XvMC.c should be addressed: + + /****************************************************************** + These are intended as a protocol interface to be used by direct + rendering libraries. They are not intended to be client viewable + functions. These will stay in place until we have a mechanism in + place similar to that of OpenGL with an libXvMCcore library. + *******************************************************************/ + +commit 08be10e6c26794ed1ffa21d7946ddcc3da007237 +Author: Daniel Stone +Date: Sat Dec 16 01:33:11 2006 +0200 + + bump to 1.0.4 + +commit eaaa31aa77f06249de137018ef85903b0ad4aa39 +Author: Daniel Stone +Date: Wed Dec 6 19:00:54 2006 +0200 + + Makefile.am: make ChangeLog hook safer + Make ChangeLog hook as safe as possible. + +commit 93d7c1c797d8c74c18e78854fcf78a3f0d79b444 +Author: Alan Coopersmith +Date: Wed Sep 27 16:47:03 2006 -0700 + + Bump version to 1.0.3 + +commit ddc72074e6389a64d5753621b48855137a8c3623 +Author: Alan Coopersmith +Date: Wed Sep 27 13:44:48 2006 -0700 + + Add XvMCWrapper to lint target + +commit 34b32e0f6773004138543e6f41f5639736493707 +Author: Alan Coopersmith +Date: Wed Sep 27 13:44:15 2006 -0700 + + Fix sparse warning: Using plain integer as NULL pointer + +commit 142aa1230c651bc70d192edbbfa6870488006d36 +Author: Alan Coopersmith +Date: Tue Sep 26 18:31:46 2006 -0700 + + Fix sparse warnings: Using plain integer as NULL pointer + +commit 945f89d551438298d9a09a4fd3e9e40ac6b1ad51 +Author: Alan Coopersmith +Date: Tue Sep 26 18:30:41 2006 -0700 + + Add hooks for checking code with sparse/lint/etc. + +commit 3cc151c221139869980bc33d5336ab75c04606bc +Author: Alan Coopersmith +Date: Tue Sep 26 17:28:45 2006 -0700 + + Replace static ChangeLog with disthook to generate from git log + +commit f856448323ad315f5301f1022e9ee75de7174dbd +Author: Alan Coopersmith +Date: Tue Sep 26 17:25:50 2006 -0700 + + Add *~ to .gitignore to skip over emacs droppings + +commit 25c9975510f7a7c4f1c18b72526bc2a9b97ff90e +Author: Alan Coopersmith +Date: Thu Jul 13 14:59:11 2006 -0700 + + renamed: .cvsignore -> .gitignore + +commit 42226f6ba7fbccd7d7cb0f9ce431be477bdf9a0c +Author: Alan Coopersmith +Date: Fri Jun 16 22:07:08 2006 +0000 + + Define HAS_SHM if shmat() is found + Include to get HAS_SHM define. + +commit 9a93b2a2ace59e6c2ab8fec586561a136c06e664 +Author: Adam Jackson +Date: Thu Apr 27 00:24:15 2006 +0000 + + Bump to 1.0.2 + +commit 987ac45a04fc6734096fd6469ef12a4b1d09f971 +Author: Adam Jackson +Date: Mon Apr 3 19:35:40 2006 +0000 + + Bug #6479: Cygwin build fix. (Yaakov Selkowitz) + +commit 3b44259383a99f4db7d7c026638c6676d838229b +Author: Donnie Berkholz +Date: Wed Mar 22 17:53:58 2006 +0000 + + Set XVMC_CONFIGDIR to $(sysconfdir)/X11. + +commit 0e3081d35bcad1b5ee637c9b5d0292011c8536b4 +Author: Kevin E Martin +Date: Wed Dec 21 02:30:06 2005 +0000 + + Update package version for X11R7 release. + +commit 588b2f5642d0061f1e1954ce9f97bff71a27d75e +Author: Adam Jackson +Date: Mon Dec 19 16:28:27 2005 +0000 + + Stub COPYING files + +commit 479c508369c27e88145aab93016c6bcee5b6e71e +Author: Kevin E Martin +Date: Thu Dec 15 00:24:35 2005 +0000 + + Update package version number for final X11R7 release candidate. + +commit d7aa41b6025facaa98c827bea605de1aa77ffb5d +Author: Kevin E Martin +Date: Sat Dec 3 05:49:45 2005 +0000 + + Update package version number for X11R7 RC3 release. + +commit 68f34d7d3b1564d967f77127b68af6c3de26578b +Author: Kevin E Martin +Date: Sat Dec 3 04:41:51 2005 +0000 + + Add check and cflags for malloc(0) returning NULL. + +commit b679a08c793780c08a21af602e4e814cc24b1a93 +Author: Thomas Hellstrom +Date: Sat Nov 26 21:06:07 2005 +0000 + + Bug #5067 Add dot + before revision definitions for libXvMCW (Cedric Berger) + +commit 7907128fae6bbb41e2e6cc6387afba857c75eb41 +Author: Eric Anholt +Date: Sun Nov 20 23:17:41 2005 +0000 + + Add/improve libs .cvsignores. + +commit 25b2dc7180677176005d65828d2bfde17119c7a6 +Author: Kevin E Martin +Date: Sat Nov 19 07:15:43 2005 +0000 + + Update pkgconfig files to separate library build-time dependencies from + application build-time dependencies, and update package deps to work + with separate build roots. + +commit 384001cc85ea7a77b2800fda7d4abc745135ad3c +Author: Kevin E Martin +Date: Wed Oct 19 02:48:12 2005 +0000 + + Update package version number for RC1 release. + +commit 6140efabd4d1dc46f40d3bc15ad2d78307c5c6e3 +Author: Matthieu Herrb +Date: Sun Sep 11 18:25:27 2005 +0000 + + XvMC depends on xv. (Bugzilla #4367, Joshua Baergen). + +commit cd5375fa75e1f232d23069a59a82f0bcf6ee2a9f +Author: Adam Jackson +Date: Wed Aug 3 03:28:03 2005 +0000 + + Do PKG_CHECK_MODULES on a unique token instead of on "DEP", so builds with + a global configure cache don't get confused. + +commit 912ba3998aba2fd6e5e669f80a6ef205a613818e +Author: Kevin E Martin +Date: Fri Jul 29 21:22:53 2005 +0000 + + Various changes preparing packages for RC0: + - Verify and update package version numbers as needed + - Implement versioning scheme + - Change bug address to point to bugzilla bug entry form + - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to + reenable it) + - Fix makedepend to use pkgconfig and pass distcheck + - Update build script to build macros first + - Update modular Xorg version + +commit ad129004fe84555fa82286577b343188bd922971 +Author: Kevin E Martin +Date: Sat Jul 23 05:27:00 2005 +0000 + + Fix distchecks + +commit 50f1a745af62aadab1118b2c565e4f3c60ddcbd6 +Author: Daniel Stone +Date: Sat Jul 16 07:44:53 2005 +0000 + + Set soversion to 1.0.0 with -version-number. + +commit 46023798075bda8427b61ce57f8d5595abed89cb +Author: Daniel Stone +Date: Tue Jul 12 01:17:49 2005 +0000 + + Set soversions to 1.0.0; add XvMClib.h. + +commit a27ff6109baf266d414db756549eba0b6e4dcaf5 +Author: Daniel Stone +Date: Tue Jul 12 00:38:53 2005 +0000 + + Change version to 1.1.0. + +commit 32a12b87526bdeeeadc6859cc2c440d74846d935 +Author: Keith Packard +Date: Sat Jul 9 06:55:15 2005 +0000 + + Add .cvsignore files + +commit 05fd6003cbd18c04268a3ee8974a81fdcf1f7a74 +Author: Kevin E Martin +Date: Sat Jul 2 06:35:04 2005 +0000 + + Add appropriate lib*_CFLAGS to Makefile.am's -- fixes build problems + +commit 125b5cabb1980a3564c2567c0702a9adf32327bf +Author: Alexander Gottwald +Date: Tue Jun 21 15:41:37 2005 +0000 + + lib/XScrnSaver/configure.ac + lib/XScrnSaver/src/Makefile.am + lib/Xfontcache/configure.ac + lib/Xfontcache/src/Makefile.am + lib/Xinerama/configure.ac + lib/Xinerama/src/Makefile.am + lib/Xtst/configure.ac + lib/Xv/configure.ac + lib/XvMC/configure.ac + lib/dmx/configure.ac Add missing xext.pc and xextproto.pc Add DEP_CFLAGS to + src/Makefile.am + +commit 0273d0113119cdefe148d58ddf3508bd9b20f2b8 +Author: Søren Sandmann Pedersen +Date: Mon Jun 20 22:39:13 2005 +0000 + + Add XvMC build system + +commit b4716fab0524c583daac7048f5d304af3b1589b5 +Author: Søren Sandmann Pedersen +Date: Mon Jun 20 22:38:12 2005 +0000 + + Fix some includes in xc/lib/XvMC + +commit 58fde9acdcc6256917089271537017dc28710988 +Author: Markus Kuhn +Date: Sat Dec 4 00:42:50 2004 +0000 + + Encoding of numerous files changed to UTF-8 + +commit 359c8b9d75372ecd1f78cdb0bfccd134577d9c31 +Author: Thomas Hellstrom +Date: Tue Nov 23 17:29:47 2004 +0000 + + Bugzilla #1883 (https://freedesktop.org/bugzilla/show_bug.cgi?id=1883): Fix + insufficient SHM detection in XvMC local test. Removed reference to + getpagesize() which caused linking problems on s390. Reported by Stefan + Dirsch + +commit 120c3035f60138ad15599b0b0c4468400e966423 +Author: Thomas Hellstrom +Date: Sat Nov 13 11:09:23 2004 +0000 + + lib/XvMC/Imake + Added support for automatic loading of the correct hardware XvMC driver. + This involves a protocol extension of the XvMC protocol. The XvMC + revision number was bumped. + +commit 0077c785f91a80d48216a969757bc3f3b607e7e2 +Author: Thomas Hellstrom +Date: Wed Oct 20 16:35:16 2004 +0000 + + Imported via XvMC library release 0.13.0 from unichrome.sf.net. This + enables hardware mpeg2 decoding for the CLE266 chip using the + nonstandard VLD XvMC extension. Complete author information is + available at the unichrome site. Updated the XvMC wrapper to look for + version specific Xv and XvMC shared libraries. + +commit d6f84be6af28d2a316e05858f0b0571074314c2c +Author: Thomas Hellstrom +Date: Sun Sep 26 11:48:57 2004 +0000 + + Added the XvMC wrapper. First support for runtime loading of hardware- + specific XvMC libraries. + +commit b3d2a9cbcf27659b04eb0088c02de753dc43d5a8 +Author: Egbert Eich +Date: Fri Apr 23 18:43:55 2004 +0000 + + Merging XORG-CURRENT into trunk + +commit 1892f06c354c1b37308a5adc35cf6a4343148871 +Author: Egbert Eich +Date: Sun Mar 14 08:32:27 2004 +0000 + + Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 + +commit 2cf814aa9975839c342fbb37c8cf34c8eaf83add +Author: Egbert Eich +Date: Wed Mar 3 12:11:32 2004 +0000 + + Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 + +commit 5fbd3ca2a0e419175a28d68cd00e00541ec51c02 +Author: Egbert Eich +Date: Thu Feb 26 13:35:34 2004 +0000 + + readding XFree86's cvs IDs + +commit 6c01fc4ce83d0a401ac497a589ca7009824b2ee7 +Author: Egbert Eich +Date: Thu Feb 26 09:22:48 2004 +0000 + + Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 + +commit 023801d605d93ffdbd383b9f32df0a3213c829f1 +Author: Kaleb Keithley +Date: Fri Dec 19 20:54:21 2003 +0000 + + XFree86 4.3.99.902 (RC 2) + +commit 59642182406c19c9d17efd9d845cbbd65ad4654f +Author: Kaleb Keithley +Date: Fri Nov 14 16:48:49 2003 +0000 + + XFree86 4.3.0.1 + +commit 204fb5fcf4292629677e3876bd449fb76e55fcdd +Author: Kaleb Keithley +Date: Fri Nov 14 16:48:49 2003 +0000 + + Initial revision diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..c9fd2c0 --- /dev/null +++ b/INSTALL @@ -0,0 +1,290 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007, 2008 Free Software Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 6. Often, you can also type `make uninstall' to remove the installed + files again. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *Note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..3b65d8d --- /dev/null +++ b/Makefile.am @@ -0,0 +1,44 @@ +# +# Copyright 2005 Red Hat, Inc. +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of Red Hat not be used in +# advertising or publicity pertaining to distribution of the software without +# specific, written prior permission. Red Hat makes no +# representations about the suitability of this software for any purpose. It +# is provided "as is" without express or implied warranty. +# +# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +# EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR +# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +SUBDIRS = src include wrapper + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = xvmc.pc + +dist_doc_DATA = XvMC_API.txt + +MAINTAINERCLEANFILES = ChangeLog INSTALL + +.PHONY: ChangeLog INSTALL + +INSTALL: + $(INSTALL_CMD) + +ChangeLog: + $(CHANGELOG_CMD) + +dist-hook: ChangeLog INSTALL + +if LINT +lint: + (cd src && $(MAKE) $(MFLAGS) lint) +endif LINT diff --git a/README b/README new file mode 100644 index 0000000..d32f69f --- /dev/null +++ b/README @@ -0,0 +1,23 @@ + +All questions regarding this software should be directed at the +Xorg mailing list: + + http://lists.freedesktop.org/mailman/listinfo/xorg + +Please submit bug reports to the Xorg bugzilla: + + https://bugs.freedesktop.org/enter_bug.cgi?product=xorg + +The master development code repository can be found at: + + git://anongit.freedesktop.org/git/xorg/lib/libXvMC + + http://cgit.freedesktop.org/xorg/lib/libXvMC + +For patch submission instructions, see: + + http://www.x.org/wiki/Development/Documentation/SubmittingPatches + +For more information on the git code manager, see: + + http://wiki.x.org/wiki/GitPage diff --git a/XvMC_API.txt b/XvMC_API.txt new file mode 100644 index 0000000..aa2fc31 --- /dev/null +++ b/XvMC_API.txt @@ -0,0 +1,1292 @@ + + X-Video Motion Compensation - API specification v. 1.0 + + Mark Vojkovich + + +/* history */ + + first draft (9/6/00) + second draft (10/31/00) - Changed to allow acceleration at both + the motion compensation and IDCT level. + third draft (1/21/01) - Some refinements and subpicture support. + fourth draft (5/2/01) - Dual Prime clarification, add + XvMCSetAttribute. + fifth draft (6/26/01) - Change definition of XvMCCompositeSubpicture + plus some clarifications and fixed typographical errors. + sixth draft (9/24/01) - Added XVMC_SECOND_FIELD and removed + XVMC_PROGRESSIVE_FRAME and XVMC_TOP_FIELD_FIRST flags. + seventh draft (10/26/01) - Added XVMC_INTRA_UNSIGNED option. + eighth draft (11/13/02) - Removed IQ level acceleration and + changed some structures to remove unused fields. + +/* acknowledgements */ + + Thanks to Matthew J. Sottek from Intel for lots of input. + +/********************************************************************/ + + OVERVIEW + +/********************************************************************/ + + XvMC extends the X-Video extension (Xv) and makes use of the + familar concept of the XvPort. Ports have attributes that can be set + and queried through Xv. In XvMC ports can also have hardware motion + compensation contexts created for use with them. Ports which support + XvImages (ie. they have an "XV_IMAGE" port encoding as described in + the Xv version 2.2 API addendum) can be queried for the list of XvMCSurface + types they support. If they support any XvMCSurface types an + XvMCContext can be created for that port. + + An XvMCContext describes the state of the motion compensation + pipeline. An individual XvMCContext can be created for use with + a single port, surface type, motion compensation type, width and + height combination. For example, a context might be created for a + particular port that does MPEG-2 motion compensation on 720 x 480 + 4:2:0 surfaces. Once the context is created, referencing it implies + the port, surface type, size and the motion compensation type. Contexts + may be "direct" or "indirect". For indirect contexts the X server + renders all video using the data passed to it by the client. For + direct contexts the client libraries render the video with little + or no interaction with the X server. + + XvMCSurfaces are buffers into which the motion compensation + hardware can render. The data in the buffers themselves are not client + accessible and may be stored in a hardware-specific format. Any + number of buffers can be created for use with a particular context + (resources permitting). + + XvMC provides video acceleration starting at one of two places + in the video pipeline. Acceleration starting at the first point, + which we shall call the "Motion Compensation" level, begins after the + the inverse quantization and IDCT at the place where motion compensation + is to be applied. The second point, which we shall call the "IDCT" + level, begins before the IDCT just after the inverse quantization. + + Rendering is done by presenting the library with a target XvMCSurface + and up to two reference XvMCSurfaces for the motion compensation, a + buffer of 8x8 blocks and a command buffer which describes how to + use the 8x8 blocks along with motion compensation vectors to construct + the data in the target XvMCSurface. When the pipeline starts at the + IDCT level, Xv will perform the IDCT on the blocks before performing + the motion compensation. A function is provided to copy/overlay a + portion of the XvMCSurface to a drawable with arbitrary scaling. + + XvMCSubpictures are separate surfaces that may be blended with the + target surface. Any number of XvMCSubpictures may be created for use + with a context (resources permitting). Both "backend" and "frontend" + subpicture behavior are supported. + +/********************************************************************/ + + QUERYING THE EXTENSION + +/********************************************************************/ + +/* Errors */ +#define XvMCBadContext 0 +#define XvMCBadSurface 1 +#define XvMCBadSubpicture 2 + +Bool XvMCQueryExtension (Display *display, int *eventBase, int *errBase) + + Returns True if the extension exists, False otherwise. Also returns + the error and event bases. + + display - The connection to the server. + + eventBase - + errBase - The returned event and error bases. Currently there + are no events defined. + +Status XvMCQueryVersion (Display *display, int *major, int *minor) + + Query the major and minor version numbers of the extension. + + display - The connection to the server. + + major - + minor - The returned major and minor version numbers. + +/********************************************************************/ + + QUERYING SURFACE TYPES + +/********************************************************************/ + +/* Chroma formats */ +#define XVMC_CHROMA_FORMAT_420 0x00000001 +#define XVMC_CHROMA_FORMAT_422 0x00000002 +#define XVMC_CHROMA_FORMAT_444 0x00000003 + +/* XvMCSurfaceInfo Flags */ +#define XVMC_OVERLAID_SURFACE 0x00000001 +#define XVMC_BACKEND_SUBPICTURE 0x00000002 +#define XVMC_SUBPICTURE_INDEPENDENT_SCALING 0x00000004 +#define XVMC_INTRA_UNSIGNED 0x00000008 + +/* Motion Compensation types */ +#define XVMC_MOCOMP 0x00000000 +#define XVMC_IDCT 0x00010000 + +#define XVMC_MPEG_1 0x00000001 +#define XVMC_MPEG_2 0x00000002 +#define XVMC_H263 0x00000003 +#define XVMC_MPEG_4 0x00000004 + + +typedef struct { + int surface_type_id; + int chroma_format; + unsigned short max_width; + unsigned short max_height; + unsigned short subpicture_max_width; + unsigned short subpicture_max_height; + int mc_type; + int flags; +} XvMCSurfaceInfo; + + surface_type_id - Unique descriptor for this surface type. + + chroma_format - Chroma format of this surface (eg. XVMC_CHROMA_FORMAT_420, + XVMC_CHROMA_FORMAT_422, XVMC_CHROMA_FORMAT_444). + + max_width - + max_height - Maximum dimensions of the luma data in pixels. + + subpicture_max_width - + subpicture_max_height - The Maximum dimensions of the subpicture + that can be created for use with this surface + Both fields are zero if subpictures are not + supported. + + mc_type - The type of motion compensation available for this + surface. This consists of XVMC_MPEG_1, XVMC_MPEG_2, XVMC_H263 + or XVMC_MPEG_4 OR'd together with any of the following: + + XVMC_MOCOMP - Acceleration starts at the motion compensation + level; + + XVMC_IDCT - Acceleration starts at the IDCT level. + + flags - Any combination of the following may be OR'd together. + + XVMC_OVERLAID_SURFACE - Displayed data is overlaid and not + physically in the visible framebuffer. + When this is set the client is responsible + for painting the colorkey. + + XVMC_BACKEND_SUBPICTURE - The supicture is of the "backend" + variety. It is "frontend" otherwise. + There is more information on this in the + section on subpictures below. + + XVMC_SUBPICTURE_INDEPENDENT_SCALING - The subpicture can be scaled + independently of the video + surface. See the section on + subpictures below. + + XVMC_INTRA_UNSIGNED - When this flag is set, the motion compenstation + level Intra macroblock data should be in an + unsigned format rather than the signed format + present in the mpeg stream. This flag applies + only to motion compensation level acceleration. + +XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num) + + Returns the number of surface types supported by the XvPort and an array + of XvMCSurfaceInfo describing each surface type. The returned array + should be freed with XFree(). + + dpy - The connection to the server. + + port - The port we want to get the XvMCSurfaceInfo array for. + + num - The number of elements returned in the array. + + Errors: + + XvBadPort - The requested port does not exist. + + BadAlloc - There are insufficient resources to complete this request. + + +/********************************************************************/ + + CREATING A CONTEXT + +/********************************************************************/ + +/* XvMCContext flags */ +#define XVMC_DIRECT 0x00000001 + +typedef struct { + XID context_id; + int surface_type_id; + unsigned short width; + unsigned short height; + XVPortID port; + int flags; + void * privData; /* private to the library */ +} XvMCContext; + + context_id - An XID associated with the context. + + surface_type_id - This refers to the XvMCSurfaceInfo that describes + the surface characteristics. + + width - + height - The dimensions (of the luma data) this context supports. + + port - The port that this context supports. + + flags - Any combination may be OR'd together. + + XVMC_DIRECT - This context is direct rendered. + + +Status XvMCCreateContext ( + Display display, + XVPortID port, + int surface_type_id, + int width, + int height, + int flags, + XvMCContext * context +); + + This creates a context by filling out the XvMCContext structure passed + to it and returning Success. + + display - Specifies the connection to the server. + + port - Specifies the port to create the context for. + + surface_type_id - + width - + height - Specifies the surface type and dimensions that this + context will be used for. The surface_type_id corresponds + to the surface_type_id referenced by the XvMCSurfaceInfo. + The surface returned may be larger than the surface requested + (usually the next larger multiple of 16x16 pixels). + + flags - Any of the following may by OR'd together: + + XVMC_DIRECT - A direct context is requested. + If a direct context cannot be created the request + will not fail, rather, an indirect context will + be created instead. + + context - Pointer to the pre-allocated XvMCContext structure. + + + + Errors: + + XvBadPort - The requested port does not exist. + + BadValue - The dimensions requested are not supported by the + surface type. + + BadMatch - The surface_type_id is not supported by the port. + + BadAlloc - There are not sufficient resources to fulfill this + request. + + +Status XvMCDestroyContext (Display display, XvMCContext * context) + + Destroys the specified context. + + display - Specifies the connection to the server. + + context - The context to be destroyed. + + Errors: + + XvMCBadContext - The XvMCContext is not valid. + + +/*********************************************************************/ + + SURFACE CREATION + +/*********************************************************************/ + +typedef struct { + XID surface_id; + XID context_id; + int surface_type_id; + unsigned short width; + unsigned short height; + void *privData; /* private to the library */ +} XvMCSurface; + + surface_id - An XID associated with the surface. + + context_id - The XID of the context for which the surface was created. + + surface_type_id - Derived from the context_id, it specifies the + XvMCSurfaceInfo describing the surface. + + width - + height - The width and height of the luma data. + + +Status +XvMCCreateSurface( + Display *display, + XvMCContext * context; + XvMCSurface * surface; +); + + Creates a surface (Frame) for use with the specified context. + The surface structure is filled out and Success is returned if no + error occured. + + context - pointer to a valid context. The context implies + the surface type to be created, and its dimensions. + + surface - pointer to a pre-allocated XvMCSurface structure. + + Errors: + + XvMCBadContext - the context is not valid. + + BadAlloc - there are insufficient resources to complete + this operation. + +Status XvMCDestroySurface(Display *display, XvMCSurface *surface); + + Destroys the given surface. + + display - Specifies the connection to the server. + + surface - The surface to be destroyed. + + Errors: + + XvMCBadSurface - The XvMCSurface is not valid. + + + +/*********************************************************************/ + + RENDERING A FRAME + +/*********************************************************************/ + +typedef struct { + XID context_id; + unsigned int num_blocks; + short *blocks; + void *privData; /* private to the library */ +} XvMCBlockArray; + + num_blocks - Number of 64 element blocks in the blocks array. + + context_id - XID of the context these blocks were allocated for. + + blocks - Pointer to an array of (64 * num_blocks) shorts. + +Status XvMCCreateBlocks ( + Display *display, + XvMCContext *context, + unsigned int num_blocks, + XvMCBlockArray * block +); + + This allocates an array of DCT blocks in the XvMCBlockArray + structure passed to it. Success is returned if no error occured. + + display - The connection to the server. + + context - The context the block array is being created for. + + num_blocks - The number of 64 element short blocks to be allocated. + This number must be non-zero. + + block - A pointer to a pre-allocated XvMCBlockArray structure. + + Errors: + + XvMCBadContext - the context is invalid. + + BadAlloc - There are insufficient resources to complete the + operation. + + BadValue - num_blocks was zero. + +Status XvMCDestroyBlocks (Display *display, XvMCBlockArray * block) + + Frees the given array. + + display - The connection to the server. + + block - The block array to be freed. + + + ---------------------------------------------------------- + +#define XVMC_MB_TYPE_MOTION_FORWARD 0x02 +#define XVMC_MB_TYPE_MOTION_BACKWARD 0x04 +#define XVMC_MB_TYPE_PATTERN 0x08 +#define XVMC_MB_TYPE_INTRA 0x10 + +#define XVMC_PREDICTION_FIELD 0x01 +#define XVMC_PREDICTION_FRAME 0x02 +#define XVMC_PREDICTION_DUAL_PRIME 0x03 +#define XVMC_PREDICTION_16x8 0x02 +#define XVMC_PREDICTION_4MV 0x04 + +#define XVMC_SELECT_FIRST_FORWARD 0x01 +#define XVMC_SELECT_FIRST_BACKWARD 0x02 +#define XVMC_SELECT_SECOND_FORWARD 0x04 +#define XVMC_SELECT_SECOND_BACKWARD 0x08 + +#define XVMC_DCT_TYPE_FRAME 0x00 +#define XVMC_DCT_TYPE_FIELD 0x01 + +typedef struct { + unsigned short x; + unsigned short y; + unsigned char macroblock_type; + unsigned char motion_type; + unsigned char motion_vertical_field_select; + unsigned char dct_type; + short PMV[2][2][2]; + unsigned int index; + unsigned short coded_block_pattern; + unsigned short pad0; +} XvMCMacroBlock; + + x, y - location of the macroblock on the surface in units of macroblocks. + + macroblock_type - can be any of the following flags OR'd together: + + XVMC_MB_TYPE_MOTION_FORWARD - Forward motion prediction should + be done. This flag is ignored for + Intra frames. + + XVMC_MB_TYPE_MOTION_BACKWARD - Backward motion prediction should + be done. This flag is ignored when + the frame is not bidirectionally + predicted. + + XVMC_MB_TYPE_PATTERN - Blocks are referenced and they contain + differentials. The coded_block_pattern will + indicate the number of blocks and index will + note their locations in the block array. + + XVMC_MB_TYPE_INTRA - Blocks are referenced and they are intra blocks. + The coded_block_pattern will indicate the number + of blocks and index will note their locations in + the block array. XVMC_MB_TYPE_PATTERN and + XVMC_MB_TYPE_INTRA are mutually exclusive. If + both are specified, XVMC_MB_TYPE_INTRA takes + precedence. + + motion_type - If the surface is a field, the following are valid: + XVMC_PREDICTION_FIELD + XVMC_PREDICTION_16x8 + XVMC_PREDICTION_DUAL_PRIME + If the surface is a frame, the following are valid: + XVMC_PREDICTION_FIELD + XVMC_PREDICTION_FRAME + XVMC_PREDICTION_DUAL_PRIME + + motion_vertical_field_select - The following flags may be OR'd together + + XVMC_SELECT_FIRST_FORWARD + XVMC_SELECT_FIRST_BACKWARD + XVMC_SELECT_SECOND_FORWARD + XVMC_SELECT_SECOND_BACKWARD + + If the bit is set the bottom field is indicated. + If the bit is clear the top field is indicated. + + X X X X D C B A + ------- | | | |_ First vector forward + | | | |___ First vector backward + unused | |_____ Second vector forward + |_______ Second vector backward + + PMV - The motion vector(s) + + PMV[c][b][a] + + a - This holds the vector. 0 = horizontal, 1 = vertical. + b - 0 = forward, 1 = backward. + c - 0 = first vector, 1 = second vector. + + The motion vectors are used only when XVMC_MB_TYPE_MOTION_FORWARD + or XVMC_MB_TYPE_MOTION_BACKWARD are set. + + DualPrime vectors must be fully decoded and placed in the PMV + array as follows. + + Field structure: + + PMV[0][0][1:0] from same parity + PMV[0][1][1:0] from opposite parity + + Frame structure: + + PMV[0][0][1:0] top from top + PMV[0][1][1:0] bottom from bottom + PMV[1][0][1:0] top from bottom + PMV[1][1][1:0] bottom from top + + + index - The offset in units of (64 * sizeof(short)) from the start of + the block array where this macroblock's DCT blocks, as indicated + by the coded_block_pattern, are stored. + + coded_block_pattern - Indicates the blocks to be updated. The bitplanes + are specific to the mc_type of the surface. This + field is valid only if XVMC_MB_TYPE_PATTERN or + XVMC_MB_TYPE_INTRA are set. In that case the blocks + are differential or intra blocks respectively. + The bitplanes are described in ISO/IEC 13818-2 + Figures 6.10-12. + + dct_type - This field indicates whether frame pictures are frame DCT + coded or field DCT coded. ie XVMC_DCT_TYPE_FIELD or + XVMC_DCT_TYPE_FRAME. + + +typedef struct { + unsigned int num_blocks; + XID context_id; + XvMCMacroBlock *macro_blocks; + void *privData; /* private to the library */ +} XvMCMacroBlockArray; + + + num_blocks - Number of XvMCMacroBlocks in the macro_blocks array. + + context_id - XID of the context these macroblocks were allocated for. + + macro_blocks - Pointer to an array of num_blocks XvMCMacroBlocks. + + +Status XvMCCreateMacroBlocks ( + Display *display, + XvMCContext *context, + unsigned int num_blocks, + XvMCMacroBlockArray * blocks +); + + This allocates an array of XvMCMacroBlocks in the XvMCMacroBlockArray + structure passed to it. Success is returned if no error occured. + + display - The connection to the server. + + context - The context the macroblock array is being created for. + + num_blocks - The number of XvMCMacroBlocks to be allocated. + This number must be non-zero. + + blocks - A pointer to a pre-allocated XvMCMacroBlockArray structure. + + Errors: + + XvMCBadContext - the context is invalid. + + BadAlloc - There are insufficient resources to complete the + operation. + + BadValue - num_blocks was zero. + +Status XvMCDestroyMacroBlocks (Display *display, XvMCMacroBlockArray * block) + + Frees the given array. + + display - The connection to the server. + + block - The macro block array to be freed. + + + ------------------------------------------------------------ + +#define XVMC_TOP_FIELD 0x00000001 +#define XVMC_BOTTOM_FIELD 0x00000002 +#define XVMC_FRAME_PICTURE (XVMC_TOP_FIELD | XVMC_BOTTOM_FIELD) + +#define XVMC_SECOND_FIELD 0x00000004 + +Status XvMCRenderSurface( + Display *display, + XvMCContext *context, + unsigned int picture_structure, + Surface *target_surface, + Surface *past_surface, + Surface *future_surface, + unsigned int flags, + unsigned int num_macroblocks, + unsigned int first_macroblock, + XvMCMacroBlockArray *macroblock_array, + XvMCBlockArray *blocks +); + + This function renders the macroblocks passed to it. It will not + return until it has read all of the macroblocks, however, rendering + will usually not be completed by that time. The return of this + function means it is safe to touch the blocks and macroblock_array. + To synchronize rendering see the section on sychronization below. + + display - The connection to the server. + + context - The context used to render. + + target_surface - + past_surface - + furture_surface - + + The target_surface is required. If the future and past + surfaces are NULL, the target_surface is an "Intra" frame. + + If the past surface is provided but not the future surface, + the target_surface is a "Predicted Inter" frame. + + If both past and future surfaces are provided, the + target_surface is a "Bidirectionally-predicted Inter" frame. + + Specifying a future surface without a past surface results + in a BadMatch. + + All surfaces must belong to the same context. + + picture_structure - XVMC_TOP_FIELD, XVMC_BOTTOM_FIELD or + XVMC_FRAME_PICTURE. + + + flags - Flags may include: + + XVMC_SECOND_FIELD - For field pictures this indicates whether + the current field (top or bottom) is first + or second in the sequence. + + num_macroblocks - The number of XvMCMacroBlock structures to execute in + the macroblock_array. + + first_macroblock - The index of the first XvMCMacroBlock to process in the + macroblock_array. + + blocks - The array of XvMCBlocks to be referenced by the XvMCMacroBlocks. + The data in the individual blocks are in raster scan order and + should be clamped to the limits specific to the acceleration + level. For motion compensation level acceleration this is 8 + bits for Intra and 9 bits for non-Intra data. At the IDCT level + this is 12 bits. + + Errors: + + XvMCBadContext - The context is not valid. + + XvMCBadSurface - Any of the surfaces are not valid. + + BadMatch - Any of the surfaces do not belong to the specified + context or a future surface was specified without + a past surface. + + BadValue - Unrecognized data for the picture_structure. + + +/***********************************************************************/ + + DISPLAYING THE SURFACE + +/***********************************************************************/ + + +Status +XvMCPutSurface( + Display *display, + XvMCSurface *surface, + Drawable draw, + short srcx, + short srcy, + unsigned short srcw, + unsigned short srch, + short destx, + short desty, + unsigned short destw, + unsigned short desth, + int flags +); + + Display the rectangle from the source defined by srcx/y/w/h scaled + to destw by desth and placed at (destx, desty) on the given drawable. + This function is not guaranteed to be pipelined with previous rendering + commands and may display the surface immediately. Therefore, the client + must query that the surface has finished rendering before calling this + function. + + display - The connection to the server. + + surface - The surface to copy/overlay from. + + draw - The drawable to copy/overlay the video on. + + srcx - + srcy - + srcw - + srch - The rectangle in the source area from the surface that is + to be displayed. + + destx - + desty - + destw - + desth - The rectangle in the destination drawable where the scaled + source rectangle should be displayed. + + flags - this indicates the field to be displayed and can be XVMC_TOP_FIELD, + XVMC_BOTTOM_FIELD or XVMC_FRAME_PICTURE. XVMC_FRAME_PICTURE + displays both fields (weave). + + Errors: + + XvMCBadSurface - The surface is not valid. + + BadDrawable - The drawable does not exist. + + +Status XvMCHideSurface(Display *display, XvMCSurface *surface) + + Stops display of a surface. This is only needed if the surface is an + overlaid surface as indicated in the XvMCSurfaceInfo - it is a no-op + otherwise. + + display - The connection to the server. + + surface - The surface to be hidden. + + Errors: + + XvMCBadSurface - The surface is not valid. + + +/***********************************************************************/ + + COMPOSITING THE SUBPICTURE + +/***********************************************************************/ + + +XvImageFormatValues * XvMCListSubpictureTypes ( + Display * display, + XvPortID port, + int surface_type_id, + int *count_return +) + + Returns an array of XvImageFormatValues supported by the surface_type_id + describing the surface. The surface_type_id is acquired from the + XvMCSurfaceInfo. This list should be freed with XFree(). + + display - Specifies the connection to the X-server. + + port - Specifies the port we are interested in. + + surface_type_id - Specifies the surface type for which we want to + query the supported subpicture types. + + count_return - the size of the returned array. + + Errors: + + BadPort - The port doesn't exist. + + BadAlloc - There are insufficient resources to complete this request. + + BadMatch - The surface type is not supported on that port. + + +typedef struct { + XID subpicture_id; + XID context_id; + int xvimage_id; + unsigned short width; + unsigned short height; + int num_palette_entries; + int entry_bytes; + char component_order[4]; + void *privData; /* private to the library */ +} XvMCSubpicture; + + + subpicture_id - An XID associated with this subpicture. + + context_id - The XID of the context this subpicture was created for. + + xvimage_id - The id descriptor of the XvImage format that may be used + with this subpicture. + + width - + height - The dimensions of the subpicture. + + num_palette_entries - For paletted formats only. This is the number + of palette entries. It is zero for XvImages + without palettes. + + entry_bytes - Each component is one byte and entry_bytes indicates + the number of components in each entry (eg. 3 for + YUV palette entries). This field is zero when + palettes are not used. + + component_order - Is an array of ascii characters describing the order + of the components within the bytes. Only entry_bytes + characters of the string are used. + +Status +XvMCCreateSubpicture ( + Display *display, + XvMCContext *context, + XvMCSubpicture *subpicture, + unsigned short width, + unsigned short height, + int xvimage_id +) + + This creates a subpicture by filling out the XvMCSubpicture structure + passed to it and returning Success. + + display - Specifies the connection to the X-Server. + + context - The context to create the subpicture for. + + subpicture - Pre-allocated XvMCSubpicture structure to be filled + out by this function. + + width - + height - The dimensions of the subpicture. + + xvimage_id - The id describing the XvImage format. + + + Errors: + + BadAlloc - There are insufficient resources to complete this request. + + XvMCBadContext - The specified context does not exist. + + BadMatch - The XvImage format id specified is not supported by + the context. + + BadValue - If the size requested is larger than the max size reported + in the XvMCSurfaceInfo. + + +Status +XvMCClearSubpicture ( + Display *display, + XvMCSubpicture *subpicture, + short x, + short y, + unsigned short width, + unsigned short height, + unsigned int color +) + + Clear the area of the given subpicture to "color". + + display - The connection to the server. + + subpicture - The subpicture to clear. + + x - + y - + width - + height - The rectangle in the subpicture to be cleared. + + color - The data to fill the rectangle with. + + Errors: + + XvMCBadSubpicture - The subpicture is invalid. + +Status +XvMCCompositeSubpicture ( + Display *display, + XvMCSubpicture *subpicture, + XvImage *image, + short srcx, + short srcy, + unsigned short width, + unsigned short height, + short dstx, + short dsty +) + + Copies the XvImage to the XvMCSubpicture. + + display - The connection to the server. + + subpicture - The subpicture used as the destination of the copy. + + image - The XvImage to be used as the source of the copy. + XvImages should be of the shared memory variety for + indirect contexts. + + srcx - + srcy - + width - + height - The rectangle from the image to be composited. + + dstx - + dsty - The location in the subpicture where the source rectangle + should be composited. + + Errors: + + XvMCBadSubpicture - The subpicture is invalid. + + BadMatch - The subpicture does not support the type of XvImage + passed to this function. + +Status +XvMCDestroySubpicture (Display *display, XvMCSubpicture *subpicture) + + Destroys the specified subpicture. + + display - Specifies the connection to the X-server. + + subpicture - The subpicture to be destroyed. + + Errors: + + XvMCBadSubpicture - The subpicture specified does not exist. + + +Status +XvMCSetSubpicturePalette ( + Display *display, + XvMCSubpicture *subpicture, + unsigned char *palette +) + + Set the subpicture's palette. This applies to paletted subpictures + only. + + display - The connection to the server. + + subpicture - The subpicture on which to change the palette. + + palette - A pointer to an array holding the palette data. The + size of this array is + + num_palette_entries * entry_bytes + + in size. The order of the components in the palette + is described by the component_order in the XvMCSubpicture + structure. + + Errors: + + XvMCBadSubpicture - The subpicture specified does not exist. + + BadMatch - The specified subpicture does not use palettes. + + +Status +XvMCBlendSubpicture ( + Display *display, + XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, + short suby, + unsigned short subw, + unsigned short subh, + short surfx, + short surfy, + unsigned short surfw, + unsigned short surfh +) + +Status +XvMCBlendSubpicture2 ( + Display *display, + XvMCSurface *source_surface, + XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, + short suby, + unsigned short subw, + unsigned short subh, + short surfx, + short surfy, + unsigned short surfw, + unsigned short surfh +) + + The behavior of these two functions is different depending on whether +or not the XVMC_BACKEND_SUBPICTURE flag is set in the XvMCSurfaceInfo. + + XVMC_BACKEND_SUBPICTURE set: + + XvMCBlendSubpicture associates the subpicture with the target_surface. + Both will be displayed at the next call to XvMCPutSurface. Additional + blends before the call to XvMCPutSurface simply overrides the association. + Both the target_surface and subpicture will query XVMC_DISPLAYING from + the call to XvMCPutSurface until they are no longer displaying. It is + safe to associate the subpicture and target_surface before rendering has + completed (while they still query XVMC_RENDERING) but it is not safe to + call XvMCPutSurface at that time. + + XvMCBlendSubpicture2 copies the source_surface to the target_surface + and associates the subpicture with the target_surface. This essentially + calls XvMCBlendSubpicture on the target_surface after the copy. Both + the subpicture and target_surface will query XVMC_DISPLAYING from the + call to XvMCPutSurface until they are no longer displaying. The + source_surface will not query XVMC_DISPLAYING as a result of this function. + The copy is pipelined with the rendering and will cause XVMC_RENDERING + to be queried until the copy is done. + + + XVMC_BACKEND_SUBPICTURE not set ("frontend" behavior): + + XvMCBlendSubpicture is a no-op in this case. + + XvMCBlendSubpicture2 blends the source_surface and subpicture and + puts it in the target_surface. This does not effect the status of + the source surface but will cause the target_surface to query + XVMC_RENDERING until the blend is completed. + + + display - The connection to the server. + + subpicture - The subpicture to be blended into the video. + + target_surface - The surface to be displayed with the blended subpicture. + + source_surface - Source surface prior to blending. + + subx - + suby - + subw - + subh - The rectangle from the subpicture to be blended. + + surfx - + surfy - + surfw - + surfh - The rectangle in the XvMCSurface to blend the subpicture rectangle + into. If XVMC_SUBPICTURE_INDEPENDENT_SCALING is not set in the + XvMCSurfaceInfo subw must be equal to surfw and subh must be + equal to surfh height or else a BadValue error occurs. + + Errors: + + XvMCBadSurface - Any of the surfaces are invalid. + + XvMCBadSubpicture - The subpicture is invalid. + + BadMatch - The subpicture or any of the surfaces do not belong to the + same context. + + BadValue - XVMC_SUBPICTURE_INDEPENDENT_SCALING is set and the source + and destination rectangles are different sizes. + + +/***********************************************************************/ + + SURFACE SYNCHRONIZATION + +/***********************************************************************/ + + +#define XVMC_RENDERING 0x00000001 +#define XVMC_DISPLAYING 0x00000002 + +Status +XvMCSyncSurface (Display *display, XvMCSurface *surface) + + This function blocks until all rendering requests on the surface + have been completed. + + display - The connection to the server. + + surface - The surface to synchronize. + + Errors: + + XvMCBadSurface - The surface is not valid. + + +Status +XvMCFlushSurface (Display *display, XvMCSurface *surface) + + This function commits pending rendering requests to ensure that + they will be completed in a finite amount of time. + + display - The connnection to the server. + + surface - The surface whos rendering requests should be flushed. + + Errors: + + XvMCBadSurface - The surface is not valid. + + +Status +XvMCGetSurfaceStatus (Display *display, XvMCSurface *surface, int *stat) + + display - The connection to the server. + + surface - The surface whos status is being queried. + + stat - May be any of the following OR'd together: + + XVMC_RENDERING - The last XvMCRenderSurface request has not completed + yet. + + XVMC_DISPLAYING - The surface is currently being displayed or a + display is pending (ie. it is not safe to render + to it). + + Errors: + + XvMCBadSurface - The surface is not valid. + + +/***********************************************************************/ + + SUBPICTURE SYNCHRONIZATION + +/***********************************************************************/ + + + +Status +XvMCSyncSubpicture (Display *display, XvMCSubpicture *subpicture) + + This function blocks until all composite/clear requests on the supicture + have been completed. + + display - The connection to the server. + + subpicture - The subpicture to synchronize. + + Errors: + + XvMCBadSubpicture - The subpicture is not valid. + + +Status +XvMCFlushSubpicture (Display *display, XvMCSubpicture *subpicture) + + This function commits pending composite/clear requests to ensure that + they will be completed in a finite amount of time. + + display - The connection to the server. + + subpicture - The subpicture whos compositing should be flushed. + + Errors: + + XvMCBadSubpicture - The surface is not valid. + + +Status +XvMCGetSubpictureStatus (Display *display, XvMCSubpicture *subpic, int *stat) + + display - The connection to the server. + + subpic - The subpicture whos status is being queried. + + stat - may be any of the following OR'd together: + + XVMC_RENDERING - The last XvMCCompositeSubpicture or XvMCClearSubpicture + request has not completed yet. + + XVMC_DISPLAYING - The subpicture is currently being displayed or a + display is pending (ie. it is not safe to render + to it). + + Errors: + + XvMCBadSubpicture - The surface is not valid. + +/********************************************************************/ + + ATTRIBUTES + +/********************************************************************/ + + Context specific attribute functions are provided. These are +similar to their Xv Counterparts XvQueryPortAttributes, XvSetPortAttribute +and XvGetPortAttribute but their state is specific to the context. + +XvAttribute * +XvMCQueryAttributes ( + Display *display, + XvMCContext *context, + int *number +) + + An array of XvAttributes of size "number" is returned by this function. + If there are no attributes, NULL is returned and number is set to 0. + The array may be freed with XFree(). + + display - The connection to the server. + + context - The context whos attributes we are querying. + + number - The returned number of recognized atoms. + + Errors: + + XvMCBadContext - The context is invalid. + +Status +XvMCSetAttribute ( + Display *display, + XvMCContext *context, + Atom attribute, + int value +) + + This function sets a context-specific attribute and returns Success + if no error has occurred. + + display - The connection to the server. + + context - The context for which the attribute change is to go into effect. + + attribute - The X Atom of the attribute to be changed. + + value - The new value of the attribute. + + Errors: + + XvMCBadContext - The context is not valid. + + BadValue - An invalid value was specified. + + BadMatch - This attribute is not defined for this context. + +Status +XvMCGetAttribute ( + Display *display, + XvMCContext *context, + Atom attribute, + int *value +) + + This function queries a context-specific attribute and return + Success and the value if no error has occurred. + + display - The connection to the server. + + context - The context whos attribute we are querying. + + attribute - The X Atom of the attribute to be retrieved. + + value - The returned attribute value. + + Errors: + + XvMCBadContext - The context is not valid. + + BadMatch - This attribute is not defined for this context. diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..ae7d08b --- /dev/null +++ b/configure.ac @@ -0,0 +1,60 @@ +# Copyright 2005 Red Hat, Inc. +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of Red Hat not be used in +# advertising or publicity pertaining to distribution of the software without +# specific, written prior permission. Red Hat makes no +# representations about the suitability of this software for any purpose. It +# is provided "as is" without express or implied warranty. +# +# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +# EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR +# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# + +# Initialize Autoconf +AC_PREREQ([2.60]) +AC_INIT([libXvMC], [1.0.7], + [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXvMC]) +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_HEADERS([config.h]) + +# Initialize Automake +AM_INIT_AUTOMAKE([foreign dist-bzip2]) +AM_MAINTAINER_MODE + +# Initialize libtool +AC_PROG_LIBTOOL + +# Require X.Org macros 1.8 or later for AC_PROG_INSTALL +m4_ifndef([XORG_MACROS_VERSION], + [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])]) +XORG_MACROS_VERSION(1.8) +XORG_DEFAULT_OPTIONS +XORG_CHECK_MALLOC_ZERO + +# Obtain compiler/linker options for depedencies +PKG_CHECK_MODULES(XVMC, x11 xext xv xextproto videoproto) + +# Checks for library functions. +AC_CHECK_FUNCS([shmat]) + +# Allow checking code with lint, sparse, etc. +XORG_WITH_LINT +LINT_FLAGS="${LINT_FLAGS} ${XVMC_CFLAGS}" + +AC_CONFIG_FILES([Makefile + include/Makefile + include/X11/Makefile + include/X11/extensions/Makefile + src/Makefile + wrapper/Makefile + xvmc.pc]) +AC_OUTPUT diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 0000000..a48f256 --- /dev/null +++ b/include/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = X11 diff --git a/include/X11/Makefile.am b/include/X11/Makefile.am new file mode 100644 index 0000000..1b5c62d --- /dev/null +++ b/include/X11/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = extensions diff --git a/include/X11/extensions/Makefile.am b/include/X11/extensions/Makefile.am new file mode 100644 index 0000000..c78fdad --- /dev/null +++ b/include/X11/extensions/Makefile.am @@ -0,0 +1,2 @@ +extdir = $(includedir)/X11/extensions +ext_HEADERS = XvMClib.h diff --git a/include/X11/extensions/XvMClib.h b/include/X11/extensions/XvMClib.h new file mode 100644 index 0000000..b0e6c8b --- /dev/null +++ b/include/X11/extensions/XvMClib.h @@ -0,0 +1,214 @@ +#ifndef _XVMCLIB_H_ +#define _XVMCLIB_H_ + +#include +#include +#include + +_XFUNCPROTOBEGIN + +Bool XvMCQueryExtension (Display *display, int *eventBase, int *errBase); +Status XvMCQueryVersion (Display *display, int *major_versionp, + int *minor_versionp); +Status XvMCGetDRInfo(Display *dpy, XvPortID port, + char **name, char **busID, + int *major, int *minor, + int *patchLevel, + int *isLocal); + + +XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num); + +Status XvMCCreateContext ( + Display *display, + XvPortID port, + int surface_type_id, + int width, + int height, + int flags, + XvMCContext * context +); + +Status XvMCDestroyContext (Display *display, XvMCContext * context); + +Status +XvMCCreateSurface( + Display *display, + XvMCContext * context, + XvMCSurface * surface +); + +Status XvMCDestroySurface(Display *display, XvMCSurface *surface); + +XvImageFormatValues * XvMCListSubpictureTypes ( + Display * display, + XvPortID port, + int surface_type_id, + int *count_return +); + +Status +XvMCPutSurface( + Display *display, + XvMCSurface *surface, + Drawable draw, + short srcx, + short srcy, + unsigned short srcw, + unsigned short srch, + short destx, + short desty, + unsigned short destw, + unsigned short desth, + int flags +); + +Status XvMCHideSurface(Display *display, XvMCSurface *surface); + +Status +XvMCCreateSubpicture ( + Display *display, + XvMCContext *context, + XvMCSubpicture *subpicture, + unsigned short width, + unsigned short height, + int xvimage_id +); + + +Status +XvMCClearSubpicture ( + Display *display, + XvMCSubpicture *subpicture, + short x, + short y, + unsigned short width, + unsigned short height, + unsigned int color +); + +Status +XvMCCompositeSubpicture ( + Display *display, + XvMCSubpicture *subpicture, + XvImage *image, + short srcx, + short srcy, + unsigned short width, + unsigned short height, + short dstx, + short dsty +); + +Status +XvMCDestroySubpicture (Display *display, XvMCSubpicture *subpicture); + +Status +XvMCSetSubpicturePalette ( + Display *display, + XvMCSubpicture *subpicture, + unsigned char *palette +); + +Status +XvMCBlendSubpicture ( + Display *display, + XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, + short suby, + unsigned short subw, + unsigned short subh, + short surfx, + short surfy, + unsigned short surfw, + unsigned short surfh +); + +Status +XvMCBlendSubpicture2 ( + Display *display, + XvMCSurface *source_surface, + XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, + short suby, + unsigned short subw, + unsigned short subh, + short surfx, + short surfy, + unsigned short surfw, + unsigned short surfh +); + +Status XvMCSyncSurface (Display *display, XvMCSurface *surface); +Status XvMCFlushSurface (Display *display, XvMCSurface *surface); +Status XvMCGetSurfaceStatus (Display *display, XvMCSurface *surface, int *stat); + +Status XvMCRenderSurface ( + Display *display, + XvMCContext *context, + unsigned int picture_structure, + XvMCSurface *target_surface, + XvMCSurface *past_surface, + XvMCSurface *future_surface, + unsigned int flags, + unsigned int num_macroblocks, + unsigned int first_macroblock, + XvMCMacroBlockArray *macroblock_array, + XvMCBlockArray *blocks +); + + +Status XvMCSyncSubpicture (Display *display, XvMCSubpicture *subpicture); +Status XvMCFlushSubpicture (Display *display, XvMCSubpicture *subpicture); +Status +XvMCGetSubpictureStatus (Display *display, XvMCSubpicture *subpic, int *stat); + +Status XvMCCreateBlocks ( + Display *display, + XvMCContext *context, + unsigned int num_blocks, + XvMCBlockArray *block +); + +Status XvMCDestroyBlocks (Display *display,XvMCBlockArray *block); + +Status XvMCCreateMacroBlocks ( + Display *display, + XvMCContext *context, + unsigned int num_blocks, + XvMCMacroBlockArray *blocks +); + +Status XvMCDestroyMacroBlocks ( + Display *display, + XvMCMacroBlockArray *block +); + +XvAttribute * +XvMCQueryAttributes ( + Display *display, + XvMCContext *context, + int *number +); + +Status +XvMCSetAttribute ( + Display *display, + XvMCContext *context, + Atom attribute, + int value +); + +Status +XvMCGetAttribute ( + Display *display, + XvMCContext *context, + Atom attribute, + int *value +); + +_XFUNCPROTOEND + +#endif diff --git a/packaging/libXvMC.spec b/packaging/libXvMC.spec new file mode 100644 index 0000000..1c12d2b --- /dev/null +++ b/packaging/libXvMC.spec @@ -0,0 +1,68 @@ +Summary: X.Org X11 libXvMC runtime library +Name: libXvMC +Version: 1.0.7 +Release: 1 +License: MIT +Group: System Environment/Libraries +URL: http://www.x.org + +Source0: %{name}-%{version}.tar.gz + +BuildRequires: pkgconfig(videoproto) pkgconfig(xv) +BuildRequires: pkgconfig(xorg-macros) + +%description +X.Org X11 libXvMC runtime library + +%package devel +Summary: X.Org X11 libXvMC development package +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +Provides: libxvmc-devel + +%description devel +X.Org X11 libXvMC development package + +%prep +%setup -q + +%build +%reconfigure --disable-static \ + LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--as-needed" +make %{?jobs:-j%jobs} + +%install +make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" + +# do this ourself in %%doc so we get %%version +rm $RPM_BUILD_ROOT%{_docdir}/*/*.txt + +# Touch XvMCConfig for rpm to package the ghost file. (#192254) +{ + mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/X11 + touch $RPM_BUILD_ROOT%{_sysconfdir}/X11/XvMCConfig +} + +find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' + +%remove_docs + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%doc COPYING README ChangeLog +%{_libdir}/libXvMC.so.1 +%{_libdir}/libXvMC.so.1.0.0 +%{_libdir}/libXvMCW.so.1 +%{_libdir}/libXvMCW.so.1.0.0 +%ghost %config(missingok,noreplace) %verify (not md5 size mtime) %{_sysconfdir}/X11/XvMCConfig + +%files devel +%defattr(-,root,root,-) +%doc XvMC_API.txt +%{_includedir}/X11/extensions/XvMClib.h +%{_libdir}/libXvMC.so +%{_libdir}/libXvMCW.so +%{_libdir}/pkgconfig/xvmc.pc diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..05284fe --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,16 @@ +lib_LTLIBRARIES = libXvMC.la + +AM_CPPFLAGS = -I$(top_srcdir)/include $(MALLOC_ZERO_CFLAGS) +AM_CFLAGS = $(CWARNFLAGS) $(XVMC_CFLAGS) + +libXvMC_la_SOURCES = XvMC.c XvMClibint.h +libXvMC_la_LIBADD = $(XVMC_LIBS) +libXvMC_la_LDFLAGS = -version-number 1:0:0 -no-undefined + +if LINT +ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) + +lint: + $(LINT) $(ALL_LINT_FLAGS) $(libXvMC_la_SOURCES) $(AM_CFLAGS) $(XVMC_LIBS) +endif LINT diff --git a/src/XvMC.c b/src/XvMC.c new file mode 100644 index 0000000..8bf3215 --- /dev/null +++ b/src/XvMC.c @@ -0,0 +1,597 @@ +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "XvMClibint.h" +#ifdef HAVE_SHMAT +#ifndef Lynx +#include +#include +#else +#include +#include +#endif /* Lynx */ +#endif /* HAVE_SHMAT */ +#include +#include +#include +#include + +static XExtensionInfo _xvmc_info_data; +static XExtensionInfo *xvmc_info = &_xvmc_info_data; +static const char *xvmc_extension_name = XvMCName; + +static const char *xvmc_error_list[] = +{ + "BadContext", + "BadSurface", + "BadSubpicture" +}; + +static XEXT_GENERATE_CLOSE_DISPLAY (xvmc_close_display, xvmc_info) + + +static XEXT_GENERATE_ERROR_STRING (xvmc_error_string, xvmc_extension_name, + XvMCNumErrors, xvmc_error_list) + + +static XExtensionHooks xvmc_extension_hooks = { + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + xvmc_close_display, /* close_display */ + NULL, /* wire_to_event */ + NULL, /* event_to_wire */ + NULL, /* error */ + xvmc_error_string /* error_string */ +}; + +static XEXT_GENERATE_FIND_DISPLAY (xvmc_find_display, xvmc_info, + xvmc_extension_name, + &xvmc_extension_hooks, + XvMCNumEvents, NULL) + +Bool XvMCQueryExtension (Display *dpy, int *event_basep, int *error_basep) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + + if (XextHasExtension(info)) { + *event_basep = info->codes->first_event; + *error_basep = info->codes->first_error; + return True; + } else { + return False; + } +} + +Status XvMCQueryVersion (Display *dpy, int *major, int *minor) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcQueryVersionReply rep; + xvmcQueryVersionReq *req; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (QueryVersion, req); + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return BadImplementation; + } + *major = rep.major; + *minor = rep.minor; + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + + +XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcListSurfaceTypesReply rep; + xvmcListSurfaceTypesReq *req; + XvMCSurfaceInfo *surface_info = NULL; + + *num = 0; + + XvMCCheckExtension (dpy, info, NULL); + + LockDisplay (dpy); + XvMCGetReq (ListSurfaceTypes, req); + req->port = port; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return NULL; + } + + if(rep.num > 0) { + surface_info = + (XvMCSurfaceInfo*)Xmalloc(rep.num * sizeof(XvMCSurfaceInfo)); + + if(surface_info) { + xvmcSurfaceInfo sinfo; + int i; + + *num = rep.num; + + for(i = 0; i < rep.num; i++) { + _XRead(dpy, (char*)&sinfo, sizeof(xvmcSurfaceInfo)); + surface_info[i].surface_type_id = sinfo.surface_type_id; + surface_info[i].chroma_format = sinfo.chroma_format; + surface_info[i].max_width = sinfo.max_width; + surface_info[i].max_height = sinfo.max_height; + surface_info[i].subpicture_max_width = + sinfo.subpicture_max_width; + surface_info[i].subpicture_max_height = + sinfo.subpicture_max_height; + surface_info[i].mc_type = sinfo.mc_type; + surface_info[i].flags = sinfo.flags; + } + } else + _XEatData(dpy, rep.length << 2); + } + + UnlockDisplay (dpy); + SyncHandle (); + return surface_info; +} + + +XvImageFormatValues * XvMCListSubpictureTypes ( + Display * dpy, + XvPortID port, + int surface_type_id, + int *count_return +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcListSubpictureTypesReply rep; + xvmcListSubpictureTypesReq *req; + XvImageFormatValues *ret = NULL; + + + *count_return = 0; + + XvMCCheckExtension (dpy, info, NULL); + + + LockDisplay (dpy); + XvMCGetReq (ListSubpictureTypes, req); + req->port = port; + req->surface_type_id = surface_type_id; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return NULL; + } + + if(rep.num > 0) { + ret = + (XvImageFormatValues*)Xmalloc(rep.num * sizeof(XvImageFormatValues)); + + if(ret) { + xvImageFormatInfo Info; + int i; + + *count_return = rep.num; + + for(i = 0; i < rep.num; i++) { + _XRead(dpy, (char*)(&Info), sz_xvImageFormatInfo); + ret[i].id = Info.id; + ret[i].type = Info.type; + ret[i].byte_order = Info.byte_order; + memcpy(&(ret[i].guid[0]), &(Info.guid[0]), 16); + ret[i].bits_per_pixel = Info.bpp; + ret[i].format = Info.format; + ret[i].num_planes = Info.num_planes; + ret[i].depth = Info.depth; + ret[i].red_mask = Info.red_mask; + ret[i].green_mask = Info.green_mask; + ret[i].blue_mask = Info.blue_mask; + ret[i].y_sample_bits = Info.y_sample_bits; + ret[i].u_sample_bits = Info.u_sample_bits; + ret[i].v_sample_bits = Info.v_sample_bits; + ret[i].horz_y_period = Info.horz_y_period; + ret[i].horz_u_period = Info.horz_u_period; + ret[i].horz_v_period = Info.horz_v_period; + ret[i].vert_y_period = Info.vert_y_period; + ret[i].vert_u_period = Info.vert_u_period; + ret[i].vert_v_period = Info.vert_v_period; + memcpy(&(ret[i].component_order[0]), &(Info.comp_order[0]), 32); + ret[i].scanline_order = Info.scanline_order; + } + } else + _XEatData(dpy, rep.length << 2); + } + + UnlockDisplay (dpy); + SyncHandle (); + return ret; +} + + +/****************************************************************** + These are intended as a protocol interface to be used by direct + rendering libraries. They are not intended to be client viewable + functions. These will stay in place until we have a mechanism in + place similar to that of OpenGL with an libXvMCcore library. +*******************************************************************/ + +/* + _xvmc_create_context - + + Pass in the context with the surface_type_id, width, height, + port and flags filled out. This function will fill out the + context_id and update the width, height and flags field. + The server may return implementation-specific information + back in the priv_data. The size of that information will + an array of priv_count CARD32s. This data is allocated by + this function. If returned, the caller is responsible for + freeing it! Generally, such information is only returned if + an XVMC_DIRECT context was specified. +*/ + + +Status _xvmc_create_context ( + Display *dpy, + XvMCContext *context, + int *priv_count, + CARD32 **priv_data +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcCreateContextReply rep; + xvmcCreateContextReq *req; + + *priv_count = 0; + *priv_data = NULL; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (CreateContext, req); + context->context_id = XAllocID(dpy); + req->context_id = context->context_id; + req->port = context->port; + req->surface_type_id = context->surface_type_id; + req->width = context->width; + req->height = context->height; + req->flags = context->flags; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return BadImplementation; + } + context->width = rep.width_actual; + context->height = rep.height_actual; + context->flags = rep.flags_return; + + if(rep.length) { + *priv_data = Xmalloc(rep.length << 2); + if(*priv_data) { + _XRead(dpy, (char*)(*priv_data), rep.length << 2); + *priv_count = rep.length; + } else + _XEatData(dpy, rep.length << 2); + } + + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + +Status _xvmc_destroy_context ( + Display *dpy, + XvMCContext *context +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcDestroyContextReq *req; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (DestroyContext, req); + req->context_id = context->context_id; + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + + +/* + _xvmc_create_surface - + + Pass the context and this function will fill out all the + information in the surface. + The server may return implementation-specific information + back in the priv_data. The size of that information will + an array of priv_count CARD32s. This data is allocated by + this function. If returned, the caller is responsible for + freeing it! Generally, such information is returned only if + the context was a direct context. + +*/ + +Status _xvmc_create_surface ( + Display *dpy, + XvMCContext *context, + XvMCSurface *surface, + int *priv_count, + CARD32 **priv_data +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcCreateSurfaceReply rep; + xvmcCreateSurfaceReq *req; + + *priv_count = 0; + *priv_data = NULL; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (CreateSurface, req); + + surface->surface_id = XAllocID(dpy); + surface->context_id = context->context_id; + surface->surface_type_id = context->surface_type_id; + surface->width = context->width; + surface->height = context->height; + + req->surface_id = surface->surface_id; + req->context_id = surface->context_id; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return BadImplementation; + } + + if(rep.length) { + *priv_data = Xmalloc(rep.length << 2); + if(*priv_data) { + _XRead(dpy, (char*)(*priv_data), rep.length << 2); + *priv_count = rep.length; + } else + _XEatData(dpy, rep.length << 2); + } + + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + +Status _xvmc_destroy_surface ( + Display *dpy, + XvMCSurface *surface +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcDestroySurfaceReq *req; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (DestroySurface, req); + req->surface_id = surface->surface_id; + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + +/* + _xvmc_create_subpicture - + + Pass the subpicture with the width, height and xvimage_id filled + out and this function will fill out everything else in the + subpicture as well as adjust the width and height if needed. + The server may return implementation-specific information + back in the priv_data. The size of that information will + an array of priv_count CARD32s. This data is allocated by + this function. If returned, the caller is responsible for + freeing it! Generally, such information is returned only if + the context was a direct context. + +*/ + +Status _xvmc_create_subpicture ( + Display *dpy, + XvMCContext *context, + XvMCSubpicture *subpicture, + int *priv_count, + CARD32 **priv_data +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcCreateSubpictureReply rep; + xvmcCreateSubpictureReq *req; + + *priv_count = 0; + *priv_data = NULL; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (CreateSubpicture, req); + + subpicture->subpicture_id = XAllocID(dpy); + subpicture->context_id = context->context_id; + + req->subpicture_id = subpicture->subpicture_id; + req->context_id = subpicture->context_id; + req->xvimage_id = subpicture->xvimage_id; + req->width = subpicture->width; + req->height = subpicture->height; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return BadImplementation; + } + + subpicture->width = rep.width_actual; + subpicture->height = rep.height_actual; + subpicture->num_palette_entries = rep.num_palette_entries; + subpicture->entry_bytes = rep.entry_bytes; + subpicture->component_order[0] = rep.component_order[0]; + subpicture->component_order[1] = rep.component_order[1]; + subpicture->component_order[2] = rep.component_order[2]; + subpicture->component_order[3] = rep.component_order[3]; + + if(rep.length) { + *priv_data = Xmalloc(rep.length << 2); + if(*priv_data) { + _XRead(dpy, (char*)(*priv_data), rep.length << 2); + *priv_count = rep.length; + } else + _XEatData(dpy, rep.length << 2); + } + + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + +Status _xvmc_destroy_subpicture( + Display *dpy, + XvMCSubpicture *subpicture +) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcDestroySubpictureReq *req; + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (DestroySubpicture, req); + req->subpicture_id = subpicture->subpicture_id; + UnlockDisplay (dpy); + SyncHandle (); + return Success; +} + +Status XvMCGetDRInfo(Display *dpy, XvPortID port, + char **name, char **busID, + int *major, int *minor, + int *patchLevel, + int *isLocal) +{ + XExtDisplayInfo *info = xvmc_find_display(dpy); + xvmcGetDRInfoReply rep; + xvmcGetDRInfoReq *req; + char *tmpBuf = NULL; + CARD32 magic; + +#ifdef HAVE_SHMAT + volatile CARD32 *shMem; + struct timezone here; + struct timeval now; + here.tz_minuteswest = 0; + here.tz_dsttime = 0; +#endif + + XvMCCheckExtension (dpy, info, BadImplementation); + + LockDisplay (dpy); + XvMCGetReq (GetDRInfo, req); + + req->port = port; + magic = 0; + req->magic = 0; +#ifdef HAVE_SHMAT + req->shmKey = shmget(IPC_PRIVATE, 1024, IPC_CREAT | 0600); + + /* + * We fill a shared memory page with a repetitive pattern. If the + * X server can read this pattern, we probably have a local connection. + * Note that we can trigger the remote X server to read any shared + * page on the remote machine, so we shouldn't be able to guess and verify + * any complicated data on those pages. Thats the explanation of this + * otherwise stupid-looking pattern algorithm. + */ + + if (req->shmKey >= 0) { + shMem = (CARD32 *) shmat(req->shmKey, NULL, 0); + shmctl( req->shmKey, IPC_RMID, NULL); + if ( shMem ) { + + register volatile CARD32 *shMemC = shMem; + register int i; + + gettimeofday( &now, &here); + magic = now.tv_usec & 0x000FFFFF; + req->magic = magic; + i = 1024 / sizeof(CARD32); + while(i--) { + *shMemC++ = magic; + magic = ~magic; + } + } else { + req->shmKey = -1; + } + } +#else + req->shmKey = 0; +#endif + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); +#ifdef HAVE_SHMAT + if ( req->shmKey >= 0) { + shmdt( (const void *) shMem ); + } +#endif + return -1; + } +#ifdef HAVE_SHMAT + shmdt( (const void *) shMem ); +#endif + + if (rep.length > 0) { + + int realSize = rep.length << 2; + + tmpBuf = (char *) Xmalloc(realSize); + if (tmpBuf) { + *name = (char *) Xmalloc(rep.nameLen); + if (*name) { + *busID = (char *) Xmalloc(rep.busIDLen); + if (! *busID) { + XFree(*name); + XFree(tmpBuf); + } + } else { + XFree(tmpBuf); + } + } + + if (*name && *busID && tmpBuf) { + + _XRead(dpy, tmpBuf, realSize); + strncpy(*name,tmpBuf,rep.nameLen); + strncpy(*busID,tmpBuf+rep.nameLen,rep.busIDLen); + XFree(tmpBuf); + + } else { + + _XEatData(dpy, realSize); + UnlockDisplay (dpy); + SyncHandle (); + return -1; + + } + } + + UnlockDisplay (dpy); + SyncHandle (); + *major = rep.major; + *minor = rep.minor; + *patchLevel = rep.patchLevel; + *isLocal = (req->shmKey > 0) ? rep.isLocal : 1; + return (rep.length > 0) ? Success : BadImplementation; +} diff --git a/src/XvMClibint.h b/src/XvMClibint.h new file mode 100644 index 0000000..94c24ad --- /dev/null +++ b/src/XvMClibint.h @@ -0,0 +1,79 @@ +#ifndef _XVMCLIBINT_H +#define _XVMCLIBINT_H + +#include +#include +#include +#include + +#define XvMCCheckExtension(dpy, i, val) \ + XextCheckExtension(dpy, i, xvmc_extension_name, val) + + +#if !defined(UNIXCPP) +#define XvMCGetReq(name, req) \ + WORD64ALIGN\ + if ((dpy->bufptr + sizeof(xvmc##name##Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (xvmc##name##Req *)(dpy->last_req = dpy->bufptr);\ + req->reqType = info->codes->major_opcode;\ + req->xvmcReqType = xvmc_##name; \ + req->length = sizeof(xvmc##name##Req)>>2;\ + dpy->bufptr += sizeof(xvmc##name##Req);\ + dpy->request++ +#else +#define XvMCGetReq(name, req) \ + WORD64ALIGN\ + if ((dpy->bufptr + sizeof(xvmc/**/name/**/Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (xvmc/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ + req->reqType = info->codes->major_opcode;\ + req->xvmcReqType = xvmc_/**/name;\ + req->length = sizeof(xvmc/**/name/**/Req)>>2;\ + dpy->bufptr += sizeof(xvmc/**/name/**/Req);\ + dpy->request++ +#endif + +_XFUNCPROTOBEGIN + +Status _xvmc_create_context( + Display * /* dpy */, + XvMCContext * /* context */, + int * /* priv_count */, + CARD32 ** /* priv_data */ +); + +Status _xvmc_destroy_context( + Display * /* dpy */, + XvMCContext * /* context */ +); + +Status _xvmc_create_surface ( + Display * /* dpy */, + XvMCContext * /* context */, + XvMCSurface * /* surface */, + int * /* priv_count */, + CARD32 ** /* priv_data */ +); + +Status _xvmc_destroy_surface ( + Display * /* dpy */, + XvMCSurface * /* surface */ +); + +Status _xvmc_create_subpicture ( + Display * /* dpy */, + XvMCContext * /* context */, + XvMCSubpicture * /* subpicture */, + int * /* priv_count */, + CARD32 ** /* priv_data */ +); + +Status _xvmc_destroy_subpicture( + Display * /* dpy */, + XvMCSubpicture * /* subpicture */ +); + +_XFUNCPROTOEND + +#endif /* XVMCLIBINT_H */ diff --git a/wrapper/Makefile.am b/wrapper/Makefile.am new file mode 100644 index 0000000..b3a1c21 --- /dev/null +++ b/wrapper/Makefile.am @@ -0,0 +1,22 @@ +lib_LTLIBRARIES = libXvMCW.la + +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + $(MALLOC_ZERO_CFLAGS) \ + -DXVMC_CONFIGDIR=$(sysconfdir)/X11 \ + -DXVMC_SOVERSION=\".1.0\" \ + -DXV_SOVERSION=\".1.0\" + +AM_CFLAGS = $(CWARNFLAGS) $(XVMC_CFLAGS) + +libXvMCW_la_SOURCES = XvMCWrapper.c +libXvMCW_la_LIBADD = $(XVMC_LIBS) +libXvMCW_la_LDFLAGS = -version-number 1:0:0 -no-undefined + +if LINT +ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) + +lint: + $(LINT) $(ALL_LINT_FLAGS) $(libXvMCW_la_SOURCES) $(AM_CFLAGS) $(XVMC_LIBS) +endif LINT diff --git a/wrapper/XvMCWrapper.c b/wrapper/XvMCWrapper.c new file mode 100644 index 0000000..bff5a8b --- /dev/null +++ b/wrapper/XvMCWrapper.c @@ -0,0 +1,781 @@ +/***************************************************************************** + * XvMC Wrapper including the Nonstandard VLD extension. + * + * Copyright (c) 2004 The Unichrome project. All rights reserved. + * + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: Thomas Hellström (2004) + */ + +/* + * BUGS: The wrapper really should maintain one symbol table per port. This + * could possibly be impemented, To do that, the port-independent symbols need to be lifted out, + * and one would have to create a number of mapping tables: + * + * port -> symbol table + * context -> port + * surface -> port + * subpicture -> port + * + * and reference the right table when needed. + * This needs to be done only if there is a player that wants to access two displays with different + * hardware simultaneously. Not likely as of today. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +typedef Bool (*XvMCQueryExtensionP) (Display *, int *, int *); +typedef Status (*XvMCQueryVersionP) (Display *, int *,int *); +typedef XvMCSurfaceInfo * (*XvMCListSurfaceTypesP)(Display *, XvPortID, int *); +typedef Status (* XvMCCreateContextP) (Display *,XvPortID,int ,int ,int ,int ,XvMCContext * ); +typedef Status (*XvMCDestroyContextP) (Display *, XvMCContext * ); +typedef Status (*XvMCCreateSurfaceP)(Display *,XvMCContext *,XvMCSurface *); +typedef Status (*XvMCDestroySurfaceP)(Display *, XvMCSurface *); +typedef XvImageFormatValues * (*XvMCListSubpictureTypesP) (Display *,XvPortID ,int ,int *); +typedef Status (*XvMCPutSurfaceP)(Display *,XvMCSurface *,Drawable ,short , short , unsigned short , + unsigned short ,short ,short ,unsigned short ,unsigned short ,int ); +typedef Status (*XvMCHideSurfaceP)(Display *, XvMCSurface *); +typedef Status (*XvMCCreateSubpictureP) (Display *, XvMCContext *, XvMCSubpicture *, + unsigned short, unsigned short,int); +typedef Status (*XvMCClearSubpictureP) (Display *,XvMCSubpicture *,short,short,unsigned short,unsigned short, + unsigned int); +typedef Status (*XvMCCompositeSubpictureP) (Display *, XvMCSubpicture *,XvImage *,short,short, + unsigned short, unsigned short,short,short); +typedef Status (*XvMCDestroySubpictureP) (Display *, XvMCSubpicture *); +typedef Status (*XvMCSetSubpicturePaletteP) (Display *, XvMCSubpicture *, unsigned char *); +typedef Status (*XvMCBlendSubpictureP) (Display *d,XvMCSurface *,XvMCSubpicture *,short, + short,unsigned short,unsigned short,short,short, + unsigned short,unsigned short); +typedef Status (*XvMCBlendSubpicture2P) (Display *,XvMCSurface *,XvMCSurface *, + XvMCSubpicture *,short,short,unsigned short, + unsigned short,short,short,unsigned short, + unsigned short); +typedef Status (*XvMCSyncSurfaceP) (Display *, XvMCSurface *); +typedef Status (*XvMCFlushSurfaceP) (Display *, XvMCSurface *); +typedef Status (*XvMCGetSurfaceStatusP) (Display *, XvMCSurface *, int *); +typedef Status (*XvMCRenderSurfaceP) (Display *,XvMCContext *,unsigned int,XvMCSurface *, + XvMCSurface *,XvMCSurface *,unsigned int,unsigned int, + unsigned int,XvMCMacroBlockArray *,XvMCBlockArray *); +typedef Status (*XvMCSyncSubpictureP) (Display *, XvMCSubpicture *); +typedef Status (*XvMCFlushSubpictureP) (Display *, XvMCSubpicture *); +typedef Status (*XvMCGetSubpictureStatusP) (Display *, XvMCSubpicture *, int *); +typedef Status (*XvMCCreateBlocksP) (Display *, XvMCContext *,unsigned int,XvMCBlockArray *); +typedef Status (*XvMCDestroyBlocksP) (Display *,XvMCBlockArray *); +typedef Status (*XvMCCreateMacroBlocksP) (Display *,XvMCContext *,unsigned int, + XvMCMacroBlockArray *); +typedef Status (*XvMCDestroyMacroBlocksP) (Display *,XvMCMacroBlockArray *); +typedef XvAttribute *(*XvMCQueryAttributesP) (Display *,XvMCContext *,int *); +typedef Status (*XvMCSetAttributeP) (Display *,XvMCContext *, Atom, int); +typedef Status (*XvMCGetAttributeP) (Display *,XvMCContext *, Atom, int *); + +/* + * Nonstandard VLD acceleration level: + */ + +typedef Status (*XvMCBeginSurfaceP) (Display *,XvMCContext *,XvMCSurface *, + XvMCSurface *,XvMCSurface *f,const XvMCMpegControl *); +typedef Status (*XvMCLoadQMatrixP) (Display *, XvMCContext *,const XvMCQMatrix *); +typedef Status (*XvMCPutSliceP)(Display *,XvMCContext *, char *,int); +typedef Status (*XvMCPutSlice2P)(Display *,XvMCContext *, char *,int, unsigned); +typedef Status (*XvMCGetDRInfoP)(Display *, XvPortID, char **, char **, int *, int *, + int *, int *); + + +typedef struct { + XvMCQueryExtensionP XvMCQueryExtension; + XvMCQueryVersionP XvMCQueryVersion; + XvMCListSurfaceTypesP XvMCListSurfaceTypes; + XvMCCreateContextP XvMCCreateContext; + XvMCDestroyContextP XvMCDestroyContext; + XvMCCreateSurfaceP XvMCCreateSurface; + XvMCDestroySurfaceP XvMCDestroySurface; + XvMCListSubpictureTypesP XvMCListSubpictureTypes; + XvMCPutSurfaceP XvMCPutSurface; + XvMCHideSurfaceP XvMCHideSurface; + XvMCCreateSubpictureP XvMCCreateSubpicture; + XvMCClearSubpictureP XvMCClearSubpicture; + XvMCCompositeSubpictureP XvMCCompositeSubpicture; + XvMCDestroySubpictureP XvMCDestroySubpicture; + XvMCSetSubpicturePaletteP XvMCSetSubpicturePalette; + XvMCBlendSubpictureP XvMCBlendSubpicture; + XvMCBlendSubpicture2P XvMCBlendSubpicture2; + XvMCSyncSurfaceP XvMCSyncSurface; + XvMCFlushSurfaceP XvMCFlushSurface; + XvMCGetSurfaceStatusP XvMCGetSurfaceStatus; + XvMCRenderSurfaceP XvMCRenderSurface; + XvMCSyncSubpictureP XvMCSyncSubpicture; + XvMCFlushSubpictureP XvMCFlushSubpicture; + XvMCGetSubpictureStatusP XvMCGetSubpictureStatus; + XvMCCreateBlocksP XvMCCreateBlocks; + XvMCDestroyBlocksP XvMCDestroyBlocks; + XvMCCreateMacroBlocksP XvMCCreateMacroBlocks; + XvMCDestroyMacroBlocksP XvMCDestroyMacroBlocks; + XvMCQueryAttributesP XvMCQueryAttributes; + XvMCSetAttributeP XvMCSetAttribute; + XvMCGetAttributeP XvMCGetAttribute; + + /* + * Nonstandard VLD acceleration level: + */ + + XvMCBeginSurfaceP XvMCBeginSurface; + XvMCLoadQMatrixP XvMCLoadQMatrix; + XvMCPutSliceP XvMCPutSlice; + XvMCPutSlice2P XvMCPutSlice2; + + /* + * Driver name function. + */ + + XvMCGetDRInfoP XvMCGetDRInfo; + + int preInitialised; + int initialised; + int vldextension; +} XvMCWrapper; + +static XvMCWrapper xW; +static int wrapperInit = 0; +static int wrapperPreInit = 0; +static void *xvhandle; +static void *handle2; + +#define BUFLEN 200 + +#define STRS(ARG) STR(ARG) +#define STR(ARG) #ARG + +#define XW_RSYM(base,handle,handle2,pointer, retval) \ + do { \ + register char *err; \ + base.pointer = (pointer##P) dlsym((handle),#pointer); \ + if ((err = dlerror()) != NULL) { \ + if (!handle2) { \ + fprintf(stderr,"%s\n",err); return retval; \ + } \ + base.pointer = (pointer##P) dlsym((handle2),#pointer); \ + if ((err = dlerror()) != NULL) { \ + fprintf(stderr,"%s\n",err); return retval; \ + } \ + } \ + } while (0); + +#define XW_RSYM2(base,handle,handle2,pointer) \ + base.pointer = (pointer##P) dlsym((handle),#pointer); \ + if (dlerror() != NULL) { \ + base.pointer = (pointer##P) dlsym((handle2),#pointer); \ + if (dlerror() != NULL) return; \ + } + + +/* + * Try to dlopen a shared library, versionless first. + */ + + +static void *dlopenversion(const char *lib, const char *version, int flag) +{ + void *ret; + int curLen,verLen; + char *curName; + const char *tail; + + + curLen = strlen(lib) + (verLen = strlen(version)) + 1; + curName = (char *) malloc(curLen * sizeof(char)); + strncpy( curName, lib, curLen); + if (verLen > 1) { + if (NULL != (tail = strstr(version+1,"."))) { + strncat( curName, version, tail - version); + } else { + strncat( curName, version, verLen); + } + } + ret = dlopen(curName, flag); + free(curName); + return ret; +} + +static int preInitW(Display *dpy) +{ + + /* + * Resolve functions that are not hw driver specific. + */ + + void *handleZ = NULL; + + wrapperPreInit = 1; + xW.preInitialised = 0; + xW.initialised = 0; + xvhandle = dlopenversion("libXv.so", XV_SOVERSION, RTLD_LAZY | RTLD_GLOBAL); + if (!xvhandle) { + fprintf(stderr,"XvMCWrapper: Warning! Could not open shared " + "library \"libXv.so" XV_SOVERSION "\"\nThis may cause relocation " + "errors later.\nError was: \"%s\".\n",dlerror()); + } + handle2 = dlopenversion("libXvMC.so", XVMC_SOVERSION, RTLD_LAZY | RTLD_GLOBAL); + if (!handle2) { + fprintf(stderr,"XvMCWrapper: Could not load XvMC " + "library \"libXvMC.so" XVMC_SOVERSION "\". Failing\n"); + fprintf(stderr,"%s\n",dlerror()); + return 1; + } + XW_RSYM(xW, handle2, handleZ, XvMCQueryExtension, 1); + XW_RSYM(xW, handle2, handleZ, XvMCQueryVersion, 1); + xW.preInitialised = 1; + return 0; +} + +static void initW(Display *dpy, XvPortID port) +{ + char nameBuffer[BUFLEN]; + void *handle; + int tmp; + char *clientName = NULL; + char *err; + FILE *configFile; + int nameLen = 0; + int major,minor,patchLevel,isLocal; + char *busID = NULL; + + wrapperInit = 1; + xW.initialised = 0; + + if (!wrapperPreInit) + if (preInitW( dpy )) return; + + /* + * Will the DDX tell us the client driver name? + */ + + xW.XvMCGetDRInfo = (XvMCGetDRInfoP) + dlsym(handle2,"XvMCGetDRInfo"); + + if ((err = dlerror()) == NULL) { + if (0 == xW.XvMCGetDRInfo( dpy, port, &clientName, &busID, &major, + &minor,&patchLevel, &isLocal)) { + nameLen = strlen(clientName); + XFree(busID); + if (!isLocal) { + fprintf(stderr,"XvMCWrapper: X server is not local. Cannot run XvMC.\n"); + XFree(clientName); + return; + } + } else { + clientName = NULL; + } + } + + if (clientName && (nameLen < BUFLEN-7) && (nameLen > 0)) { + nameLen += 3; + strncpy(nameBuffer,"lib",BUFLEN-1); + strncpy(nameBuffer+3, clientName, BUFLEN-4); + strncpy(nameBuffer + nameLen, ".so", BUFLEN-nameLen-1); + nameBuffer[BUFLEN-1] = 0; + XFree(clientName); + handle = dlopenversion(nameBuffer, XVMC_SOVERSION,RTLD_LAZY); + } else { + /* + * No. Try to obtain it from the config file. + */ + + if (clientName) XFree(clientName); + + configFile = fopen(STRS(XVMC_CONFIGDIR) "/XvMCConfig","r"); + + xW.initialised = 0; + xW.vldextension = 0; + + if (NULL == configFile) { + fprintf(stderr,"XvMCWrapper: Could not open config file \"%s\".\n", + STRS(XVMC_CONFIGDIR) "/XvMCConfig"); + perror("XvMCWrapper"); + return; + } + + if (NULL == fgets(nameBuffer, BUFLEN, configFile)) { + fclose(configFile); + fprintf(stderr,"XvMCWrapper: Could not read XvMC library name.\n"); + perror("XvMCWrapper"); + return; + } + + fclose(configFile); + if ((tmp = strlen(nameBuffer)) == 0) { + fprintf(stderr,"XvMCWrapper: Zero length XvMC library name.\n"); + fprintf(stderr,"%s\n",dlerror()); + return; + } + + /* + * Skip trailing newlines and garbage. + */ + + while (iscntrl(nameBuffer[tmp-1])) { + nameBuffer[tmp-1] = 0; + if (--tmp == 0) { + fprintf(stderr,"XvMCWrapper: Zero length XvMC library name.\n"); + return; + } + } + handle = dlopen(nameBuffer,RTLD_LAZY); + } + if (!handle) { + fprintf(stderr,"XvMCWrapper: Could not load hardware specific XvMC " + "library \"%s\".\n",nameBuffer); + fprintf(stderr,"%s\n",dlerror()); + return; + } + + XW_RSYM(xW, handle, handle2, XvMCListSurfaceTypes,); + XW_RSYM(xW, handle, handle2, XvMCCreateContext,); + XW_RSYM(xW, handle, handle2, XvMCDestroyContext,); + XW_RSYM(xW, handle, handle2, XvMCCreateSurface,); + XW_RSYM(xW, handle, handle2, XvMCDestroySurface,); + XW_RSYM(xW, handle, handle2, XvMCListSubpictureTypes,); + XW_RSYM(xW, handle, handle2, XvMCHideSurface,); + XW_RSYM(xW, handle, handle2, XvMCCreateSubpicture,); + XW_RSYM(xW, handle, handle2, XvMCClearSubpicture,); + XW_RSYM(xW, handle, handle2, XvMCCompositeSubpicture,); + XW_RSYM(xW, handle, handle2, XvMCDestroySubpicture,); + XW_RSYM(xW, handle, handle2, XvMCSetSubpicturePalette,); + XW_RSYM(xW, handle, handle2, XvMCBlendSubpicture,); + XW_RSYM(xW, handle, handle2, XvMCBlendSubpicture2,); + XW_RSYM(xW, handle, handle2, XvMCPutSurface,); + XW_RSYM(xW, handle, handle2, XvMCSyncSurface,); + XW_RSYM(xW, handle, handle2, XvMCFlushSurface,); + XW_RSYM(xW, handle, handle2, XvMCGetSurfaceStatus,); + XW_RSYM(xW, handle, handle2, XvMCRenderSurface,); + XW_RSYM(xW, handle, handle2, XvMCSyncSubpicture,); + XW_RSYM(xW, handle, handle2, XvMCFlushSubpicture,); + XW_RSYM(xW, handle, handle2, XvMCGetSubpictureStatus,); + XW_RSYM(xW, handle, handle2, XvMCCreateBlocks,); + XW_RSYM(xW, handle, handle2, XvMCDestroyBlocks,); + XW_RSYM(xW, handle, handle2, XvMCCreateMacroBlocks,); + XW_RSYM(xW, handle, handle2, XvMCDestroyMacroBlocks,); + XW_RSYM(xW, handle, handle2, XvMCQueryAttributes,); + XW_RSYM(xW, handle, handle2, XvMCSetAttribute,); + XW_RSYM(xW, handle, handle2, XvMCGetAttribute,); + xW.initialised = 1; + XW_RSYM2(xW, handle, handle2, XvMCBeginSurface); + XW_RSYM(xW, handle, handle2, XvMCLoadQMatrix,); + XW_RSYM(xW, handle, handle2, XvMCPutSlice,); + XW_RSYM(xW, handle, handle2, XvMCPutSlice2,); + xW.vldextension = 1; +} + + +Bool XvMCQueryExtension (Display *display, int *eventBase, int *errBase) +{ + if (!wrapperPreInit) preInitW( display ); + if (!xW.preInitialised) return 0; + return (*xW.XvMCQueryExtension)(display, eventBase, errBase); +} + +Status XvMCQueryVersion (Display *display, int *major_versionp, + int *minor_versionp) +{ + if (!wrapperPreInit) preInitW( display ); + if (!xW.preInitialised) return 0; + return (*xW.XvMCQueryVersion)(display, major_versionp, minor_versionp); +} + + +XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num) +{ + if (!wrapperInit) initW( dpy, port); + if (!xW.initialised) return NULL; + return (*xW.XvMCListSurfaceTypes)(dpy, port, num); +} + +Status XvMCCreateContext ( + Display *display, + XvPortID port, + int surface_type_id, + int width, + int height, + int flags, + XvMCContext * context + ) +{ + if (!wrapperInit) initW(display, port); + if (!xW.initialised) return BadValue; + return (*xW.XvMCCreateContext)(display, port, surface_type_id, + width, height, flags, context); +} + +Status XvMCDestroyContext (Display *display, XvMCContext * context) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCDestroyContext)(display, context); +} + +Status +XvMCCreateSurface( + Display *display, + XvMCContext * context, + XvMCSurface * surface + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCCreateSurface)(display, context, surface); +} + +Status XvMCDestroySurface(Display *display, XvMCSurface *surface) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCDestroySurface)(display, surface); +} + + +XvImageFormatValues * XvMCListSubpictureTypes ( + Display * display, + XvPortID port, + int surface_type_id, + int *count_return + ) +{ + if (!xW.initialised) return NULL; + return (*xW.XvMCListSubpictureTypes)(display, port, surface_type_id, + count_return); +} + + +Status +XvMCPutSurface( + Display *display, + XvMCSurface *surface, + Drawable draw, + short srcx, + short srcy, + unsigned short srcw, + unsigned short srch, + short destx, + short desty, + unsigned short destw, + unsigned short desth, + int flags + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCPutSurface)(display, surface, draw, srcx, srcy, srcw, srch, + destx, desty, destw, desth, flags); +} + +Status XvMCHideSurface(Display *display, XvMCSurface *surface) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCHideSurface)(display, surface); +} + + +Status +XvMCCreateSubpicture ( + Display *display, + XvMCContext *context, + XvMCSubpicture *subpicture, + unsigned short width, + unsigned short height, + int xvimage_id + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCCreateSubpicture)(display, context, subpicture, width, height, + xvimage_id); +} + + +Status +XvMCClearSubpicture ( + Display *display, + XvMCSubpicture *subpicture, + short x, + short y, + unsigned short width, + unsigned short height, + unsigned int color + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCClearSubpicture)(display, subpicture, x, y, width, height, color); +} + + +Status +XvMCCompositeSubpicture ( + Display *display, + XvMCSubpicture *subpicture, + XvImage *image, + short srcx, + short srcy, + unsigned short width, + unsigned short height, + short dstx, + short dsty + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCCompositeSubpicture)(display, subpicture, image, srcx, srcy, + width, height, dstx, dsty); +} + +Status +XvMCDestroySubpicture (Display *display, XvMCSubpicture *subpicture) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCDestroySubpicture)(display, subpicture); +} + +Status +XvMCSetSubpicturePalette ( + Display *display, + XvMCSubpicture *subpicture, + unsigned char *palette + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCSetSubpicturePalette)(display, subpicture, palette); +} + + +Status +XvMCBlendSubpicture ( + Display *display, + XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, + short suby, + unsigned short subw, + unsigned short subh, + short surfx, + short surfy, + unsigned short surfw, + unsigned short surfh + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCBlendSubpicture)(display, target_surface, subpicture, + subx, suby, subw, subh, surfx, surfy, + surfw, surfh); +} + +Status +XvMCBlendSubpicture2 ( + Display *display, + XvMCSurface *source_surface, + XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, + short suby, + unsigned short subw, + unsigned short subh, + short surfx, + short surfy, + unsigned short surfw, + unsigned short surfh + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCBlendSubpicture2)(display, source_surface, target_surface, subpicture, + subx, suby, subw, subh, surfx, surfy, surfw, surfh); +} + + +Status XvMCSyncSurface (Display *display, XvMCSurface *surface) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCSyncSurface)(display, surface); +} + +Status XvMCFlushSurface (Display *display, XvMCSurface *surface) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCFlushSurface)(display, surface); +} + +Status XvMCGetSurfaceStatus (Display *display, XvMCSurface *surface, int *stat) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCGetSurfaceStatus)(display, surface, stat); +} + +Status XvMCRenderSurface ( + Display *display, + XvMCContext *context, + unsigned int picture_structure, + XvMCSurface *target_surface, + XvMCSurface *past_surface, + XvMCSurface *future_surface, + unsigned int flags, + unsigned int num_macroblocks, + unsigned int first_macroblock, + XvMCMacroBlockArray *macroblock_array, + XvMCBlockArray *blocks + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCRenderSurface)(display, context, picture_structure, target_surface, + past_surface, future_surface, flags, num_macroblocks, + first_macroblock, macroblock_array, blocks); +} + +Status XvMCSyncSubpicture (Display *display, XvMCSubpicture *subpicture) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCSyncSubpicture)(display, subpicture); +} + +Status XvMCFlushSubpicture (Display *display, XvMCSubpicture *subpicture) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCFlushSubpicture)(display, subpicture); +} +Status +XvMCGetSubpictureStatus (Display *display, XvMCSubpicture *subpic, int *stat) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCGetSubpictureStatus)(display, subpic, stat); +} + +Status XvMCCreateBlocks ( + Display *display, + XvMCContext *context, + unsigned int num_blocks, + XvMCBlockArray *block + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCCreateBlocks)(display, context, num_blocks, block); +} + + +Status XvMCDestroyBlocks (Display *display,XvMCBlockArray *block) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCDestroyBlocks)(display, block); +} + +Status XvMCCreateMacroBlocks ( + Display *display, + XvMCContext *context, + unsigned int num_blocks, + XvMCMacroBlockArray *blocks + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCCreateMacroBlocks)(display, context, num_blocks, blocks); +} + + +Status XvMCDestroyMacroBlocks ( + Display *display, + XvMCMacroBlockArray *block + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCDestroyMacroBlocks)(display, block); +} + + +XvAttribute * +XvMCQueryAttributes ( + Display *display, + XvMCContext *context, + int *number + ) +{ + if (!xW.initialised) return NULL; + return (*xW.XvMCQueryAttributes)(display, context, number); +} + + +Status +XvMCSetAttribute ( + Display *display, + XvMCContext *context, + Atom attribute, + int value + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCSetAttribute)(display, context, attribute, value); +} + + +Status +XvMCGetAttribute ( + Display *display, + XvMCContext *context, + Atom attribute, + int *value + ) +{ + if (!xW.initialised) return BadValue; + return (*xW.XvMCGetAttribute)(display, context, attribute, value); +} + + +Status XvMCBeginSurface(Display *display, + XvMCContext *context, + XvMCSurface *target_surface, + XvMCSurface *past_surface, + XvMCSurface *future_surface, + const XvMCMpegControl *control) +{ + if (!xW.vldextension) return BadValue; + return (*xW.XvMCBeginSurface)(display, context, target_surface, past_surface, future_surface, + control); +} + +Status XvMCLoadQMatrix(Display *display, XvMCContext *context, + const XvMCQMatrix *qmx) +{ + if (!xW.vldextension) return BadValue; + return (*xW.XvMCLoadQMatrix)(display, context, qmx); +} + +Status XvMCPutSlice(Display *display,XvMCContext *context, + char *slice, int nBytes) +{ + if (!xW.vldextension) return BadValue; + return (*xW.XvMCPutSlice)(display, context, slice, nBytes); +} + +Status XvMCPutSlice2(Display *display,XvMCContext *context, + char *slice, int nBytes, int sliceCode) +{ + if (!xW.vldextension) return BadValue; + return (*xW.XvMCPutSlice2)(display, context, slice, nBytes, sliceCode); +} diff --git a/xvmc.pc.in b/xvmc.pc.in new file mode 100644 index 0000000..ecf81d2 --- /dev/null +++ b/xvmc.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: XvMC +Description: The XvMC Library +Version: @PACKAGE_VERSION@ +Requires: xproto videoproto xv +Requires.private: x11 xext xv +Cflags: -I${includedir} +Libs: -L${libdir} -lXvMC -- 2.7.4