aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xv
diff options
context:
space:
mode:
Diffstat (limited to 'nexgb/xv')
-rw-r--r--nexgb/xv/xv.go2356
1 files changed, 1178 insertions, 1178 deletions
diff --git a/nexgb/xv/xv.go b/nexgb/xv/xv.go
index ed10b3b..f5539b3 100644
--- a/nexgb/xv/xv.go
+++ b/nexgb/xv/xv.go
@@ -2,7 +2,7 @@
package xv
/*
- This file was generated by xv.xml on Jun 5 2012 12:12:00am EDT.
+ This file was generated by xv.xml on Aug 11 2013 8:39:44pm EDT.
This file is automatically generated. Edit at your peril!
*/
@@ -41,139 +41,186 @@ func init() {
xgb.NewExtErrorFuncs["XVideo"] = make(map[int]xgb.NewErrorFun)
}
-// Skipping definition for base type 'Card8'
+type AdaptorInfo struct {
+ BaseId Port
+ NameSize uint16
+ NumPorts uint16
+ NumFormats uint16
+ Type byte
+ // padding: 1 bytes
+ Name string // size: xgb.Pad((int(NameSize) * 1))
+ Formats []Format // size: xgb.Pad((int(NumFormats) * 8))
+}
-// Skipping definition for base type 'Int16'
+// AdaptorInfoRead reads a byte slice into a AdaptorInfo value.
+func AdaptorInfoRead(buf []byte, v *AdaptorInfo) int {
+ b := 0
-// Skipping definition for base type 'Int32'
+ v.BaseId = Port(xgb.Get32(buf[b:]))
+ b += 4
-// Skipping definition for base type 'Void'
+ v.NameSize = xgb.Get16(buf[b:])
+ b += 2
-// Skipping definition for base type 'Byte'
+ v.NumPorts = xgb.Get16(buf[b:])
+ b += 2
-// Skipping definition for base type 'Int8'
+ v.NumFormats = xgb.Get16(buf[b:])
+ b += 2
-// Skipping definition for base type 'Card16'
+ v.Type = buf[b]
+ b += 1
-// Skipping definition for base type 'Char'
+ b += 1 // padding
-// Skipping definition for base type 'Card32'
+ {
+ byteString := make([]byte, v.NameSize)
+ copy(byteString[:v.NameSize], buf[b:])
+ v.Name = string(byteString)
+ b += xgb.Pad(int(v.NameSize))
+ }
-// Skipping definition for base type 'Double'
+ v.Formats = make([]Format, v.NumFormats)
+ b += FormatReadList(buf[b:], v.Formats)
-// Skipping definition for base type 'Bool'
+ return b
+}
-// Skipping definition for base type 'Float'
+// AdaptorInfoReadList reads a byte slice into a list of AdaptorInfo values.
+func AdaptorInfoReadList(buf []byte, dest []AdaptorInfo) int {
+ b := 0
+ for i := 0; i < len(dest); i++ {
+ dest[i] = AdaptorInfo{}
+ b += AdaptorInfoRead(buf[b:], &dest[i])
+ }
+ return xgb.Pad(b)
+}
-const (
- TypeInputMask = 1
- TypeOutputMask = 2
- TypeVideoMask = 4
- TypeStillMask = 8
- TypeImageMask = 16
-)
+// Bytes writes a AdaptorInfo value to a byte slice.
+func (v AdaptorInfo) Bytes() []byte {
+ buf := make([]byte, ((12 + xgb.Pad((int(v.NameSize) * 1))) + xgb.Pad((int(v.NumFormats) * 8))))
+ b := 0
-const (
- ImageFormatInfoTypeRgb = 0
- ImageFormatInfoTypeYuv = 1
-)
+ xgb.Put32(buf[b:], uint32(v.BaseId))
+ b += 4
-const (
- ImageFormatInfoFormatPacked = 0
- ImageFormatInfoFormatPlanar = 1
-)
+ xgb.Put16(buf[b:], v.NameSize)
+ b += 2
-const (
- AttributeFlagGettable = 1
- AttributeFlagSettable = 2
-)
+ xgb.Put16(buf[b:], v.NumPorts)
+ b += 2
-const (
- VideoNotifyReasonStarted = 0
- VideoNotifyReasonStopped = 1
- VideoNotifyReasonBusy = 2
- VideoNotifyReasonPreempted = 3
- VideoNotifyReasonHardError = 4
-)
+ xgb.Put16(buf[b:], v.NumFormats)
+ b += 2
-const (
- ScanlineOrderTopToBottom = 0
- ScanlineOrderBottomToTop = 1
-)
+ buf[b] = v.Type
+ b += 1
-const (
- GrabPortStatusSuccess = 0
- GrabPortStatusBadExtension = 1
- GrabPortStatusAlreadyGrabbed = 2
- GrabPortStatusInvalidTime = 3
- GrabPortStatusBadReply = 4
- GrabPortStatusBadAlloc = 5
-)
+ b += 1 // padding
-type Port uint32
+ copy(buf[b:], v.Name[:v.NameSize])
+ b += xgb.Pad(int(v.NameSize))
-func NewPortId(c *xgb.Conn) (Port, error) {
- id, err := c.NewId()
- if err != nil {
- return 0, err
- }
- return Port(id), nil
+ b += FormatListBytes(buf[b:], v.Formats)
+
+ return buf
}
-type Encoding uint32
+// AdaptorInfoListBytes writes a list of AdaptorInfo values to a byte slice.
+func AdaptorInfoListBytes(buf []byte, list []AdaptorInfo) int {
+ b := 0
+ var structBytes []byte
+ for _, item := range list {
+ structBytes = item.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
+ return b
+}
-func NewEncodingId(c *xgb.Conn) (Encoding, error) {
- id, err := c.NewId()
- if err != nil {
- return 0, err
+// AdaptorInfoListSize computes the size (bytes) of a list of AdaptorInfo values.
+func AdaptorInfoListSize(list []AdaptorInfo) int {
+ size := 0
+ for _, item := range list {
+ size += ((12 + xgb.Pad((int(item.NameSize) * 1))) + xgb.Pad((int(item.NumFormats) * 8)))
}
- return Encoding(id), nil
+ return size
}
-type Rational struct {
- Numerator int32
- Denominator int32
+const (
+ AttributeFlagGettable = 1
+ AttributeFlagSettable = 2
+)
+
+type AttributeInfo struct {
+ Flags uint32
+ Min int32
+ Max int32
+ Size uint32
+ Name string // size: xgb.Pad((int(Size) * 1))
}
-// RationalRead reads a byte slice into a Rational value.
-func RationalRead(buf []byte, v *Rational) int {
+// AttributeInfoRead reads a byte slice into a AttributeInfo value.
+func AttributeInfoRead(buf []byte, v *AttributeInfo) int {
b := 0
- v.Numerator = int32(xgb.Get32(buf[b:]))
+ v.Flags = xgb.Get32(buf[b:])
b += 4
- v.Denominator = int32(xgb.Get32(buf[b:]))
+ v.Min = int32(xgb.Get32(buf[b:]))
b += 4
+ v.Max = int32(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.Size = xgb.Get32(buf[b:])
+ b += 4
+
+ {
+ byteString := make([]byte, v.Size)
+ copy(byteString[:v.Size], buf[b:])
+ v.Name = string(byteString)
+ b += xgb.Pad(int(v.Size))
+ }
+
return b
}
-// RationalReadList reads a byte slice into a list of Rational values.
-func RationalReadList(buf []byte, dest []Rational) int {
+// AttributeInfoReadList reads a byte slice into a list of AttributeInfo values.
+func AttributeInfoReadList(buf []byte, dest []AttributeInfo) int {
b := 0
for i := 0; i < len(dest); i++ {
- dest[i] = Rational{}
- b += RationalRead(buf[b:], &dest[i])
+ dest[i] = AttributeInfo{}
+ b += AttributeInfoRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
-// Bytes writes a Rational value to a byte slice.
-func (v Rational) Bytes() []byte {
- buf := make([]byte, 8)
+// Bytes writes a AttributeInfo value to a byte slice.
+func (v AttributeInfo) Bytes() []byte {
+ buf := make([]byte, (16 + xgb.Pad((int(v.Size) * 1))))
b := 0
- xgb.Put32(buf[b:], uint32(v.Numerator))
+ xgb.Put32(buf[b:], v.Flags)
b += 4
- xgb.Put32(buf[b:], uint32(v.Denominator))
+ xgb.Put32(buf[b:], uint32(v.Min))
b += 4
+ xgb.Put32(buf[b:], uint32(v.Max))
+ b += 4
+
+ xgb.Put32(buf[b:], v.Size)
+ b += 4
+
+ copy(buf[b:], v.Name[:v.Size])
+ b += xgb.Pad(int(v.Size))
+
return buf
}
-// RationalListBytes writes a list of Rational values to a byte slice.
-func RationalListBytes(buf []byte, list []Rational) int {
+// AttributeInfoListBytes writes a list of AttributeInfo values to a byte slice.
+func AttributeInfoListBytes(buf []byte, list []AttributeInfo) int {
b := 0
var structBytes []byte
for _, item := range list {
@@ -184,169 +231,161 @@ func RationalListBytes(buf []byte, list []Rational) int {
return b
}
-type Format struct {
- Visual xproto.Visualid
- Depth byte
- // padding: 3 bytes
+// AttributeInfoListSize computes the size (bytes) of a list of AttributeInfo values.
+func AttributeInfoListSize(list []AttributeInfo) int {
+ size := 0
+ for _, item := range list {
+ size += (16 + xgb.Pad((int(item.Size) * 1)))
+ }
+ return size
}
-// FormatRead reads a byte slice into a Format value.
-func FormatRead(buf []byte, v *Format) int {
- b := 0
-
- v.Visual = xproto.Visualid(xgb.Get32(buf[b:]))
- b += 4
-
- v.Depth = buf[b]
- b += 1
-
- b += 3 // padding
+// BadBadControl is the error number for a BadBadControl.
+const BadBadControl = 2
- return b
+type BadControlError struct {
+ Sequence uint16
+ NiceName string
}
-// FormatReadList reads a byte slice into a list of Format values.
-func FormatReadList(buf []byte, dest []Format) int {
- b := 0
- for i := 0; i < len(dest); i++ {
- dest[i] = Format{}
- b += FormatRead(buf[b:], &dest[i])
- }
- return xgb.Pad(b)
-}
+// BadControlErrorNew constructs a BadControlError value that implements xgb.Error from a byte slice.
+func BadControlErrorNew(buf []byte) xgb.Error {
+ v := BadControlError{}
+ v.NiceName = "BadControl"
-// Bytes writes a Format value to a byte slice.
-func (v Format) Bytes() []byte {
- buf := make([]byte, 8)
- b := 0
+ b := 1 // skip error determinant
+ b += 1 // don't read error number
- xgb.Put32(buf[b:], uint32(v.Visual))
- b += 4
+ v.Sequence = xgb.Get16(buf[b:])
+ b += 2
- buf[b] = v.Depth
- b += 1
+ return v
+}
- b += 3 // padding
+// SequenceId returns the sequence id attached to the BadBadControl error.
+// This is mostly used internally.
+func (err BadControlError) SequenceId() uint16 {
+ return err.Sequence
+}
- return buf
+// BadId returns the 'BadValue' number if one exists for the BadBadControl error. If no bad value exists, 0 is returned.
+func (err BadControlError) BadId() uint32 {
+ return 0
}
-// FormatListBytes writes a list of Format values to a byte slice.
-func FormatListBytes(buf []byte, list []Format) int {
- b := 0
- var structBytes []byte
- for _, item := range list {
- structBytes = item.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
- }
- return b
+// Error returns a rudimentary string representation of the BadBadControl error.
+
+func (err BadControlError) Error() string {
+ fieldVals := make([]string, 0, 0)
+ fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
+ fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
+ return "BadBadControl {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
-type AdaptorInfo struct {
- BaseId Port
- NameSize uint16
- NumPorts uint16
- NumFormats uint16
- Type byte
- // padding: 1 bytes
- Name string // size: xgb.Pad((int(NameSize) * 1))
- Formats []Format // size: xgb.Pad((int(NumFormats) * 8))
+func init() {
+ xgb.NewExtErrorFuncs["XVideo"][2] = BadControlErrorNew
}
-// AdaptorInfoRead reads a byte slice into a AdaptorInfo value.
-func AdaptorInfoRead(buf []byte, v *AdaptorInfo) int {
- b := 0
+// BadBadEncoding is the error number for a BadBadEncoding.
+const BadBadEncoding = 1
- v.BaseId = Port(xgb.Get32(buf[b:]))
- b += 4
+type BadEncodingError struct {
+ Sequence uint16
+ NiceName string
+}
- v.NameSize = xgb.Get16(buf[b:])
- b += 2
+// BadEncodingErrorNew constructs a BadEncodingError value that implements xgb.Error from a byte slice.
+func BadEncodingErrorNew(buf []byte) xgb.Error {
+ v := BadEncodingError{}
+ v.NiceName = "BadEncoding"
- v.NumPorts = xgb.Get16(buf[b:])
- b += 2
+ b := 1 // skip error determinant
+ b += 1 // don't read error number
- v.NumFormats = xgb.Get16(buf[b:])
+ v.Sequence = xgb.Get16(buf[b:])
b += 2
- v.Type = buf[b]
- b += 1
+ return v
+}
- b += 1 // padding
+// SequenceId returns the sequence id attached to the BadBadEncoding error.
+// This is mostly used internally.
+func (err BadEncodingError) SequenceId() uint16 {
+ return err.Sequence
+}
- {
- byteString := make([]byte, v.NameSize)
- copy(byteString[:v.NameSize], buf[b:])
- v.Name = string(byteString)
- b += xgb.Pad(int(v.NameSize))
- }
+// BadId returns the 'BadValue' number if one exists for the BadBadEncoding error. If no bad value exists, 0 is returned.
+func (err BadEncodingError) BadId() uint32 {
+ return 0
+}
- v.Formats = make([]Format, v.NumFormats)
- b += FormatReadList(buf[b:], v.Formats)
+// Error returns a rudimentary string representation of the BadBadEncoding error.
- return b
+func (err BadEncodingError) Error() string {
+ fieldVals := make([]string, 0, 0)
+ fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
+ fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
+ return "BadBadEncoding {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
-// AdaptorInfoReadList reads a byte slice into a list of AdaptorInfo values.
-func AdaptorInfoReadList(buf []byte, dest []AdaptorInfo) int {
- b := 0
- for i := 0; i < len(dest); i++ {
- dest[i] = AdaptorInfo{}
- b += AdaptorInfoRead(buf[b:], &dest[i])
- }
- return xgb.Pad(b)
+func init() {
+ xgb.NewExtErrorFuncs["XVideo"][1] = BadEncodingErrorNew
}
-// Bytes writes a AdaptorInfo value to a byte slice.
-func (v AdaptorInfo) Bytes() []byte {
- buf := make([]byte, ((12 + xgb.Pad((int(v.NameSize) * 1))) + xgb.Pad((int(v.NumFormats) * 8))))
- b := 0
+// BadBadPort is the error number for a BadBadPort.
+const BadBadPort = 0
- xgb.Put32(buf[b:], uint32(v.BaseId))
- b += 4
+type BadPortError struct {
+ Sequence uint16
+ NiceName string
+}
- xgb.Put16(buf[b:], v.NameSize)
- b += 2
+// BadPortErrorNew constructs a BadPortError value that implements xgb.Error from a byte slice.
+func BadPortErrorNew(buf []byte) xgb.Error {
+ v := BadPortError{}
+ v.NiceName = "BadPort"
- xgb.Put16(buf[b:], v.NumPorts)
- b += 2
+ b := 1 // skip error determinant
+ b += 1 // don't read error number
- xgb.Put16(buf[b:], v.NumFormats)
+ v.Sequence = xgb.Get16(buf[b:])
b += 2
- buf[b] = v.Type
- b += 1
+ return v
+}
- b += 1 // padding
+// SequenceId returns the sequence id attached to the BadBadPort error.
+// This is mostly used internally.
+func (err BadPortError) SequenceId() uint16 {
+ return err.Sequence
+}
- copy(buf[b:], v.Name[:v.NameSize])
- b += xgb.Pad(int(v.NameSize))
+// BadId returns the 'BadValue' number if one exists for the BadBadPort error. If no bad value exists, 0 is returned.
+func (err BadPortError) BadId() uint32 {
+ return 0
+}
- b += FormatListBytes(buf[b:], v.Formats)
+// Error returns a rudimentary string representation of the BadBadPort error.
- return buf
+func (err BadPortError) Error() string {
+ fieldVals := make([]string, 0, 0)
+ fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
+ fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
+ return "BadBadPort {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
-// AdaptorInfoListBytes writes a list of AdaptorInfo values to a byte slice.
-func AdaptorInfoListBytes(buf []byte, list []AdaptorInfo) int {
- b := 0
- var structBytes []byte
- for _, item := range list {
- structBytes = item.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
- }
- return b
+func init() {
+ xgb.NewExtErrorFuncs["XVideo"][0] = BadPortErrorNew
}
-// AdaptorInfoListSize computes the size (bytes) of a list of AdaptorInfo values.
-func AdaptorInfoListSize(list []AdaptorInfo) int {
- size := 0
- for _, item := range list {
- size += ((12 + xgb.Pad((int(item.NameSize) * 1))) + xgb.Pad((int(item.NumFormats) * 8)))
+type Encoding uint32
+
+func NewEncodingId(c *xgb.Conn) (Encoding, error) {
+ id, err := c.NewId()
+ if err != nil {
+ return 0, err
}
- return size
+ return Encoding(id), nil
}
type EncodingInfo struct {
@@ -452,6 +491,74 @@ func EncodingInfoListSize(list []EncodingInfo) int {
return size
}
+type Format struct {
+ Visual xproto.Visualid
+ Depth byte
+ // padding: 3 bytes
+}
+
+// FormatRead reads a byte slice into a Format value.
+func FormatRead(buf []byte, v *Format) int {
+ b := 0
+
+ v.Visual = xproto.Visualid(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.Depth = buf[b]
+ b += 1
+
+ b += 3 // padding
+
+ return b
+}
+
+// FormatReadList reads a byte slice into a list of Format values.
+func FormatReadList(buf []byte, dest []Format) int {
+ b := 0
+ for i := 0; i < len(dest); i++ {
+ dest[i] = Format{}
+ b += FormatRead(buf[b:], &dest[i])
+ }
+ return xgb.Pad(b)
+}
+
+// Bytes writes a Format value to a byte slice.
+func (v Format) Bytes() []byte {
+ buf := make([]byte, 8)
+ b := 0
+
+ xgb.Put32(buf[b:], uint32(v.Visual))
+ b += 4
+
+ buf[b] = v.Depth
+ b += 1
+
+ b += 3 // padding
+
+ return buf
+}
+
+// FormatListBytes writes a list of Format values to a byte slice.
+func FormatListBytes(buf []byte, list []Format) int {
+ b := 0
+ var structBytes []byte
+ for _, item := range list {
+ structBytes = item.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
+ return b
+}
+
+const (
+ GrabPortStatusSuccess = 0
+ GrabPortStatusBadExtension = 1
+ GrabPortStatusAlreadyGrabbed = 2
+ GrabPortStatusInvalidTime = 3
+ GrabPortStatusBadReply = 4
+ GrabPortStatusBadAlloc = 5
+)
+
type Image struct {
Id uint32
Width uint16
@@ -572,94 +679,6 @@ func ImageListSize(list []Image) int {
return size
}
-type AttributeInfo struct {
- Flags uint32
- Min int32
- Max int32
- Size uint32
- Name string // size: xgb.Pad((int(Size) * 1))
-}
-
-// AttributeInfoRead reads a byte slice into a AttributeInfo value.
-func AttributeInfoRead(buf []byte, v *AttributeInfo) int {
- b := 0
-
- v.Flags = xgb.Get32(buf[b:])
- b += 4
-
- v.Min = int32(xgb.Get32(buf[b:]))
- b += 4
-
- v.Max = int32(xgb.Get32(buf[b:]))
- b += 4
-
- v.Size = xgb.Get32(buf[b:])
- b += 4
-
- {
- byteString := make([]byte, v.Size)
- copy(byteString[:v.Size], buf[b:])
- v.Name = string(byteString)
- b += xgb.Pad(int(v.Size))
- }
-
- return b
-}
-
-// AttributeInfoReadList reads a byte slice into a list of AttributeInfo values.
-func AttributeInfoReadList(buf []byte, dest []AttributeInfo) int {
- b := 0
- for i := 0; i < len(dest); i++ {
- dest[i] = AttributeInfo{}
- b += AttributeInfoRead(buf[b:], &dest[i])
- }
- return xgb.Pad(b)
-}
-
-// Bytes writes a AttributeInfo value to a byte slice.
-func (v AttributeInfo) Bytes() []byte {
- buf := make([]byte, (16 + xgb.Pad((int(v.Size) * 1))))
- b := 0
-
- xgb.Put32(buf[b:], v.Flags)
- b += 4
-
- xgb.Put32(buf[b:], uint32(v.Min))
- b += 4
-
- xgb.Put32(buf[b:], uint32(v.Max))
- b += 4
-
- xgb.Put32(buf[b:], v.Size)
- b += 4
-
- copy(buf[b:], v.Name[:v.Size])
- b += xgb.Pad(int(v.Size))
-
- return buf
-}
-
-// AttributeInfoListBytes writes a list of AttributeInfo values to a byte slice.
-func AttributeInfoListBytes(buf []byte, list []AttributeInfo) int {
- b := 0
- var structBytes []byte
- for _, item := range list {
- structBytes = item.Bytes()
- copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
- }
- return b
-}
-
-// AttributeInfoListSize computes the size (bytes) of a list of AttributeInfo values.
-func AttributeInfoListSize(list []AttributeInfo) int {
- size := 0
- for _, item := range list {
- size += (16 + xgb.Pad((int(item.Size) * 1)))
- }
- return size
-}
-
type ImageFormatInfo struct {
Id uint32
Type byte
@@ -890,86 +909,24 @@ func ImageFormatInfoListSize(list []ImageFormatInfo) int {
return size
}
-// VideoNotify is the event number for a VideoNotifyEvent.
-const VideoNotify = 0
-
-type VideoNotifyEvent struct {
- Sequence uint16
- Reason byte
- Time xproto.Timestamp
- Drawable xproto.Drawable
- Port Port
-}
-
-// VideoNotifyEventNew constructs a VideoNotifyEvent value that implements xgb.Event from a byte slice.
-func VideoNotifyEventNew(buf []byte) xgb.Event {
- v := VideoNotifyEvent{}
- b := 1 // don't read event number
-
- v.Reason = buf[b]
- b += 1
-
- v.Sequence = xgb.Get16(buf[b:])
- b += 2
-
- v.Time = xproto.Timestamp(xgb.Get32(buf[b:]))
- b += 4
-
- v.Drawable = xproto.Drawable(xgb.Get32(buf[b:]))
- b += 4
-
- v.Port = Port(xgb.Get32(buf[b:]))
- b += 4
-
- return v
-}
-
-// Bytes writes a VideoNotifyEvent value to a byte slice.
-func (v VideoNotifyEvent) Bytes() []byte {
- buf := make([]byte, 32)
- b := 0
-
- // write event number
- buf[b] = 0
- b += 1
-
- buf[b] = v.Reason
- b += 1
-
- b += 2 // skip sequence number
-
- xgb.Put32(buf[b:], uint32(v.Time))
- b += 4
-
- xgb.Put32(buf[b:], uint32(v.Drawable))
- b += 4
-
- xgb.Put32(buf[b:], uint32(v.Port))
- b += 4
-
- return buf
-}
+const (
+ ImageFormatInfoFormatPacked = 0
+ ImageFormatInfoFormatPlanar = 1
+)
-// SequenceId returns the sequence id attached to the VideoNotify event.
-// Events without a sequence number (KeymapNotify) return 0.
-// This is mostly used internally.
-func (v VideoNotifyEvent) SequenceId() uint16 {
- return v.Sequence
-}
+const (
+ ImageFormatInfoTypeRgb = 0
+ ImageFormatInfoTypeYuv = 1
+)
-// String is a rudimentary string representation of VideoNotifyEvent.
-func (v VideoNotifyEvent) String() string {
- fieldVals := make([]string, 0, 4)
- fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
- fieldVals = append(fieldVals, xgb.Sprintf("Reason: %d", v.Reason))
- fieldVals = append(fieldVals, xgb.Sprintf("Time: %d", v.Time))
- fieldVals = append(fieldVals, xgb.Sprintf("Drawable: %d", v.Drawable))
- fieldVals = append(fieldVals, xgb.Sprintf("Port: %d", v.Port))
- return "VideoNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
-}
+type Port uint32
-func init() {
- xgb.NewExtEventFuncs["XVideo"][0] = VideoNotifyEventNew
+func NewPortId(c *xgb.Conn) (Port, error) {
+ id, err := c.NewId()
+ if err != nil {
+ return 0, err
+ }
+ return Port(id), nil
}
// PortNotify is the event number for a PortNotifyEvent.
@@ -1059,182 +1016,224 @@ func init() {
xgb.NewExtEventFuncs["XVideo"][1] = PortNotifyEventNew
}
-// BadBadPort is the error number for a BadBadPort.
-const BadBadPort = 0
-
-type BadPortError struct {
- Sequence uint16
- NiceName string
+type Rational struct {
+ Numerator int32
+ Denominator int32
}
-// BadPortErrorNew constructs a BadPortError value that implements xgb.Error from a byte slice.
-func BadPortErrorNew(buf []byte) xgb.Error {
- v := BadPortError{}
- v.NiceName = "BadPort"
+// RationalRead reads a byte slice into a Rational value.
+func RationalRead(buf []byte, v *Rational) int {
+ b := 0
- b := 1 // skip error determinant
- b += 1 // don't read error number
+ v.Numerator = int32(xgb.Get32(buf[b:]))
+ b += 4
- v.Sequence = xgb.Get16(buf[b:])
- b += 2
+ v.Denominator = int32(xgb.Get32(buf[b:]))
+ b += 4
- return v
+ return b
}
-// SequenceId returns the sequence id attached to the BadBadPort error.
-// This is mostly used internally.
-func (err BadPortError) SequenceId() uint16 {
- return err.Sequence
+// RationalReadList reads a byte slice into a list of Rational values.
+func RationalReadList(buf []byte, dest []Rational) int {
+ b := 0
+ for i := 0; i < len(dest); i++ {
+ dest[i] = Rational{}
+ b += RationalRead(buf[b:], &dest[i])
+ }
+ return xgb.Pad(b)
}
-// BadId returns the 'BadValue' number if one exists for the BadBadPort error. If no bad value exists, 0 is returned.
-func (err BadPortError) BadId() uint32 {
- return 0
-}
+// Bytes writes a Rational value to a byte slice.
+func (v Rational) Bytes() []byte {
+ buf := make([]byte, 8)
+ b := 0
-// Error returns a rudimentary string representation of the BadBadPort error.
+ xgb.Put32(buf[b:], uint32(v.Numerator))
+ b += 4
-func (err BadPortError) Error() string {
- fieldVals := make([]string, 0, 0)
- fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
- fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
- return "BadBadPort {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+ xgb.Put32(buf[b:], uint32(v.Denominator))
+ b += 4
+
+ return buf
}
-func init() {
- xgb.NewExtErrorFuncs["XVideo"][0] = BadPortErrorNew
+// RationalListBytes writes a list of Rational values to a byte slice.
+func RationalListBytes(buf []byte, list []Rational) int {
+ b := 0
+ var structBytes []byte
+ for _, item := range list {
+ structBytes = item.Bytes()
+ copy(buf[b:], structBytes)
+ b += xgb.Pad(len(structBytes))
+ }
+ return b
}
-// BadBadEncoding is the error number for a BadBadEncoding.
-const BadBadEncoding = 1
+const (
+ ScanlineOrderTopToBottom = 0
+ ScanlineOrderBottomToTop = 1
+)
-type BadEncodingError struct {
+const (
+ TypeInputMask = 1
+ TypeOutputMask = 2
+ TypeVideoMask = 4
+ TypeStillMask = 8
+ TypeImageMask = 16
+)
+
+// VideoNotify is the event number for a VideoNotifyEvent.
+const VideoNotify = 0
+
+type VideoNotifyEvent struct {
Sequence uint16
- NiceName string
+ Reason byte
+ Time xproto.Timestamp
+ Drawable xproto.Drawable
+ Port Port
}
-// BadEncodingErrorNew constructs a BadEncodingError value that implements xgb.Error from a byte slice.
-func BadEncodingErrorNew(buf []byte) xgb.Error {
- v := BadEncodingError{}
- v.NiceName = "BadEncoding"
+// VideoNotifyEventNew constructs a VideoNotifyEvent value that implements xgb.Event from a byte slice.
+func VideoNotifyEventNew(buf []byte) xgb.Event {
+ v := VideoNotifyEvent{}
+ b := 1 // don't read event number
- b := 1 // skip error determinant
- b += 1 // don't read error number
+ v.Reason = buf[b]
+ b += 1
v.Sequence = xgb.Get16(buf[b:])
b += 2
+ v.Time = xproto.Timestamp(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.Drawable = xproto.Drawable(xgb.Get32(buf[b:]))
+ b += 4
+
+ v.Port = Port(xgb.Get32(buf[b:]))
+ b += 4
+
return v
}
-// SequenceId returns the sequence id attached to the BadBadEncoding error.
-// This is mostly used internally.
-func (err BadEncodingError) SequenceId() uint16 {
- return err.Sequence
-}
+// Bytes writes a VideoNotifyEvent value to a byte slice.
+func (v VideoNotifyEvent) Bytes() []byte {
+ buf := make([]byte, 32)
+ b := 0
-// BadId returns the 'BadValue' number if one exists for the BadBadEncoding error. If no bad value exists, 0 is returned.
-func (err BadEncodingError) BadId() uint32 {
- return 0
+ // write event number
+ buf[b] = 0
+ b += 1
+
+ buf[b] = v.Reason
+ b += 1
+
+ b += 2 // skip sequence number
+
+ xgb.Put32(buf[b:], uint32(v.Time))
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(v.Drawable))
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(v.Port))
+ b += 4
+
+ return buf
}
-// Error returns a rudimentary string representation of the BadBadEncoding error.
+// SequenceId returns the sequence id attached to the VideoNotify event.
+// Events without a sequence number (KeymapNotify) return 0.
+// This is mostly used internally.
+func (v VideoNotifyEvent) SequenceId() uint16 {
+ return v.Sequence
+}
-func (err BadEncodingError) Error() string {
- fieldVals := make([]string, 0, 0)
- fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
- fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
- return "BadBadEncoding {" + xgb.StringsJoin(fieldVals, ", ") + "}"
+// String is a rudimentary string representation of VideoNotifyEvent.
+func (v VideoNotifyEvent) String() string {
+ fieldVals := make([]string, 0, 4)
+ fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", v.Sequence))
+ fieldVals = append(fieldVals, xgb.Sprintf("Reason: %d", v.Reason))
+ fieldVals = append(fieldVals, xgb.Sprintf("Time: %d", v.Time))
+ fieldVals = append(fieldVals, xgb.Sprintf("Drawable: %d", v.Drawable))
+ fieldVals = append(fieldVals, xgb.Sprintf("Port: %d", v.Port))
+ return "VideoNotify {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
- xgb.NewExtErrorFuncs["XVideo"][1] = BadEncodingErrorNew
+ xgb.NewExtEventFuncs["XVideo"][0] = VideoNotifyEventNew
}
-// BadBadControl is the error number for a BadBadControl.
-const BadBadControl = 2
+const (
+ VideoNotifyReasonStarted = 0
+ VideoNotifyReasonStopped = 1
+ VideoNotifyReasonBusy = 2
+ VideoNotifyReasonPreempted = 3
+ VideoNotifyReasonHardError = 4
+)
-type BadControlError struct {
- Sequence uint16
- NiceName string
-}
+// Skipping definition for base type 'Bool'
-// BadControlErrorNew constructs a BadControlError value that implements xgb.Error from a byte slice.
-func BadControlErrorNew(buf []byte) xgb.Error {
- v := BadControlError{}
- v.NiceName = "BadControl"
+// Skipping definition for base type 'Byte'
- b := 1 // skip error determinant
- b += 1 // don't read error number
+// Skipping definition for base type 'Card8'
- v.Sequence = xgb.Get16(buf[b:])
- b += 2
+// Skipping definition for base type 'Char'
- return v
-}
+// Skipping definition for base type 'Void'
-// SequenceId returns the sequence id attached to the BadBadControl error.
-// This is mostly used internally.
-func (err BadControlError) SequenceId() uint16 {
- return err.Sequence
-}
+// Skipping definition for base type 'Double'
-// BadId returns the 'BadValue' number if one exists for the BadBadControl error. If no bad value exists, 0 is returned.
-func (err BadControlError) BadId() uint32 {
- return 0
-}
+// Skipping definition for base type 'Float'
-// Error returns a rudimentary string representation of the BadBadControl error.
+// Skipping definition for base type 'Int16'
-func (err BadControlError) Error() string {
- fieldVals := make([]string, 0, 0)
- fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
- fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
- return "BadBadControl {" + xgb.StringsJoin(fieldVals, ", ") + "}"
-}
+// Skipping definition for base type 'Int32'
-func init() {
- xgb.NewExtErrorFuncs["XVideo"][2] = BadControlErrorNew
-}
+// Skipping definition for base type 'Int8'
-// QueryExtensionCookie is a cookie used only for QueryExtension requests.
-type QueryExtensionCookie struct {
+// Skipping definition for base type 'Card16'
+
+// Skipping definition for base type 'Card32'
+
+// GetPortAttributeCookie is a cookie used only for GetPortAttribute requests.
+type GetPortAttributeCookie struct {
*xgb.Cookie
}
-// QueryExtension sends a checked request.
-// If an error occurs, it will be returned with the reply by calling QueryExtensionCookie.Reply()
-func QueryExtension(c *xgb.Conn) QueryExtensionCookie {
+// GetPortAttribute sends a checked request.
+// If an error occurs, it will be returned with the reply by calling GetPortAttributeCookie.Reply()
+func GetPortAttribute(c *xgb.Conn, Port Port, Attribute xproto.Atom) GetPortAttributeCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'QueryExtension' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetPortAttribute' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(queryExtensionRequest(c), cookie)
- return QueryExtensionCookie{cookie}
+ c.NewRequest(getPortAttributeRequest(c, Port, Attribute), cookie)
+ return GetPortAttributeCookie{cookie}
}
-// QueryExtensionUnchecked sends an unchecked request.
+// GetPortAttributeUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func QueryExtensionUnchecked(c *xgb.Conn) QueryExtensionCookie {
+func GetPortAttributeUnchecked(c *xgb.Conn, Port Port, Attribute xproto.Atom) GetPortAttributeCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'QueryExtension' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetPortAttribute' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(queryExtensionRequest(c), cookie)
- return QueryExtensionCookie{cookie}
+ c.NewRequest(getPortAttributeRequest(c, Port, Attribute), cookie)
+ return GetPortAttributeCookie{cookie}
}
-// QueryExtensionReply represents the data returned from a QueryExtension request.
-type QueryExtensionReply struct {
+// GetPortAttributeReply represents the data returned from a GetPortAttribute request.
+type GetPortAttributeReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- Major uint16
- Minor uint16
+ Value int32
}
-// Reply blocks and returns the reply data for a QueryExtension request.
-func (cook QueryExtensionCookie) Reply() (*QueryExtensionReply, error) {
+// Reply blocks and returns the reply data for a GetPortAttribute request.
+func (cook GetPortAttributeCookie) Reply() (*GetPortAttributeReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -1242,12 +1241,12 @@ func (cook QueryExtensionCookie) Reply() (*QueryExtensionReply, error) {
if buf == nil {
return nil, nil
}
- return queryExtensionReply(buf), nil
+ return getPortAttributeReply(buf), nil
}
-// queryExtensionReply reads a byte slice into a QueryExtensionReply value.
-func queryExtensionReply(buf []byte) *QueryExtensionReply {
- v := new(QueryExtensionReply)
+// getPortAttributeReply reads a byte slice into a GetPortAttributeReply value.
+func getPortAttributeReply(buf []byte) *GetPortAttributeReply {
+ v := new(GetPortAttributeReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -1258,220 +1257,203 @@ func queryExtensionReply(buf []byte) *QueryExtensionReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Major = xgb.Get16(buf[b:])
- b += 2
-
- v.Minor = xgb.Get16(buf[b:])
- b += 2
+ v.Value = int32(xgb.Get32(buf[b:]))
+ b += 4
return v
}
-// Write request to wire for QueryExtension
-// queryExtensionRequest writes a QueryExtension request to a byte slice.
-func queryExtensionRequest(c *xgb.Conn) []byte {
- size := 4
+// Write request to wire for GetPortAttribute
+// getPortAttributeRequest writes a GetPortAttribute request to a byte slice.
+func getPortAttributeRequest(c *xgb.Conn, Port Port, Attribute xproto.Atom) []byte {
+ size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO"]
b += 1
- buf[b] = 0 // request opcode
+ buf[b] = 14 // 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(Port))
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(Attribute))
+ b += 4
+
return buf
}
-// QueryAdaptorsCookie is a cookie used only for QueryAdaptors requests.
-type QueryAdaptorsCookie struct {
+// GetStillCookie is a cookie used only for GetStill requests.
+type GetStillCookie struct {
*xgb.Cookie
}
-// QueryAdaptors sends a checked request.
-// If an error occurs, it will be returned with the reply by calling QueryAdaptorsCookie.Reply()
-func QueryAdaptors(c *xgb.Conn, Window xproto.Window) QueryAdaptorsCookie {
+// GetStill sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func GetStill(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetStillCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'QueryAdaptors' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetStill' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, true)
- c.NewRequest(queryAdaptorsRequest(c, Window), cookie)
- return QueryAdaptorsCookie{cookie}
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(getStillRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie)
+ return GetStillCookie{cookie}
}
-// QueryAdaptorsUnchecked sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func QueryAdaptorsUnchecked(c *xgb.Conn, Window xproto.Window) QueryAdaptorsCookie {
+// GetStillChecked sends a checked request.
+// If an error occurs, it can be retrieved using GetStillCookie.Check()
+func GetStillChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetStillCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'QueryAdaptors' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetStill' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, true)
- c.NewRequest(queryAdaptorsRequest(c, Window), cookie)
- return QueryAdaptorsCookie{cookie}
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(getStillRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie)
+ return GetStillCookie{cookie}
}
-// QueryAdaptorsReply represents the data returned from a QueryAdaptors request.
-type QueryAdaptorsReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- NumAdaptors uint16
- // padding: 22 bytes
- Info []AdaptorInfo // size: AdaptorInfoListSize(Info)
+// 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 GetStillCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Reply blocks and returns the reply data for a QueryAdaptors request.
-func (cook QueryAdaptorsCookie) Reply() (*QueryAdaptorsReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
- }
- return queryAdaptorsReply(buf), nil
-}
+// Write request to wire for GetStill
+// getStillRequest writes a GetStill request to a byte slice.
+func getStillRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte {
+ size := 32
+ b := 0
+ buf := make([]byte, size)
-// queryAdaptorsReply reads a byte slice into a QueryAdaptorsReply value.
-func queryAdaptorsReply(buf []byte) *QueryAdaptorsReply {
- v := new(QueryAdaptorsReply)
- b := 1 // skip reply determinant
+ buf[b] = c.Extensions["XVIDEO"]
+ b += 1
- b += 1 // padding
+ buf[b] = 8 // request opcode
+ b += 1
- v.Sequence = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- v.Length = xgb.Get32(buf[b:]) // 4-byte units
+ xgb.Put32(buf[b:], uint32(Port))
b += 4
- v.NumAdaptors = xgb.Get16(buf[b:])
- b += 2
+ xgb.Put32(buf[b:], uint32(Drawable))
+ b += 4
- b += 22 // padding
+ xgb.Put32(buf[b:], uint32(Gc))
+ b += 4
- v.Info = make([]AdaptorInfo, v.NumAdaptors)
- b += AdaptorInfoReadList(buf[b:], v.Info)
+ xgb.Put16(buf[b:], uint16(VidX))
+ b += 2
- return v
-}
+ xgb.Put16(buf[b:], uint16(VidY))
+ b += 2
-// Write request to wire for QueryAdaptors
-// queryAdaptorsRequest writes a QueryAdaptors request to a byte slice.
-func queryAdaptorsRequest(c *xgb.Conn, Window xproto.Window) []byte {
- size := 8
- b := 0
- buf := make([]byte, size)
+ xgb.Put16(buf[b:], VidW)
+ b += 2
- buf[b] = c.Extensions["XVIDEO"]
- b += 1
+ xgb.Put16(buf[b:], VidH)
+ b += 2
- buf[b] = 1 // request opcode
- b += 1
+ xgb.Put16(buf[b:], uint16(DrwX))
+ b += 2
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ xgb.Put16(buf[b:], uint16(DrwY))
b += 2
- xgb.Put32(buf[b:], uint32(Window))
- b += 4
+ xgb.Put16(buf[b:], DrwW)
+ b += 2
+
+ xgb.Put16(buf[b:], DrwH)
+ b += 2
return buf
}
-// QueryEncodingsCookie is a cookie used only for QueryEncodings requests.
-type QueryEncodingsCookie struct {
+// GetVideoCookie is a cookie used only for GetVideo requests.
+type GetVideoCookie struct {
*xgb.Cookie
}
-// QueryEncodings sends a checked request.
-// If an error occurs, it will be returned with the reply by calling QueryEncodingsCookie.Reply()
-func QueryEncodings(c *xgb.Conn, Port Port) QueryEncodingsCookie {
+// GetVideo sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func GetVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetVideoCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'QueryEncodings' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, true)
- c.NewRequest(queryEncodingsRequest(c, Port), cookie)
- return QueryEncodingsCookie{cookie}
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(getVideoRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie)
+ return GetVideoCookie{cookie}
}
-// QueryEncodingsUnchecked sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func QueryEncodingsUnchecked(c *xgb.Conn, Port Port) QueryEncodingsCookie {
+// GetVideoChecked sends a checked request.
+// If an error occurs, it can be retrieved using GetVideoCookie.Check()
+func GetVideoChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetVideoCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'QueryEncodings' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'GetVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, true)
- c.NewRequest(queryEncodingsRequest(c, Port), cookie)
- return QueryEncodingsCookie{cookie}
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(getVideoRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie)
+ return GetVideoCookie{cookie}
}
-// QueryEncodingsReply represents the data returned from a QueryEncodings request.
-type QueryEncodingsReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- NumEncodings uint16
- // padding: 22 bytes
- Info []EncodingInfo // size: EncodingInfoListSize(Info)
+// 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 GetVideoCookie) Check() error {
+ return cook.Cookie.Check()
}
-// Reply blocks and returns the reply data for a QueryEncodings request.
-func (cook QueryEncodingsCookie) Reply() (*QueryEncodingsReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
- }
- return queryEncodingsReply(buf), nil
-}
+// Write request to wire for GetVideo
+// getVideoRequest writes a GetVideo request to a byte slice.
+func getVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte {
+ size := 32
+ b := 0
+ buf := make([]byte, size)
-// queryEncodingsReply reads a byte slice into a QueryEncodingsReply value.
-func queryEncodingsReply(buf []byte) *QueryEncodingsReply {
- v := new(QueryEncodingsReply)
- b := 1 // skip reply determinant
+ buf[b] = c.Extensions["XVIDEO"]
+ b += 1
- b += 1 // padding
+ buf[b] = 7 // request opcode
+ b += 1
- v.Sequence = xgb.Get16(buf[b:])
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- v.Length = xgb.Get32(buf[b:]) // 4-byte units
+ xgb.Put32(buf[b:], uint32(Port))
b += 4
- v.NumEncodings = xgb.Get16(buf[b:])
- b += 2
+ xgb.Put32(buf[b:], uint32(Drawable))
+ b += 4
- b += 22 // padding
+ xgb.Put32(buf[b:], uint32(Gc))
+ b += 4
- v.Info = make([]EncodingInfo, v.NumEncodings)
- b += EncodingInfoReadList(buf[b:], v.Info)
+ xgb.Put16(buf[b:], uint16(VidX))
+ b += 2
- return v
-}
+ xgb.Put16(buf[b:], uint16(VidY))
+ b += 2
-// Write request to wire for QueryEncodings
-// queryEncodingsRequest writes a QueryEncodings request to a byte slice.
-func queryEncodingsRequest(c *xgb.Conn, Port Port) []byte {
- size := 8
- b := 0
- buf := make([]byte, size)
+ xgb.Put16(buf[b:], VidW)
+ b += 2
- buf[b] = c.Extensions["XVIDEO"]
- b += 1
+ xgb.Put16(buf[b:], VidH)
+ b += 2
- buf[b] = 2 // request opcode
- b += 1
+ xgb.Put16(buf[b:], uint16(DrwX))
+ b += 2
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ xgb.Put16(buf[b:], uint16(DrwY))
b += 2
- xgb.Put32(buf[b:], uint32(Port))
- b += 4
+ xgb.Put16(buf[b:], DrwW)
+ b += 2
+
+ xgb.Put16(buf[b:], DrwH)
+ b += 2
return buf
}
@@ -1564,50 +1546,90 @@ func grabPortRequest(c *xgb.Conn, Port Port, Time xproto.Timestamp) []byte {
return buf
}
-// UngrabPortCookie is a cookie used only for UngrabPort requests.
-type UngrabPortCookie struct {
+// ListImageFormatsCookie is a cookie used only for ListImageFormats requests.
+type ListImageFormatsCookie struct {
*xgb.Cookie
}
-// UngrabPort sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func UngrabPort(c *xgb.Conn, Port Port, Time xproto.Timestamp) UngrabPortCookie {
+// ListImageFormats sends a checked request.
+// If an error occurs, it will be returned with the reply by calling ListImageFormatsCookie.Reply()
+func ListImageFormats(c *xgb.Conn, Port Port) ListImageFormatsCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'UngrabPort' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'ListImageFormats' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(ungrabPortRequest(c, Port, Time), cookie)
- return UngrabPortCookie{cookie}
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(listImageFormatsRequest(c, Port), cookie)
+ return ListImageFormatsCookie{cookie}
}
-// UngrabPortChecked sends a checked request.
-// If an error occurs, it can be retrieved using UngrabPortCookie.Check()
-func UngrabPortChecked(c *xgb.Conn, Port Port, Time xproto.Timestamp) UngrabPortCookie {
+// ListImageFormatsUnchecked sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func ListImageFormatsUnchecked(c *xgb.Conn, Port Port) ListImageFormatsCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'UngrabPort' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'ListImageFormats' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(ungrabPortRequest(c, Port, Time), cookie)
- return UngrabPortCookie{cookie}
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(listImageFormatsRequest(c, Port), cookie)
+ return ListImageFormatsCookie{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 UngrabPortCookie) Check() error {
- return cook.Cookie.Check()
+// ListImageFormatsReply represents the data returned from a ListImageFormats request.
+type ListImageFormatsReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ NumFormats uint32
+ // padding: 20 bytes
+ Format []ImageFormatInfo // size: ImageFormatInfoListSize(Format)
}
-// Write request to wire for UngrabPort
-// ungrabPortRequest writes a UngrabPort request to a byte slice.
-func ungrabPortRequest(c *xgb.Conn, Port Port, Time xproto.Timestamp) []byte {
- size := 12
+// Reply blocks and returns the reply data for a ListImageFormats request.
+func (cook ListImageFormatsCookie) Reply() (*ListImageFormatsReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return listImageFormatsReply(buf), nil
+}
+
+// listImageFormatsReply reads a byte slice into a ListImageFormatsReply value.
+func listImageFormatsReply(buf []byte) *ListImageFormatsReply {
+ v := new(ListImageFormatsReply)
+ 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.NumFormats = xgb.Get32(buf[b:])
+ b += 4
+
+ b += 20 // padding
+
+ v.Format = make([]ImageFormatInfo, v.NumFormats)
+ b += ImageFormatInfoReadList(buf[b:], v.Format)
+
+ return v
+}
+
+// Write request to wire for ListImageFormats
+// listImageFormatsRequest writes a ListImageFormats request to a byte slice.
+func listImageFormatsRequest(c *xgb.Conn, Port Port) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO"]
b += 1
- buf[b] = 4 // request opcode
+ buf[b] = 16 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -1616,56 +1638,53 @@ func ungrabPortRequest(c *xgb.Conn, Port Port, Time xproto.Timestamp) []byte {
xgb.Put32(buf[b:], uint32(Port))
b += 4
- xgb.Put32(buf[b:], uint32(Time))
- b += 4
-
return buf
}
-// PutVideoCookie is a cookie used only for PutVideo requests.
-type PutVideoCookie struct {
+// PutImageCookie is a cookie used only for PutImage requests.
+type PutImageCookie struct {
*xgb.Cookie
}
-// PutVideo sends an unchecked request.
+// PutImage sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func PutVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) PutVideoCookie {
+func PutImage(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) PutImageCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'PutVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'PutImage' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
- c.NewRequest(putVideoRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie)
- return PutVideoCookie{cookie}
+ c.NewRequest(putImageRequest(c, Port, Drawable, Gc, Id, SrcX, SrcY, SrcW, SrcH, DrwX, DrwY, DrwW, DrwH, Width, Height, Data), cookie)
+ return PutImageCookie{cookie}
}
-// PutVideoChecked sends a checked request.
-// If an error occurs, it can be retrieved using PutVideoCookie.Check()
-func PutVideoChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) PutVideoCookie {
+// PutImageChecked sends a checked request.
+// If an error occurs, it can be retrieved using PutImageCookie.Check()
+func PutImageChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) PutImageCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'PutVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'PutImage' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
- c.NewRequest(putVideoRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie)
- return PutVideoCookie{cookie}
+ c.NewRequest(putImageRequest(c, Port, Drawable, Gc, Id, SrcX, SrcY, SrcW, SrcH, DrwX, DrwY, DrwW, DrwH, Width, Height, Data), cookie)
+ return PutImageCookie{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 PutVideoCookie) Check() error {
+func (cook PutImageCookie) Check() error {
return cook.Cookie.Check()
}
-// Write request to wire for PutVideo
-// putVideoRequest writes a PutVideo request to a byte slice.
-func putVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte {
- size := 32
+// Write request to wire for PutImage
+// putImageRequest writes a PutImage request to a byte slice.
+func putImageRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) []byte {
+ size := xgb.Pad((40 + xgb.Pad((len(Data) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO"]
b += 1
- buf[b] = 5 // request opcode
+ buf[b] = 18 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -1680,16 +1699,19 @@ func putVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto
xgb.Put32(buf[b:], uint32(Gc))
b += 4
- xgb.Put16(buf[b:], uint16(VidX))
+ xgb.Put32(buf[b:], Id)
+ b += 4
+
+ xgb.Put16(buf[b:], uint16(SrcX))
b += 2
- xgb.Put16(buf[b:], uint16(VidY))
+ xgb.Put16(buf[b:], uint16(SrcY))
b += 2
- xgb.Put16(buf[b:], VidW)
+ xgb.Put16(buf[b:], SrcW)
b += 2
- xgb.Put16(buf[b:], VidH)
+ xgb.Put16(buf[b:], SrcH)
b += 2
xgb.Put16(buf[b:], uint16(DrwX))
@@ -1704,6 +1726,15 @@ func putVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto
xgb.Put16(buf[b:], DrwH)
b += 2
+ xgb.Put16(buf[b:], Width)
+ b += 2
+
+ xgb.Put16(buf[b:], Height)
+ b += 2
+
+ copy(buf[b:], Data[:len(Data)])
+ b += xgb.Pad(int(len(Data)))
+
return buf
}
@@ -1792,42 +1823,42 @@ func putStillRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto
return buf
}
-// GetVideoCookie is a cookie used only for GetVideo requests.
-type GetVideoCookie struct {
+// PutVideoCookie is a cookie used only for PutVideo requests.
+type PutVideoCookie struct {
*xgb.Cookie
}
-// GetVideo sends an unchecked request.
+// PutVideo sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetVideoCookie {
+func PutVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) PutVideoCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'GetVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'PutVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
- c.NewRequest(getVideoRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie)
- return GetVideoCookie{cookie}
+ c.NewRequest(putVideoRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie)
+ return PutVideoCookie{cookie}
}
-// GetVideoChecked sends a checked request.
-// If an error occurs, it can be retrieved using GetVideoCookie.Check()
-func GetVideoChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetVideoCookie {
+// PutVideoChecked sends a checked request.
+// If an error occurs, it can be retrieved using PutVideoCookie.Check()
+func PutVideoChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) PutVideoCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'GetVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'PutVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
- c.NewRequest(getVideoRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie)
- return GetVideoCookie{cookie}
+ c.NewRequest(putVideoRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie)
+ return PutVideoCookie{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 GetVideoCookie) Check() error {
+func (cook PutVideoCookie) Check() error {
return cook.Cookie.Check()
}
-// Write request to wire for GetVideo
-// getVideoRequest writes a GetVideo request to a byte slice.
-func getVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte {
+// Write request to wire for PutVideo
+// putVideoRequest writes a PutVideo request to a byte slice.
+func putVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte {
size := 32
b := 0
buf := make([]byte, size)
@@ -1835,7 +1866,7 @@ func getVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto
buf[b] = c.Extensions["XVIDEO"]
b += 1
- buf[b] = 7 // request opcode
+ buf[b] = 5 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -1877,274 +1908,98 @@ func getVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto
return buf
}
-// GetStillCookie is a cookie used only for GetStill requests.
-type GetStillCookie struct {
+// QueryAdaptorsCookie is a cookie used only for QueryAdaptors requests.
+type QueryAdaptorsCookie struct {
*xgb.Cookie
}
-// GetStill sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetStill(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetStillCookie {
- if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'GetStill' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(getStillRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie)
- return GetStillCookie{cookie}
-}
-
-// GetStillChecked sends a checked request.
-// If an error occurs, it can be retrieved using GetStillCookie.Check()
-func GetStillChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) GetStillCookie {
+// QueryAdaptors sends a checked request.
+// If an error occurs, it will be returned with the reply by calling QueryAdaptorsCookie.Reply()
+func QueryAdaptors(c *xgb.Conn, Window xproto.Window) QueryAdaptorsCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'GetStill' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryAdaptors' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(getStillRequest(c, Port, Drawable, Gc, VidX, VidY, VidW, VidH, DrwX, DrwY, DrwW, DrwH), cookie)
- return GetStillCookie{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 GetStillCookie) Check() error {
- return cook.Cookie.Check()
-}
-
-// Write request to wire for GetStill
-// getStillRequest writes a GetStill request to a byte slice.
-func getStillRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, VidX int16, VidY int16, VidW uint16, VidH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16) []byte {
- size := 32
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["XVIDEO"]
- 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(Port))
- b += 4
-
- xgb.Put32(buf[b:], uint32(Drawable))
- b += 4
-
- xgb.Put32(buf[b:], uint32(Gc))
- b += 4
-
- xgb.Put16(buf[b:], uint16(VidX))
- b += 2
-
- xgb.Put16(buf[b:], uint16(VidY))
- b += 2
-
- xgb.Put16(buf[b:], VidW)
- b += 2
-
- xgb.Put16(buf[b:], VidH)
- b += 2
-
- xgb.Put16(buf[b:], uint16(DrwX))
- b += 2
-
- xgb.Put16(buf[b:], uint16(DrwY))
- b += 2
-
- xgb.Put16(buf[b:], DrwW)
- b += 2
-
- xgb.Put16(buf[b:], DrwH)
- b += 2
-
- return buf
-}
-
-// StopVideoCookie is a cookie used only for StopVideo requests.
-type StopVideoCookie struct {
- *xgb.Cookie
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(queryAdaptorsRequest(c, Window), cookie)
+ return QueryAdaptorsCookie{cookie}
}
-// StopVideo sends an unchecked request.
+// QueryAdaptorsUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func StopVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable) StopVideoCookie {
- if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'StopVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(stopVideoRequest(c, Port, Drawable), cookie)
- return StopVideoCookie{cookie}
-}
-
-// StopVideoChecked sends a checked request.
-// If an error occurs, it can be retrieved using StopVideoCookie.Check()
-func StopVideoChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable) StopVideoCookie {
+func QueryAdaptorsUnchecked(c *xgb.Conn, Window xproto.Window) QueryAdaptorsCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'StopVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryAdaptors' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(stopVideoRequest(c, Port, Drawable), cookie)
- return StopVideoCookie{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 StopVideoCookie) Check() error {
- return cook.Cookie.Check()
-}
-
-// Write request to wire for StopVideo
-// stopVideoRequest writes a StopVideo request to a byte slice.
-func stopVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable) []byte {
- size := 12
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["XVIDEO"]
- b += 1
-
- buf[b] = 9 // 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(Port))
- b += 4
-
- xgb.Put32(buf[b:], uint32(Drawable))
- b += 4
-
- return buf
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(queryAdaptorsRequest(c, Window), cookie)
+ return QueryAdaptorsCookie{cookie}
}
-// SelectVideoNotifyCookie is a cookie used only for SelectVideoNotify requests.
-type SelectVideoNotifyCookie struct {
- *xgb.Cookie
+// QueryAdaptorsReply represents the data returned from a QueryAdaptors request.
+type QueryAdaptorsReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ NumAdaptors uint16
+ // padding: 22 bytes
+ Info []AdaptorInfo // size: AdaptorInfoListSize(Info)
}
-// SelectVideoNotify sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SelectVideoNotify(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) SelectVideoNotifyCookie {
- if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'SelectVideoNotify' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+// Reply blocks and returns the reply data for a QueryAdaptors request.
+func (cook QueryAdaptorsCookie) Reply() (*QueryAdaptorsReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
}
- cookie := c.NewCookie(false, false)
- c.NewRequest(selectVideoNotifyRequest(c, Drawable, Onoff), cookie)
- return SelectVideoNotifyCookie{cookie}
-}
-
-// SelectVideoNotifyChecked sends a checked request.
-// If an error occurs, it can be retrieved using SelectVideoNotifyCookie.Check()
-func SelectVideoNotifyChecked(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) SelectVideoNotifyCookie {
- if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'SelectVideoNotify' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ if buf == nil {
+ return nil, nil
}
- cookie := c.NewCookie(true, false)
- c.NewRequest(selectVideoNotifyRequest(c, Drawable, Onoff), cookie)
- return SelectVideoNotifyCookie{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 SelectVideoNotifyCookie) Check() error {
- return cook.Cookie.Check()
+ return queryAdaptorsReply(buf), nil
}
-// Write request to wire for SelectVideoNotify
-// selectVideoNotifyRequest writes a SelectVideoNotify request to a byte slice.
-func selectVideoNotifyRequest(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) []byte {
- size := 12
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["XVIDEO"]
- b += 1
+// queryAdaptorsReply reads a byte slice into a QueryAdaptorsReply value.
+func queryAdaptorsReply(buf []byte) *QueryAdaptorsReply {
+ v := new(QueryAdaptorsReply)
+ b := 1 // skip reply determinant
- buf[b] = 10 // request opcode
- b += 1
+ b += 1 // padding
- xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
+ v.Sequence = xgb.Get16(buf[b:])
b += 2
- xgb.Put32(buf[b:], uint32(Drawable))
+ v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- if Onoff {
- buf[b] = 1
- } else {
- buf[b] = 0
- }
- b += 1
-
- b += 3 // padding
-
- return buf
-}
-
-// SelectPortNotifyCookie is a cookie used only for SelectPortNotify requests.
-type SelectPortNotifyCookie struct {
- *xgb.Cookie
-}
+ v.NumAdaptors = xgb.Get16(buf[b:])
+ b += 2
-// SelectPortNotify sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SelectPortNotify(c *xgb.Conn, Port Port, Onoff bool) SelectPortNotifyCookie {
- if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'SelectPortNotify' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(selectPortNotifyRequest(c, Port, Onoff), cookie)
- return SelectPortNotifyCookie{cookie}
-}
+ b += 22 // padding
-// SelectPortNotifyChecked sends a checked request.
-// If an error occurs, it can be retrieved using SelectPortNotifyCookie.Check()
-func SelectPortNotifyChecked(c *xgb.Conn, Port Port, Onoff bool) SelectPortNotifyCookie {
- if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'SelectPortNotify' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(selectPortNotifyRequest(c, Port, Onoff), cookie)
- return SelectPortNotifyCookie{cookie}
-}
+ v.Info = make([]AdaptorInfo, v.NumAdaptors)
+ b += AdaptorInfoReadList(buf[b:], v.Info)
-// 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 SelectPortNotifyCookie) Check() error {
- return cook.Cookie.Check()
+ return v
}
-// Write request to wire for SelectPortNotify
-// selectPortNotifyRequest writes a SelectPortNotify request to a byte slice.
-func selectPortNotifyRequest(c *xgb.Conn, Port Port, Onoff bool) []byte {
- size := 12
+// Write request to wire for QueryAdaptors
+// queryAdaptorsRequest writes a QueryAdaptors request to a byte slice.
+func queryAdaptorsRequest(c *xgb.Conn, Window xproto.Window) []byte {
+ size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO"]
b += 1
- buf[b] = 11 // 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(Port))
+ xgb.Put32(buf[b:], uint32(Window))
b += 4
- if Onoff {
- buf[b] = 1
- } else {
- buf[b] = 0
- }
- b += 1
-
- b += 3 // padding
-
return buf
}
@@ -2261,104 +2116,45 @@ func queryBestSizeRequest(c *xgb.Conn, Port Port, VidW uint16, VidH uint16, DrwW
return buf
}
-// SetPortAttributeCookie is a cookie used only for SetPortAttribute requests.
-type SetPortAttributeCookie struct {
- *xgb.Cookie
-}
-
-// SetPortAttribute sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func SetPortAttribute(c *xgb.Conn, Port Port, Attribute xproto.Atom, Value int32) SetPortAttributeCookie {
- if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'SetPortAttribute' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, false)
- c.NewRequest(setPortAttributeRequest(c, Port, Attribute, Value), cookie)
- return SetPortAttributeCookie{cookie}
-}
-
-// SetPortAttributeChecked sends a checked request.
-// If an error occurs, it can be retrieved using SetPortAttributeCookie.Check()
-func SetPortAttributeChecked(c *xgb.Conn, Port Port, Attribute xproto.Atom, Value int32) SetPortAttributeCookie {
- if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'SetPortAttribute' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, false)
- c.NewRequest(setPortAttributeRequest(c, Port, Attribute, Value), cookie)
- return SetPortAttributeCookie{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 SetPortAttributeCookie) Check() error {
- return cook.Cookie.Check()
-}
-
-// Write request to wire for SetPortAttribute
-// setPortAttributeRequest writes a SetPortAttribute request to a byte slice.
-func setPortAttributeRequest(c *xgb.Conn, Port Port, Attribute xproto.Atom, Value int32) []byte {
- size := 16
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["XVIDEO"]
- b += 1
-
- buf[b] = 13 // 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(Port))
- b += 4
-
- xgb.Put32(buf[b:], uint32(Attribute))
- b += 4
-
- xgb.Put32(buf[b:], uint32(Value))
- b += 4
-
- return buf
-}
-
-// GetPortAttributeCookie is a cookie used only for GetPortAttribute requests.
-type GetPortAttributeCookie struct {
+// QueryEncodingsCookie is a cookie used only for QueryEncodings requests.
+type QueryEncodingsCookie struct {
*xgb.Cookie
}
-// GetPortAttribute sends a checked request.
-// If an error occurs, it will be returned with the reply by calling GetPortAttributeCookie.Reply()
-func GetPortAttribute(c *xgb.Conn, Port Port, Attribute xproto.Atom) GetPortAttributeCookie {
+// QueryEncodings sends a checked request.
+// If an error occurs, it will be returned with the reply by calling QueryEncodingsCookie.Reply()
+func QueryEncodings(c *xgb.Conn, Port Port) QueryEncodingsCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'GetPortAttribute' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryEncodings' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(getPortAttributeRequest(c, Port, Attribute), cookie)
- return GetPortAttributeCookie{cookie}
+ c.NewRequest(queryEncodingsRequest(c, Port), cookie)
+ return QueryEncodingsCookie{cookie}
}
-// GetPortAttributeUnchecked sends an unchecked request.
+// QueryEncodingsUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func GetPortAttributeUnchecked(c *xgb.Conn, Port Port, Attribute xproto.Atom) GetPortAttributeCookie {
+func QueryEncodingsUnchecked(c *xgb.Conn, Port Port) QueryEncodingsCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'GetPortAttribute' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryEncodings' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(getPortAttributeRequest(c, Port, Attribute), cookie)
- return GetPortAttributeCookie{cookie}
+ c.NewRequest(queryEncodingsRequest(c, Port), cookie)
+ return QueryEncodingsCookie{cookie}
}
-// GetPortAttributeReply represents the data returned from a GetPortAttribute request.
-type GetPortAttributeReply struct {
+// QueryEncodingsReply represents the data returned from a QueryEncodings request.
+type QueryEncodingsReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- Value int32
+ NumEncodings uint16
+ // padding: 22 bytes
+ Info []EncodingInfo // size: EncodingInfoListSize(Info)
}
-// Reply blocks and returns the reply data for a GetPortAttribute request.
-func (cook GetPortAttributeCookie) Reply() (*GetPortAttributeReply, error) {
+// Reply blocks and returns the reply data for a QueryEncodings request.
+func (cook QueryEncodingsCookie) Reply() (*QueryEncodingsReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -2366,12 +2162,12 @@ func (cook GetPortAttributeCookie) Reply() (*GetPortAttributeReply, error) {
if buf == nil {
return nil, nil
}
- return getPortAttributeReply(buf), nil
+ return queryEncodingsReply(buf), nil
}
-// getPortAttributeReply reads a byte slice into a GetPortAttributeReply value.
-func getPortAttributeReply(buf []byte) *GetPortAttributeReply {
- v := new(GetPortAttributeReply)
+// queryEncodingsReply reads a byte slice into a QueryEncodingsReply value.
+func queryEncodingsReply(buf []byte) *QueryEncodingsReply {
+ v := new(QueryEncodingsReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -2382,117 +2178,20 @@ func getPortAttributeReply(buf []byte) *GetPortAttributeReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.Value = int32(xgb.Get32(buf[b:]))
- b += 4
-
- return v
-}
-
-// Write request to wire for GetPortAttribute
-// getPortAttributeRequest writes a GetPortAttribute request to a byte slice.
-func getPortAttributeRequest(c *xgb.Conn, Port Port, Attribute xproto.Atom) []byte {
- size := 12
- b := 0
- buf := make([]byte, size)
-
- buf[b] = c.Extensions["XVIDEO"]
- b += 1
-
- buf[b] = 14 // 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(Port))
- b += 4
-
- xgb.Put32(buf[b:], uint32(Attribute))
- b += 4
-
- return buf
-}
-
-// QueryPortAttributesCookie is a cookie used only for QueryPortAttributes requests.
-type QueryPortAttributesCookie struct {
- *xgb.Cookie
-}
-
-// QueryPortAttributes sends a checked request.
-// If an error occurs, it will be returned with the reply by calling QueryPortAttributesCookie.Reply()
-func QueryPortAttributes(c *xgb.Conn, Port Port) QueryPortAttributesCookie {
- if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'QueryPortAttributes' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(true, true)
- c.NewRequest(queryPortAttributesRequest(c, Port), cookie)
- return QueryPortAttributesCookie{cookie}
-}
-
-// QueryPortAttributesUnchecked sends an unchecked request.
-// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func QueryPortAttributesUnchecked(c *xgb.Conn, Port Port) QueryPortAttributesCookie {
- if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'QueryPortAttributes' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
- }
- cookie := c.NewCookie(false, true)
- c.NewRequest(queryPortAttributesRequest(c, Port), cookie)
- return QueryPortAttributesCookie{cookie}
-}
-
-// QueryPortAttributesReply represents the data returned from a QueryPortAttributes request.
-type QueryPortAttributesReply struct {
- Sequence uint16 // sequence number of the request for this reply
- Length uint32 // number of bytes in this reply
- // padding: 1 bytes
- NumAttributes uint32
- TextSize uint32
- // padding: 16 bytes
- Attributes []AttributeInfo // size: AttributeInfoListSize(Attributes)
-}
-
-// Reply blocks and returns the reply data for a QueryPortAttributes request.
-func (cook QueryPortAttributesCookie) Reply() (*QueryPortAttributesReply, error) {
- buf, err := cook.Cookie.Reply()
- if err != nil {
- return nil, err
- }
- if buf == nil {
- return nil, nil
- }
- return queryPortAttributesReply(buf), nil
-}
-
-// queryPortAttributesReply reads a byte slice into a QueryPortAttributesReply value.
-func queryPortAttributesReply(buf []byte) *QueryPortAttributesReply {
- v := new(QueryPortAttributesReply)
- b := 1 // skip reply determinant
-
- b += 1 // padding
-
- v.Sequence = xgb.Get16(buf[b:])
+ v.NumEncodings = xgb.Get16(buf[b:])
b += 2
- v.Length = xgb.Get32(buf[b:]) // 4-byte units
- b += 4
-
- v.NumAttributes = xgb.Get32(buf[b:])
- b += 4
-
- v.TextSize = xgb.Get32(buf[b:])
- b += 4
-
- b += 16 // padding
+ b += 22 // padding
- v.Attributes = make([]AttributeInfo, v.NumAttributes)
- b += AttributeInfoReadList(buf[b:], v.Attributes)
+ v.Info = make([]EncodingInfo, v.NumEncodings)
+ b += EncodingInfoReadList(buf[b:], v.Info)
return v
}
-// Write request to wire for QueryPortAttributes
-// queryPortAttributesRequest writes a QueryPortAttributes request to a byte slice.
-func queryPortAttributesRequest(c *xgb.Conn, Port Port) []byte {
+// Write request to wire for QueryEncodings
+// queryEncodingsRequest writes a QueryEncodings request to a byte slice.
+func queryEncodingsRequest(c *xgb.Conn, Port Port) []byte {
size := 8
b := 0
buf := make([]byte, size)
@@ -2500,7 +2199,7 @@ func queryPortAttributesRequest(c *xgb.Conn, Port Port) []byte {
buf[b] = c.Extensions["XVIDEO"]
b += 1
- buf[b] = 15 // request opcode
+ buf[b] = 2 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -2512,45 +2211,44 @@ func queryPortAttributesRequest(c *xgb.Conn, Port Port) []byte {
return buf
}
-// ListImageFormatsCookie is a cookie used only for ListImageFormats requests.
-type ListImageFormatsCookie struct {
+// QueryExtensionCookie is a cookie used only for QueryExtension requests.
+type QueryExtensionCookie struct {
*xgb.Cookie
}
-// ListImageFormats sends a checked request.
-// If an error occurs, it will be returned with the reply by calling ListImageFormatsCookie.Reply()
-func ListImageFormats(c *xgb.Conn, Port Port) ListImageFormatsCookie {
+// QueryExtension sends a checked request.
+// If an error occurs, it will be returned with the reply by calling QueryExtensionCookie.Reply()
+func QueryExtension(c *xgb.Conn) QueryExtensionCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'ListImageFormats' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryExtension' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
- c.NewRequest(listImageFormatsRequest(c, Port), cookie)
- return ListImageFormatsCookie{cookie}
+ c.NewRequest(queryExtensionRequest(c), cookie)
+ return QueryExtensionCookie{cookie}
}
-// ListImageFormatsUnchecked sends an unchecked request.
+// QueryExtensionUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func ListImageFormatsUnchecked(c *xgb.Conn, Port Port) ListImageFormatsCookie {
+func QueryExtensionUnchecked(c *xgb.Conn) QueryExtensionCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'ListImageFormats' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryExtension' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
- c.NewRequest(listImageFormatsRequest(c, Port), cookie)
- return ListImageFormatsCookie{cookie}
+ c.NewRequest(queryExtensionRequest(c), cookie)
+ return QueryExtensionCookie{cookie}
}
-// ListImageFormatsReply represents the data returned from a ListImageFormats request.
-type ListImageFormatsReply struct {
+// QueryExtensionReply represents the data returned from a QueryExtension request.
+type QueryExtensionReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
- NumFormats uint32
- // padding: 20 bytes
- Format []ImageFormatInfo // size: ImageFormatInfoListSize(Format)
+ Major uint16
+ Minor uint16
}
-// Reply blocks and returns the reply data for a ListImageFormats request.
-func (cook ListImageFormatsCookie) Reply() (*ListImageFormatsReply, error) {
+// Reply blocks and returns the reply data for a QueryExtension request.
+func (cook QueryExtensionCookie) Reply() (*QueryExtensionReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
@@ -2558,12 +2256,12 @@ func (cook ListImageFormatsCookie) Reply() (*ListImageFormatsReply, error) {
if buf == nil {
return nil, nil
}
- return listImageFormatsReply(buf), nil
+ return queryExtensionReply(buf), nil
}
-// listImageFormatsReply reads a byte slice into a ListImageFormatsReply value.
-func listImageFormatsReply(buf []byte) *ListImageFormatsReply {
- v := new(ListImageFormatsReply)
+// queryExtensionReply reads a byte slice into a QueryExtensionReply value.
+func queryExtensionReply(buf []byte) *QueryExtensionReply {
+ v := new(QueryExtensionReply)
b := 1 // skip reply determinant
b += 1 // padding
@@ -2574,36 +2272,31 @@ func listImageFormatsReply(buf []byte) *ListImageFormatsReply {
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
- v.NumFormats = xgb.Get32(buf[b:])
- b += 4
-
- b += 20 // padding
+ v.Major = xgb.Get16(buf[b:])
+ b += 2
- v.Format = make([]ImageFormatInfo, v.NumFormats)
- b += ImageFormatInfoReadList(buf[b:], v.Format)
+ v.Minor = xgb.Get16(buf[b:])
+ b += 2
return v
}
-// Write request to wire for ListImageFormats
-// listImageFormatsRequest writes a ListImageFormats request to a byte slice.
-func listImageFormatsRequest(c *xgb.Conn, Port Port) []byte {
- size := 8
+// Write request to wire for QueryExtension
+// queryExtensionRequest writes a QueryExtension request to a byte slice.
+func queryExtensionRequest(c *xgb.Conn) []byte {
+ size := 4
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO"]
b += 1
- buf[b] = 16 // 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(Port))
- b += 4
-
return buf
}
@@ -2735,50 +2428,149 @@ func queryImageAttributesRequest(c *xgb.Conn, Port Port, Id uint32, Width uint16
return buf
}
-// PutImageCookie is a cookie used only for PutImage requests.
-type PutImageCookie struct {
+// QueryPortAttributesCookie is a cookie used only for QueryPortAttributes requests.
+type QueryPortAttributesCookie struct {
*xgb.Cookie
}
-// PutImage sends an unchecked request.
+// QueryPortAttributes sends a checked request.
+// If an error occurs, it will be returned with the reply by calling QueryPortAttributesCookie.Reply()
+func QueryPortAttributes(c *xgb.Conn, Port Port) QueryPortAttributesCookie {
+ if _, ok := c.Extensions["XVIDEO"]; !ok {
+ panic("Cannot issue request 'QueryPortAttributes' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, true)
+ c.NewRequest(queryPortAttributesRequest(c, Port), cookie)
+ return QueryPortAttributesCookie{cookie}
+}
+
+// QueryPortAttributesUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
-func PutImage(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) PutImageCookie {
+func QueryPortAttributesUnchecked(c *xgb.Conn, Port Port) QueryPortAttributesCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'PutImage' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'QueryPortAttributes' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, true)
+ c.NewRequest(queryPortAttributesRequest(c, Port), cookie)
+ return QueryPortAttributesCookie{cookie}
+}
+
+// QueryPortAttributesReply represents the data returned from a QueryPortAttributes request.
+type QueryPortAttributesReply struct {
+ Sequence uint16 // sequence number of the request for this reply
+ Length uint32 // number of bytes in this reply
+ // padding: 1 bytes
+ NumAttributes uint32
+ TextSize uint32
+ // padding: 16 bytes
+ Attributes []AttributeInfo // size: AttributeInfoListSize(Attributes)
+}
+
+// Reply blocks and returns the reply data for a QueryPortAttributes request.
+func (cook QueryPortAttributesCookie) Reply() (*QueryPortAttributesReply, error) {
+ buf, err := cook.Cookie.Reply()
+ if err != nil {
+ return nil, err
+ }
+ if buf == nil {
+ return nil, nil
+ }
+ return queryPortAttributesReply(buf), nil
+}
+
+// queryPortAttributesReply reads a byte slice into a QueryPortAttributesReply value.
+func queryPortAttributesReply(buf []byte) *QueryPortAttributesReply {
+ v := new(QueryPortAttributesReply)
+ 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.NumAttributes = xgb.Get32(buf[b:])
+ b += 4
+
+ v.TextSize = xgb.Get32(buf[b:])
+ b += 4
+
+ b += 16 // padding
+
+ v.Attributes = make([]AttributeInfo, v.NumAttributes)
+ b += AttributeInfoReadList(buf[b:], v.Attributes)
+
+ return v
+}
+
+// Write request to wire for QueryPortAttributes
+// queryPortAttributesRequest writes a QueryPortAttributes request to a byte slice.
+func queryPortAttributesRequest(c *xgb.Conn, Port Port) []byte {
+ size := 8
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["XVIDEO"]
+ b += 1
+
+ buf[b] = 15 // 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(Port))
+ b += 4
+
+ return buf
+}
+
+// SelectPortNotifyCookie is a cookie used only for SelectPortNotify requests.
+type SelectPortNotifyCookie struct {
+ *xgb.Cookie
+}
+
+// SelectPortNotify sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func SelectPortNotify(c *xgb.Conn, Port Port, Onoff bool) SelectPortNotifyCookie {
+ if _, ok := c.Extensions["XVIDEO"]; !ok {
+ panic("Cannot issue request 'SelectPortNotify' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
- c.NewRequest(putImageRequest(c, Port, Drawable, Gc, Id, SrcX, SrcY, SrcW, SrcH, DrwX, DrwY, DrwW, DrwH, Width, Height, Data), cookie)
- return PutImageCookie{cookie}
+ c.NewRequest(selectPortNotifyRequest(c, Port, Onoff), cookie)
+ return SelectPortNotifyCookie{cookie}
}
-// PutImageChecked sends a checked request.
-// If an error occurs, it can be retrieved using PutImageCookie.Check()
-func PutImageChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) PutImageCookie {
+// SelectPortNotifyChecked sends a checked request.
+// If an error occurs, it can be retrieved using SelectPortNotifyCookie.Check()
+func SelectPortNotifyChecked(c *xgb.Conn, Port Port, Onoff bool) SelectPortNotifyCookie {
if _, ok := c.Extensions["XVIDEO"]; !ok {
- panic("Cannot issue request 'PutImage' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ panic("Cannot issue request 'SelectPortNotify' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
- c.NewRequest(putImageRequest(c, Port, Drawable, Gc, Id, SrcX, SrcY, SrcW, SrcH, DrwX, DrwY, DrwW, DrwH, Width, Height, Data), cookie)
- return PutImageCookie{cookie}
+ c.NewRequest(selectPortNotifyRequest(c, Port, Onoff), cookie)
+ return SelectPortNotifyCookie{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 PutImageCookie) Check() error {
+func (cook SelectPortNotifyCookie) Check() error {
return cook.Cookie.Check()
}
-// Write request to wire for PutImage
-// putImageRequest writes a PutImage request to a byte slice.
-func putImageRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto.Gcontext, Id uint32, SrcX int16, SrcY int16, SrcW uint16, SrcH uint16, DrwX int16, DrwY int16, DrwW uint16, DrwH uint16, Width uint16, Height uint16, Data []byte) []byte {
- size := xgb.Pad((40 + xgb.Pad((len(Data) * 1))))
+// Write request to wire for SelectPortNotify
+// selectPortNotifyRequest writes a SelectPortNotify request to a byte slice.
+func selectPortNotifyRequest(c *xgb.Conn, Port Port, Onoff bool) []byte {
+ size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["XVIDEO"]
b += 1
- buf[b] = 18 // request opcode
+ buf[b] = 11 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
@@ -2787,47 +2579,139 @@ func putImageRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xproto
xgb.Put32(buf[b:], uint32(Port))
b += 4
+ if Onoff {
+ buf[b] = 1
+ } else {
+ buf[b] = 0
+ }
+ b += 1
+
+ b += 3 // padding
+
+ return buf
+}
+
+// SelectVideoNotifyCookie is a cookie used only for SelectVideoNotify requests.
+type SelectVideoNotifyCookie struct {
+ *xgb.Cookie
+}
+
+// SelectVideoNotify sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func SelectVideoNotify(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) SelectVideoNotifyCookie {
+ if _, ok := c.Extensions["XVIDEO"]; !ok {
+ panic("Cannot issue request 'SelectVideoNotify' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(selectVideoNotifyRequest(c, Drawable, Onoff), cookie)
+ return SelectVideoNotifyCookie{cookie}
+}
+
+// SelectVideoNotifyChecked sends a checked request.
+// If an error occurs, it can be retrieved using SelectVideoNotifyCookie.Check()
+func SelectVideoNotifyChecked(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) SelectVideoNotifyCookie {
+ if _, ok := c.Extensions["XVIDEO"]; !ok {
+ panic("Cannot issue request 'SelectVideoNotify' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(selectVideoNotifyRequest(c, Drawable, Onoff), cookie)
+ return SelectVideoNotifyCookie{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 SelectVideoNotifyCookie) Check() error {
+ return cook.Cookie.Check()
+}
+
+// Write request to wire for SelectVideoNotify
+// selectVideoNotifyRequest writes a SelectVideoNotify request to a byte slice.
+func selectVideoNotifyRequest(c *xgb.Conn, Drawable xproto.Drawable, Onoff bool) []byte {
+ size := 12
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["XVIDEO"]
+ b += 1
+
+ buf[b] = 10 // 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(Drawable))
b += 4
- xgb.Put32(buf[b:], uint32(Gc))
- b += 4
+ if Onoff {
+ buf[b] = 1
+ } else {
+ buf[b] = 0
+ }
+ b += 1
- xgb.Put32(buf[b:], Id)
- b += 4
+ b += 3 // padding
- xgb.Put16(buf[b:], uint16(SrcX))
- b += 2
+ return buf
+}
- xgb.Put16(buf[b:], uint16(SrcY))
- b += 2
+// SetPortAttributeCookie is a cookie used only for SetPortAttribute requests.
+type SetPortAttributeCookie struct {
+ *xgb.Cookie
+}
- xgb.Put16(buf[b:], SrcW)
- b += 2
+// SetPortAttribute sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func SetPortAttribute(c *xgb.Conn, Port Port, Attribute xproto.Atom, Value int32) SetPortAttributeCookie {
+ if _, ok := c.Extensions["XVIDEO"]; !ok {
+ panic("Cannot issue request 'SetPortAttribute' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(setPortAttributeRequest(c, Port, Attribute, Value), cookie)
+ return SetPortAttributeCookie{cookie}
+}
- xgb.Put16(buf[b:], SrcH)
- b += 2
+// SetPortAttributeChecked sends a checked request.
+// If an error occurs, it can be retrieved using SetPortAttributeCookie.Check()
+func SetPortAttributeChecked(c *xgb.Conn, Port Port, Attribute xproto.Atom, Value int32) SetPortAttributeCookie {
+ if _, ok := c.Extensions["XVIDEO"]; !ok {
+ panic("Cannot issue request 'SetPortAttribute' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(setPortAttributeRequest(c, Port, Attribute, Value), cookie)
+ return SetPortAttributeCookie{cookie}
+}
- xgb.Put16(buf[b:], uint16(DrwX))
- b += 2
+// 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 SetPortAttributeCookie) Check() error {
+ return cook.Cookie.Check()
+}
- xgb.Put16(buf[b:], uint16(DrwY))
- b += 2
+// Write request to wire for SetPortAttribute
+// setPortAttributeRequest writes a SetPortAttribute request to a byte slice.
+func setPortAttributeRequest(c *xgb.Conn, Port Port, Attribute xproto.Atom, Value int32) []byte {
+ size := 16
+ b := 0
+ buf := make([]byte, size)
- xgb.Put16(buf[b:], DrwW)
- b += 2
+ buf[b] = c.Extensions["XVIDEO"]
+ b += 1
- xgb.Put16(buf[b:], DrwH)
- b += 2
+ buf[b] = 13 // request opcode
+ b += 1
- xgb.Put16(buf[b:], Width)
+ xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
- xgb.Put16(buf[b:], Height)
- b += 2
+ xgb.Put32(buf[b:], uint32(Port))
+ b += 4
- copy(buf[b:], Data[:len(Data)])
- b += xgb.Pad(int(len(Data)))
+ xgb.Put32(buf[b:], uint32(Attribute))
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(Value))
+ b += 4
return buf
}
@@ -2936,3 +2820,119 @@ func shmPutImageRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable, Gc xpr
return buf
}
+
+// StopVideoCookie is a cookie used only for StopVideo requests.
+type StopVideoCookie struct {
+ *xgb.Cookie
+}
+
+// StopVideo sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func StopVideo(c *xgb.Conn, Port Port, Drawable xproto.Drawable) StopVideoCookie {
+ if _, ok := c.Extensions["XVIDEO"]; !ok {
+ panic("Cannot issue request 'StopVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(stopVideoRequest(c, Port, Drawable), cookie)
+ return StopVideoCookie{cookie}
+}
+
+// StopVideoChecked sends a checked request.
+// If an error occurs, it can be retrieved using StopVideoCookie.Check()
+func StopVideoChecked(c *xgb.Conn, Port Port, Drawable xproto.Drawable) StopVideoCookie {
+ if _, ok := c.Extensions["XVIDEO"]; !ok {
+ panic("Cannot issue request 'StopVideo' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(stopVideoRequest(c, Port, Drawable), cookie)
+ return StopVideoCookie{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 StopVideoCookie) Check() error {
+ return cook.Cookie.Check()
+}
+
+// Write request to wire for StopVideo
+// stopVideoRequest writes a StopVideo request to a byte slice.
+func stopVideoRequest(c *xgb.Conn, Port Port, Drawable xproto.Drawable) []byte {
+ size := 12
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["XVIDEO"]
+ b += 1
+
+ buf[b] = 9 // 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(Port))
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(Drawable))
+ b += 4
+
+ return buf
+}
+
+// UngrabPortCookie is a cookie used only for UngrabPort requests.
+type UngrabPortCookie struct {
+ *xgb.Cookie
+}
+
+// UngrabPort sends an unchecked request.
+// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
+func UngrabPort(c *xgb.Conn, Port Port, Time xproto.Timestamp) UngrabPortCookie {
+ if _, ok := c.Extensions["XVIDEO"]; !ok {
+ panic("Cannot issue request 'UngrabPort' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(false, false)
+ c.NewRequest(ungrabPortRequest(c, Port, Time), cookie)
+ return UngrabPortCookie{cookie}
+}
+
+// UngrabPortChecked sends a checked request.
+// If an error occurs, it can be retrieved using UngrabPortCookie.Check()
+func UngrabPortChecked(c *xgb.Conn, Port Port, Time xproto.Timestamp) UngrabPortCookie {
+ if _, ok := c.Extensions["XVIDEO"]; !ok {
+ panic("Cannot issue request 'UngrabPort' using the uninitialized extension 'XVideo'. xv.Init(connObj) must be called first.")
+ }
+ cookie := c.NewCookie(true, false)
+ c.NewRequest(ungrabPortRequest(c, Port, Time), cookie)
+ return UngrabPortCookie{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 UngrabPortCookie) Check() error {
+ return cook.Cookie.Check()
+}
+
+// Write request to wire for UngrabPort
+// ungrabPortRequest writes a UngrabPort request to a byte slice.
+func ungrabPortRequest(c *xgb.Conn, Port Port, Time xproto.Timestamp) []byte {
+ size := 12
+ b := 0
+ buf := make([]byte, size)
+
+ buf[b] = c.Extensions["XVIDEO"]
+ 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(Port))
+ b += 4
+
+ xgb.Put32(buf[b:], uint32(Time))
+ b += 4
+
+ return buf
+}