tizen 2.4 release accepted/tizen_2.4_mobile tizen_2.4 accepted/tizen/2.4/mobile/20151029.025922 submit/tizen_2.4/20151028.065332 tizen_2.4_mobile_release
authorjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 08:24:01 +0000 (17:24 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 08:24:01 +0000 (17:24 +0900)
13 files changed:
.gitignore [new file with mode: 0644]
ChangeLog [deleted file]
INSTALL [deleted file]
autogen.sh [new file with mode: 0755]
configure.ac
include/X11/extensions/Xvlib.h
man/XvListImageFormats.man
packaging/baselibs.conf [new file with mode: 0644]
packaging/libXv.changes [new file with mode: 0644]
packaging/libXv.manifest [new file with mode: 0644]
packaging/libXv.spec [changed mode: 0755->0644]
src/Xv.c
src/Xvlibint.h

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..2cf65b9
--- /dev/null
@@ -0,0 +1,78 @@
+#
+#              X.Org module default exclusion patterns
+#              The next section if for module specific patterns
+#
+#      Do not edit the following section
+#      GNU Build System (Autotools)
+aclocal.m4
+autom4te.cache/
+autoscan.log
+ChangeLog
+compile
+config.guess
+config.h
+config.h.in
+config.log
+config-ml.in
+config.py
+config.status
+config.status.lineno
+config.sub
+configure
+configure.scan
+depcomp
+.deps/
+INSTALL
+install-sh
+.libs/
+libtool
+libtool.m4
+ltmain.sh
+lt~obsolete.m4
+ltoptions.m4
+ltsugar.m4
+ltversion.m4
+Makefile
+Makefile.in
+mdate-sh
+missing
+mkinstalldirs
+*.pc
+py-compile
+stamp-h?
+symlink-tree
+texinfo.tex
+ylwrap
+
+#      Do not edit the following section
+#      Edit Compile Debug Document Distribute
+*~
+*.[0-9]
+*.[0-9]x
+*.bak
+*.bin
+core
+*.dll
+*.exe
+*-ISO*.bdf
+*-JIS*.bdf
+*-KOI8*.bdf
+*.kld
+*.ko
+*.ko.cmd
+*.lai
+*.l[oa]
+*.[oa]
+*.obj
+*.patch
+*.so
+*.pcf.gz
+*.pdb
+*.tar.bz2
+*.tar.gz
+#
+#              Add & Override patterns for libXv 
+#
+#              Edit the following section as needed
+# For example, !report.pc overrides *.pc. See 'man gitignore'
+# 
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644 (file)
index ab6871f..0000000
--- a/ChangeLog
+++ /dev/null
@@ -1,686 +0,0 @@
-commit 0f4fa1820041394e879517abb49c0391ecc796f7
-Author: Alan Coopersmith <alan.coopersmith@oracle.com>
-Date:   Wed Mar 7 21:25:38 2012 -0800
-
-    libXv 1.0.7
-    
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-
-commit de5e2271b54b7fe8bb3f8b66a70b5b87853f51a2
-Author: Alan Coopersmith <alan.coopersmith@oracle.com>
-Date:   Thu Nov 10 21:45:11 2011 -0800
-
-    Fix gcc -Wwrite-strings warnings
-    
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-
-commit ff45155aa59c22aa5abc5ffe941dfe3b0f4c288f
-Author: Jeremy Huddleston <jeremyhu@apple.com>
-Date:   Wed Oct 5 20:59:37 2011 -0700
-
-    XvQueryExtension doesn't return XvBadAlloc
-    
-    https://bugs.freedesktop.org/show_bug.cgi?id=22829
-    
-    Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-
-commit 21ce77de0fc1b92bb55699df7e93dd1aae988fc5
-Author: Alan Coopersmith <alan.coopersmith@oracle.com>
-Date:   Fri Sep 16 22:56:12 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 <alan.coopersmith@oracle.com>
-
-commit 7091e73f39b813adcc8fa5e61ad336ba063d7e00
-Author: Gaetan Nadon <memsize@videotron.ca>
-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])
-    Remove redundant AC_SUBST(*_CFLAGS) and/or *_LIBS
-    No functional configuration changes
-    
-    This helps automated maintenance and release activities.
-    Details can be found in http://wiki.x.org/wiki/NewModuleGuidelines
-
-commit 50a2f154f20763c9e98bdcf705fa366c87c6bae4
-Author: Gaetan Nadon <memsize@videotron.ca>
-Date:   Fri Jan 28 19:41:37 2011 -0500
-
-    config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS
-    
-    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
-
-commit b9b6680cbc95501af70c3597bfdd51d17aace695
-Author: Gaetan Nadon <memsize@videotron.ca>
-Date:   Thu Jan 27 18:50:15 2011 -0500
-
-    config: remove AC_PROG_CC as it overrides AC_PROG_C_C99
-    
-    XORG_STRICT_OPTION from XORG_DEFAULT_OPTIONS calls
-    AC_PROG_C_C99. This sets gcc with -std=gnu99.
-    If AC_PROG_CC macro is called afterwards, it resets CC to gcc.
-    
-    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
-
-commit e34fff44ebc4f8c258df127f6f80d0a1aa86a25d
-Author: Alan Coopersmith <alan.coopersmith@oracle.com>
-Date:   Fri Oct 29 17:52:32 2010 -0700
-
-    libXv 1.0.6
-    
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-
-commit 6e0da1da31552faaba26a351be0a4cf2d5964b05
-Author: Alan Coopersmith <alan.coopersmith@oracle.com>
-Date:   Fri Oct 29 17:51:53 2010 -0700
-
-    Sun's copyrights now belong to Oracle
-    
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-
-commit 4c2bc9a94ee759423adbc4e7c99b9bf9fea692ec
-Author: Jesse Adkins <jesserayadkins@gmail.com>
-Date:   Tue Sep 28 13:30:04 2010 -0700
-
-    Purge cvs tags.
-    
-    Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com>
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-
-commit ec92e24e86363fcbc14f8dce9739a430f68b998f
-Author: Gaetan Nadon <memsize@videotron.ca>
-Date:   Wed Aug 18 17:29:15 2010 -0400
-
-    man: whitespace management
-    
-    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
-
-commit 7bb70e6f8f394775d5d7ed7035a6d4b2accd2892
-Author: Gaetan Nadon <memsize@videotron.ca>
-Date:   Wed Aug 18 17:23:31 2010 -0400
-
-    man: remove unrequired local fix for bug 5628
-    
-    Local fix in CVS for bug 5628 is not required
-    as the problem has been fixed in
-    util-macros d9062e4077ebfd0985baf8418f3d0f111b9ddbba
-    
-    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
-
-commit 14cf5e3d19488f9a36824a01d4aba4a7f5ebc1cd
-Author: Alan Coopersmith <alan.coopersmith@oracle.com>
-Date:   Thu Jul 8 15:21:36 2010 -0700
-
-    config: upgrade to util-macros 1.8 for additional man page support
-    
-    Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS
-    The value of MAN_SUBST is the same for all X.Org packages.
-    
-    Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS
-    Enables use of platform appropriate version of sed.
-    
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-
-commit e106f955dfc23798975ef14b3d3400aff39eced9
-Author: Fernando Carrijo <fcarrijo@yahoo.com.br>
-Date:   Thu Jul 1 07:07:12 2010 -0300
-
-    Purge macro NEED_REPLIES
-    
-    Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
-    Acked-by: Tiago Vignatti <tiago.vignatti@nokia.com>
-    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-
-commit 481033e52111a42ae80c2814a499a068d7dc4771
-Author: Gaetan Nadon <memsize@videotron.ca>
-Date:   Mon Mar 29 16:50:34 2010 -0400
-
-    config: update AC_PREREQ statement to 2.60
-    
-    Unrelated to the previous patches, the new value simply reflects
-    the reality that the minimum level for autoconf to configure
-    all x.org modules is 2.60 dated June 2006.
-    
-    ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
-    
-    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
-
-commit ea333fad90bce73c95a5ac310c127e22d6b41c6c
-Author: Gaetan Nadon <memsize@videotron.ca>
-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 <memsize@videotron.ca>
-
-commit 917a09fe40630d9ba2ac7f2f48636989f3163580
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Thu Jan 14 20:55:17 2010 -0800
-
-    Update Sun license notices to current X.Org standard form
-    
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-
-commit f0225573605729797a0edd00276f4704f9cda3c2
-Author: Gaetan Nadon <memsize@videotron.ca>
-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 f6ab500cf3d00bfa49070007c006e500253b6d84
-Author: Gaetan Nadon <memsize@videotron.ca>
-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 fec734de503d63bb0abce9088be2e6655e82f800
-Author: Gaetan Nadon <memsize@videotron.ca>
-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 f0b191321146550b88a94233b9677e32044b6c0e
-Author: Gaetan Nadon <memsize@videotron.ca>
-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 9ae8551458ee56b7ea19066023da64c7e24ea9f3
-Author: Gaetan Nadon <memsize@videotron.ca>
-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 05974c72286a9556ebf5ff541967fa53f75a55a8
-Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
-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 <jeremyhu@freedesktop.org>
-
-commit 5be9a0099a83d1acf464640e930518a4c46c0920
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Sat Oct 3 02:12:52 2009 -0700
-
-    libXv 1.0.5
-    
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-
-commit 5aa62bb376608cd0350e46263dec74f861019431
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Sat Oct 3 01:53:56 2009 -0700
-
-    Migrate to xorg macros 1.3 & XORG_DEFAULT_OPTIONS
-    
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-
-commit 4d189188c913e6956344689802a582589db04abe
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Sat Oct 3 01:31:44 2009 -0700
-
-    Convert documentation from xv-library-v2.2.txt into man pages
-    
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-
-commit 7303af622984579e600893934a3958c0654d57bf
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Fri Oct 2 08:55:52 2009 -0700
-
-    Man page cleanups and formatting fixes
-    
-     - Convert man page section headings to traditional style/names
-       Make them all caps, and use 'synopsis' instead of 'syntax'
-     - Strip trailing whitespace from man pages
-     - Add return types to function prototypes
-     - Fix unbalanced quoting and other formatting issues
-     - Use .BR for formatting man page references
-     - Add "libXv Functions" to man page header
-    
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-
-commit ea79759a6940855dab10472a876e784fb8494eee
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Thu Oct 1 23:04:56 2009 -0700
-
-    Move xv-library-v2.2.txt document from xorg-docs
-    
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-
-commit dbf88774a77d91f3f7996071dfccf61636afa77b
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Sat May 9 17:13:11 2009 -0700
-
-    Adjust flags definitions to fix lint library build
-    
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-
-commit 7cc28e8ae807e69663e0a73cd12edf9963277a2d
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Mon Feb 2 20:34:37 2009 -0800
-
-    Add README with pointers to mailing list, bugzilla & git repos
-    
-    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-
-commit 245b7cffe78203eeb265ac73177ed258471cb227
-Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
-Date:   Mon Feb 2 13:58:34 2009 -0200
-
-    Janitor: make distcheck, compiler warnings, .gitignore.
-
-commit 2c0dc990a1ad96b71c95800d83378413eab63dbb
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Mon Mar 17 20:01:01 2008 -0700
-
-    Version bump: 1.0.4
-
-commit acb78abb510e7e69e74fb3bba80d8ceaf2af7ce4
-Author: Matthieu Herrb <matthieu.herrb@laas.fr>
-Date:   Sun Mar 9 08:43:44 2008 +0100
-
-    nuke RCS Ids
-
-commit d455a1d9ae336a397a1b1a08228b7faa1024c1aa
-Author: Ademar de Souza Reis Jr <ademar@mandriva.com.br>
-Date:   Mon Aug 20 19:02:40 2007 -0300
-
-    get rid of ancient XFree86 CVS Id tags
-
-commit 8b0752135f84edebc5e476f19069c8d78676f416
-Author: Ademar de Souza Reis Jr <ademar@mandriva.com.br>
-Date:   Mon Aug 20 18:58:44 2007 -0300
-
-    convert manpages prototypes to C ANSI format
-    
-    Closes: #8360 (libXv man pages should be
-    converted to ANSI prototypes)
-
-commit 20d07bb9ba2bca56e3f02b4b878377eded241059
-Author: Daniel Stone <daniel@fooishbar.org>
-Date:   Sat Dec 16 01:31:51 2006 +0200
-
-    bump to 1.0.3
-
-commit 2f0089d24ab28f3325a5da7a136873eefb0bd97f
-Author: Daniel Stone <daniel@fooishbar.org>
-Date:   Wed Dec 6 19:00:07 2006 +0200
-
-    Makefile.am: make ChangeLog hook safer
-    Make ChangeLog hook as safe as possible.
-
-commit 978e98c43245671b4fdedb42371260f5fa139f14
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Mon Sep 25 14:49:45 2006 -0700
-
-    Bump version number to 1.0.2
-
-commit 1dd351499ee692bb71eee4cffc305431843cfb87
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Fri Sep 22 19:06:30 2006 -0700
-
-    Fill in AUTHORS & COPYING files
-
-commit e5cb03cfa7386e13bede2d33d06be5369ab2a5d2
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Tue Sep 19 15:06:27 2006 -0700
-
-    Correct description of dpy argument in libXv function man pages
-    
-    (Previous description applies to programs, not functions - you must supply a
-     valid Display pointer to functions, there is no fallback to $DISPLAY.)
-
-commit 5dc20e33bc29f1efd88ed1cf5e83943ab53b9ac6
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Tue Sep 19 13:25:27 2006 -0700
-
-    Fix man page typos
-
-commit dd25684d6f67b8c5a836b98d224ac6bf21076972
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Mon Sep 18 16:29:46 2006 -0700
-
-    Coverity CID #580: XvQueryEncodings Returned without freeing storage "pes"
-    
-    Free the portion of the encoding list we had already filled in if we get
-    an error allocating memory for a list entry.
-
-commit 8681d431516979dcffd1ca7a65d47026d8ad0336
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Mon Sep 18 16:14:11 2006 -0700
-
-    Add hooks for running code checkers like sparse & lint over the source
-
-commit d19e0d1fe15de6b9a2bfffe30bd041497c021eaf
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Mon Sep 18 16:13:16 2006 -0700
-
-    Add argument types to static function prototypes to clear sparse & lint warnings
-
-commit 3c80665e7c53db021b52ad267c12c6b4f43e7c3a
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Mon Sep 18 15:45:50 2006 -0700
-
-    Replace static Changelog with dist-hook to generate from git log
-
-commit d968d8b6777f21b799a99c9652c27e39da319b00
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Mon Sep 18 15:43:59 2006 -0700
-
-    Add *~ to .gitignore to skip emacs droppings
-
-commit abab8955bdb30ffe74dc3b8fe2e6b009a2d2cf3d
-Author: Alan Coopersmith <alan.coopersmith@sun.com>
-Date:   Thu Jul 13 14:59:10 2006 -0700
-
-    renamed: .cvsignore -> .gitignore
-
-commit 8bf896eb20d6752f31b7d966ff6d8c3f905b536d
-Author: Kevin E Martin <kem@kem.org>
-Date:   Wed Dec 21 02:30:06 2005 +0000
-
-    Update package version for X11R7 release.
-
-commit d54ce4a8f14bcb3d027c1bf8f46e215caf596dad
-Author: Adam Jackson <ajax@nwnk.net>
-Date:   Mon Dec 19 16:28:27 2005 +0000
-
-    Stub COPYING files
-
-commit 6561f50b1ac74ebb02ec13d434af1e8bef50fd99
-Author: Kevin E Martin <kem@kem.org>
-Date:   Thu Dec 15 00:24:35 2005 +0000
-
-    Update package version number for final X11R7 release candidate.
-
-commit e495ba278269a66eab6829b796e7fa32b79dbc2e
-Author: Kevin E Martin <kem@kem.org>
-Date:   Tue Dec 6 22:48:45 2005 +0000
-
-    Change *man_SOURCES ==> *man_PRE to fix autotools warnings.
-
-commit 4cf396de99b15b48751ece43e74f0aeb60ab5d50
-Author: Kevin E Martin <kem@kem.org>
-Date:   Sat Dec 3 05:49:45 2005 +0000
-
-    Update package version number for X11R7 RC3 release.
-
-commit 4ff8025f6d0c9ef14e500d123613ccee45c8c23e
-Author: Kevin E Martin <kem@kem.org>
-Date:   Sat Dec 3 04:41:51 2005 +0000
-
-    Add check and cflags for malloc(0) returning NULL.
-
-commit 4c738dba961b3eae69e466a0bfcd8e6e3e539675
-Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
-Date:   Mon Nov 28 22:03:06 2005 +0000
-
-    Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4
-        update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir)
-
-commit 9460f736b6f61687b20e91e0a02aa81c879d7e4f
-Author: Eric Anholt <anholt@freebsd.org>
-Date:   Sun Nov 20 23:17:41 2005 +0000
-
-    Add/improve libs .cvsignores.
-
-commit ed2d19981e048a31d3a594341787f0505d4dd6a8
-Author: Kevin E Martin <kem@kem.org>
-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 768933f26103bd9324e3c3efbc287ca21a2776b3
-Author: Kevin E Martin <kem@kem.org>
-Date:   Wed Oct 19 02:48:12 2005 +0000
-
-    Update package version number for RC1 release.
-
-commit 6159966aa69254620b25552bb09ae00ef31798ef
-Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
-Date:   Tue Oct 18 00:00:09 2005 +0000
-
-    Use @LIB_MAN_SUFFIX@ instead of $(LIB_MAN_SUFFIX) in macro substitutions to
-        work better with BSD make
-
-commit 0b5be2efbcd3d405f1d84b6b31add361a39f411d
-Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
-Date:   Thu Oct 13 05:13:36 2005 +0000
-
-    doc/man/Xv/Xv.man
-    doc/man/Xv/XvFreeAdaptorInfo.man
-    doc/man/Xv/XvFreeEncodingInfo.man
-    doc/man/Xv/XvGetPortAttribute.man
-    doc/man/Xv/XvGetStill.man
-    doc/man/Xv/XvGetVideo.man
-    doc/man/Xv/XvGrabPort.man
-    doc/man/Xv/XvPortNotify.man
-    doc/man/Xv/XvPutStill.man
-    doc/man/Xv/XvPutVideo.man
-    doc/man/Xv/XvQueryAdaptors.man
-    doc/man/Xv/XvQueryBestSize.man
-    doc/man/Xv/XvQueryEncodings.man
-    doc/man/Xv/XvQueryExtension.man
-    doc/man/Xv/XvSelectPortNotify.man
-    doc/man/Xv/XvSelectVideoNotify.man
-    doc/man/Xv/XvSetPortAttribute.man
-    doc/man/Xv/XvStopVideo.man
-    doc/man/Xv/XvUngrabPort.man
-    doc/man/Xv/XvVideoNotify.man Convert hardcoded 3X to substitutable
-        __libmansuffix__ like other library man pages.
-
-commit 0b0ae11e4d5872f55bd412f7876c4b526d420fe0
-Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
-Date:   Thu Oct 13 04:47:38 2005 +0000
-
-    [lib/Xv]
-    Use sed to fill in variables in man pages
-
-commit bc34a489531d1a71857a5d68e4c256d1dacb89ae
-Author: Adam Jackson <ajax@nwnk.net>
-Date:   Wed Aug 3 03:28:02 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 45bb17c155ce80c817e29144e960b02596ed7214
-Author: Kevin E Martin <kem@kem.org>
-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 ca932bc2cfaa0a7faaf9c0d870ea4314de24855e
-Author: Daniel Stone <daniel@fooishbar.org>
-Date:   Sat Jul 16 07:41:25 2005 +0000
-
-    Set soversion to 1.0.0 with -version-number.
-
-commit 2ece1ee39d248966d2399b30b9de6307db86f4b5
-Author: Daniel Stone <daniel@fooishbar.org>
-Date:   Tue Jul 12 01:10:57 2005 +0000
-
-    Add Xvlib.h, change soversion to 1.0.0.
-
-commit 6ed09fe071574abdf5f7c08d9f1de41f4177e5df
-Author: Daniel Stone <daniel@fooishbar.org>
-Date:   Tue Jul 12 00:35:54 2005 +0000
-
-    Change version to 2.2.0.
-
-commit f27ed2a7dfd43345ae820186a033c301d77861ad
-Author: Daniel Stone <daniel@fooishbar.org>
-Date:   Tue Jul 12 00:34:54 2005 +0000
-
-    Typo fix.
-
-commit 9db3c882e7571eebc98d0070c3ccbc7633b57604
-Author: Keith Packard <keithp@keithp.com>
-Date:   Sat Jul 9 06:53:49 2005 +0000
-
-    Add .cvsignore files Switch _la_CFLAGS for AM_CFLAGS to clean up directory
-
-commit 1b0c54229a5259677eab3f80cf8baedc1ca802e5
-Author: Daniel Stone <daniel@fooishbar.org>
-Date:   Sun Jul 3 07:00:57 2005 +0000
-
-    Add Xtrans definitions (FONT_t, TRANS_CLIENT) to clean up warnings.
-    Add XSERV_t, TRANS_SERVER, TRANS_REOPEN to quash warnings.
-    Add #include <dix-config.h> or <xorg-config.h>, as appropriate, to all
-        source files in the xserver/xorg tree, predicated on defines of
-        HAVE_{DIX,XORG}_CONFIG_H. Change all Xfont includes to
-        <X11/fonts/foo.h>.
-
-commit a0abd747a0203ddf590fd0f4973f12dd0a5fc48d
-Author: Kevin E Martin <kem@kem.org>
-Date:   Sat Jul 2 06:35:03 2005 +0000
-
-    Add appropriate lib*_CFLAGS to Makefile.am's -- fixes build problems
-
-commit 9064f83cdb11b1515fec1c9f33bd7397ad7f492b
-Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
-Date:   Fri Jul 1 20:09:12 2005 +0000
-
-    xtrap.pc.in: s/Xfixes/XTrap/ xi.pc.in: s/Xt/Xi/ Xv/src/Makefile.am: remove
-        whitespace after backslash modularizeapp.sh: s/destkop/desktop/
-        modular/symlink.sh: Add bitmaps for xeyes, system.xsm for xsm, and
-        Xvidtune.cpp for xvidtune. Also comment out non-existing mga_bios.h
-    Check in buildsystems for xsetroot, xsm, xstdcmap, xtrap, and xvinfo
-
-commit dd829239e989de7b7affc504fc29da673d1d46d5
-Author: Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>
-Date:   Tue Jun 21 15:41:36 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 ea1bfd2bef80ed33740916dfc8118ca8ac94a0eb
-Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
-Date:   Mon Jun 13 20:30:01 2005 +0000
-
-    - Add Xv man pages
-
-commit 3e71b1e06264f84428e04264b740a634cd7a5499
-Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
-Date:   Mon Jun 13 19:55:32 2005 +0000
-
-    - Add Xv to symlink.sh
-    - Add Xv build system
-
-commit 7306d726bfd8ba10d7ad75f8167dc3ddd85b65e6
-Author: Egbert Eich <eich@suse.de>
-Date:   Fri Apr 23 18:43:55 2004 +0000
-
-    Merging XORG-CURRENT into trunk
-
-commit 71d90c59573b4ef0f90e3f9bde03efd6dcf2912e
-Author: Egbert Eich <eich@suse.de>
-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 7cb88c27d6784873439ae6bdd22d78784eae41da
-Author: Egbert Eich <eich@suse.de>
-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 1faf3c691266e6f9a40914900eb6c94bd639ffb0
-Author: Egbert Eich <eich@suse.de>
-Date:   Thu Feb 26 13:35:34 2004 +0000
-
-    readding XFree86's cvs IDs
-
-commit e2399deda299a091cbd99cebf363595534a8ea55
-Author: Egbert Eich <eich@suse.de>
-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 fe30a03a47c336d508667bb0477383f389e13b5e
-Author: Kaleb Keithley <kaleb@freedesktop.org>
-Date:   Thu Dec 4 22:02:57 2003 +0000
-
-    XFree86 4.3.99.901 (RC 1)
-
-commit 22a0d01c7610f366cf3cec9e7f7cf5968dcc285e
-Author: Kaleb Keithley <kaleb@freedesktop.org>
-Date:   Tue Nov 25 19:28:16 2003 +0000
-
-    XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks
-
-commit ddef819383953954d9514eab7803367ef20dee82
-Author: Kaleb Keithley <kaleb@freedesktop.org>
-Date:   Fri Nov 14 16:48:49 2003 +0000
-
-    XFree86 4.3.0.1
-
-commit 355f676a4ff26d8fcdfdbe64e791e60bc579e339
-Author: Kaleb Keithley <kaleb@freedesktop.org>
-Date:   Fri Nov 14 16:48:49 2003 +0000
-
-    Initial revision
diff --git a/INSTALL b/INSTALL
deleted file mode 100644 (file)
index 8b82ade..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,291 +0,0 @@
-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 `<wchar.h>' 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/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..fc34bd5
--- /dev/null
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
+
+if test -z "$NOCONFIGURE"; then
+    $srcdir/configure "$@"
+fi
index d3ad5bf..4d651b5 100644 (file)
 
 # Initialize Autoconf
 AC_PREREQ([2.60])
-AC_INIT([libXv], [1.0.7],
+AC_INIT([libXv], [1.0.10],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXv])
 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
@@ -42,7 +41,7 @@ XORG_DEFAULT_OPTIONS
 XORG_CHECK_MALLOC_ZERO
 
 # Obtain compiler/linker options for depedencies
-PKG_CHECK_MODULES(XV, x11 xext xextproto videoproto)
+PKG_CHECK_MODULES(XV, [x11 >= 1.6 xext xextproto videoproto])
 
 # Allow checking code with lint, sparse, etc.
 XORG_WITH_LINT
index 313037a..32b98bf 100644 (file)
@@ -57,323 +57,323 @@ SOFTWARE.
 #include <X11/extensions/XShm.h>
 
 typedef struct {
-  int numerator;
-  int denominator;
+    int numerator;
+    int denominator;
 } XvRational;
 
 typedef struct {
-  int flags;   /* XvGettable, XvSettable */
-  int min_value;
-  int max_value;
-  char *name;
+    int flags;                  /* XvGettable, XvSettable */
+    int min_value;
+    int max_value;
+    char *name;
 } XvAttribute;
 
 typedef struct {
-  XvEncodingID encoding_id;
-  char *name;
-  unsigned long width;
-  unsigned long height;
-  XvRational rate;
-  unsigned long num_encodings;
+    XvEncodingID encoding_id;
+    char *name;
+    unsigned long width;
+    unsigned long height;
+    XvRational rate;
+    unsigned long num_encodings;
 } XvEncodingInfo;
 
 typedef struct {
-  char depth;
-  unsigned long visual_id;
+    char depth;
+    unsigned long visual_id;
 } XvFormat;
 
 typedef struct {
-  XvPortID base_id;
-  unsigned long num_ports;
-  char type;
-  char *name;
-  unsigned long num_formats;
-  XvFormat *formats;
-  unsigned long num_adaptors;
+    XvPortID base_id;
+    unsigned long num_ports;
+    char type;
+    char *name;
+    unsigned long num_formats;
+    XvFormat *formats;
+    unsigned long num_adaptors;
 } XvAdaptorInfo;
 
 typedef struct {
-  int type;
-  unsigned long serial;           /* # of last request processed by server */
-  Bool send_event;        /* true if this came from a SendEvent request */
-  Display *display;       /* Display the event was read from */
-  Drawable drawable;       /* drawable */
-  unsigned long reason;    /* what generated this event */
-  XvPortID port_id;        /* what port */
-  Time time;              /* milliseconds */
+    int type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool send_event;            /* true if this came from a SendEvent request */
+    Display *display;           /* Display the event was read from */
+    Drawable drawable;          /* drawable */
+    unsigned long reason;       /* what generated this event */
+    XvPortID port_id;           /* what port */
+    Time time;                  /* milliseconds */
 } XvVideoNotifyEvent;
 
 typedef struct {
-  int type;
-  unsigned long serial;           /* # of last request processed by server */
-  Bool send_event;        /* true if this came from a SendEvent request */
-  Display *display;       /* Display the event was read from */
-  XvPortID port_id;        /* what port */
-  Time time;              /* milliseconds */
-  Atom attribute;           /* atom that identifies attribute */
-  long value;              /* value of attribute */
+    int type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool send_event;            /* true if this came from a SendEvent request */
+    Display *display;           /* Display the event was read from */
+    XvPortID port_id;           /* what port */
+    Time time;                  /* milliseconds */
+    Atom attribute;             /* atom that identifies attribute */
+    long value;                 /* value of attribute */
 } XvPortNotifyEvent;
 
 typedef union {
-  int type;
-  XvVideoNotifyEvent xvvideo;
-  XvPortNotifyEvent xvport;
-  long pad[24];
+    int type;
+    XvVideoNotifyEvent xvvideo;
+    XvPortNotifyEvent xvport;
+    long pad[24];
 } XvEvent;
 
 typedef struct {
-  int id;                      /* Unique descriptor for the format */
-  int type;                    /* XvRGB, XvYUV */
-  int byte_order;              /* LSBFirst, MSBFirst */
-  char guid[16];               /* Globally Unique IDentifier */
-  int bits_per_pixel;
-  int format;                  /* XvPacked, XvPlanar */
-  int num_planes;
-
-  /* for RGB formats only */
-  int depth;
-  unsigned int red_mask;
-  unsigned int green_mask;
-  unsigned int blue_mask;
-
-  /* for YUV formats only */
-  unsigned int y_sample_bits;
-  unsigned int u_sample_bits;
-  unsigned int v_sample_bits;
-  unsigned int horz_y_period;
-  unsigned int horz_u_period;
-  unsigned int horz_v_period;
-  unsigned int vert_y_period;
-  unsigned int vert_u_period;
-  unsigned int vert_v_period;
-  char component_order[32];    /* eg. UYVY */
-  int scanline_order;          /* XvTopToBottom, XvBottomToTop */
+    int id;                     /* Unique descriptor for the format */
+    int type;                   /* XvRGB, XvYUV */
+    int byte_order;             /* LSBFirst, MSBFirst */
+    char guid[16];              /* Globally Unique IDentifier */
+    int bits_per_pixel;
+    int format;                 /* XvPacked, XvPlanar */
+    int num_planes;
+
+    /* for RGB formats only */
+    int depth;
+    unsigned int red_mask;
+    unsigned int green_mask;
+    unsigned int blue_mask;
+
+    /* for YUV formats only */
+    unsigned int y_sample_bits;
+    unsigned int u_sample_bits;
+    unsigned int v_sample_bits;
+    unsigned int horz_y_period;
+    unsigned int horz_u_period;
+    unsigned int horz_v_period;
+    unsigned int vert_y_period;
+    unsigned int vert_u_period;
+    unsigned int vert_v_period;
+    char component_order[32];   /* eg. UYVY */
+    int scanline_order;         /* XvTopToBottom, XvBottomToTop */
 } XvImageFormatValues;
 
 typedef struct {
-  int id;
-  int width, height;
-  int data_size;              /* bytes */
-  int num_planes;
-  int *pitches;               /* bytes */
-  int *offsets;               /* bytes */
-  char *data;
-  XPointer obdata;
+    int id;
+    int width, height;
+    int data_size;              /* bytes */
+    int num_planes;
+    int *pitches;               /* bytes */
+    int *offsets;               /* bytes */
+    char *data;
+    XPointer obdata;
 } XvImage;
 
 _XFUNCPROTOBEGIN
 
 extern int XvQueryExtension(
-  Display*                 /* display */,
-  unsigned int*            /* p_version */,
-  unsigned int*            /* p_revision */,
-  unsigned int*            /* p_requestBase */,
-  unsigned int*            /* p_eventBase */,
-  unsigned int*            /* p_errorBase */
+    Display *                   /* display */,
+    unsigned int *              /* p_version */,
+    unsigned int *              /* p_revision */,
+    unsigned int *              /* p_requestBase */,
+    unsigned int *              /* p_eventBase */,
+    unsigned int *              /* p_errorBase */
 );
 
 extern int XvQueryAdaptors(
-  Display*                 /* display */,
-  Window                   /* window */,
-  unsigned int*            /* p_nAdaptors */,
-  XvAdaptorInfo**          /* p_pAdaptors */
+    Display *                   /* display */,
+    Window                      /* window */,
+    unsigned int *              /* p_nAdaptors */,
+    XvAdaptorInfo **            /* p_pAdaptors */
 );
 
 extern int XvQueryEncodings(
-  Display*                 /* display */,
-  XvPortID                 /* port */,
-  unsigned int*            /* p_nEncoding */,
-  XvEncodingInfo**         /* p_pEncoding */
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    unsigned int *              /* p_nEncoding */,
+    XvEncodingInfo **           /* p_pEncoding */
 );
 
 extern int XvPutVideo(
-  Display*                 /* display */,
-  XvPortID                 /* port */,
-  Drawable                 /* d */,
-  GC                       /* gc */,
-  int                      /* vx */,
-  int                      /* vy */,
-  unsigned int             /* vw */,
-  unsigned int             /* vh */,
-  int                      /* dx */,
-  int                      /* dy */,
-  unsigned int             /* dw */,
-  unsigned int             /* dh */
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Drawable                    /* d */,
+    GC                          /* gc */,
+    int                         /* vx */,
+    int                         /* vy */,
+    unsigned int                /* vw */,
+    unsigned int                /* vh */,
+    int                         /* dx */,
+    int                         /* dy */,
+    unsigned int                /* dw */,
+    unsigned int                /* dh */
 );
 
 extern int XvPutStill(
-  Display*                 /* display */,
-  XvPortID                 /* port */,
-  Drawable                 /* d */,
-  GC                       /* gc */,
-  int                      /* vx */,
-  int                      /* vy */,
-  unsigned int             /* vw */,
-  unsigned int             /* vh */,
-  int                      /* dx */,
-  int                      /* dy */,
-  unsigned int             /* dw */,
-  unsigned int             /* dh */
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Drawable                    /* d */,
+    GC                          /* gc */,
+    int                         /* vx */,
+    int                         /* vy */,
+    unsigned int                /* vw */,
+    unsigned int                /* vh */,
+    int                         /* dx */,
+    int                         /* dy */,
+    unsigned int                /* dw */,
+    unsigned int                /* dh */
 );
 
 extern int XvGetVideo(
-  Display*                 /* display */,
-  XvPortID                 /* port */,
-  Drawable                 /* d */,
-  GC                       /* gc */,
-  int                      /* vx */,
-  int                      /* vy */,
-  unsigned int             /* vw */,
-  unsigned int             /* vh */,
-  int                      /* dx */,
-  int                      /* dy */,
-  unsigned int             /* dw */,
-  unsigned int             /* dh */
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Drawable                    /* d */,
+    GC                          /* gc */,
+    int                         /* vx */,
+    int                         /* vy */,
+    unsigned int                /* vw */,
+    unsigned int                /* vh */,
+    int                         /* dx */,
+    int                         /* dy */,
+    unsigned int                /* dw */,
+    unsigned int                /* dh */
 );
 
 extern int XvGetStill(
-  Display*                 /* display */,
-  XvPortID                 /* port */,
-  Drawable                 /* d */,
-  GC                       /* gc */,
-  int                      /* vx */,
-  int                      /* vy */,
-  unsigned int             /* vw */,
-  unsigned int             /* vh */,
-  int                      /* dx */,
-  int                      /* dy */,
-  unsigned int             /* dw */,
-  unsigned int             /* dh */
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Drawable                    /* d */,
+    GC                          /* gc */,
+    int                         /* vx */,
+    int                         /* vy */,
+    unsigned int                /* vw */,
+    unsigned int                /* vh */,
+    int                         /* dx */,
+    int                         /* dy */,
+    unsigned int                /* dw */,
+    unsigned int                /* dh */
 );
 
 extern int XvStopVideo(
-  Display*                /* display */,
-  XvPortID                /* port */,
-  Drawable                /* drawable */
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Drawable                    /* drawable */
 );
 
 extern int XvGrabPort(
-  Display*                /* display */,
-  XvPortID                /* port */,
-  Time                    /* time */
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Time                        /* time */
 );
 
 extern int XvUngrabPort(
-  Display*                /* display */,
-  XvPortID                /* port */,
-  Time                    /* time */
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Time                        /* time */
 );
 
 extern int XvSelectVideoNotify(
-  Display*                /* display */,
-  Drawable                /* drawable */,
-  Bool                    /* onoff */
+    Display *                   /* display */,
+    Drawable                    /* drawable */,
+    Bool                        /* onoff */
 );
 
 extern int XvSelectPortNotify(
-  Display*                /* display */,
-  XvPortID                /* port */,
-  Bool                    /* onoff */
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Bool                        /* onoff */
 );
 
 extern int XvSetPortAttribute(
-  Display*                /* display */,
-  XvPortID                /* port */,
-  Atom                    /* attribute */,
-  int                     /* value */
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Atom                        /* attribute */,
+    int                         /* value */
 );
 
 extern int XvGetPortAttribute(
-  Display*                /* display */,
-  XvPortID                /* port */,
-  Atom                    /* attribute */,
-  int*                    /* p_value */
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Atom                        /* attribute */,
+    int *                       /* p_value */
 );
 
 extern int XvQueryBestSize(
-  Display*                /* display */,
-  XvPortID                /* port */,
-  Bool                    /* motion */,
-  unsigned int            /* vid_w */,
-  unsigned int            /* vid_h */,
-  unsigned int            /* drw_w */,
-  unsigned int            /* drw_h */,
-  unsigned int*           /* p_actual_width */,
-  unsigned int*           /* p_actual_width */
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    Bool                        /* motion */,
+    unsigned int                /* vid_w */,
+    unsigned int                /* vid_h */,
+    unsigned int                /* drw_w */,
+    unsigned int                /* drw_h */,
+    unsigned int *              /* p_actual_width */,
+    unsigned int *              /* p_actual_width */
 );
 
-extern XvAttributeXvQueryPortAttributes(
-  Display*                /* display */,
-  XvPortID                /* port */,
-  int*                    /* number */
+extern XvAttribute *XvQueryPortAttributes(
+    Display *                   /* display */,
+    XvPortID                    /* port */,
+    int *                       /* number */
 );
 
 
 extern void XvFreeAdaptorInfo(
-  XvAdaptorInfo*          /* adaptors */
+    XvAdaptorInfo *             /* adaptors */
 );
 
 extern void XvFreeEncodingInfo(
-  XvEncodingInfo*         /* encodings */
+    XvEncodingInfo *            /* encodings */
 );
 
 
-extern XvImageFormatValues * XvListImageFormats (
-   Display     *display,
-   XvPortID    port_id,
-   int                 *count_return
+extern XvImageFormatValues *XvListImageFormats (
+    Display     *display,
+    XvPortID    port_id,
+    int         *count_return
 );
 
-extern XvImage * XvCreateImage (
-   Display *display,
-   XvPortID port,
-   int id,
-   char *data,
-   int width,
-   int height
+extern XvImage *XvCreateImage (
+    Display *display,
+    XvPortID port,
+    int id,
+    char *data,
+    int width,
+    int height
 );
 
 extern int XvPutImage (
-  Display *display,
-   XvPortID id,
-   Drawable d,
-   GC gc,
-   XvImage *image,
-   int src_x,
-   int src_y,
-   unsigned int src_w,
-   unsigned int src_h,
-   int dest_x,
-   int dest_y,
-   unsigned int dest_w,
-   unsigned int dest_h
+    Display *display,
+    XvPortID id,
+    Drawable d,
+    GC gc,
+    XvImage *image,
+    int src_x,
+    int src_y,
+    unsigned int src_w,
+    unsigned int src_h,
+    int dest_x,
+    int dest_y,
+    unsigned int dest_w,
+    unsigned int dest_h
 );
 
 extern int XvShmPutImage (
-   Display *display,
-   XvPortID id,
-   Drawable d,
-   GC gc,
-   XvImage *image,
-   int src_x,
-   int src_y,
-   unsigned int src_w,
-   unsigned int src_h,
-   int dest_x,
-   int dest_y,
-   unsigned int dest_w,
-   unsigned int dest_h,
-   Bool send_event
+    Display *display,
+    XvPortID id,
+    Drawable d,
+    GC gc,
+    XvImage *image,
+    int src_x,
+    int src_y,
+    unsigned int src_w,
+    unsigned int src_h,
+    int dest_x,
+    int dest_y,
+    unsigned int dest_w,
+    unsigned int dest_h,
+    Bool send_event
 );
 
-extern XvImage * XvShmCreateImage (
-   Display *display,
-   XvPortID port,
-   int id,
-   char* data,
-   int width,
-   int height,
-   XShmSegmentInfo *shminfo
+extern XvImage *XvShmCreateImage (
+    Display *display,
+    XvPortID port,
+    int id,
+    char *data,
+    int width,
+    int height,
+    XShmSegmentInfo *shminfo
 );
 
 
index c5159e5..51e5a2e 100644 (file)
@@ -1,15 +1,15 @@
 .TH XvListImageFormats __libmansuffix__ __vendorversion__ "libXv Functions"
-.SH Name
+.SH NAME
 XvListImageFormats \- return list of image formats supported by a video port
 .\"
-.SH Syntax
+.SH SYNTAX
 .B #include <X11/extensions/Xvlib.h>
 .sp
 .nf
 .BI "XvImageFormatValues * XvListImageFormats (Display *" dpy ","
 .BI "                 XvPortID " port ",  int *" p_num_formats ");"
 .fi
-.SH Arguments
+.SH ARGUMENTS
 .\"
 .IP \fIdpy\fR 8
 Specifies the connection to the X server.
@@ -18,12 +18,12 @@ Specifies the port whose adaptor is to be queried for its list of attributes.
 .IP \fIp_num_formats\fR 8
 A pointer to where the number of formats returned in the array is written.
 .\"
-.SH Description
+.SH DESCRIPTION
 .BR XvListImageFormats (__libmansuffix__)
 returns the XvImageFormatValues supported by the specified port. This list
 should be freed with
 .BR XFree (__libmansuffix__).
-.SH Returned Values
+.SH RETURN VALUES
 XvImageFormatValues has the following structure:
 .EX
 
@@ -93,15 +93,15 @@ For planar formats this represents the ordering of the planes.
 .IP \fIscanline_order\fR 8
 XvTopToBottom or XvBottomToTop.
 .\"
-.SH Notes
+.SH NOTES
 Since some formats (particularly some planar YUV formats) may not be
 completely defined by the parameters above, the guid, when available,
 should provide the most accurate description of the format.
 .\"
-.SH Diagnostics
+.SH DIAGNOSTICS
 .IP [XvBadPort] 8
 Generated if the requested port does not exist.
 .\"
-.SH See Also
+.SH SEE ALSO
 .BR XvCreateImage (__libmansuffix__),
 .BR XvCreateShmImage (__libmansuffix__)
diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf
new file mode 100644 (file)
index 0000000..30a6596
--- /dev/null
@@ -0,0 +1 @@
+libXv
diff --git a/packaging/libXv.changes b/packaging/libXv.changes
new file mode 100644 (file)
index 0000000..7df62b8
--- /dev/null
@@ -0,0 +1,6 @@
+* Mon Mar 18 2013 Anas Nashif <anas.nashif@intel.com> submit/trunk/20130204.203832@77f2dc0
+- Fixed package groups
+
+* Mon Feb 04 2013 Anas Nashif <anas.nashif@intel.com> upstream/1.0.7@ef80db9
+- Add multi-lib support
+
diff --git a/packaging/libXv.manifest b/packaging/libXv.manifest
new file mode 100644 (file)
index 0000000..017d22d
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+    <domain name="_"/>
+ </request>
+</manifest>
old mode 100755 (executable)
new mode 100644 (file)
index 0d7f7f0..9e33847
@@ -1,6 +1,6 @@
 Summary: X.Org X11 libXv runtime library
 Name:    libXv
-Version: 1.0.7
+Version: 1.0.10
 Release: 1
 License: MIT
 Group: System Environment/Libraries
@@ -51,7 +51,7 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(-,root,root,-)
 /usr/share/license/%{name}
-%doc AUTHORS COPYING ChangeLog
+%doc AUTHORS COPYING
 %{_libdir}/libXv.so.1
 %{_libdir}/libXv.so.1.0.0
 
@@ -62,4 +62,4 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/libXv.so
 %{_libdir}/pkgconfig/xv.pc
 #%dir %{_mandir}/man3x
-#%{_mandir}/man3/*.3*
+#%{_mandir}/man3/*.3*
\ No newline at end of file
index b081e8a..e47093a 100644 (file)
--- a/src/Xv.c
+++ b/src/Xv.c
@@ -49,11 +49,16 @@ SOFTWARE.
 **
 */
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <stdio.h>
 #include "Xvlibint.h"
 #include <X11/extensions/Xext.h>
 #include <X11/extensions/extutil.h>
 #include <X11/extensions/XShm.h>
+#include <limits.h>
 
 static XExtensionInfo _xv_info_data;
 static XExtensionInfo *xv_info = &_xv_info_data;
@@ -62,1094 +67,1121 @@ static const char *xv_extension_name = XvName;
 #define XvCheckExtension(dpy, i, val) \
   XextCheckExtension(dpy, i, xv_extension_name, val)
 
+#define pad_to_int32(bytes) (((bytes) + 3) & ~3U)
+
 static char *xv_error_string(Display *dpy, int code, XExtCodes *codes,
-                            char * buf, int n);
+                             char *buf, int n);
 static int xv_close_display(Display *dpy, XExtCodes *codes);
 static Bool xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire);
 
 static XExtensionHooks xv_extension_hooks = {
-    NULL,                               /* create_gc */
-    NULL,                               /* copy_gc */
-    NULL,                               /* flush_gc */
-    NULL,                               /* free_gc */
-    NULL,                               /* create_font */
-    NULL,                               /* free_font */
-    xv_close_display,                   /* close_display */
-    xv_wire_to_event,                   /* wire_to_event */
-    NULL,                               /* event_to_wire */
-    NULL,                               /* error */
-    xv_error_string                     /* error_string */
+    NULL,                       /* create_gc */
+    NULL,                       /* copy_gc */
+    NULL,                       /* flush_gc */
+    NULL,                       /* free_gc */
+    NULL,                       /* create_font */
+    NULL,                       /* free_font */
+    xv_close_display,           /* close_display */
+    xv_wire_to_event,           /* wire_to_event */
+    NULL,                       /* event_to_wire */
+    NULL,                       /* error */
+    xv_error_string             /* error_string */
 };
 
 
-static const char *xv_error_list[] =
-{
-   "BadPort",      /* XvBadPort     */
-   "BadEncoding",   /* XvBadEncoding */
-   "BadControl"     /* XvBadControl  */
+static const char *xv_error_list[] = {
+    "BadPort",                  /* XvBadPort     */
+    "BadEncoding",              /* XvBadEncoding */
+    "BadControl"                /* XvBadControl  */
 };
 
-static XEXT_GENERATE_CLOSE_DISPLAY (xv_close_display, xv_info)
+static XEXT_GENERATE_CLOSE_DISPLAY(xv_close_display, xv_info)
 
+static XEXT_GENERATE_FIND_DISPLAY(xv_find_display, xv_info,
+                                 xv_extension_name, &xv_extension_hooks,
+                                 XvNumEvents, NULL)
 
-static XEXT_GENERATE_FIND_DISPLAY (xv_find_display, xv_info,
-                                   xv_extension_name,
-                                   &xv_extension_hooks,
-                                  XvNumEvents, NULL)
-
-
-static XEXT_GENERATE_ERROR_STRING (xv_error_string, xv_extension_name,
-                                   XvNumErrors, xv_error_list)
+static XEXT_GENERATE_ERROR_STRING(xv_error_string, xv_extension_name,
+                                 XvNumErrors, xv_error_list)
 
 
 int
 XvQueryExtension(
-     Display *dpy,
-     unsigned int *p_version,
-     unsigned int *p_revision,
-     unsigned int *p_requestBase,
-     unsigned int *p_eventBase,
-     unsigned int *p_errorBase
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvQueryExtensionReq *req;
-  xvQueryExtensionReply rep;
-
-  XvCheckExtension(dpy, info, XvBadExtension);
-
-  LockDisplay(dpy);
-
-  XvGetReq(QueryExtension, req);
-
-  if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-     UnlockDisplay(dpy);
-     SyncHandle();
-     return XvBadExtension;
-  }
-
-  *p_version = rep.version;
-  *p_revision = rep.revision;
-  *p_requestBase = info->codes->major_opcode;
-  *p_eventBase = info->codes->first_event;
-  *p_errorBase = info->codes->first_error;
-
-  UnlockDisplay(dpy);
-  SyncHandle();
-
-  return Success;
+    Display *dpy,
+    unsigned int *p_version,
+    unsigned int *p_revision,
+    unsigned int *p_requestBase,
+    unsigned int *p_eventBase,
+    unsigned int *p_errorBase)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvQueryExtensionReq *req;
+    xvQueryExtensionReply rep;
+    int status;
+
+    XvCheckExtension(dpy, info, XvBadExtension);
+
+    LockDisplay(dpy);
+
+    XvGetReq(QueryExtension, req);
+
+    if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
+        status = XvBadExtension;
+        goto out;
+    }
+
+    *p_version = rep.version;
+    *p_revision = rep.revision;
+    *p_requestBase = info->codes->major_opcode;
+    *p_eventBase = info->codes->first_event;
+    *p_errorBase = info->codes->first_error;
+
+    status = Success;
+
+  out:
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return status;
 }
 
 int
 XvQueryAdaptors(
-     Display *dpy,
-     Window window,
-     unsigned int *p_nAdaptors,
-     XvAdaptorInfo **p_pAdaptors
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvQueryAdaptorsReq *req;
-  xvQueryAdaptorsReply rep;
-  int size,ii,jj;
-  char *name;
-  XvAdaptorInfo *pas, *pa;
-  XvFormat *pfs, *pf;
-  char *buffer;
-  union
-    {
-      char *buffer;
-      char *string;
-      xvAdaptorInfo *pa;
-      xvFormat *pf;
+    Display *dpy,
+    Window window,
+    unsigned int *p_nAdaptors,
+    XvAdaptorInfo **p_pAdaptors)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvQueryAdaptorsReq *req;
+    xvQueryAdaptorsReply rep;
+    size_t size;
+    unsigned int ii, jj;
+    char *name;
+    XvAdaptorInfo *pas = NULL, *pa;
+    XvFormat *pfs, *pf;
+    char *buffer = NULL;
+    union {
+        char *buffer;
+        char *string;
+        xvAdaptorInfo *pa;
+        xvFormat *pf;
     } u;
+    int status;
+
+    XvCheckExtension(dpy, info, XvBadExtension);
+
+    LockDisplay(dpy);
+
+    XvGetReq(QueryAdaptors, req);
+    req->window = window;
+
+    /* READ THE REPLY */
+
+    if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == 0) {
+        rep.num_adaptors = 0;
+        status = XvBadReply;
+        goto out;
+    }
+
+    size = rep.length << 2;
+    if (size > 0) {
+        if ((buffer = Xmalloc(size)) == NULL) {
+            _XEatDataWords(dpy, rep.length);
+            status = XvBadAlloc;
+            goto out;
+        }
+        _XRead(dpy, buffer, (long) size);
+    }
+
+    /* GET INPUT ADAPTORS */
+
+    if (rep.num_adaptors == 0) {
+        /* If there's no adaptors, there's nothing more to do. */
+        status = Success;
+        goto out;
+    }
+
+    if (size < (rep.num_adaptors * sz_xvAdaptorInfo)) {
+        /* If there's not enough data for the number of adaptors,
+           then we have a problem. */
+        status = XvBadReply;
+        goto out;
+    }
+
+    size = rep.num_adaptors * sizeof(XvAdaptorInfo);
+    if ((pas = Xmalloc(size)) == NULL) {
+        status = XvBadAlloc;
+        goto out;
+    }
+
+    /* INIT ADAPTOR FIELDS */
+
+    pa = pas;
+    for (ii = 0; ii < rep.num_adaptors; ii++) {
+        pa->num_adaptors = 0;
+        pa->name = (char *) NULL;
+        pa->formats = (XvFormat *) NULL;
+        pa++;
+    }
+
+    u.buffer = buffer;
+    pa = pas;
+    for (ii = 0; ii < rep.num_adaptors; ii++) {
+        pa->type = u.pa->type;
+        pa->base_id = u.pa->base_id;
+        pa->num_ports = u.pa->num_ports;
+        pa->num_formats = u.pa->num_formats;
+        pa->num_adaptors = rep.num_adaptors - ii;
+
+        /* GET ADAPTOR NAME */
+
+        size = u.pa->name_size;
+        u.buffer += pad_to_int32(sz_xvAdaptorInfo);
+
+        if ((name = Xmalloc(size + 1)) == NULL) {
+            status = XvBadAlloc;
+            goto out;
+        }
+        (void) strncpy(name, u.string, size);
+        name[size] = '\0';
+        pa->name = name;
+
+        u.buffer += pad_to_int32(size);
+
+        /* GET FORMATS */
+
+        size = pa->num_formats * sizeof(XvFormat);
+        if ((pfs = Xmalloc(size)) == NULL) {
+            status = XvBadAlloc;
+            goto out;
+        }
 
-  XvCheckExtension(dpy, info, XvBadExtension);
-
-  LockDisplay(dpy);
-
-  XvGetReq(QueryAdaptors, req);
-  req->window = window;
-
-  /* READ THE REPLY */
-
-  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return(XvBadReply);
-  }
-
-  size = rep.length << 2;
-  if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return(XvBadAlloc);
-  }
-  _XRead (dpy, buffer, size);
-
-  u.buffer = buffer;
-
-  /* GET INPUT ADAPTORS */
-
-  if (rep.num_adaptors == 0) {
-      pas = NULL;
-  } else {
-      size = rep.num_adaptors*sizeof(XvAdaptorInfo);
-      if ((pas=(XvAdaptorInfo *)Xmalloc(size))==NULL) {
-          Xfree(buffer);
-          UnlockDisplay(dpy);
-          SyncHandle();
-          return(XvBadAlloc);
-      }
-  }
-
-  /* INIT ADAPTOR FIELDS */
-
-  pa = pas;
-  for (ii=0; ii<rep.num_adaptors; ii++) {
-      pa->num_adaptors = 0;
-      pa->name = (char *)NULL;
-      pa->formats = (XvFormat *)NULL;
-      pa++;
-  }
-
-  pa = pas;
-  for (ii=0; ii<rep.num_adaptors; ii++) {
-      pa->type = u.pa->type;
-      pa->base_id = u.pa->base_id;
-      pa->num_ports = u.pa->num_ports;
-      pa->num_formats = u.pa->num_formats;
-      pa->num_adaptors = rep.num_adaptors - ii;
-
-      /* GET ADAPTOR NAME */
-
-      size = u.pa->name_size;
-      u.buffer += (sz_xvAdaptorInfo + 3) & ~3;
-
-      if ( (name = (char *)Xmalloc(size+1)) == NULL)
-       {
-         XvFreeAdaptorInfo(pas);
-         Xfree(buffer);
-          UnlockDisplay(dpy);
-          SyncHandle();
-         return(XvBadAlloc);
-       }
-      (void)strncpy(name, u.string, size);
-      name[size] = '\0';
-      pa->name = name;
-
-      u.buffer += (size + 3) & ~3;
-
-      /* GET FORMATS */
-
-      size = pa->num_formats*sizeof(XvFormat);
-      if ((pfs=(XvFormat *)Xmalloc(size))==NULL) {
-         XvFreeAdaptorInfo(pas);
-         Xfree(buffer);
-          UnlockDisplay(dpy);
-          SyncHandle();
-         return(XvBadAlloc);
-      }
-
-      pf = pfs;
-      for (jj=0; jj<pa->num_formats; jj++) {
-         pf->depth = u.pf->depth;
-         pf->visual_id = u.pf->visual;
-         pf++;
-
-         u.buffer += (sz_xvFormat + 3) & ~3;
-      }
-
-      pa->formats = pfs;
-
-      pa++;
-
-  }
-
-  *p_nAdaptors = rep.num_adaptors;
-  *p_pAdaptors = pas;
-
-  Xfree(buffer);
-  UnlockDisplay(dpy);
-  SyncHandle();
-
-  return (Success);
+        pf = pfs;
+        for (jj = 0; jj < pa->num_formats; jj++) {
+            pf->depth = u.pf->depth;
+            pf->visual_id = u.pf->visual;
+            pf++;
+
+            u.buffer += pad_to_int32(sz_xvFormat);
+        }
+
+        pa->formats = pfs;
+
+        pa++;
+
+    }
+
+    status = Success;
+
+  out:
+    if (status != Success) {
+        XvFreeAdaptorInfo(pas);
+        pas = NULL;
+    }
+
+    *p_nAdaptors = rep.num_adaptors;
+    *p_pAdaptors = pas;
+
+    Xfree(buffer);
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return status;
 }
 
 
 void
 XvFreeAdaptorInfo(XvAdaptorInfo *pAdaptors)
 {
+    XvAdaptorInfo *pa;
+    unsigned int ii;
 
-  XvAdaptorInfo *pa;
-  int ii;
+    if (!pAdaptors)
+        return;
 
-  if (!pAdaptors) return;
+    pa = pAdaptors;
 
-  pa = pAdaptors;
-
-  for (ii=0; ii<pAdaptors->num_adaptors; ii++, pa++)
-    {
-      if (pa->name)
-       {
-         Xfree(pa->name);
-       }
-      if (pa->formats)
-       {
-         Xfree(pa->formats);
-       }
+    for (ii = 0; ii < pAdaptors->num_adaptors; ii++, pa++) {
+        if (pa->name) {
+            Xfree(pa->name);
+        }
+        if (pa->formats) {
+            Xfree(pa->formats);
+        }
     }
 
-  Xfree(pAdaptors);
+    Xfree(pAdaptors);
 }
 
 int
 XvQueryEncodings(
-     Display *dpy,
-     XvPortID port,
-     unsigned int *p_nEncodings,
-     XvEncodingInfo **p_pEncodings
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvQueryEncodingsReq *req;
-  xvQueryEncodingsReply rep;
-  int size, jj;
-  char *name;
-  XvEncodingInfo *pes, *pe;
-  char *buffer;
-  union
-    {
-      char *buffer;
-      char *string;
-      xvEncodingInfo *pe;
+    Display *dpy,
+    XvPortID port,
+    unsigned int *p_nEncodings,
+    XvEncodingInfo ** p_pEncodings)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvQueryEncodingsReq *req;
+    xvQueryEncodingsReply rep;
+    size_t size;
+    unsigned int jj;
+    char *name;
+    XvEncodingInfo *pes = NULL, *pe;
+    char *buffer = NULL;
+    union {
+        char *buffer;
+        char *string;
+        xvEncodingInfo *pe;
     } u;
+    int status;
+
+    XvCheckExtension(dpy, info, XvBadExtension);
+
+    LockDisplay(dpy);
+
+    XvGetReq(QueryEncodings, req);
+    req->port = port;
+
+    /* READ THE REPLY */
+
+    if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == 0) {
+        rep.num_encodings = 0;
+        status = XvBadReply;
+        goto out;
+    }
+
+    size = rep.length << 2;
+    if (size > 0) {
+        if ((buffer = Xmalloc(size)) == NULL) {
+            _XEatDataWords(dpy, rep.length);
+            status = XvBadAlloc;
+            goto out;
+        }
+        _XRead(dpy, buffer, (long) size);
+    }
 
-  XvCheckExtension(dpy, info, XvBadExtension);
-
-  LockDisplay(dpy);
-
-  XvGetReq(QueryEncodings, req);
-  req->port = port;
-
-  /* READ THE REPLY */
-
-  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return(XvBadReply);
-  }
-
-  size = rep.length << 2;
-  if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return(XvBadAlloc);
-  }
-  _XRead (dpy, buffer, size);
-
-  u.buffer = buffer;
-
-  /* GET ENCODINGS */
-
-  size = rep.num_encodings*sizeof(XvEncodingInfo);
-  if ( (pes = (XvEncodingInfo *)Xmalloc(size)) == NULL) {
-      Xfree(buffer);
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return(XvBadAlloc);
-  }
-
-  /* INITIALIZE THE ENCODING POINTER */
-
-  pe = pes;
-  for (jj=0; jj<rep.num_encodings; jj++) {
-      pe->name = (char *)NULL;
-      pe->num_encodings = 0;
-      pe++;
-  }
-
-  pe = pes;
-  for (jj=0; jj<rep.num_encodings; jj++) {
-      pe->encoding_id = u.pe->encoding;
-      pe->width = u.pe->width;
-      pe->height = u.pe->height;
-      pe->rate.numerator = u.pe->rate.numerator;
-      pe->rate.denominator = u.pe->rate.denominator;
-      pe->num_encodings = rep.num_encodings - jj;
-
-      size = u.pe->name_size;
-      u.buffer += (sz_xvEncodingInfo + 3) & ~3;
-
-      if ( (name = (char *)Xmalloc(size+1)) == NULL) {
-         XvFreeEncodingInfo(pes);
-         Xfree(buffer);
-          UnlockDisplay(dpy);
-          SyncHandle();
-         return(XvBadAlloc);
-      }
-      strncpy(name, u.string, size);
-      name[size] = '\0';
-      pe->name = name;
-      pe++;
-
-      u.buffer += (size + 3) & ~3;
-  }
-
-  *p_nEncodings = rep.num_encodings;
-  *p_pEncodings = pes;
-
-  Xfree(buffer);
-  UnlockDisplay(dpy);
-  SyncHandle();
-
-  return (Success);
+    /* GET ENCODINGS */
+
+    if (rep.num_encodings == 0) {
+        /* If there's no encodings, there's nothing more to do. */
+        status = Success;
+        goto out;
+    }
+
+    if (size < (rep.num_encodings * sz_xvEncodingInfo)) {
+        /* If there's not enough data for the number of adaptors,
+           then we have a problem. */
+        status = XvBadReply;
+        goto out;
+    }
+
+    size = rep.num_encodings * sizeof(XvEncodingInfo);
+    if ((pes = Xmalloc(size)) == NULL) {
+        status = XvBadAlloc;
+        goto out;
+    }
+
+    /* INITIALIZE THE ENCODING POINTER */
+
+    pe = pes;
+    for (jj = 0; jj < rep.num_encodings; jj++) {
+        pe->name = (char *) NULL;
+        pe->num_encodings = 0;
+        pe++;
+    }
+
+    u.buffer = buffer;
+
+    pe = pes;
+    for (jj = 0; jj < rep.num_encodings; jj++) {
+        pe->encoding_id = u.pe->encoding;
+        pe->width = u.pe->width;
+        pe->height = u.pe->height;
+        pe->rate.numerator = u.pe->rate.numerator;
+        pe->rate.denominator = u.pe->rate.denominator;
+        pe->num_encodings = rep.num_encodings - jj;
+
+        size = u.pe->name_size;
+        u.buffer += pad_to_int32(sz_xvEncodingInfo);
+
+        if ((name = Xmalloc(size + 1)) == NULL) {
+            status = XvBadAlloc;
+            goto out;
+        }
+        strncpy(name, u.string, size);
+        name[size] = '\0';
+        pe->name = name;
+        pe++;
+
+        u.buffer += pad_to_int32(size);
+    }
+
+    status = Success;
+
+  out:
+    if (status != Success) {
+        XvFreeEncodingInfo(pes);
+        pes = NULL;
+    }
+
+    *p_nEncodings = rep.num_encodings;
+    *p_pEncodings = pes;
+
+    Xfree(buffer);
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return (Success);
 }
 
 void
 XvFreeEncodingInfo(XvEncodingInfo *pEncodings)
 {
+    XvEncodingInfo *pe;
+    unsigned long ii;
 
-  XvEncodingInfo *pe;
-  int ii;
-
-  if (!pEncodings) return;
+    if (!pEncodings)
+        return;
 
-  pe = pEncodings;
+    pe = pEncodings;
 
-  for (ii=0; ii<pEncodings->num_encodings; ii++, pe++) {
-      if (pe->name) Xfree(pe->name);
-  }
+    for (ii = 0; ii < pEncodings->num_encodings; ii++, pe++) {
+        if (pe->name)
+            Xfree(pe->name);
+    }
 
-  Xfree(pEncodings);
+    Xfree(pEncodings);
 }
 
 int
 XvPutVideo(
-     Display *dpy,
-     XvPortID port,
-     Drawable d,
-     GC gc,
-     int vx, int vy,
-     unsigned int vw, unsigned int vh,
-     int dx, int dy,
-     unsigned int dw, unsigned int dh
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvPutVideoReq *req;
-
-  XvCheckExtension(dpy, info, XvBadExtension);
-
-  LockDisplay(dpy);
-
-  FlushGC(dpy, gc);
-
-  XvGetReq(PutVideo, req);
-
-  req->port = port;
-  req->drawable = d;
-  req->gc = gc->gid;
-  req->vid_x = vx;
-  req->vid_y = vy;
-  req->vid_w = vw;
-  req->vid_h = vh;
-  req->drw_x = dx;
-  req->drw_y = dy;
-  req->drw_w = dw;
-  req->drw_h = dh;
-
-  UnlockDisplay(dpy);
-  SyncHandle();
-
-  return Success;
+    Display *dpy,
+    XvPortID port,
+    Drawable d,
+    GC gc,
+    int vx, int vy,
+    unsigned int vw, unsigned int vh,
+    int dx, int dy,
+    unsigned int dw, unsigned int dh)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvPutVideoReq *req;
+
+    XvCheckExtension(dpy, info, XvBadExtension);
+
+    LockDisplay(dpy);
+
+    FlushGC(dpy, gc);
+
+    XvGetReq(PutVideo, req);
+
+    req->port = port;
+    req->drawable = d;
+    req->gc = gc->gid;
+    req->vid_x = vx;
+    req->vid_y = vy;
+    req->vid_w = vw;
+    req->vid_h = vh;
+    req->drw_x = dx;
+    req->drw_y = dy;
+    req->drw_w = dw;
+    req->drw_h = dh;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return Success;
 }
 
 int
 XvPutStill(
-     Display *dpy,
-     XvPortID port,
-     Drawable d,
-     GC gc,
-     int vx, int vy,
-     unsigned int vw, unsigned int vh,
-     int dx, int dy,
-     unsigned int dw, unsigned int dh
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvPutStillReq *req;
-
-  XvCheckExtension(dpy, info, XvBadExtension);
-
-  LockDisplay(dpy);
-
-  FlushGC(dpy, gc);
-
-  XvGetReq(PutStill, req);
-  req->port = port;
-  req->drawable = d;
-  req->gc = gc->gid;
-  req->vid_x = vx;
-  req->vid_y = vy;
-  req->vid_w = vw;
-  req->vid_h = vh;
-  req->drw_x = dx;
-  req->drw_y = dy;
-  req->drw_w = dw;
-  req->drw_h = dh;
-
-  UnlockDisplay(dpy);
-  SyncHandle();
-
-  return Success;
+    Display *dpy,
+    XvPortID port,
+    Drawable d,
+    GC gc,
+    int vx, int vy,
+    unsigned int vw, unsigned int vh,
+    int dx, int dy,
+    unsigned int dw, unsigned int dh)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvPutStillReq *req;
+
+    XvCheckExtension(dpy, info, XvBadExtension);
+
+    LockDisplay(dpy);
+
+    FlushGC(dpy, gc);
+
+    XvGetReq(PutStill, req);
+    req->port = port;
+    req->drawable = d;
+    req->gc = gc->gid;
+    req->vid_x = vx;
+    req->vid_y = vy;
+    req->vid_w = vw;
+    req->vid_h = vh;
+    req->drw_x = dx;
+    req->drw_y = dy;
+    req->drw_w = dw;
+    req->drw_h = dh;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return Success;
 }
 
 int
 XvGetVideo(
-     Display *dpy,
-     XvPortID port,
-     Drawable d,
-     GC gc,
-     int vx, int vy,
-     unsigned int vw, unsigned int vh,
-     int dx, int dy,
-     unsigned int dw, unsigned int dh
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvGetVideoReq *req;
-
-  XvCheckExtension(dpy, info, XvBadExtension);
-
-  LockDisplay(dpy);
-
-  FlushGC(dpy, gc);
-
-  XvGetReq(GetVideo, req);
-  req->port = port;
-  req->drawable = d;
-  req->gc = gc->gid;
-  req->vid_x = vx;
-  req->vid_y = vy;
-  req->vid_w = vw;
-  req->vid_h = vh;
-  req->drw_x = dx;
-  req->drw_y = dy;
-  req->drw_w = dw;
-  req->drw_h = dh;
-
-  UnlockDisplay(dpy);
-  SyncHandle();
-
-  return Success;
+    Display *dpy,
+    XvPortID port,
+    Drawable d,
+    GC gc,
+    int vx, int vy,
+    unsigned int vw, unsigned int vh,
+    int dx, int dy,
+    unsigned int dw, unsigned int dh)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvGetVideoReq *req;
+
+    XvCheckExtension(dpy, info, XvBadExtension);
+
+    LockDisplay(dpy);
+
+    FlushGC(dpy, gc);
+
+    XvGetReq(GetVideo, req);
+    req->port = port;
+    req->drawable = d;
+    req->gc = gc->gid;
+    req->vid_x = vx;
+    req->vid_y = vy;
+    req->vid_w = vw;
+    req->vid_h = vh;
+    req->drw_x = dx;
+    req->drw_y = dy;
+    req->drw_w = dw;
+    req->drw_h = dh;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return Success;
 }
 
 int
 XvGetStill(
-     Display *dpy,
-     XvPortID port,
-     Drawable d,
-     GC gc,
-     int vx, int vy,
-     unsigned int vw, unsigned int vh,
-     int dx, int dy,
-     unsigned int dw, unsigned int dh
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvGetStillReq *req;
-
-  XvCheckExtension(dpy, info, XvBadExtension);
-
-  LockDisplay(dpy);
-
-  FlushGC(dpy, gc);
-
-  XvGetReq(GetStill, req);
-  req->port = port;
-  req->drawable = d;
-  req->gc = gc->gid;
-  req->vid_x = vx;
-  req->vid_y = vy;
-  req->vid_w = vw;
-  req->vid_h = vh;
-  req->drw_x = dx;
-  req->drw_y = dy;
-  req->drw_w = dw;
-  req->drw_h = dh;
-
-  UnlockDisplay(dpy);
-  SyncHandle();
-
-  return Success;
+    Display *dpy,
+    XvPortID port,
+    Drawable d,
+    GC gc,
+    int vx, int vy,
+    unsigned int vw, unsigned int vh,
+    int dx, int dy,
+    unsigned int dw, unsigned int dh)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvGetStillReq *req;
+
+    XvCheckExtension(dpy, info, XvBadExtension);
+
+    LockDisplay(dpy);
+
+    FlushGC(dpy, gc);
+
+    XvGetReq(GetStill, req);
+    req->port = port;
+    req->drawable = d;
+    req->gc = gc->gid;
+    req->vid_x = vx;
+    req->vid_y = vy;
+    req->vid_w = vw;
+    req->vid_h = vh;
+    req->drw_x = dx;
+    req->drw_y = dy;
+    req->drw_w = dw;
+    req->drw_h = dh;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return Success;
 }
 
 int
-XvStopVideo(
-     Display *dpy,
-     XvPortID port,
-     Drawable draw
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvStopVideoReq *req;
+XvStopVideo(Display *dpy, XvPortID port, Drawable draw)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvStopVideoReq *req;
 
-  XvCheckExtension(dpy, info, XvBadExtension);
+    XvCheckExtension(dpy, info, XvBadExtension);
 
-  LockDisplay(dpy);
+    LockDisplay(dpy);
 
-  XvGetReq(StopVideo, req);
-  req->port = port;
-  req->drawable = draw;
+    XvGetReq(StopVideo, req);
+    req->port = port;
+    req->drawable = draw;
 
-  UnlockDisplay(dpy);
-  SyncHandle();
+    UnlockDisplay(dpy);
+    SyncHandle();
 
-  return Success;
+    return Success;
 }
 
 int
-XvGrabPort(
-     Display *dpy,
-     XvPortID port,
-     Time time
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  int result;
-  xvGrabPortReply rep;
-  xvGrabPortReq *req;
+XvGrabPort(Display *dpy, XvPortID port, Time time)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    int result;
+    xvGrabPortReply rep;
+    xvGrabPortReq *req;
 
-  XvCheckExtension(dpy, info, XvBadExtension);
+    XvCheckExtension(dpy, info, XvBadExtension);
 
-  LockDisplay(dpy);
+    LockDisplay(dpy);
 
-  XvGetReq(GrabPort, req);
-  req->port = port;
-  req->time = time;
+    XvGetReq(GrabPort, req);
+    req->port = port;
+    req->time = time;
 
-  if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0)
-    rep.result = GrabSuccess;
+    if (_XReply(dpy, (xReply *) &rep, 0, xTrue) == 0)
+        rep.result = GrabSuccess;
 
-  result = rep.result;
+    result = rep.result;
 
-  UnlockDisplay(dpy);
-  SyncHandle();
+    UnlockDisplay(dpy);
+    SyncHandle();
 
-  return result;
+    return result;
 }
 
 int
-XvUngrabPort(
-     Display *dpy,
-     XvPortID port,
-     Time time
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvUngrabPortReq *req;
+XvUngrabPort(Display *dpy, XvPortID port, Time time)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvUngrabPortReq *req;
 
-  XvCheckExtension(dpy, info, XvBadExtension);
+    XvCheckExtension(dpy, info, XvBadExtension);
 
-  LockDisplay(dpy);
+    LockDisplay(dpy);
 
-  XvGetReq(UngrabPort, req);
-  req->port = port;
-  req->time = time;
+    XvGetReq(UngrabPort, req);
+    req->port = port;
+    req->time = time;
 
-  UnlockDisplay(dpy);
-  SyncHandle();
+    UnlockDisplay(dpy);
+    SyncHandle();
 
-  return Success;
+    return Success;
 }
 
 int
-XvSelectVideoNotify(
-     Display *dpy,
-     Drawable drawable,
-     Bool onoff
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvSelectVideoNotifyReq *req;
+XvSelectVideoNotify(Display *dpy, Drawable drawable, Bool onoff)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvSelectVideoNotifyReq *req;
 
-  XvCheckExtension(dpy, info, XvBadExtension);
+    XvCheckExtension(dpy, info, XvBadExtension);
 
-  LockDisplay(dpy);
+    LockDisplay(dpy);
 
-  XvGetReq(SelectVideoNotify, req);
-  req->drawable = drawable;
-  req->onoff = onoff;
+    XvGetReq(SelectVideoNotify, req);
+    req->drawable = drawable;
+    req->onoff = onoff;
 
-  UnlockDisplay(dpy);
-  SyncHandle();
+    UnlockDisplay(dpy);
+    SyncHandle();
 
-  return Success;
+    return Success;
 }
 
 int
-XvSelectPortNotify(
-     Display *dpy,
-     XvPortID port,
-     Bool onoff
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvSelectPortNotifyReq *req;
+XvSelectPortNotify(Display *dpy, XvPortID port, Bool onoff)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvSelectPortNotifyReq *req;
 
-  XvCheckExtension(dpy, info, XvBadExtension);
+    XvCheckExtension(dpy, info, XvBadExtension);
 
-  LockDisplay(dpy);
+    LockDisplay(dpy);
 
-  XvGetReq(SelectPortNotify, req);
-  req->port = port;
-  req->onoff = onoff;
+    XvGetReq(SelectPortNotify, req);
+    req->port = port;
+    req->onoff = onoff;
 
-  UnlockDisplay(dpy);
-  SyncHandle();
+    UnlockDisplay(dpy);
+    SyncHandle();
 
-  return Success;
+    return Success;
 }
 
 int
-XvSetPortAttribute (
-     Display *dpy,
-     XvPortID port,
-     Atom attribute,
-     int value
-)
+XvSetPortAttribute(Display *dpy, XvPortID port, Atom attribute, int value)
 {
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvSetPortAttributeReq *req;
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvSetPortAttributeReq *req;
 
-  XvCheckExtension(dpy, info, XvBadExtension);
+    XvCheckExtension(dpy, info, XvBadExtension);
 
-  LockDisplay(dpy);
+    LockDisplay(dpy);
 
-  XvGetReq(SetPortAttribute, req);
-  req->port = port;
-  req->attribute = attribute;
-  req->value = value;
+    XvGetReq(SetPortAttribute, req);
+    req->port = port;
+    req->attribute = attribute;
+    req->value = value;
 
-  UnlockDisplay(dpy);
-  SyncHandle();
+    UnlockDisplay(dpy);
+    SyncHandle();
 
-  return (Success);
+    return (Success);
 }
 
 int
-XvGetPortAttribute (
-     Display *dpy,
-     XvPortID port,
-     Atom attribute,
-     int *p_value
-)
+XvGetPortAttribute(Display *dpy, XvPortID port, Atom attribute, int *p_value)
 {
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvGetPortAttributeReq *req;
-  xvGetPortAttributeReply rep;
-
-  XvCheckExtension(dpy, info, XvBadExtension);
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvGetPortAttributeReq *req;
+    xvGetPortAttributeReply rep;
+    int status;
 
-  LockDisplay(dpy);
+    XvCheckExtension(dpy, info, XvBadExtension);
 
-  XvGetReq(GetPortAttribute, req);
-  req->port = port;
-  req->attribute = attribute;
+    LockDisplay(dpy);
 
-  /* READ THE REPLY */
+    XvGetReq(GetPortAttribute, req);
+    req->port = port;
+    req->attribute = attribute;
 
-  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return(XvBadReply);
-  }
+    /* READ THE REPLY */
 
-  *p_value = rep.value;
+    if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == 0) {
+        status = XvBadReply;
+    }
+    else {
+        *p_value = rep.value;
+        status = Success;
+    }
 
-  UnlockDisplay(dpy);
-  SyncHandle();
+    UnlockDisplay(dpy);
+    SyncHandle();
 
-  return (Success);
+    return status;
 }
 
 int
 XvQueryBestSize(
-     Display *dpy,
-     XvPortID port,
-     Bool motion,
-     unsigned int vid_w,
-     unsigned int vid_h,
-     unsigned int drw_w,
-     unsigned int drw_h,
-     unsigned int *p_actual_width,
-     unsigned int *p_actual_height
-)
+    Display *dpy,
+    XvPortID port,
+    Bool motion,
+    unsigned int vid_w,
+    unsigned int vid_h,
+    unsigned int drw_w,
+    unsigned int drw_h,
+    unsigned int *p_actual_width,
+    unsigned int *p_actual_height)
 {
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvQueryBestSizeReq *req;
-  xvQueryBestSizeReply rep;
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvQueryBestSizeReq *req;
+    xvQueryBestSizeReply rep;
+    int status;
 
-  XvCheckExtension(dpy, info, XvBadExtension);
+    XvCheckExtension(dpy, info, XvBadExtension);
 
-  LockDisplay(dpy);
+    LockDisplay(dpy);
 
-  XvGetReq(QueryBestSize, req);
-  req->port = port;
-  req->motion = motion;
-  req->vid_w = vid_w;
-  req->vid_h = vid_h;
-  req->drw_w = drw_w;
-  req->drw_h = drw_h;
+    XvGetReq(QueryBestSize, req);
+    req->port = port;
+    req->motion = motion;
+    req->vid_w = vid_w;
+    req->vid_h = vid_h;
+    req->drw_w = drw_w;
+    req->drw_h = drw_h;
 
-  /* READ THE REPLY */
+    /* READ THE REPLY */
 
-  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return(XvBadReply);
-  }
-
-  *p_actual_width = rep.actual_width;
-  *p_actual_height = rep.actual_height;
+    if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == 0) {
+        status = XvBadReply;
+    }
+    else {
+        *p_actual_width = rep.actual_width;
+        *p_actual_height = rep.actual_height;
+        status = Success;
+    }
 
-  UnlockDisplay(dpy);
-  SyncHandle();
+    UnlockDisplay(dpy);
+    SyncHandle();
 
-  return (Success);
+    return status;
 }
 
 
-XvAttribute*
+XvAttribute *
 XvQueryPortAttributes(Display *dpy, XvPortID port, int *num)
 {
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvQueryPortAttributesReq *req;
-  xvQueryPortAttributesReply rep;
-  XvAttribute *ret = NULL;
-
-  *num = 0;
-
-  XvCheckExtension(dpy, info, NULL);
-
-  LockDisplay(dpy);
-
-  XvGetReq(QueryPortAttributes, req);
-  req->port = port;
-
-  /* READ THE REPLY */
-
-  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return ret;
-  }
-
-  if(rep.num_attributes) {
-      int size = (rep.num_attributes * sizeof(XvAttribute)) + rep.text_size;
-
-      if((ret = Xmalloc(size))) {
-         char* marker = (char*)(&ret[rep.num_attributes]);
-         xvAttributeInfo Info;
-         int i;
-
-         for(i = 0; i < rep.num_attributes; i++) {
-             _XRead(dpy, (char*)(&Info), sz_xvAttributeInfo);
-             ret[i].flags = (int)Info.flags;
-             ret[i].min_value = Info.min;
-             ret[i].max_value = Info.max;
-             ret[i].name = marker;
-             _XRead(dpy, marker, Info.size);
-             marker += Info.size;
-             (*num)++;
-         }
-      } else
-       _XEatData(dpy, rep.length << 2);
-  }
-
-  UnlockDisplay(dpy);
-  SyncHandle();
-
-  return ret;
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvQueryPortAttributesReq *req;
+    xvQueryPortAttributesReply rep;
+    XvAttribute *ret = NULL;
+
+    *num = 0;
+
+    XvCheckExtension(dpy, info, NULL);
+
+    LockDisplay(dpy);
+
+    XvGetReq(QueryPortAttributes, req);
+    req->port = port;
+
+    /* READ THE REPLY */
+
+    if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == 0) {
+        goto out;
+    }
+
+    /*
+     * X server sends data packed as:
+     *   attribute1, name1, attribute2, name2, ...
+     * We allocate a single buffer large enough to hold them all and
+     * then de-interleave the data so we return it to clients as:
+     *   attribute1, attribute2, ..., name1, name2, ...
+     * so that clients may refer to attributes as a simple array of
+     * structs:  attributes[0], attributes[1], ...
+     * and free it as a single/simple buffer.
+     */
+
+    if (rep.num_attributes) {
+        unsigned long size;
+
+        /* limit each part to no more than one half the max size */
+        if ((rep.num_attributes < ((INT_MAX / 2) / sizeof(XvAttribute))) &&
+            (rep.text_size < (INT_MAX / 2) - 1)) {
+            size = (rep.num_attributes * sizeof(XvAttribute)) +
+               rep.text_size + 1;
+            ret = Xmalloc(size);
+        }
+
+        if (ret != NULL) {
+            char *marker = (char *) (&ret[rep.num_attributes]);
+            xvAttributeInfo Info;
+            unsigned int i;
+
+            /* keep track of remaining room for text strings */
+            size = rep.text_size;
+
+            for (i = 0; i < rep.num_attributes; i++) {
+                _XRead(dpy, (char *) (&Info), sz_xvAttributeInfo);
+                ret[i].flags = (int) Info.flags;
+                ret[i].min_value = Info.min;
+                ret[i].max_value = Info.max;
+                ret[i].name = marker;
+                if (Info.size <= size) {
+                    _XRead(dpy, marker, Info.size);
+                    marker += Info.size;
+                    size -= Info.size;
+                }
+                (*num)++;
+            }
+
+            /* ensure final string is nil-terminated to avoid exposure of
+               uninitialized memory */
+            *marker = '\0';
+        }
+        else
+            _XEatDataWords(dpy, rep.length);
+    }
+
+  out:
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return ret;
 }
 
-XvImageFormatValues * XvListImageFormats (
-   Display     *dpy,
-   XvPortID    port,
-   int                 *num
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvListImageFormatsReq *req;
-  xvListImageFormatsReply rep;
-  XvImageFormatValues *ret = NULL;
-
-  *num = 0;
-
-  XvCheckExtension(dpy, info, NULL);
-
-  LockDisplay(dpy);
-
-  XvGetReq(ListImageFormats, req);
-  req->port = port;
-
-  /* READ THE REPLY */
-
-  if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
-      UnlockDisplay(dpy);
-      SyncHandle();
-      return NULL;
-  }
-
-  if(rep.num_formats) {
-      int size = (rep.num_formats * sizeof(XvImageFormatValues));
-
-      if((ret = Xmalloc(size))) {
-         xvImageFormatInfo Info;
-         int i;
-
-         for(i = 0; i < rep.num_formats; 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;
-             (*num)++;
-         }
-      } else
-       _XEatData(dpy, rep.length << 2);
-  }
-
-  UnlockDisplay(dpy);
-  SyncHandle();
-
-  return ret;
+XvImageFormatValues *
+XvListImageFormats(Display *dpy, XvPortID port, int *num)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvListImageFormatsReq *req;
+    xvListImageFormatsReply rep;
+    XvImageFormatValues *ret = NULL;
+
+    *num = 0;
+
+    XvCheckExtension(dpy, info, NULL);
+
+    LockDisplay(dpy);
+
+    XvGetReq(ListImageFormats, req);
+    req->port = port;
+
+    /* READ THE REPLY */
+
+    if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == 0) {
+        goto out;
+    }
+
+    if (rep.num_formats) {
+        if (rep.num_formats < (INT_MAX / sizeof(XvImageFormatValues)))
+            ret = Xmalloc(rep.num_formats * sizeof(XvImageFormatValues));
+
+        if (ret != NULL) {
+            xvImageFormatInfo Info;
+            unsigned int i;
+
+            for (i = 0; i < rep.num_formats; 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;
+                (*num)++;
+            }
+        }
+        else
+            _XEatDataWords(dpy, rep.length);
+    }
+
+  out:
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return ret;
 }
 
-XvImage * XvCreateImage (
-   Display *dpy,
-   XvPortID port,
-   int id,
-   char *data,
-   int width,
-   int height
-) {
-   XExtDisplayInfo *info = xv_find_display(dpy);
-   xvQueryImageAttributesReq *req;
-   xvQueryImageAttributesReply rep;
-   XvImage *ret = NULL;
-
-   XvCheckExtension(dpy, info, NULL);
-
-   LockDisplay(dpy);
-
-   XvGetReq(QueryImageAttributes, req);
-   req->id = id;
-   req->port = port;
-   req->width = width;
-   req->height = height;
-
-   /* READ THE REPLY */
-
-   if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
-       UnlockDisplay(dpy);
-       SyncHandle();
-      return NULL;
-   }
-
-   if((ret = (XvImage*)Xmalloc(sizeof(XvImage) + (rep.num_planes << 3)))) {
-       ret->id = id;
-       ret->width = rep.width;
-       ret->height = rep.height;
-       ret->data_size = rep.data_size;
-       ret->num_planes = rep.num_planes;
-       ret->pitches = (int*)(&ret[1]);
-       ret->offsets = ret->pitches + rep.num_planes;
-       ret->data = data;
-       ret->obdata = NULL;
-       _XRead(dpy, (char*)(ret->pitches), rep.num_planes << 2);
-       _XRead(dpy, (char*)(ret->offsets), rep.num_planes << 2);
-   } else
-       _XEatData(dpy, rep.length << 2);
-
-   UnlockDisplay(dpy);
-   SyncHandle();
-
-   return ret;
+XvImage *
+XvCreateImage(
+    Display *dpy,
+    XvPortID port,
+    int id,
+    char *data,
+    int width,
+    int height)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvQueryImageAttributesReq *req;
+    xvQueryImageAttributesReply rep;
+    XvImage *ret = NULL;
+
+    XvCheckExtension(dpy, info, NULL);
+
+    LockDisplay(dpy);
+
+    XvGetReq(QueryImageAttributes, req);
+    req->id = id;
+    req->port = port;
+    req->width = width;
+    req->height = height;
+
+    /* READ THE REPLY */
+
+    if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) {
+        goto out;
+    }
+
+    if (rep.num_planes < ((INT_MAX >> 3) - sizeof(XvImage)))
+        ret = Xmalloc(sizeof(XvImage) + (rep.num_planes << 3));
+
+    if (ret != NULL) {
+        ret->id = id;
+        ret->width = rep.width;
+        ret->height = rep.height;
+        ret->data_size = rep.data_size;
+        ret->num_planes = rep.num_planes;
+        ret->pitches = (int *) (&ret[1]);
+        ret->offsets = ret->pitches + rep.num_planes;
+        ret->data = data;
+        ret->obdata = NULL;
+        _XRead(dpy, (char *) (ret->pitches), rep.num_planes << 2);
+        _XRead(dpy, (char *) (ret->offsets), rep.num_planes << 2);
+    }
+    else
+        _XEatDataWords(dpy, rep.length);
+
+  out:
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return ret;
 }
 
-XvImage * XvShmCreateImage (
-   Display *dpy,
-   XvPortID port,
-   int id,
-   char *data,
-   int width,
-   int height,
-   XShmSegmentInfo *shminfo
-){
-   XvImage *ret;
+XvImage *
+XvShmCreateImage(
+    Display *dpy,
+    XvPortID port,
+    int id,
+    char *data,
+    int width,
+    int height,
+    XShmSegmentInfo *shminfo)
+{
+    XvImage *ret;
 
-   ret = XvCreateImage(dpy, port, id, data, width, height);
+    ret = XvCreateImage(dpy, port, id, data, width, height);
 
-   if(ret) ret->obdata = (XPointer)shminfo;
+    if (ret)
+        ret->obdata = (XPointer) shminfo;
 
-   return ret;
+    return ret;
 }
 
-int XvPutImage (
-   Display *dpy,
-   XvPortID port,
-   Drawable d,
-   GC gc,
-   XvImage *image,
-   int src_x,
-   int src_y,
-   unsigned int src_w,
-   unsigned int src_h,
-   int dest_x,
-   int dest_y,
-   unsigned int dest_w,
-   unsigned int dest_h
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  xvPutImageReq *req;
-  int len;
-
-  XvCheckExtension(dpy, info, XvBadExtension);
-
-  LockDisplay(dpy);
-
-  FlushGC(dpy, gc);
-
-  XvGetReq(PutImage, req);
-
-  req->port = port;
-  req->drawable = d;
-  req->gc = gc->gid;
-  req->id = image->id;
-  req->src_x = src_x;
-  req->src_y = src_y;
-  req->src_w = src_w;
-  req->src_h = src_h;
-  req->drw_x = dest_x;
-  req->drw_y = dest_y;
-  req->drw_w = dest_w;
-  req->drw_h = dest_h;
-  req->width = image->width;
-  req->height = image->height;
-
-  len = (image->data_size + 3) >> 2;
-  SetReqLen(req, len, len);
-
-  /* Yes it's kindof lame that we are sending the whole thing,
-     but for video all of it may be needed even if displaying
-     only a subsection, and I don't want to go through the
-     trouble of creating subregions to send */
-  Data(dpy, (char *)image->data, image->data_size);
-
-  UnlockDisplay(dpy);
-  SyncHandle();
-
-  return Success;
+int
+XvPutImage(
+    Display *dpy,
+    XvPortID port,
+    Drawable d,
+    GC gc,
+    XvImage *image,
+    int src_x, int src_y,
+    unsigned int src_w, unsigned int src_h,
+    int dest_x, int dest_y,
+    unsigned int dest_w, unsigned int dest_h)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    xvPutImageReq *req;
+    unsigned int len;
+
+    XvCheckExtension(dpy, info, XvBadExtension);
+
+    LockDisplay(dpy);
+
+    FlushGC(dpy, gc);
+
+    XvGetReq(PutImage, req);
+
+    req->port = port;
+    req->drawable = d;
+    req->gc = gc->gid;
+    req->id = image->id;
+    req->src_x = src_x;
+    req->src_y = src_y;
+    req->src_w = src_w;
+    req->src_h = src_h;
+    req->drw_x = dest_x;
+    req->drw_y = dest_y;
+    req->drw_w = dest_w;
+    req->drw_h = dest_h;
+    req->width = image->width;
+    req->height = image->height;
+
+    len = ((unsigned int) image->data_size + 3) >> 2;
+    SetReqLen(req, len, len);
+
+    /* Yes it's kindof lame that we are sending the whole thing,
+       but for video all of it may be needed even if displaying
+       only a subsection, and I don't want to go through the
+       trouble of creating subregions to send */
+    Data(dpy, (char *) image->data, image->data_size);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return Success;
 }
 
-int XvShmPutImage (
-   Display *dpy,
-   XvPortID port,
-   Drawable d,
-   GC gc,
-   XvImage *image,
-   int src_x,
-   int src_y,
-   unsigned int src_w,
-   unsigned int src_h,
-   int dest_x,
-   int dest_y,
-   unsigned int dest_w,
-   unsigned int dest_h,
-   Bool send_event
-){
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata;
-  xvShmPutImageReq *req;
-
-  XvCheckExtension(dpy, info, XvBadExtension);
-
-  LockDisplay(dpy);
-
-  FlushGC(dpy, gc);
-
-  XvGetReq(ShmPutImage, req);
-
-  req->port = port;
-  req->drawable = d;
-  req->gc = gc->gid;
-  req->shmseg = shminfo->shmseg;
-  req->id = image->id;
-  req->src_x = src_x;
-  req->src_y = src_y;
-  req->src_w = src_w;
-  req->src_h = src_h;
-  req->drw_x = dest_x;
-  req->drw_y = dest_y;
-  req->drw_w = dest_w;
-  req->drw_h = dest_h;
-  req->offset = image->data - shminfo->shmaddr;
-  req->width = image->width;
-  req->height = image->height;
-  req->send_event = send_event;
-
-  UnlockDisplay(dpy);
-  SyncHandle();
-
-  return Success;
+int
+XvShmPutImage(
+    Display *dpy,
+    XvPortID port,
+    Drawable d,
+    GC gc,
+    XvImage *image,
+    int src_x, int src_y,
+    unsigned int src_w, unsigned int src_h,
+    int dest_x, int dest_y,
+    unsigned int dest_w, unsigned int dest_h,
+    Bool send_event)
+{
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    XShmSegmentInfo *shminfo = (XShmSegmentInfo *) image->obdata;
+    xvShmPutImageReq *req;
+
+    XvCheckExtension(dpy, info, XvBadExtension);
+
+    LockDisplay(dpy);
+
+    FlushGC(dpy, gc);
+
+    XvGetReq(ShmPutImage, req);
+
+    req->port = port;
+    req->drawable = d;
+    req->gc = gc->gid;
+    req->shmseg = shminfo->shmseg;
+    req->id = image->id;
+    req->src_x = src_x;
+    req->src_y = src_y;
+    req->src_w = src_w;
+    req->src_h = src_h;
+    req->drw_x = dest_x;
+    req->drw_y = dest_y;
+    req->drw_w = dest_w;
+    req->drw_h = dest_h;
+    req->offset = image->data - shminfo->shmaddr;
+    req->width = image->width;
+    req->height = image->height;
+    req->send_event = send_event;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return Success;
 }
 
 
 static Bool
 xv_wire_to_event(Display *dpy, XEvent *host, xEvent *wire)
 {
-  XExtDisplayInfo *info = xv_find_display(dpy);
-  XvEvent *re    = (XvEvent *)host;
-  xvEvent *event = (xvEvent *)wire;
+    XExtDisplayInfo *info = xv_find_display(dpy);
+    XvEvent *re = (XvEvent *) host;
+    xvEvent *event = (xvEvent *) wire;
 
-  XvCheckExtension(dpy, info, False);
+    XvCheckExtension(dpy, info, False);
 
-  switch((event->u.u.type & 0x7F) - info->codes->first_event)
-  {
+    switch ((event->u.u.type & 0x7F) - info->codes->first_event) {
     case XvVideoNotify:
-      re->xvvideo.type = event->u.u.type & 0x7f;
-      re->xvvideo.serial =
-       _XSetLastRequestRead(dpy, (xGenericReply *)event);
-      re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0);
-      re->xvvideo.display = dpy;
-      re->xvvideo.time = event->u.videoNotify.time;
-      re->xvvideo.reason = event->u.videoNotify.reason;
-      re->xvvideo.drawable = event->u.videoNotify.drawable;
-      re->xvvideo.port_id = event->u.videoNotify.port;
-      break;
+        re->xvvideo.type = event->u.u.type & 0x7f;
+        re->xvvideo.serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
+        re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0);
+        re->xvvideo.display = dpy;
+        re->xvvideo.time = event->u.videoNotify.time;
+        re->xvvideo.reason = event->u.videoNotify.reason;
+        re->xvvideo.drawable = event->u.videoNotify.drawable;
+        re->xvvideo.port_id = event->u.videoNotify.port;
+        break;
     case XvPortNotify:
-      re->xvport.type = event->u.u.type & 0x7f;
-      re->xvport.serial =
-       _XSetLastRequestRead(dpy, (xGenericReply *)event);
-      re->xvport.send_event = ((event->u.u.type & 0x80) != 0);
-      re->xvport.display = dpy;
-      re->xvport.time = event->u.portNotify.time;
-      re->xvport.port_id = event->u.portNotify.port;
-      re->xvport.attribute = event->u.portNotify.attribute;
-      re->xvport.value = event->u.portNotify.value;
-      break;
+        re->xvport.type = event->u.u.type & 0x7f;
+        re->xvport.serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
+        re->xvport.send_event = ((event->u.u.type & 0x80) != 0);
+        re->xvport.display = dpy;
+        re->xvport.time = event->u.portNotify.time;
+        re->xvport.port_id = event->u.portNotify.port;
+        re->xvport.attribute = event->u.portNotify.attribute;
+        re->xvport.value = event->u.portNotify.value;
+        break;
     default:
-      return False;
-  }
+        return False;
+    }
 
-  return (True);
+    return (True);
 }
-
-
index f16a515..c2ae7d6 100644 (file)
@@ -44,30 +44,12 @@ SOFTWARE.
 #include <X11/extensions/Xvproto.h>
 #include <X11/extensions/Xvlib.h>
 
-#if !defined(UNIXCPP)
-#define XvGetReq(name, req) \
-        WORD64ALIGN\
-       if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax)\
-               _XFlush(dpy);\
-       req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\
-       req->reqType = info->codes->major_opcode;\
-        req->xvReqType = xv_##name; \
-        req->length = (SIZEOF(xv##name##Req))>>2;\
-       dpy->bufptr += SIZEOF(xv##name##Req);\
-       dpy->request++
+/* names in Xvproto.h don't match the expectation of Xlib's GetReq* macros,
+   so we have to provide our own implementation */
 
-#else  /* non-ANSI C uses empty comment instead of "##" for token concatenation */
 #define XvGetReq(name, req) \
-        WORD64ALIGN\
-       if ((dpy->bufptr + SIZEOF(xv/**/name/**/Req)) > dpy->bufmax)\
-               _XFlush(dpy);\
-       req = (xv/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
-       req->reqType = info->codes->major_opcode;\
-       req->xvReqType = xv_/**/name;\
-       req->length = (SIZEOF(xv/**/name/**/Req))>>2;\
-       dpy->bufptr += SIZEOF(xv/**/name/**/Req);\
-       dpy->request++
-#endif
-
+    req = (xv##name##Req *) _XGetRequest(                               \
+        dpy, (CARD8) info->codes->major_opcode, SIZEOF(xv##name##Req)); \
+    req->xvReqType = xv_##name;
 
 #endif /* XVLIBINT_H */