From 29942bf078c92fea681e42ca5029592526f00718 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Fri, 11 May 2012 23:58:52 -0400 Subject: panic when an extension request is issued before an extension has been initialized. but give a nice error message for the happy people. --- nexgb/xvmc/xvmc.go | 76 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 65 insertions(+), 11 deletions(-) (limited to 'nexgb/xvmc') diff --git a/nexgb/xvmc/xvmc.go b/nexgb/xvmc/xvmc.go index cf794cc..19b1c83 100644 --- a/nexgb/xvmc/xvmc.go +++ b/nexgb/xvmc/xvmc.go @@ -2,7 +2,7 @@ package xvmc /* - This file was generated by xvmc.xml on May 11 2012 1:58:37am EDT. + This file was generated by xvmc.xml on May 11 2012 11:57:20pm EDT. This file is automatically generated. Edit at your peril! */ @@ -41,6 +41,16 @@ func init() { xgb.NewExtErrorFuncs["XVideo-MotionCompensation"] = make(map[int]xgb.NewErrorFun) } +// Skipping definition for base type 'Card8' + +// Skipping definition for base type 'Int16' + +// Skipping definition for base type 'Int32' + +// Skipping definition for base type 'Void' + +// Skipping definition for base type 'Byte' + // Skipping definition for base type 'Int8' // Skipping definition for base type 'Card16' @@ -55,16 +65,6 @@ func init() { // Skipping definition for base type 'Float' -// Skipping definition for base type 'Card8' - -// Skipping definition for base type 'Int16' - -// Skipping definition for base type 'Int32' - -// Skipping definition for base type 'Void' - -// Skipping definition for base type 'Byte' - type Context uint32 func NewContextId(c *xgb.Conn) (Context, error) { @@ -206,6 +206,9 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn) QueryVersionCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryVersionRequest(c), cookie) return QueryVersionCookie{cookie} @@ -214,6 +217,9 @@ func QueryVersion(c *xgb.Conn) QueryVersionCookie { // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn) QueryVersionCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c), cookie) return QueryVersionCookie{cookie} @@ -289,6 +295,9 @@ type ListSurfaceTypesCookie struct { // ListSurfaceTypes sends a checked request. // If an error occurs, it will be returned with the reply by calling ListSurfaceTypesCookie.Reply() func ListSurfaceTypes(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie) return ListSurfaceTypesCookie{cookie} @@ -297,6 +306,9 @@ func ListSurfaceTypes(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie { // ListSurfaceTypesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListSurfaceTypesUnchecked(c *xgb.Conn, PortId xv.Port) ListSurfaceTypesCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'ListSurfaceTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(listSurfaceTypesRequest(c, PortId), cookie) return ListSurfaceTypesCookie{cookie} @@ -378,6 +390,9 @@ type CreateContextCookie struct { // CreateContext sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateContextCookie.Reply() func CreateContext(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(createContextRequest(c, ContextId, PortId, SurfaceId, Width, Height, Flags), cookie) return CreateContextCookie{cookie} @@ -386,6 +401,9 @@ func CreateContext(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Sur // CreateContextUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateContextUnchecked(c *xgb.Conn, ContextId Context, PortId xv.Port, SurfaceId Surface, Width uint16, Height uint16, Flags uint32) CreateContextCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'CreateContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(createContextRequest(c, ContextId, PortId, SurfaceId, Width, Height, Flags), cookie) return CreateContextCookie{cookie} @@ -494,6 +512,9 @@ type DestroyContextCookie struct { // DestroyContext sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyContext(c *xgb.Conn, ContextId Context) DestroyContextCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(destroyContextRequest(c, ContextId), cookie) return DestroyContextCookie{cookie} @@ -502,6 +523,9 @@ func DestroyContext(c *xgb.Conn, ContextId Context) DestroyContextCookie { // DestroyContextChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyContextCookie.Check() func DestroyContextChecked(c *xgb.Conn, ContextId Context) DestroyContextCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'DestroyContext' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(destroyContextRequest(c, ContextId), cookie) return DestroyContextCookie{cookie} @@ -543,6 +567,9 @@ type CreateSurfaceCookie struct { // CreateSurface sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateSurfaceCookie.Reply() func CreateSurface(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'CreateSurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(createSurfaceRequest(c, SurfaceId, ContextId), cookie) return CreateSurfaceCookie{cookie} @@ -551,6 +578,9 @@ func CreateSurface(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurf // CreateSurfaceUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateSurfaceUnchecked(c *xgb.Conn, SurfaceId Surface, ContextId Context) CreateSurfaceCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'CreateSurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(createSurfaceRequest(c, SurfaceId, ContextId), cookie) return CreateSurfaceCookie{cookie} @@ -635,6 +665,9 @@ type DestroySurfaceCookie struct { // DestroySurface sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroySurface(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'DestroySurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(destroySurfaceRequest(c, SurfaceId), cookie) return DestroySurfaceCookie{cookie} @@ -643,6 +676,9 @@ func DestroySurface(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie { // DestroySurfaceChecked sends a checked request. // If an error occurs, it can be retrieved using DestroySurfaceCookie.Check() func DestroySurfaceChecked(c *xgb.Conn, SurfaceId Surface) DestroySurfaceCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'DestroySurface' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(destroySurfaceRequest(c, SurfaceId), cookie) return DestroySurfaceCookie{cookie} @@ -684,6 +720,9 @@ type CreateSubpictureCookie struct { // CreateSubpicture sends a checked request. // If an error occurs, it will be returned with the reply by calling CreateSubpictureCookie.Reply() func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'CreateSubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(createSubpictureRequest(c, SubpictureId, Context, XvimageId, Width, Height), cookie) return CreateSubpictureCookie{cookie} @@ -692,6 +731,9 @@ func CreateSubpicture(c *xgb.Conn, SubpictureId Subpicture, Context Context, Xvi // CreateSubpictureUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateSubpictureUnchecked(c *xgb.Conn, SubpictureId Subpicture, Context Context, XvimageId uint32, Width uint16, Height uint16) CreateSubpictureCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'CreateSubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(createSubpictureRequest(c, SubpictureId, Context, XvimageId, Width, Height), cookie) return CreateSubpictureCookie{cookie} @@ -806,6 +848,9 @@ type DestroySubpictureCookie struct { // DestroySubpicture sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(destroySubpictureRequest(c, SubpictureId), cookie) return DestroySubpictureCookie{cookie} @@ -814,6 +859,9 @@ func DestroySubpicture(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCo // DestroySubpictureChecked sends a checked request. // If an error occurs, it can be retrieved using DestroySubpictureCookie.Check() func DestroySubpictureChecked(c *xgb.Conn, SubpictureId Subpicture) DestroySubpictureCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'DestroySubpicture' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(destroySubpictureRequest(c, SubpictureId), cookie) return DestroySubpictureCookie{cookie} @@ -855,6 +903,9 @@ type ListSubpictureTypesCookie struct { // ListSubpictureTypes sends a checked request. // If an error occurs, it will be returned with the reply by calling ListSubpictureTypesCookie.Reply() func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(listSubpictureTypesRequest(c, PortId, SurfaceId), cookie) return ListSubpictureTypesCookie{cookie} @@ -863,6 +914,9 @@ func ListSubpictureTypes(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSub // ListSubpictureTypesUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ListSubpictureTypesUnchecked(c *xgb.Conn, PortId xv.Port, SurfaceId Surface) ListSubpictureTypesCookie { + if _, ok := c.Extensions["XVIDEO-MOTIONCOMPENSATION"]; !ok { + panic("Cannot issue request 'ListSubpictureTypes' using the uninitialized extension 'XVideo-MotionCompensation'. xvmc.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(listSubpictureTypesRequest(c, PortId, SurfaceId), cookie) return ListSubpictureTypesCookie{cookie} -- cgit v1.2.3