Update to latest xproto XML.

This commit is contained in:
Andrew Gallant
2013-08-11 20:43:26 -04:00
committed by Přemysl Janouch
parent 4b20ffaf4f
commit 0685fb57e1
28 changed files with 40204 additions and 40104 deletions

View File

@@ -2,7 +2,7 @@
package xvmc
/*
This file was generated by xvmc.xml on Jun 5 2012 12:12:00am EDT.
This file was generated by xvmc.xml on Aug 11 2013 8:39:44pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -41,30 +41,6 @@ func init() {
xgb.NewExtErrorFuncs["XVideo-MotionCompensation"] = make(map[int]xgb.NewErrorFun)
}
// Skipping definition for base type 'Card8'
// Skipping definition for base type 'Int16'
// Skipping definition for base type 'Int32'
// Skipping definition for base type 'Void'
// Skipping definition for base type 'Byte'
// Skipping definition for base type 'Int8'
// Skipping definition for base type 'Card16'
// Skipping definition for base type 'Char'
// Skipping definition for base type 'Card32'
// Skipping definition for base type 'Double'
// Skipping definition for base type 'Bool'
// Skipping definition for base type 'Float'
type Context uint32
func NewContextId(c *xgb.Conn) (Context, error) {
@@ -75,16 +51,6 @@ func NewContextId(c *xgb.Conn) (Context, error) {
return Context(id), nil
}
type Surface uint32
func NewSurfaceId(c *xgb.Conn) (Surface, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Surface(id), nil
}
type Subpicture uint32
func NewSubpictureId(c *xgb.Conn) (Subpicture, error) {
@@ -95,6 +61,16 @@ func NewSubpictureId(c *xgb.Conn) (Subpicture, error) {
return Subpicture(id), nil
}
type Surface uint32
func NewSurfaceId(c *xgb.Conn) (Surface, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Surface(id), nil
}
type SurfaceInfo struct {
Id Surface
ChromaFormat uint16
@@ -198,189 +174,29 @@ func SurfaceInfoListBytes(buf []byte, list []SurfaceInfo) int {
return b
}
// QueryVersionCookie is a cookie used only for QueryVersion requests.
type QueryVersionCookie struct {
*xgb.Cookie
}
// Skipping definition for base type 'Bool'
// QueryVersion sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
func QueryVersion(c *xgb.Conn) QueryVersionCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(queryVersionRequest(c), cookie)
return QueryVersionCookie{cookie}
}
// Skipping definition for base type 'Byte'
// QueryVersionUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(queryVersionRequest(c), cookie)
return QueryVersionCookie{cookie}
}
// Skipping definition for base type 'Card8'
// QueryVersionReply represents the data returned from a QueryVersion request.
type QueryVersionReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
Major uint32
Minor uint32
}
// Skipping definition for base type 'Char'
// Reply blocks and returns the reply data for a QueryVersion request.
func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return queryVersionReply(buf), nil
}
// Skipping definition for base type 'Void'
// queryVersionReply reads a byte slice into a QueryVersionReply value.
func queryVersionReply(buf []byte) *QueryVersionReply {
v := new(QueryVersionReply)
b := 1 // skip reply determinant
// Skipping definition for base type 'Double'
b += 1 // padding
// Skipping definition for base type 'Float'
v.Sequence = xgb.Get16(buf[b:])
b += 2
// Skipping definition for base type 'Int16'
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
// Skipping definition for base type 'Int32'
v.Major = xgb.Get32(buf[b:])
b += 4
// Skipping definition for base type 'Int8'
v.Minor = xgb.Get32(buf[b:])
b += 4
// Skipping definition for base type 'Card16'
return v
}
// Write request to wire for QueryVersion
// queryVersionRequest writes a QueryVersion request to a byte slice.
func queryVersionRequest(c *xgb.Conn) []byte {
size := 4
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
b += 1
buf[b] = 0 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
return buf
}
// ListSurfaceTypesCookie is a cookie used only for ListSurfaceTypes requests.
type ListSurfaceTypesCookie struct {
*xgb.Cookie
}
// ListSurfaceTypes sends a checked request.
// If an error occurs, it will be returned with the reply by calling ListSurfaceTypesCookie.Reply()
func ListSurfaceTypes(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie)
return ListSurfaceTypesCookie{cookie}
}
// ListSurfaceTypesUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func ListSurfaceTypesUnchecked(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie)
return ListSurfaceTypesCookie{cookie}
}
// ListSurfaceTypesReply represents the data returned from a ListSurfaceTypes request.
type ListSurfaceTypesReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
Num uint32
// padding: 20 bytes
Surfaces []SurfaceInfo // size: xgb.Pad((int(Num) * 24))
}
// Reply blocks and returns the reply data for a ListSurfaceTypes request.
func (cook ListSurfaceTypesCookie) Reply() (*ListSurfaceTypesReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return listSurfaceTypesReply(buf), nil
}
// listSurfaceTypesReply reads a byte slice into a ListSurfaceTypesReply value.
func listSurfaceTypesReply(buf []byte) *ListSurfaceTypesReply {
v := new(ListSurfaceTypesReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.Num = xgb.Get32(buf[b:])
b += 4
b += 20 // padding
v.Surfaces = make([]SurfaceInfo, v.Num)
b += SurfaceInfoReadList(buf[b:], v.Surfaces)
return v
}
// Write request to wire for ListSurfaceTypes
// listSurfaceTypesRequest writes a ListSurfaceTypes request to a byte slice.
func listSurfaceTypesRequest(c *xgb.Conn, PortId xv.Port) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
b += 1
buf[b] = 1 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(PortId))
b += 4
return buf
}
// Skipping definition for base type 'Card32'
// CreateContextCookie is a cookie used only for CreateContext requests.
type CreateContextCookie struct {
@@ -504,214 +320,6 @@ func createContextRequest(c *xgb.Conn, ContextId Context, PortId xv.Port, Surfac
return buf
}
// DestroyContextCookie is a cookie used only for DestroyContext requests.
type DestroyContextCookie struct {
*xgb.Cookie
}
// DestroyContext sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func DestroyContext(c *xgb.Conn, ContextId Context) DestroyContextCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(destroyContextRequest(c, ContextId), cookie)
return DestroyContextCookie{cookie}
}
// DestroyContextChecked sends a checked request.
// If an error occurs, it can be retrieved using DestroyContextCookie.Check()
func DestroyContextChecked(c *xgb.Conn, ContextId Context) DestroyContextCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(destroyContextRequest(c, ContextId), cookie)
return DestroyContextCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DestroyContextCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for DestroyContext
// destroyContextRequest writes a DestroyContext request to a byte slice.
func destroyContextRequest(c *xgb.Conn, ContextId Context) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
b += 1
buf[b] = 3 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextId))
b += 4
return buf
}
// CreateSurfaceCookie is a cookie used only for CreateSurface requests.
type CreateSurfaceCookie struct {
*xgb.Cookie
}
// CreateSurface sends a checked request.
// If an error occurs, it will be returned with the reply by calling CreateSurfaceCookie.Reply()
func CreateSurface(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'CreateSurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(createSurfaceRequest(c, SurfaceId, ContextId), cookie)
return CreateSurfaceCookie{cookie}
}
// CreateSurfaceUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateSurfaceUnchecked(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'CreateSurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(createSurfaceRequest(c, SurfaceId, ContextId), cookie)
return CreateSurfaceCookie{cookie}
}
// CreateSurfaceReply represents the data returned from a CreateSurface request.
type CreateSurfaceReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 24 bytes
PrivData []uint32 // size: xgb.Pad((int(Length) * 4))
}
// Reply blocks and returns the reply data for a CreateSurface request.
func (cook CreateSurfaceCookie) Reply() (*CreateSurfaceReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return createSurfaceReply(buf), nil
}
// createSurfaceReply reads a byte slice into a CreateSurfaceReply value.
func createSurfaceReply(buf []byte) *CreateSurfaceReply {
v := new(CreateSurfaceReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 24 // padding
v.PrivData = make([]uint32, v.Length)
for i := 0; i < int(v.Length); i++ {
v.PrivData[i] = xgb.Get32(buf[b:])
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for CreateSurface
// createSurfaceRequest writes a CreateSurface request to a byte slice.
func createSurfaceRequest(c *xgb.Conn, SurfaceId Surface, ContextId Context) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
b += 1
buf[b] = 4 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(SurfaceId))
b += 4
xgb.Put32(buf[b:], uint32(ContextId))
b += 4
return buf
}
// DestroySurfaceCookie is a cookie used only for DestroySurface requests.
type DestroySurfaceCookie struct {
*xgb.Cookie
}
// DestroySurface sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func DestroySurface(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'DestroySurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(destroySurfaceRequest(c, SurfaceId), cookie)
return DestroySurfaceCookie{cookie}
}
// DestroySurfaceChecked sends a checked request.
// If an error occurs, it can be retrieved using DestroySurfaceCookie.Check()
func DestroySurfaceChecked(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'DestroySurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(destroySurfaceRequest(c, SurfaceId), cookie)
return DestroySurfaceCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DestroySurfaceCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for DestroySurface
// destroySurfaceRequest writes a DestroySurface request to a byte slice.
func destroySurfaceRequest(c *xgb.Conn, SurfaceId Surface) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
b += 1
buf[b] = 5 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(SurfaceId))
b += 4
return buf
}
// CreateSubpictureCookie is a cookie used only for CreateSubpicture requests.
type CreateSubpictureCookie struct {
*xgb.Cookie
@@ -840,6 +448,159 @@ func createSubpictureRequest(c *xgb.Conn, SubpictureId Subpicture, Context Conte
return buf
}
// CreateSurfaceCookie is a cookie used only for CreateSurface requests.
type CreateSurfaceCookie struct {
*xgb.Cookie
}
// CreateSurface sends a checked request.
// If an error occurs, it will be returned with the reply by calling CreateSurfaceCookie.Reply()
func CreateSurface(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'CreateSurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(createSurfaceRequest(c, SurfaceId, ContextId), cookie)
return CreateSurfaceCookie{cookie}
}
// CreateSurfaceUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateSurfaceUnchecked(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'CreateSurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(createSurfaceRequest(c, SurfaceId, ContextId), cookie)
return CreateSurfaceCookie{cookie}
}
// CreateSurfaceReply represents the data returned from a CreateSurface request.
type CreateSurfaceReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
// padding: 24 bytes
PrivData []uint32 // size: xgb.Pad((int(Length) * 4))
}
// Reply blocks and returns the reply data for a CreateSurface request.
func (cook CreateSurfaceCookie) Reply() (*CreateSurfaceReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return createSurfaceReply(buf), nil
}
// createSurfaceReply reads a byte slice into a CreateSurfaceReply value.
func createSurfaceReply(buf []byte) *CreateSurfaceReply {
v := new(CreateSurfaceReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
b += 24 // padding
v.PrivData = make([]uint32, v.Length)
for i := 0; i < int(v.Length); i++ {
v.PrivData[i] = xgb.Get32(buf[b:])
b += 4
}
b = xgb.Pad(b)
return v
}
// Write request to wire for CreateSurface
// createSurfaceRequest writes a CreateSurface request to a byte slice.
func createSurfaceRequest(c *xgb.Conn, SurfaceId Surface, ContextId Context) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
b += 1
buf[b] = 4 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(SurfaceId))
b += 4
xgb.Put32(buf[b:], uint32(ContextId))
b += 4
return buf
}
// DestroyContextCookie is a cookie used only for DestroyContext requests.
type DestroyContextCookie struct {
*xgb.Cookie
}
// DestroyContext sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func DestroyContext(c *xgb.Conn, ContextId Context) DestroyContextCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(destroyContextRequest(c, ContextId), cookie)
return DestroyContextCookie{cookie}
}
// DestroyContextChecked sends a checked request.
// If an error occurs, it can be retrieved using DestroyContextCookie.Check()
func DestroyContextChecked(c *xgb.Conn, ContextId Context) DestroyContextCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(destroyContextRequest(c, ContextId), cookie)
return DestroyContextCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DestroyContextCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for DestroyContext
// destroyContextRequest writes a DestroyContext request to a byte slice.
func destroyContextRequest(c *xgb.Conn, ContextId Context) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
b += 1
buf[b] = 3 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(ContextId))
b += 4
return buf
}
// DestroySubpictureCookie is a cookie used only for DestroySubpicture requests.
type DestroySubpictureCookie struct {
*xgb.Cookie
@@ -895,6 +656,61 @@ func destroySubpictureRequest(c *xgb.Conn, SubpictureId Subpicture) []byte {
return buf
}
// DestroySurfaceCookie is a cookie used only for DestroySurface requests.
type DestroySurfaceCookie struct {
*xgb.Cookie
}
// DestroySurface sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func DestroySurface(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'DestroySurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(destroySurfaceRequest(c, SurfaceId), cookie)
return DestroySurfaceCookie{cookie}
}
// DestroySurfaceChecked sends a checked request.
// If an error occurs, it can be retrieved using DestroySurfaceCookie.Check()
func DestroySurfaceChecked(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'DestroySurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(destroySurfaceRequest(c, SurfaceId), cookie)
return DestroySurfaceCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook DestroySurfaceCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for DestroySurface
// destroySurfaceRequest writes a DestroySurface request to a byte slice.
func destroySurfaceRequest(c *xgb.Conn, SurfaceId Surface) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
b += 1
buf[b] = 5 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(SurfaceId))
b += 4
return buf
}
// ListSubpictureTypesCookie is a cookie used only for ListSubpictureTypes requests.
type ListSubpictureTypesCookie struct {
*xgb.Cookie
@@ -992,3 +808,187 @@ func listSubpictureTypesRequest(c *xgb.Conn, PortId xv.Port, SurfaceId Surface)
return buf
}
// ListSurfaceTypesCookie is a cookie used only for ListSurfaceTypes requests.
type ListSurfaceTypesCookie struct {
*xgb.Cookie
}
// ListSurfaceTypes sends a checked request.
// If an error occurs, it will be returned with the reply by calling ListSurfaceTypesCookie.Reply()
func ListSurfaceTypes(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie)
return ListSurfaceTypesCookie{cookie}
}
// ListSurfaceTypesUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func ListSurfaceTypesUnchecked(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie)
return ListSurfaceTypesCookie{cookie}
}
// ListSurfaceTypesReply represents the data returned from a ListSurfaceTypes request.
type ListSurfaceTypesReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
Num uint32
// padding: 20 bytes
Surfaces []SurfaceInfo // size: xgb.Pad((int(Num) * 24))
}
// Reply blocks and returns the reply data for a ListSurfaceTypes request.
func (cook ListSurfaceTypesCookie) Reply() (*ListSurfaceTypesReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return listSurfaceTypesReply(buf), nil
}
// listSurfaceTypesReply reads a byte slice into a ListSurfaceTypesReply value.
func listSurfaceTypesReply(buf []byte) *ListSurfaceTypesReply {
v := new(ListSurfaceTypesReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.Num = xgb.Get32(buf[b:])
b += 4
b += 20 // padding
v.Surfaces = make([]SurfaceInfo, v.Num)
b += SurfaceInfoReadList(buf[b:], v.Surfaces)
return v
}
// Write request to wire for ListSurfaceTypes
// listSurfaceTypesRequest writes a ListSurfaceTypes request to a byte slice.
func listSurfaceTypesRequest(c *xgb.Conn, PortId xv.Port) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
b += 1
buf[b] = 1 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(PortId))
b += 4
return buf
}
// QueryVersionCookie is a cookie used only for QueryVersion requests.
type QueryVersionCookie struct {
*xgb.Cookie
}
// QueryVersion sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
func QueryVersion(c *xgb.Conn) QueryVersionCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(queryVersionRequest(c), cookie)
return QueryVersionCookie{cookie}
}
// QueryVersionUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie {
if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok {
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(queryVersionRequest(c), cookie)
return QueryVersionCookie{cookie}
}
// QueryVersionReply represents the data returned from a QueryVersion request.
type QueryVersionReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
Major uint32
Minor uint32
}
// Reply blocks and returns the reply data for a QueryVersion request.
func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return queryVersionReply(buf), nil
}
// queryVersionReply reads a byte slice into a QueryVersionReply value.
func queryVersionReply(buf []byte) *QueryVersionReply {
v := new(QueryVersionReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.Major = xgb.Get32(buf[b:])
b += 4
v.Minor = xgb.Get32(buf[b:])
b += 4
return v
}
// Write request to wire for QueryVersion
// queryVersionRequest writes a QueryVersion request to a byte slice.
func queryVersionRequest(c *xgb.Conn) []byte {
size := 4
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"]
b += 1
buf[b] = 0 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
return buf
}