From 0c50dc6241fa21712e041cfa2bfb9db4ccaef10a Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 17:01:42 -0400 Subject: a huge commit. splitting extensions into their own sub-packages. --- nexgb/xvmc/xvmc.go | 908 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 908 insertions(+) create mode 100644 nexgb/xvmc/xvmc.go (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go new file mode 100644 index 0000000..8878acf --- /dev/null +++ b/nexgb/xvmc/xvmc.go @@ -0,0 +1,908 @@ +package xvmc + +/* + This file was generated by xvmc.xml on May 10 2012 4:20:29pm EDT. + This file is automatically generated. Edit at your peril! +*/ + +import ( + "github.com/BurntSushi/xgb" + + "github.com/BurntSushi/xgb/xproto" + "github.com/BurntSushi/xgb/xv" +) + +// Init must be called before using the XVideo-MotionCompensation extension. +func Init(c *xgb.Conn) error { + reply, err := xproto.QueryExtension(c, 25, "XVideo-MotionCompensation").Reply() + switch { + case err != nil: + return err + case !reply.Present: + return xgb.Errorf("No extension named XVideo-MotionCompensation could be found on on the server.") + } + + xgb.ExtLock.Lock() + c.Extensions["XVideo-MotionCompensation"] = reply.MajorOpcode + for evNum, fun := range xgb.NewExtEventFuncs["XVideo-MotionCompensation"] { + xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun + } + for errNum, fun := range xgb.NewExtErrorFuncs["XVideo-MotionCompensation"] { + xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun + } + xgb.ExtLock.Unlock() + + return nil +} + +func init() { + xgb.NewExtEventFuncs["XVideo-MotionCompensation"] = make(map[int]xgb.NewEventFun) + xgb.NewExtErrorFuncs["XVideo-MotionCompensation"] = make(map[int]xgb.NewErrorFun) +} + +// Skipping definition for base type 'Bool' + +// Skipping definition for base type 'Float' + +// 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' + +type Context uint32 + +func NewContextId(c *xgb.Conn) (Context, error) { + id, err := c.NewId() + if err != nil { + return 0, err + } + 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) { + id, err := c.NewId() + if err != nil { + return 0, err + } + return Subpicture(id), nil +} + +// 'SurfaceInfo' struct definition +// Size: 24 +type SurfaceInfo struct { + Id Surface + ChromaFormat uint16 + Pad0 uint16 + MaxWidth uint16 + MaxHeight uint16 + SubpictureMaxWidth uint16 + SubpictureMaxHeight uint16 + McType uint32 + Flags uint32 +} + +// Struct read SurfaceInfo +func SurfaceInfoRead(buf []byte, v *SurfaceInfo) int { + b := 0 + + v.Id = Surface(xgb.Get32(buf[b:])) + b += 4 + + v.ChromaFormat = xgb.Get16(buf[b:]) + b += 2 + + v.Pad0 = xgb.Get16(buf[b:]) + b += 2 + + v.MaxWidth = xgb.Get16(buf[b:]) + b += 2 + + v.MaxHeight = xgb.Get16(buf[b:]) + b += 2 + + v.SubpictureMaxWidth = xgb.Get16(buf[b:]) + b += 2 + + v.SubpictureMaxHeight = xgb.Get16(buf[b:]) + b += 2 + + v.McType = xgb.Get32(buf[b:]) + b += 4 + + v.Flags = xgb.Get32(buf[b:]) + b += 4 + + return b +} + +// Struct list read SurfaceInfo +func SurfaceInfoReadList(buf []byte, dest []SurfaceInfo) int { + b := 0 + for i := 0; i < len(dest); i++ { + dest[i] = SurfaceInfo{} + b += SurfaceInfoRead(buf[b:], &dest[i]) + } + return xgb.Pad(b) +} + +// Struct write SurfaceInfo +func (v SurfaceInfo) Bytes() []byte { + buf := make([]byte, 24) + b := 0 + + xgb.Put32(buf[b:], uint32(v.Id)) + b += 4 + + xgb.Put16(buf[b:], v.ChromaFormat) + b += 2 + + xgb.Put16(buf[b:], v.Pad0) + b += 2 + + xgb.Put16(buf[b:], v.MaxWidth) + b += 2 + + xgb.Put16(buf[b:], v.MaxHeight) + b += 2 + + xgb.Put16(buf[b:], v.SubpictureMaxWidth) + b += 2 + + xgb.Put16(buf[b:], v.SubpictureMaxHeight) + b += 2 + + xgb.Put32(buf[b:], v.McType) + b += 4 + + xgb.Put32(buf[b:], v.Flags) + b += 4 + + return buf +} + +// Write struct list SurfaceInfo +func SurfaceInfoListBytes(buf []byte, list []SurfaceInfo) int { + b := 0 + var structBytes []byte + for _, item := range list { + structBytes = item.Bytes() + copy(buf[b:], structBytes) + b += xgb.Pad(len(structBytes)) + } + return b +} + +// Request QueryVersion +// size: 4 +type QueryVersionCookie struct { + *xgb.Cookie +} + +func QueryVersion(c *xgb.Conn) QueryVersionCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(queryVersionRequest(c), cookie) + return QueryVersionCookie{cookie} +} + +func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(queryVersionRequest(c), cookie) + return QueryVersionCookie{cookie} +} + +// Request reply for QueryVersion +// size: 16 +type QueryVersionReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Major uint32 + Minor uint32 +} + +// Waits and reads reply data from request QueryVersion +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 +} + +// Read reply into structure from buffer for QueryVersion +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 +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 +} + +// Request ListSurfaceTypes +// size: 8 +type ListSurfaceTypesCookie struct { + *xgb.Cookie +} + +func ListSurfaceTypes(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie) + return ListSurfaceTypesCookie{cookie} +} + +func ListSurfaceTypesUnchecked(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie) + return ListSurfaceTypesCookie{cookie} +} + +// Request reply for ListSurfaceTypes +// size: (32 + xgb.Pad((int(Num) * 24))) +type ListSurfaceTypesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Num uint32 + // padding: 20 bytes + Surfaces []SurfaceInfo // size: xgb.Pad((int(Num) * 24)) +} + +// Waits and reads reply data from request ListSurfaceTypes +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 +} + +// Read reply into structure from buffer for ListSurfaceTypes +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 +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 +} + +// Request CreateContext +// size: 24 +type CreateContextCookie struct { + *xgb.Cookie +} + +func CreateContext(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(createContextRequest(c, ContextId, PortId, SurfaceId, Width, Height, Flags), cookie) + return CreateContextCookie{cookie} +} + +func CreateContextUnchecked(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(createContextRequest(c, ContextId, PortId, SurfaceId, Width, Height, Flags), cookie) + return CreateContextCookie{cookie} +} + +// Request reply for CreateContext +// size: (36 + xgb.Pad((int(Length) * 4))) +type CreateContextReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + WidthActual uint16 + HeightActual uint16 + FlagsReturn uint32 + // padding: 20 bytes + PrivData []uint32 // size: xgb.Pad((int(Length) * 4)) +} + +// Waits and reads reply data from request CreateContext +func (cook CreateContextCookie) Reply() (*CreateContextReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return createContextReply(buf), nil +} + +// Read reply into structure from buffer for CreateContext +func createContextReply(buf []byte) *CreateContextReply { + v := new(CreateContextReply) + 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.WidthActual = xgb.Get16(buf[b:]) + b += 2 + + v.HeightActual = xgb.Get16(buf[b:]) + b += 2 + + v.FlagsReturn = xgb.Get32(buf[b:]) + b += 4 + + b += 20 // 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 CreateContext +func createContextRequest(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) []byte { + size := 24 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 2 // 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 + + xgb.Put32(buf[b:], uint32(PortId)) + b += 4 + + xgb.Put32(buf[b:], uint32(SurfaceId)) + b += 4 + + xgb.Put16(buf[b:], Width) + b += 2 + + xgb.Put16(buf[b:], Height) + b += 2 + + xgb.Put32(buf[b:], Flags) + b += 4 + + return buf +} + +// Request DestroyContext +// size: 8 +type DestroyContextCookie struct { + *xgb.Cookie +} + +// Write request to wire for DestroyContext +func DestroyContext(c *xgb.Conn, ContextId Context) DestroyContextCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(destroyContextRequest(c, ContextId), cookie) + return DestroyContextCookie{cookie} +} + +func DestroyContextChecked(c *xgb.Conn, ContextId Context) DestroyContextCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(destroyContextRequest(c, ContextId), cookie) + return DestroyContextCookie{cookie} +} + +func (cook DestroyContextCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for DestroyContext +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 +} + +// Request CreateSurface +// size: 12 +type CreateSurfaceCookie struct { + *xgb.Cookie +} + +func CreateSurface(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(createSurfaceRequest(c, SurfaceId, ContextId), cookie) + return CreateSurfaceCookie{cookie} +} + +func CreateSurfaceUnchecked(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(createSurfaceRequest(c, SurfaceId, ContextId), cookie) + return CreateSurfaceCookie{cookie} +} + +// Request reply for CreateSurface +// size: (32 + xgb.Pad((int(Length) * 4))) +type CreateSurfaceReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + // padding: 24 bytes + PrivData []uint32 // size: xgb.Pad((int(Length) * 4)) +} + +// Waits and reads reply data from request CreateSurface +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 +} + +// Read reply into structure from buffer for CreateSurface +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 +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 +} + +// Request DestroySurface +// size: 8 +type DestroySurfaceCookie struct { + *xgb.Cookie +} + +// Write request to wire for DestroySurface +func DestroySurface(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(destroySurfaceRequest(c, SurfaceId), cookie) + return DestroySurfaceCookie{cookie} +} + +func DestroySurfaceChecked(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(destroySurfaceRequest(c, SurfaceId), cookie) + return DestroySurfaceCookie{cookie} +} + +func (cook DestroySurfaceCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for DestroySurface +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 +} + +// Request CreateSubpicture +// size: 20 +type CreateSubpictureCookie struct { + *xgb.Cookie +} + +func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(createSubpictureRequest(c, SubpictureId, Context, XvimageId, Width, Height), cookie) + return CreateSubpictureCookie{cookie} +} + +func CreateSubpictureUnchecked(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(createSubpictureRequest(c, SubpictureId, Context, XvimageId, Width, Height), cookie) + return CreateSubpictureCookie{cookie} +} + +// Request reply for CreateSubpicture +// size: (32 + xgb.Pad((int(Length) * 4))) +type CreateSubpictureReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + WidthActual uint16 + HeightActual uint16 + NumPaletteEntries uint16 + EntryBytes uint16 + ComponentOrder []byte // size: 4 + // padding: 12 bytes + PrivData []uint32 // size: xgb.Pad((int(Length) * 4)) +} + +// Waits and reads reply data from request CreateSubpicture +func (cook CreateSubpictureCookie) Reply() (*CreateSubpictureReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return createSubpictureReply(buf), nil +} + +// Read reply into structure from buffer for CreateSubpicture +func createSubpictureReply(buf []byte) *CreateSubpictureReply { + v := new(CreateSubpictureReply) + 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.WidthActual = xgb.Get16(buf[b:]) + b += 2 + + v.HeightActual = xgb.Get16(buf[b:]) + b += 2 + + v.NumPaletteEntries = xgb.Get16(buf[b:]) + b += 2 + + v.EntryBytes = xgb.Get16(buf[b:]) + b += 2 + + v.ComponentOrder = make([]byte, 4) + copy(v.ComponentOrder[:4], buf[b:]) + b += xgb.Pad(int(4)) + + b += 12 // 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 CreateSubpicture +func createSubpictureRequest(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) []byte { + size := 20 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 6 // 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(SubpictureId)) + b += 4 + + xgb.Put32(buf[b:], uint32(Context)) + b += 4 + + xgb.Put32(buf[b:], XvimageId) + b += 4 + + xgb.Put16(buf[b:], Width) + b += 2 + + xgb.Put16(buf[b:], Height) + b += 2 + + return buf +} + +// Request DestroySubpicture +// size: 8 +type DestroySubpictureCookie struct { + *xgb.Cookie +} + +// Write request to wire for DestroySubpicture +func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { + cookie := c.NewCookie(false, false) + c.NewRequest(destroySubpictureRequest(c, SubpictureId), cookie) + return DestroySubpictureCookie{cookie} +} + +func DestroySubpictureChecked(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { + cookie := c.NewCookie(true, false) + c.NewRequest(destroySubpictureRequest(c, SubpictureId), cookie) + return DestroySubpictureCookie{cookie} +} + +func (cook DestroySubpictureCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for DestroySubpicture +func destroySubpictureRequest(c *xgb.Conn, SubpictureId Subpicture) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 7 // 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(SubpictureId)) + b += 4 + + return buf +} + +// Request ListSubpictureTypes +// size: 12 +type ListSubpictureTypesCookie struct { + *xgb.Cookie +} + +func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { + cookie := c.NewCookie(true, true) + c.NewRequest(listSubpictureTypesRequest(c, PortId, SurfaceId), cookie) + return ListSubpictureTypesCookie{cookie} +} + +func ListSubpictureTypesUnchecked(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { + cookie := c.NewCookie(false, true) + c.NewRequest(listSubpictureTypesRequest(c, PortId, SurfaceId), cookie) + return ListSubpictureTypesCookie{cookie} +} + +// Request reply for ListSubpictureTypes +// size: (32 + xv.ImageFormatInfoListSize(Types)) +type ListSubpictureTypesReply struct { + Sequence uint16 + Length uint32 + // padding: 1 bytes + Num uint32 + // padding: 20 bytes + Types []xv.ImageFormatInfo // size: xv.ImageFormatInfoListSize(Types) +} + +// Waits and reads reply data from request ListSubpictureTypes +func (cook ListSubpictureTypesCookie) Reply() (*ListSubpictureTypesReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return listSubpictureTypesReply(buf), nil +} + +// Read reply into structure from buffer for ListSubpictureTypes +func listSubpictureTypesReply(buf []byte) *ListSubpictureTypesReply { + v := new(ListSubpictureTypesReply) + 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.Types = make([]xv.ImageFormatInfo, v.Num) + b += xv.ImageFormatInfoReadList(buf[b:], v.Types) + + return v +} + +// Write request to wire for ListSubpictureTypes +func listSubpictureTypesRequest(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) []byte { + size := 12 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 8 // 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 + + xgb.Put32(buf[b:], uint32(SurfaceId)) + b += 4 + + return buf +} -- cgit v1.2.3 From a3363755cdfdafdf02d5a772bd47a462e99af057 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 20:06:22 -0400 Subject: adding package header comments --- nexgb/xvmc/xvmc.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index 8878acf..60fcb2e 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -1,7 +1,8 @@ +// Package xvmc is the X client API for the XVideo-MotionCompensation extension. package xvmc /* - This file was generated by xvmc.xml on May 10 2012 4:20:29pm EDT. + This file was generated by xvmc.xml on May 10 2012 8:04:33pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,8 +41,6 @@ func init() { xgb.NewExtErrorFuncs["XVideo-MotionCompensation"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Bool' - // Skipping definition for base type 'Float' // Skipping definition for base type 'Card8' @@ -64,6 +63,8 @@ func init() { // Skipping definition for base type 'Double' +// Skipping definition for base type 'Bool' + type Context uint32 func NewContextId(c *xgb.Conn) (Context, error) { -- cgit v1.2.3 From c00652934e4ec68016a152b9bea10273b0be8726 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Thu, 10 May 2012 23:57:34 -0400 Subject: better docs --- nexgb/xvmc/xvmc.go | 179 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 105 insertions(+), 74 deletions(-) (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index 60fcb2e..dc9c220 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -2,7 +2,7 @@ package xvmc /* - This file was generated by xvmc.xml on May 10 2012 8:04:33pm EDT. + This file was generated by xvmc.xml on May 10 2012 11:56:20pm EDT. This file is automatically generated. Edit at your peril! */ @@ -41,6 +41,16 @@ func init() { xgb.NewExtErrorFuncs["XVideo-MotionCompensation"] = make(map[int]xgb.NewErrorFun) } +// 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' // Skipping definition for base type 'Card8' @@ -55,16 +65,6 @@ func init() { // 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' - type Context uint32 func NewContextId(c *xgb.Conn) (Context, error) { @@ -95,8 +95,6 @@ func NewSubpictureId(c *xgb.Conn) (Subpicture, error) { return Subpicture(id), nil } -// 'SurfaceInfo' struct definition -// Size: 24 type SurfaceInfo struct { Id Surface ChromaFormat uint16 @@ -109,7 +107,7 @@ type SurfaceInfo struct { Flags uint32 } -// Struct read SurfaceInfo +// SurfaceInfoRead reads a byte slice into a SurfaceInfo value. func SurfaceInfoRead(buf []byte, v *SurfaceInfo) int { b := 0 @@ -143,7 +141,7 @@ func SurfaceInfoRead(buf []byte, v *SurfaceInfo) int { return b } -// Struct list read SurfaceInfo +// SurfaceInfoReadList reads a byte slice into a list of SurfaceInfo values. func SurfaceInfoReadList(buf []byte, dest []SurfaceInfo) int { b := 0 for i := 0; i < len(dest); i++ { @@ -153,7 +151,7 @@ func SurfaceInfoReadList(buf []byte, dest []SurfaceInfo) int { return xgb.Pad(b) } -// Struct write SurfaceInfo +// Bytes writes a SurfaceInfo value to a byte slice. func (v SurfaceInfo) Bytes() []byte { buf := make([]byte, 24) b := 0 @@ -188,7 +186,7 @@ func (v SurfaceInfo) Bytes() []byte { return buf } -// Write struct list SurfaceInfo +// SurfaceInfoListBytes writes a list of %s(MISSING) values to a byte slice. func SurfaceInfoListBytes(buf []byte, list []SurfaceInfo) int { b := 0 var structBytes []byte @@ -200,35 +198,37 @@ func SurfaceInfoListBytes(buf []byte, list []SurfaceInfo) int { return b } -// Request QueryVersion -// size: 4 +// 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 { 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 { cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c), cookie) return QueryVersionCookie{cookie} } -// Request reply for QueryVersion -// size: 16 +// QueryVersionReply represents the data returned from a QueryVersion request. type QueryVersionReply struct { - Sequence uint16 - Length uint32 + 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 } -// Waits and reads reply data from request QueryVersion +// 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 { @@ -240,7 +240,7 @@ func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) { return queryVersionReply(buf), nil } -// Read reply into structure from buffer for QueryVersion +// queryVersionReply reads a byte slice into a QueryVersionReply value. func queryVersionReply(buf []byte) *QueryVersionReply { v := new(QueryVersionReply) b := 1 // skip reply determinant @@ -263,6 +263,7 @@ func queryVersionReply(buf []byte) *QueryVersionReply { } // 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 @@ -280,36 +281,38 @@ func queryVersionRequest(c *xgb.Conn) []byte { return buf } -// Request ListSurfaceTypes -// size: 8 +// 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 { 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 { cookie := c.NewCookie(false, true) c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie) return ListSurfaceTypesCookie{cookie} } -// Request reply for ListSurfaceTypes -// size: (32 + xgb.Pad((int(Num) * 24))) +// ListSurfaceTypesReply represents the data returned from a ListSurfaceTypes request. type ListSurfaceTypesReply struct { - Sequence uint16 - Length uint32 + 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)) } -// Waits and reads reply data from request ListSurfaceTypes +// 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 { @@ -321,7 +324,7 @@ func (cook ListSurfaceTypesCookie) Reply() (*ListSurfaceTypesReply, error) { return listSurfaceTypesReply(buf), nil } -// Read reply into structure from buffer for ListSurfaceTypes +// listSurfaceTypesReply reads a byte slice into a ListSurfaceTypesReply value. func listSurfaceTypesReply(buf []byte) *ListSurfaceTypesReply { v := new(ListSurfaceTypesReply) b := 1 // skip reply determinant @@ -346,6 +349,7 @@ func listSurfaceTypesReply(buf []byte) *ListSurfaceTypesReply { } // 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 @@ -366,29 +370,31 @@ func listSurfaceTypesRequest(c *xgb.Conn, PortId xv.Port) []byte { return buf } -// Request CreateContext -// size: 24 +// CreateContextCookie is a cookie used only for CreateContext requests. type CreateContextCookie struct { *xgb.Cookie } +// CreateContext sends a checked request. +// If an error occurs, it will be returned with the reply by calling CreateContextCookie.Reply() func CreateContext(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { cookie := c.NewCookie(true, true) c.NewRequest(createContextRequest(c, ContextId, PortId, SurfaceId, Width, Height, Flags), cookie) return CreateContextCookie{cookie} } +// CreateContextUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateContextUnchecked(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { cookie := c.NewCookie(false, true) c.NewRequest(createContextRequest(c, ContextId, PortId, SurfaceId, Width, Height, Flags), cookie) return CreateContextCookie{cookie} } -// Request reply for CreateContext -// size: (36 + xgb.Pad((int(Length) * 4))) +// CreateContextReply represents the data returned from a CreateContext request. type CreateContextReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes WidthActual uint16 HeightActual uint16 @@ -397,7 +403,7 @@ type CreateContextReply struct { PrivData []uint32 // size: xgb.Pad((int(Length) * 4)) } -// Waits and reads reply data from request CreateContext +// Reply blocks and returns the reply data for a CreateContext request. func (cook CreateContextCookie) Reply() (*CreateContextReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -409,7 +415,7 @@ func (cook CreateContextCookie) Reply() (*CreateContextReply, error) { return createContextReply(buf), nil } -// Read reply into structure from buffer for CreateContext +// createContextReply reads a byte slice into a CreateContextReply value. func createContextReply(buf []byte) *CreateContextReply { v := new(CreateContextReply) b := 1 // skip reply determinant @@ -444,6 +450,7 @@ func createContextReply(buf []byte) *CreateContextReply { } // Write request to wire for CreateContext +// createContextRequest writes a CreateContext request to a byte slice. func createContextRequest(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) []byte { size := 24 b := 0 @@ -479,30 +486,35 @@ func createContextRequest(c *xgb.Conn, ContextId Context, PortId xv.Port, Surfac return buf } -// Request DestroyContext -// size: 8 +// DestroyContextCookie is a cookie used only for DestroyContext requests. type DestroyContextCookie struct { *xgb.Cookie } -// Write request to wire for DestroyContext +// 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 { 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 { 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 @@ -523,35 +535,37 @@ func destroyContextRequest(c *xgb.Conn, ContextId Context) []byte { return buf } -// Request CreateSurface -// size: 12 +// 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 { 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 { cookie := c.NewCookie(false, true) c.NewRequest(createSurfaceRequest(c, SurfaceId, ContextId), cookie) return CreateSurfaceCookie{cookie} } -// Request reply for CreateSurface -// size: (32 + xgb.Pad((int(Length) * 4))) +// CreateSurfaceReply represents the data returned from a CreateSurface request. type CreateSurfaceReply struct { - Sequence uint16 - Length uint32 + 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)) } -// Waits and reads reply data from request CreateSurface +// 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 { @@ -563,7 +577,7 @@ func (cook CreateSurfaceCookie) Reply() (*CreateSurfaceReply, error) { return createSurfaceReply(buf), nil } -// Read reply into structure from buffer for CreateSurface +// createSurfaceReply reads a byte slice into a CreateSurfaceReply value. func createSurfaceReply(buf []byte) *CreateSurfaceReply { v := new(CreateSurfaceReply) b := 1 // skip reply determinant @@ -589,6 +603,7 @@ func createSurfaceReply(buf []byte) *CreateSurfaceReply { } // 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 @@ -612,30 +627,35 @@ func createSurfaceRequest(c *xgb.Conn, SurfaceId Surface, ContextId Context) []b return buf } -// Request DestroySurface -// size: 8 +// DestroySurfaceCookie is a cookie used only for DestroySurface requests. type DestroySurfaceCookie struct { *xgb.Cookie } -// Write request to wire for DestroySurface +// 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 { 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 { 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 @@ -656,29 +676,31 @@ func destroySurfaceRequest(c *xgb.Conn, SurfaceId Surface) []byte { return buf } -// Request CreateSubpicture -// size: 20 +// CreateSubpictureCookie is a cookie used only for CreateSubpicture requests. type CreateSubpictureCookie struct { *xgb.Cookie } +// CreateSubpicture sends a checked request. +// If an error occurs, it will be returned with the reply by calling CreateSubpictureCookie.Reply() func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { cookie := c.NewCookie(true, true) c.NewRequest(createSubpictureRequest(c, SubpictureId, Context, XvimageId, Width, Height), cookie) return CreateSubpictureCookie{cookie} } +// CreateSubpictureUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateSubpictureUnchecked(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { cookie := c.NewCookie(false, true) c.NewRequest(createSubpictureRequest(c, SubpictureId, Context, XvimageId, Width, Height), cookie) return CreateSubpictureCookie{cookie} } -// Request reply for CreateSubpicture -// size: (32 + xgb.Pad((int(Length) * 4))) +// CreateSubpictureReply represents the data returned from a CreateSubpicture request. type CreateSubpictureReply struct { - Sequence uint16 - Length uint32 + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply // padding: 1 bytes WidthActual uint16 HeightActual uint16 @@ -689,7 +711,7 @@ type CreateSubpictureReply struct { PrivData []uint32 // size: xgb.Pad((int(Length) * 4)) } -// Waits and reads reply data from request CreateSubpicture +// Reply blocks and returns the reply data for a CreateSubpicture request. func (cook CreateSubpictureCookie) Reply() (*CreateSubpictureReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -701,7 +723,7 @@ func (cook CreateSubpictureCookie) Reply() (*CreateSubpictureReply, error) { return createSubpictureReply(buf), nil } -// Read reply into structure from buffer for CreateSubpicture +// createSubpictureReply reads a byte slice into a CreateSubpictureReply value. func createSubpictureReply(buf []byte) *CreateSubpictureReply { v := new(CreateSubpictureReply) b := 1 // skip reply determinant @@ -743,6 +765,7 @@ func createSubpictureReply(buf []byte) *CreateSubpictureReply { } // Write request to wire for CreateSubpicture +// createSubpictureRequest writes a CreateSubpicture request to a byte slice. func createSubpictureRequest(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) []byte { size := 20 b := 0 @@ -775,30 +798,35 @@ func createSubpictureRequest(c *xgb.Conn, SubpictureId Subpicture, Context Conte return buf } -// Request DestroySubpicture -// size: 8 +// DestroySubpictureCookie is a cookie used only for DestroySubpicture requests. type DestroySubpictureCookie struct { *xgb.Cookie } -// Write request to wire for DestroySubpicture +// DestroySubpicture sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { cookie := c.NewCookie(false, false) c.NewRequest(destroySubpictureRequest(c, SubpictureId), cookie) return DestroySubpictureCookie{cookie} } +// DestroySubpictureChecked sends a checked request. +// If an error occurs, it can be retrieved using DestroySubpictureCookie.Check() func DestroySubpictureChecked(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { cookie := c.NewCookie(true, false) c.NewRequest(destroySubpictureRequest(c, SubpictureId), cookie) return DestroySubpictureCookie{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 DestroySubpictureCookie) Check() error { return cook.Cookie.Check() } // Write request to wire for DestroySubpicture +// destroySubpictureRequest writes a DestroySubpicture request to a byte slice. func destroySubpictureRequest(c *xgb.Conn, SubpictureId Subpicture) []byte { size := 8 b := 0 @@ -819,36 +847,38 @@ func destroySubpictureRequest(c *xgb.Conn, SubpictureId Subpicture) []byte { return buf } -// Request ListSubpictureTypes -// size: 12 +// ListSubpictureTypesCookie is a cookie used only for ListSubpictureTypes requests. type ListSubpictureTypesCookie struct { *xgb.Cookie } +// ListSubpictureTypes sends a checked request. +// If an error occurs, it will be returned with the reply by calling ListSubpictureTypesCookie.Reply() func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { cookie := c.NewCookie(true, true) c.NewRequest(listSubpictureTypesRequest(c, PortId, SurfaceId), cookie) return ListSubpictureTypesCookie{cookie} } +// ListSubpictureTypesUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListSubpictureTypesUnchecked(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { cookie := c.NewCookie(false, true) c.NewRequest(listSubpictureTypesRequest(c, PortId, SurfaceId), cookie) return ListSubpictureTypesCookie{cookie} } -// Request reply for ListSubpictureTypes -// size: (32 + xv.ImageFormatInfoListSize(Types)) +// ListSubpictureTypesReply represents the data returned from a ListSubpictureTypes request. type ListSubpictureTypesReply struct { - Sequence uint16 - Length uint32 + 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 Types []xv.ImageFormatInfo // size: xv.ImageFormatInfoListSize(Types) } -// Waits and reads reply data from request ListSubpictureTypes +// Reply blocks and returns the reply data for a ListSubpictureTypes request. func (cook ListSubpictureTypesCookie) Reply() (*ListSubpictureTypesReply, error) { buf, err := cook.Cookie.Reply() if err != nil { @@ -860,7 +890,7 @@ func (cook ListSubpictureTypesCookie) Reply() (*ListSubpictureTypesReply, error) return listSubpictureTypesReply(buf), nil } -// Read reply into structure from buffer for ListSubpictureTypes +// listSubpictureTypesReply reads a byte slice into a ListSubpictureTypesReply value. func listSubpictureTypesReply(buf []byte) *ListSubpictureTypesReply { v := new(ListSubpictureTypesReply) b := 1 // skip reply determinant @@ -885,6 +915,7 @@ func listSubpictureTypesReply(buf []byte) *ListSubpictureTypesReply { } // Write request to wire for ListSubpictureTypes +// listSubpictureTypesRequest writes a ListSubpictureTypes request to a byte slice. func listSubpictureTypesRequest(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) []byte { size := 12 b := 0 -- cgit v1.2.3 From 3e6b3544934cb71e3a3b0edf9bc184241ac1ad7f Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Fri, 11 May 2012 01:58:52 -0400 Subject: add a little more docs for errors --- nexgb/xvmc/xvmc.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index dc9c220..cf794cc 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -2,7 +2,7 @@ package xvmc /* - This file was generated by xvmc.xml on May 10 2012 11:56:20pm EDT. + This file was generated by xvmc.xml on May 11 2012 1:58:37am EDT. This file is automatically generated. Edit at your peril! */ @@ -41,6 +41,8 @@ func init() { xgb.NewExtErrorFuncs["XVideo-MotionCompensation"] = make(map[int]xgb.NewErrorFun) } +// Skipping definition for base type 'Int8' + // Skipping definition for base type 'Card16' // Skipping definition for base type 'Char' @@ -63,8 +65,6 @@ func init() { // Skipping definition for base type 'Byte' -// Skipping definition for base type 'Int8' - type Context uint32 func NewContextId(c *xgb.Conn) (Context, error) { -- cgit v1.2.3 From 29942bf078c92fea681e42ca5029592526f00718 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Fri, 11 May 2012 23:58:52 -0400 Subject: panic when an extension request is issued before an extension has been initialized. but give a nice error message for the happy people. --- nexgb/xvmc/xvmc.go | 76 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 65 insertions(+), 11 deletions(-) (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index cf794cc..19b1c83 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -2,7 +2,7 @@ package xvmc /* - This file was generated by xvmc.xml on May 11 2012 1:58:37am EDT. + This file was generated by xvmc.xml on May 11 2012 11:57:20pm EDT. This file is automatically generated. Edit at your peril! */ @@ -41,6 +41,16 @@ 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' @@ -55,16 +65,6 @@ func init() { // Skipping definition for base type 'Float' -// 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' - type Context uint32 func NewContextId(c *xgb.Conn) (Context, error) { @@ -206,6 +206,9 @@ type QueryVersionCookie struct { // 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} @@ -214,6 +217,9 @@ func QueryVersion(c *xgb.Conn) QueryVersionCookie { // 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} @@ -289,6 +295,9 @@ type ListSurfaceTypesCookie struct { // 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} @@ -297,6 +306,9 @@ func ListSurfaceTypes(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie { // 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} @@ -378,6 +390,9 @@ type CreateContextCookie struct { // CreateContext sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateContextCookie.Reply() func CreateContext(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(createContextRequest(c, ContextId, PortId, SurfaceId, Width, Height, Flags), cookie) return CreateContextCookie{cookie} @@ -386,6 +401,9 @@ func CreateContext(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Sur // CreateContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateContextUnchecked(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(createContextRequest(c, ContextId, PortId, SurfaceId, Width, Height, Flags), cookie) return CreateContextCookie{cookie} @@ -494,6 +512,9 @@ type DestroyContextCookie struct { // 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} @@ -502,6 +523,9 @@ func DestroyContext(c *xgb.Conn, ContextId Context) DestroyContextCookie { // 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} @@ -543,6 +567,9 @@ type CreateSurfaceCookie struct { // 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} @@ -551,6 +578,9 @@ func CreateSurface(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurf // 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} @@ -635,6 +665,9 @@ type DestroySurfaceCookie struct { // 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} @@ -643,6 +676,9 @@ func DestroySurface(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie { // 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} @@ -684,6 +720,9 @@ type CreateSubpictureCookie struct { // CreateSubpicture sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateSubpictureCookie.Reply() func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'CreateSubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(createSubpictureRequest(c, SubpictureId, Context, XvimageId, Width, Height), cookie) return CreateSubpictureCookie{cookie} @@ -692,6 +731,9 @@ func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, Xvi // CreateSubpictureUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateSubpictureUnchecked(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'CreateSubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(createSubpictureRequest(c, SubpictureId, Context, XvimageId, Width, Height), cookie) return CreateSubpictureCookie{cookie} @@ -806,6 +848,9 @@ type DestroySubpictureCookie struct { // DestroySubpicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(destroySubpictureRequest(c, SubpictureId), cookie) return DestroySubpictureCookie{cookie} @@ -814,6 +859,9 @@ func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCo // DestroySubpictureChecked sends a checked request. // If an error occurs, it can be retrieved using DestroySubpictureCookie.Check() func DestroySubpictureChecked(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(destroySubpictureRequest(c, SubpictureId), cookie) return DestroySubpictureCookie{cookie} @@ -855,6 +903,9 @@ type ListSubpictureTypesCookie struct { // ListSubpictureTypes sends a checked request. // If an error occurs, it will be returned with the reply by calling ListSubpictureTypesCookie.Reply() func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(listSubpictureTypesRequest(c, PortId, SurfaceId), cookie) return ListSubpictureTypesCookie{cookie} @@ -863,6 +914,9 @@ func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSub // ListSubpictureTypesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListSubpictureTypesUnchecked(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(listSubpictureTypesRequest(c, PortId, SurfaceId), cookie) return ListSubpictureTypesCookie{cookie} -- cgit v1.2.3 From 4ea94ca0fef7786ce21722cbb02a9cf069bdedd9 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Sat, 26 May 2012 18:24:52 -0400 Subject: Bug fix in the generator that was outputting %(MISSING) crud. --- nexgb/xvmc/xvmc.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index 19b1c83..dc6a950 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -2,7 +2,7 @@ package xvmc /* - This file was generated by xvmc.xml on May 11 2012 11:57:20pm EDT. + This file was generated by xvmc.xml on May 26 2012 6:23:14pm EDT. This file is automatically generated. Edit at your peril! */ @@ -41,16 +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' @@ -65,6 +55,16 @@ func init() { // Skipping definition for base type 'Float' +// 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' + type Context uint32 func NewContextId(c *xgb.Conn) (Context, error) { @@ -186,7 +186,7 @@ func (v SurfaceInfo) Bytes() []byte { return buf } -// SurfaceInfoListBytes writes a list of %s(MISSING) values to a byte slice. +// SurfaceInfoListBytes writes a list of SurfaceInfo values to a byte slice. func SurfaceInfoListBytes(buf []byte, list []SurfaceInfo) int { b := 0 var structBytes []byte -- cgit v1.2.3 From a9eae45cb3977bce5983e817d00d4584d176b044 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Tue, 5 Jun 2012 00:14:34 -0400 Subject: Refresh build. Eh. --- nexgb/xvmc/xvmc.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index dc6a950..0ddf369 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -2,7 +2,7 @@ package xvmc /* - This file was generated by xvmc.xml on May 26 2012 6:23:14pm EDT. + This file was generated by xvmc.xml on Jun 5 2012 12:12:00am EDT. This file is automatically generated. Edit at your peril! */ @@ -41,6 +41,16 @@ 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' @@ -55,16 +65,6 @@ func init() { // Skipping definition for base type 'Float' -// 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' - type Context uint32 func NewContextId(c *xgb.Conn) (Context, error) { -- cgit v1.2.3 From 0685fb57e14104ee4ad9f70ec94f787a9a22c028 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sun, 11 Aug 2013 20:43:26 -0400 Subject: Update to latest xproto XML. --- nexgb/xvmc/xvmc.go | 720 ++++++++++++++++++++++++++--------------------------- 1 file changed, 360 insertions(+), 360 deletions(-) (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index 0ddf369..9bcb60b 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -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,24 +51,24 @@ func NewContextId(c *xgb.Conn) (Context, error) { return Context(id), nil } -type Surface uint32 +type Subpicture uint32 -func NewSurfaceId(c *xgb.Conn) (Surface, error) { +func NewSubpictureId(c *xgb.Conn) (Subpicture, error) { id, err := c.NewId() if err != nil { return 0, err } - return Surface(id), nil + return Subpicture(id), nil } -type Subpicture uint32 +type Surface uint32 -func NewSubpictureId(c *xgb.Conn) (Subpicture, error) { +func NewSurfaceId(c *xgb.Conn) (Surface, error) { id, err := c.NewId() if err != nil { return 0, err } - return Subpicture(id), nil + return Surface(id), nil } type SurfaceInfo struct { @@ -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 -} - -// 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 -} - -// 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 +// Skipping definition for base type 'Bool' - v.Length = xgb.Get32(buf[b:]) // 4-byte units - b += 4 +// Skipping definition for base type 'Byte' - v.Num = xgb.Get32(buf[b:]) - b += 4 +// Skipping definition for base type 'Card8' - b += 20 // padding +// Skipping definition for base type 'Char' - v.Surfaces = make([]SurfaceInfo, v.Num) - b += SurfaceInfoReadList(buf[b:], v.Surfaces) +// Skipping definition for base type 'Void' - return v -} +// Skipping definition for base type 'Double' -// 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) +// Skipping definition for base type 'Float' - buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] - b += 1 +// Skipping definition for base type 'Int16' - buf[b] = 1 // request opcode - b += 1 +// Skipping definition for base type 'Int32' - xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units - b += 2 +// Skipping definition for base type 'Int8' - xgb.Put32(buf[b:], uint32(PortId)) - b += 4 +// Skipping definition for base type 'Card16' - return buf -} +// Skipping definition for base type 'Card32' // CreateContextCookie is a cookie used only for CreateContext requests. type CreateContextCookie struct { @@ -504,58 +320,131 @@ 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 { +// CreateSubpictureCookie is a cookie used only for CreateSubpicture requests. +type CreateSubpictureCookie 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 { +// CreateSubpicture sends a checked request. +// If an error occurs, it will be returned with the reply by calling CreateSubpictureCookie.Reply() +func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { 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.") + panic("Cannot issue request 'CreateSubpicture' 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} + cookie := c.NewCookie(true, true) + c.NewRequest(createSubpictureRequest(c, SubpictureId, Context, XvimageId, Width, Height), cookie) + return CreateSubpictureCookie{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 { +// CreateSubpictureUnchecked sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. +func CreateSubpictureUnchecked(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { 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.") + panic("Cannot issue request 'CreateSubpicture' 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} + cookie := c.NewCookie(false, true) + c.NewRequest(createSubpictureRequest(c, SubpictureId, Context, XvimageId, Width, Height), cookie) + return CreateSubpictureCookie{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() +// CreateSubpictureReply represents the data returned from a CreateSubpicture request. +type CreateSubpictureReply struct { + Sequence uint16 // sequence number of the request for this reply + Length uint32 // number of bytes in this reply + // padding: 1 bytes + WidthActual uint16 + HeightActual uint16 + NumPaletteEntries uint16 + EntryBytes uint16 + ComponentOrder []byte // size: 4 + // padding: 12 bytes + PrivData []uint32 // size: xgb.Pad((int(Length) * 4)) } -// 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 +// Reply blocks and returns the reply data for a CreateSubpicture request. +func (cook CreateSubpictureCookie) Reply() (*CreateSubpictureReply, error) { + buf, err := cook.Cookie.Reply() + if err != nil { + return nil, err + } + if buf == nil { + return nil, nil + } + return createSubpictureReply(buf), nil +} + +// createSubpictureReply reads a byte slice into a CreateSubpictureReply value. +func createSubpictureReply(buf []byte) *CreateSubpictureReply { + v := new(CreateSubpictureReply) + 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.WidthActual = xgb.Get16(buf[b:]) + b += 2 + + v.HeightActual = xgb.Get16(buf[b:]) + b += 2 + + v.NumPaletteEntries = xgb.Get16(buf[b:]) + b += 2 + + v.EntryBytes = xgb.Get16(buf[b:]) + b += 2 + + v.ComponentOrder = make([]byte, 4) + copy(v.ComponentOrder[:4], buf[b:]) + b += xgb.Pad(int(4)) + + b += 12 // 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 CreateSubpicture +// createSubpictureRequest writes a CreateSubpicture request to a byte slice. +func createSubpictureRequest(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) []byte { + size := 20 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] b += 1 - buf[b] = 3 // request opcode + buf[b] = 6 // 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)) + xgb.Put32(buf[b:], uint32(SubpictureId)) + b += 4 + + xgb.Put32(buf[b:], uint32(Context)) b += 4 + xgb.Put32(buf[b:], XvimageId) + b += 4 + + xgb.Put16(buf[b:], Width) + b += 2 + + xgb.Put16(buf[b:], Height) + b += 2 + return buf } @@ -657,6 +546,116 @@ func createSurfaceRequest(c *xgb.Conn, SurfaceId Surface, ContextId Context) []b 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 +} + +// DestroySubpicture sends an unchecked request. +// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. +func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } + cookie := c.NewCookie(false, false) + c.NewRequest(destroySubpictureRequest(c, SubpictureId), cookie) + return DestroySubpictureCookie{cookie} +} + +// DestroySubpictureChecked sends a checked request. +// If an error occurs, it can be retrieved using DestroySubpictureCookie.Check() +func DestroySubpictureChecked(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } + cookie := c.NewCookie(true, false) + c.NewRequest(destroySubpictureRequest(c, SubpictureId), cookie) + return DestroySubpictureCookie{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 DestroySubpictureCookie) Check() error { + return cook.Cookie.Check() +} + +// Write request to wire for DestroySubpicture +// destroySubpictureRequest writes a DestroySubpicture request to a byte slice. +func destroySubpictureRequest(c *xgb.Conn, SubpictureId Subpicture) []byte { + size := 8 + b := 0 + buf := make([]byte, size) + + buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + b += 1 + + buf[b] = 7 // 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(SubpictureId)) + b += 4 + + return buf +} + // DestroySurfaceCookie is a cookie used only for DestroySurface requests. type DestroySurfaceCookie struct { *xgb.Cookie @@ -712,49 +711,45 @@ func destroySurfaceRequest(c *xgb.Conn, SurfaceId Surface) []byte { return buf } -// CreateSubpictureCookie is a cookie used only for CreateSubpicture requests. -type CreateSubpictureCookie struct { +// ListSubpictureTypesCookie is a cookie used only for ListSubpictureTypes requests. +type ListSubpictureTypesCookie struct { *xgb.Cookie } -// CreateSubpicture sends a checked request. -// If an error occurs, it will be returned with the reply by calling CreateSubpictureCookie.Reply() -func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { +// ListSubpictureTypes sends a checked request. +// If an error occurs, it will be returned with the reply by calling ListSubpictureTypesCookie.Reply() +func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { - panic("Cannot issue request 'CreateSubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + panic("Cannot issue request 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) - c.NewRequest(createSubpictureRequest(c, SubpictureId, Context, XvimageId, Width, Height), cookie) - return CreateSubpictureCookie{cookie} + c.NewRequest(listSubpictureTypesRequest(c, PortId, SurfaceId), cookie) + return ListSubpictureTypesCookie{cookie} } -// CreateSubpictureUnchecked sends an unchecked request. +// ListSubpictureTypesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func CreateSubpictureUnchecked(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { +func ListSubpictureTypesUnchecked(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { - panic("Cannot issue request 'CreateSubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + panic("Cannot issue request 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) - c.NewRequest(createSubpictureRequest(c, SubpictureId, Context, XvimageId, Width, Height), cookie) - return CreateSubpictureCookie{cookie} + c.NewRequest(listSubpictureTypesRequest(c, PortId, SurfaceId), cookie) + return ListSubpictureTypesCookie{cookie} } -// CreateSubpictureReply represents the data returned from a CreateSubpicture request. -type CreateSubpictureReply struct { +// ListSubpictureTypesReply represents the data returned from a ListSubpictureTypes request. +type ListSubpictureTypesReply struct { Sequence uint16 // sequence number of the request for this reply Length uint32 // number of bytes in this reply // padding: 1 bytes - WidthActual uint16 - HeightActual uint16 - NumPaletteEntries uint16 - EntryBytes uint16 - ComponentOrder []byte // size: 4 - // padding: 12 bytes - PrivData []uint32 // size: xgb.Pad((int(Length) * 4)) + Num uint32 + // padding: 20 bytes + Types []xv.ImageFormatInfo // size: xv.ImageFormatInfoListSize(Types) } -// Reply blocks and returns the reply data for a CreateSubpicture request. -func (cook CreateSubpictureCookie) Reply() (*CreateSubpictureReply, error) { +// Reply blocks and returns the reply data for a ListSubpictureTypes request. +func (cook ListSubpictureTypesCookie) Reply() (*ListSubpictureTypesReply, error) { buf, err := cook.Cookie.Reply() if err != nil { return nil, err @@ -762,12 +757,12 @@ func (cook CreateSubpictureCookie) Reply() (*CreateSubpictureReply, error) { if buf == nil { return nil, nil } - return createSubpictureReply(buf), nil + return listSubpictureTypesReply(buf), nil } -// createSubpictureReply reads a byte slice into a CreateSubpictureReply value. -func createSubpictureReply(buf []byte) *CreateSubpictureReply { - v := new(CreateSubpictureReply) +// listSubpictureTypesReply reads a byte slice into a ListSubpictureTypesReply value. +func listSubpictureTypesReply(buf []byte) *ListSubpictureTypesReply { + v := new(ListSubpictureTypesReply) b := 1 // skip reply determinant b += 1 // padding @@ -778,104 +773,118 @@ func createSubpictureReply(buf []byte) *CreateSubpictureReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.WidthActual = xgb.Get16(buf[b:]) - b += 2 - - v.HeightActual = xgb.Get16(buf[b:]) - b += 2 - - v.NumPaletteEntries = xgb.Get16(buf[b:]) - b += 2 - - v.EntryBytes = xgb.Get16(buf[b:]) - b += 2 - - v.ComponentOrder = make([]byte, 4) - copy(v.ComponentOrder[:4], buf[b:]) - b += xgb.Pad(int(4)) + v.Num = xgb.Get32(buf[b:]) + b += 4 - b += 12 // padding + b += 20 // 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) + v.Types = make([]xv.ImageFormatInfo, v.Num) + b += xv.ImageFormatInfoReadList(buf[b:], v.Types) return v } -// Write request to wire for CreateSubpicture -// createSubpictureRequest writes a CreateSubpicture request to a byte slice. -func createSubpictureRequest(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) []byte { - size := 20 +// Write request to wire for ListSubpictureTypes +// listSubpictureTypesRequest writes a ListSubpictureTypes request to a byte slice. +func listSubpictureTypesRequest(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) []byte { + size := 12 b := 0 buf := make([]byte, size) buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] b += 1 - buf[b] = 6 // request opcode + buf[b] = 8 // 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(SubpictureId)) - b += 4 - - xgb.Put32(buf[b:], uint32(Context)) + xgb.Put32(buf[b:], uint32(PortId)) b += 4 - xgb.Put32(buf[b:], XvimageId) + xgb.Put32(buf[b:], uint32(SurfaceId)) b += 4 - xgb.Put16(buf[b:], Width) - b += 2 - - xgb.Put16(buf[b:], Height) - b += 2 - return buf } -// DestroySubpictureCookie is a cookie used only for DestroySubpicture requests. -type DestroySubpictureCookie struct { +// ListSurfaceTypesCookie is a cookie used only for ListSurfaceTypes requests. +type ListSurfaceTypesCookie struct { *xgb.Cookie } -// DestroySubpicture sends an unchecked request. -// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { +// 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 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } - cookie := c.NewCookie(false, false) - c.NewRequest(destroySubpictureRequest(c, SubpictureId), cookie) - return DestroySubpictureCookie{cookie} + cookie := c.NewCookie(true, true) + c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie) + return ListSurfaceTypesCookie{cookie} } -// DestroySubpictureChecked sends a checked request. -// If an error occurs, it can be retrieved using DestroySubpictureCookie.Check() -func DestroySubpictureChecked(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { +// 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 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } - cookie := c.NewCookie(true, false) - c.NewRequest(destroySubpictureRequest(c, SubpictureId), cookie) - return DestroySubpictureCookie{cookie} + cookie := c.NewCookie(false, true) + c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie) + return ListSurfaceTypesCookie{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 DestroySubpictureCookie) Check() error { - return cook.Cookie.Check() +// 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)) } -// Write request to wire for DestroySubpicture -// destroySubpictureRequest writes a DestroySubpicture request to a byte slice. -func destroySubpictureRequest(c *xgb.Conn, SubpictureId Subpicture) []byte { +// 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) @@ -883,57 +892,56 @@ func destroySubpictureRequest(c *xgb.Conn, SubpictureId Subpicture) []byte { buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] b += 1 - buf[b] = 7 // request opcode + 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(SubpictureId)) + xgb.Put32(buf[b:], uint32(PortId)) b += 4 return buf } -// ListSubpictureTypesCookie is a cookie used only for ListSubpictureTypes requests. -type ListSubpictureTypesCookie struct { +// QueryVersionCookie is a cookie used only for QueryVersion requests. +type QueryVersionCookie struct { *xgb.Cookie } -// ListSubpictureTypes sends a checked request. -// If an error occurs, it will be returned with the reply by calling ListSubpictureTypesCookie.Reply() -func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { +// 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 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + 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(listSubpictureTypesRequest(c, PortId, SurfaceId), cookie) - return ListSubpictureTypesCookie{cookie} + c.NewRequest(queryVersionRequest(c), cookie) + return QueryVersionCookie{cookie} } -// ListSubpictureTypesUnchecked sends an unchecked request. +// QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. -func ListSubpictureTypesUnchecked(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { +func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie { if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { - panic("Cannot issue request 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + 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(listSubpictureTypesRequest(c, PortId, SurfaceId), cookie) - return ListSubpictureTypesCookie{cookie} + c.NewRequest(queryVersionRequest(c), cookie) + return QueryVersionCookie{cookie} } -// ListSubpictureTypesReply represents the data returned from a ListSubpictureTypes request. -type ListSubpictureTypesReply struct { +// 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 - Num uint32 - // padding: 20 bytes - Types []xv.ImageFormatInfo // size: xv.ImageFormatInfoListSize(Types) + Major uint32 + Minor uint32 } -// Reply blocks and returns the reply data for a ListSubpictureTypes request. -func (cook ListSubpictureTypesCookie) Reply() (*ListSubpictureTypesReply, error) { +// 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 @@ -941,12 +949,12 @@ func (cook ListSubpictureTypesCookie) Reply() (*ListSubpictureTypesReply, error) if buf == nil { return nil, nil } - return listSubpictureTypesReply(buf), nil + return queryVersionReply(buf), nil } -// listSubpictureTypesReply reads a byte slice into a ListSubpictureTypesReply value. -func listSubpictureTypesReply(buf []byte) *ListSubpictureTypesReply { - v := new(ListSubpictureTypesReply) +// 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 @@ -957,38 +965,30 @@ func listSubpictureTypesReply(buf []byte) *ListSubpictureTypesReply { v.Length = xgb.Get32(buf[b:]) // 4-byte units b += 4 - v.Num = xgb.Get32(buf[b:]) + v.Major = xgb.Get32(buf[b:]) b += 4 - b += 20 // padding - - v.Types = make([]xv.ImageFormatInfo, v.Num) - b += xv.ImageFormatInfoReadList(buf[b:], v.Types) + v.Minor = xgb.Get32(buf[b:]) + b += 4 return v } -// Write request to wire for ListSubpictureTypes -// listSubpictureTypesRequest writes a ListSubpictureTypes request to a byte slice. -func listSubpictureTypesRequest(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) []byte { - size := 12 +// 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] = 8 // request opcode + buf[b] = 0 // 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 - - xgb.Put32(buf[b:], uint32(SurfaceId)) - b += 4 - return buf } -- cgit v1.2.3 From b06a8ca97625c1134449c3af65d9ac3fb251a613 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sun, 11 Aug 2013 20:45:36 -0400 Subject: Don't needlessly change source files every time. --- nexgb/xvmc/xvmc.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index 9bcb60b..f0988eb 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -1,10 +1,7 @@ // Package xvmc is the X client API for the XVideo-MotionCompensation extension. package xvmc -/* - This file was generated by xvmc.xml on Aug 11 2013 8:39:44pm EDT. - This file is automatically generated. Edit at your peril! -*/ +// This file is automatically generated from xvmc.xml. Edit at your peril! import ( "github.com/BurntSushi/xgb" -- cgit v1.2.3 From 38b293e74db6631873d5dfd74cf731eb7b76737d Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sun, 11 Aug 2013 20:54:15 -0400 Subject: Padding on a list is on the length of the list. There was a bug where padding was being computed on each element of the list. Close #5. --- nexgb/xvmc/xvmc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index f0988eb..5ab7108 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -166,9 +166,9 @@ func SurfaceInfoListBytes(buf []byte, list []SurfaceInfo) int { for _, item := range list { structBytes = item.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } - return b + return xgb.Pad(b) } // Skipping definition for base type 'Bool' -- cgit v1.2.3 From 76f9adb5991081e27ebc6eec82db6bdba36c910f Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sat, 28 Dec 2013 10:13:20 -0500 Subject: Use consistent extension names. Close #6. --- nexgb/xvmc/xvmc.go | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index 5ab7108..cd82b33 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -203,7 +203,7 @@ type CreateContextCookie struct { // CreateContext sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateContextCookie.Reply() func CreateContext(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { - if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -214,7 +214,7 @@ func CreateContext(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Sur // CreateContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateContextUnchecked(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { - if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -287,7 +287,7 @@ func createContextRequest(c *xgb.Conn, ContextId Context, PortId xv.Port, Surfac b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + buf[b] = c.Extensions["XVideo-MotionCompensation"] b += 1 buf[b] = 2 // request opcode @@ -325,7 +325,7 @@ type CreateSubpictureCookie struct { // CreateSubpicture sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateSubpictureCookie.Reply() func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { - if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateSubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -336,7 +336,7 @@ func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, Xvi // CreateSubpictureUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateSubpictureUnchecked(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { - if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateSubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -418,7 +418,7 @@ func createSubpictureRequest(c *xgb.Conn, SubpictureId Subpicture, Context Conte b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + buf[b] = c.Extensions["XVideo-MotionCompensation"] b += 1 buf[b] = 6 // request opcode @@ -453,7 +453,7 @@ type CreateSurfaceCookie struct { // 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 { + 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) @@ -464,7 +464,7 @@ func CreateSurface(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurf // 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 { + 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) @@ -525,7 +525,7 @@ func createSurfaceRequest(c *xgb.Conn, SurfaceId Surface, ContextId Context) []b b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + buf[b] = c.Extensions["XVideo-MotionCompensation"] b += 1 buf[b] = 4 // request opcode @@ -551,7 +551,7 @@ type DestroyContextCookie struct { // 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 { + 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) @@ -562,7 +562,7 @@ func DestroyContext(c *xgb.Conn, ContextId Context) DestroyContextCookie { // 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 { + 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) @@ -583,7 +583,7 @@ func destroyContextRequest(c *xgb.Conn, ContextId Context) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + buf[b] = c.Extensions["XVideo-MotionCompensation"] b += 1 buf[b] = 3 // request opcode @@ -606,7 +606,7 @@ type DestroySubpictureCookie struct { // DestroySubpicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { - if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } cookie := c.NewCookie(false, false) @@ -617,7 +617,7 @@ func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCo // DestroySubpictureChecked sends a checked request. // If an error occurs, it can be retrieved using DestroySubpictureCookie.Check() func DestroySubpictureChecked(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { - if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } cookie := c.NewCookie(true, false) @@ -638,7 +638,7 @@ func destroySubpictureRequest(c *xgb.Conn, SubpictureId Subpicture) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + buf[b] = c.Extensions["XVideo-MotionCompensation"] b += 1 buf[b] = 7 // request opcode @@ -661,7 +661,7 @@ type DestroySurfaceCookie struct { // 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 { + 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) @@ -672,7 +672,7 @@ func DestroySurface(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie { // 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 { + 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) @@ -693,7 +693,7 @@ func destroySurfaceRequest(c *xgb.Conn, SurfaceId Surface) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + buf[b] = c.Extensions["XVideo-MotionCompensation"] b += 1 buf[b] = 5 // request opcode @@ -716,7 +716,7 @@ type ListSubpictureTypesCookie struct { // ListSubpictureTypes sends a checked request. // If an error occurs, it will be returned with the reply by calling ListSubpictureTypesCookie.Reply() func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { - if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } cookie := c.NewCookie(true, true) @@ -727,7 +727,7 @@ func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSub // ListSubpictureTypesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListSubpictureTypesUnchecked(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { - if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } cookie := c.NewCookie(false, true) @@ -788,7 +788,7 @@ func listSubpictureTypesRequest(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + buf[b] = c.Extensions["XVideo-MotionCompensation"] b += 1 buf[b] = 8 // request opcode @@ -814,7 +814,7 @@ type ListSurfaceTypesCookie struct { // 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 { + 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) @@ -825,7 +825,7 @@ func ListSurfaceTypes(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie { // 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 { + 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) @@ -886,7 +886,7 @@ func listSurfaceTypesRequest(c *xgb.Conn, PortId xv.Port) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + buf[b] = c.Extensions["XVideo-MotionCompensation"] b += 1 buf[b] = 1 // request opcode @@ -909,7 +909,7 @@ type QueryVersionCookie struct { // 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 { + 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) @@ -920,7 +920,7 @@ func QueryVersion(c *xgb.Conn) QueryVersionCookie { // 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 { + 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) @@ -978,7 +978,7 @@ func queryVersionRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) - buf[b] = c.Extensions["XVIDEO-MOTIONCOMPENSATION"] + buf[b] = c.Extensions["XVideo-MotionCompensation"] b += 1 buf[b] = 0 // request opcode -- cgit v1.2.3 From a548d9d0f7b889627c43b18811357fad88760b2d Mon Sep 17 00:00:00 2001 From: aarzilli Date: Fri, 2 May 2014 15:09:23 +0200 Subject: Fix Issue #21: automatic calculation of alignment padding after lists --- nexgb/xvmc/xvmc.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index cd82b33..a574a21 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -156,7 +156,7 @@ func (v SurfaceInfo) Bytes() []byte { xgb.Put32(buf[b:], v.Flags) b += 4 - return buf + return buf[:b] } // SurfaceInfoListBytes writes a list of SurfaceInfo values to a byte slice. @@ -275,7 +275,6 @@ func createContextReply(buf []byte) *CreateContextReply { v.PrivData[i] = xgb.Get32(buf[b:]) b += 4 } - b = xgb.Pad(b) return v } @@ -397,7 +396,7 @@ func createSubpictureReply(buf []byte) *CreateSubpictureReply { v.ComponentOrder = make([]byte, 4) copy(v.ComponentOrder[:4], buf[b:]) - b += xgb.Pad(int(4)) + b += int(4) b += 12 // padding @@ -406,7 +405,6 @@ func createSubpictureReply(buf []byte) *CreateSubpictureReply { v.PrivData[i] = xgb.Get32(buf[b:]) b += 4 } - b = xgb.Pad(b) return v } @@ -513,7 +511,6 @@ func createSurfaceReply(buf []byte) *CreateSurfaceReply { v.PrivData[i] = xgb.Get32(buf[b:]) b += 4 } - b = xgb.Pad(b) return v } -- cgit v1.2.3 From becaf43dcb3e9832c3eb951ff9908ed697868152 Mon Sep 17 00:00:00 2001 From: aarzilli Date: Tue, 1 Mar 2016 15:41:38 +0100 Subject: Read/Write mutex for Extensions map --- nexgb/xvmc/xvmc.go | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index a574a21..b943fa0 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -20,16 +20,15 @@ func Init(c *xgb.Conn) error { return xgb.Errorf("No extension named XVideo-MotionCompensation could be found on on the server.") } - xgb.ExtLock.Lock() + c.ExtLock.Lock() c.Extensions["XVideo-MotionCompensation"] = reply.MajorOpcode + c.ExtLock.Unlock() for evNum, fun := range xgb.NewExtEventFuncs["XVideo-MotionCompensation"] { xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun } for errNum, fun := range xgb.NewExtErrorFuncs["XVideo-MotionCompensation"] { xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun } - xgb.ExtLock.Unlock() - return nil } @@ -203,6 +202,8 @@ type CreateContextCookie struct { // CreateContext sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateContextCookie.Reply() func CreateContext(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -214,6 +215,8 @@ func CreateContext(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Sur // CreateContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateContextUnchecked(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -286,7 +289,9 @@ func createContextRequest(c *xgb.Conn, ContextId Context, PortId xv.Port, Surfac b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 2 // request opcode @@ -324,6 +329,8 @@ type CreateSubpictureCookie struct { // CreateSubpicture sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateSubpictureCookie.Reply() func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateSubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -335,6 +342,8 @@ func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, Xvi // CreateSubpictureUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateSubpictureUnchecked(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'CreateSubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -416,7 +425,9 @@ func createSubpictureRequest(c *xgb.Conn, SubpictureId Subpicture, Context Conte b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 6 // request opcode @@ -451,6 +462,8 @@ type CreateSurfaceCookie struct { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() 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.") } @@ -462,6 +475,8 @@ func CreateSurface(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurf // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() 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.") } @@ -522,7 +537,9 @@ func createSurfaceRequest(c *xgb.Conn, SurfaceId Surface, ContextId Context) []b b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 4 // request opcode @@ -548,6 +565,8 @@ type DestroyContextCookie struct { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() 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.") } @@ -559,6 +578,8 @@ func DestroyContext(c *xgb.Conn, ContextId Context) DestroyContextCookie { // DestroyContextChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyContextCookie.Check() func DestroyContextChecked(c *xgb.Conn, ContextId Context) DestroyContextCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() 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.") } @@ -580,7 +601,9 @@ func destroyContextRequest(c *xgb.Conn, ContextId Context) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 3 // request opcode @@ -603,6 +626,8 @@ type DestroySubpictureCookie struct { // DestroySubpicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -614,6 +639,8 @@ func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCo // DestroySubpictureChecked sends a checked request. // If an error occurs, it can be retrieved using DestroySubpictureCookie.Check() func DestroySubpictureChecked(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -635,7 +662,9 @@ func destroySubpictureRequest(c *xgb.Conn, SubpictureId Subpicture) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 7 // request opcode @@ -658,6 +687,8 @@ type DestroySurfaceCookie struct { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() 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.") } @@ -669,6 +700,8 @@ func DestroySurface(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie { // DestroySurfaceChecked sends a checked request. // If an error occurs, it can be retrieved using DestroySurfaceCookie.Check() func DestroySurfaceChecked(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() 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.") } @@ -690,7 +723,9 @@ func destroySurfaceRequest(c *xgb.Conn, SurfaceId Surface) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 5 // request opcode @@ -713,6 +748,8 @@ type ListSubpictureTypesCookie struct { // ListSubpictureTypes sends a checked request. // If an error occurs, it will be returned with the reply by calling ListSubpictureTypesCookie.Reply() func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -724,6 +761,8 @@ func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSub // ListSubpictureTypesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListSubpictureTypesUnchecked(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() if _, ok := c.Extensions["XVideo-MotionCompensation"]; !ok { panic("Cannot issue request 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") } @@ -785,7 +824,9 @@ func listSubpictureTypesRequest(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 8 // request opcode @@ -811,6 +852,8 @@ type ListSurfaceTypesCookie struct { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() 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.") } @@ -822,6 +865,8 @@ func ListSurfaceTypes(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() 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.") } @@ -883,7 +928,9 @@ func listSurfaceTypesRequest(c *xgb.Conn, PortId xv.Port) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 1 // request opcode @@ -906,6 +953,8 @@ type QueryVersionCookie struct { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() 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.") } @@ -917,6 +966,8 @@ func QueryVersion(c *xgb.Conn) QueryVersionCookie { // 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 { + c.ExtLock.RLock() + defer c.ExtLock.RUnlock() 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.") } @@ -975,7 +1026,9 @@ func queryVersionRequest(c *xgb.Conn) []byte { b := 0 buf := make([]byte, size) + c.ExtLock.RLock() buf[b] = c.Extensions["XVideo-MotionCompensation"] + c.ExtLock.RUnlock() b += 1 buf[b] = 0 // request opcode -- cgit v1.2.3