Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 126
View file
lightspark.spec
Changed
@@ -20,7 +20,7 @@ %bcond_without librtmp Name: lightspark -Version: 0.7.2.99+git20161120.1708 +Version: 0.7.2.99+git20161204.1709 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+ @@ -95,9 +95,13 @@ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DLIB_SUFFIX=$(echo %{_lib} | cut -b4-) \ -DCMAKE_BUILD_TYPE=RelWithDebugInfo \ + -DCOMPILE_NPAPI_PLUGIN=TRUE \ -DPLUGIN_DIRECTORY=%{_libdir}/browser-plugins \ -DENABLE_LIBAVCODEC=%{?with_ffmpeg:YES}%{!?with_ffmpeg:NO} \ - -DENABLE_RTMP=%{?with_rtmp:YES}%{!?with_rtmp:NO} .. + -DENABLE_RTMP=%{?with_rtmp:YES}%{!?with_rtmp:NO} \ + -DCOMPILE_PPAPI_PLUGIN=TRUE \ + -DPPAPI_PLUGIN_DIRECTORY=%{_libdir}/browser-plugins \ + .. make %{?_smp_mflags} %install @@ -131,6 +135,6 @@ %files plugin %defattr(0644,root,root,0755) -%{_libdir}/browser-plugins/liblightsparkplugin.so +%{_libdir}/browser-plugins/*.so %changelog
View file
lightspark.tar.xz/CMakeLists.txt
Changed
@@ -86,7 +86,7 @@ #endif int main() { return 0; }" GCC_IS_4_6) IF(NOT GCC_IS_4_6) - MESSAGE(FATAL_ERROR "GCC 4.6+ is required.") + MESSAGE(FATAL_ERROR "GCC 4.6+ is required.") ENDIF(NOT GCC_IS_4_6) ENDIF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -176,7 +176,6 @@ #later on SET(PRIVATELIBDIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR}/lightspark") SET(CMAKE_INSTALL_RPATH "${PRIVATELIBDIR}") - SET(PLUGINSDIR "${PRIVATELIBDIR}/plugins") ELSE() SET(ETCDIR ".") SET(BINDIR ".") @@ -184,13 +183,13 @@ SET(LSDATADIR ".") SET(LIBDIR ".") SET(PRIVATELIBDIR ".") - SET(PLUGINSDIR ".") ENDIF(UNIX) SET(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Install prefix, default is /usr/local (UNIX) and C:\\Program Files (Windows)") SET(COMPILE_LIGHTSPARK TRUE CACHE BOOL "Compile Lightspark?") SET(COMPILE_TIGHTSPARK TRUE CACHE BOOL "Compile Tightspark?") -SET(COMPILE_PLUGIN TRUE CACHE BOOL "Compile the browser plugin?") +SET(COMPILE_NPAPI_PLUGIN TRUE CACHE BOOL "Compile the npapi browser plugin?") +SET(COMPILE_PPAPI_PLUGIN FALSE CACHE BOOL "Compile the ppapi browser plugin?") SET(ENABLE_CURL TRUE CACHE BOOL "Enable CURL? (Required for Downloader functionality)") SET(ENABLE_GLES2 FALSE CACHE BOOL "Build with OpenGLES 2.0 support instead of OpenGL") SET(ENABLE_LIBAVCODEC TRUE CACHE BOOL "Enable libavcodec and dependent functionality?") @@ -198,6 +197,7 @@ SET(ENABLE_PROFILING FALSE CACHE BOOL "Enable profiling support? (Causes performance issues)") SET(ENABLE_MEMORY_USAGE_PROFILING FALSE CACHE BOOL "Enable profiling of memory usage? (Causes performance issues)") SET(PLUGIN_DIRECTORY "${LIBDIR}/mozilla/plugins" CACHE STRING "Directory to install Firefox plugin to") +SET(PPAPI_PLUGIN_DIRECTORY "${CMAKE_INSTALL_PREFIX}/lib/PepperFlash" CACHE STRING "Directory to install PPAPI plugin to") SET(MANUAL_DIRECTORY "share/man" CACHE STRING "Directory to install manual to (UNIX only)") SET(ENABLE_SSE2 TRUE CACHE BOOL "Enable use of SSE2 asm instructions (x86/x86_64 only)")
View file
lightspark.tar.xz/src/CMakeLists.txt
Changed
@@ -231,8 +231,11 @@ PACK_EXECUTABLE(tightspark) ENDIF(COMPILE_TIGHTSPARK) -# Browser plugin -IF(COMPILE_PLUGIN) +# Browser plugins +IF(COMPILE_NPAPI_PLUGIN) ADD_SUBDIRECTORY(plugin) -ENDIF(COMPILE_PLUGIN) +ENDIF(COMPILE_NPAPI_PLUGIN) +IF(COMPILE_PPAPI_PLUGIN) + ADD_SUBDIRECTORY(plugin_ppapi) +ENDIF(COMPILE_PPAPI_PLUGIN)
View file
lightspark.tar.xz/src/backends/graphics.cpp
Changed
@@ -32,147 +32,6 @@ using namespace lightspark; -void TextureBuffer::setAllocSize(uint32_t w, uint32_t h) -{ - if(getRenderThread()->hasNPOTTextures) - { - allocWidth=w; - allocHeight=h; - //Now adjust for the requested alignment - if((allocWidth%horizontalAlignment)) - { - allocWidth+=horizontalAlignment; - allocWidth-=(allocWidth%horizontalAlignment); - } - if((allocHeight%verticalAlignment)) - { - allocHeight+=verticalAlignment; - allocHeight-=(allocHeight%verticalAlignment); - } - } - else - { - allocWidth=nearestPOT(w); - allocHeight=nearestPOT(h); - //Assert that the requested alignment is satisfied - assert((allocWidth%horizontalAlignment)==0); - assert((allocHeight%verticalAlignment)==0); - } -} - -uint32_t TextureBuffer::nearestPOT(uint32_t a) const -{ - if(a==0) - return 0; - uint32_t ret=1; - while(ret<a) - ret<<=1; - return ret; -} - -TextureBuffer::TextureBuffer(bool initNow, uint32_t w, uint32_t h, GLenum f):texId(0),filtering(f),allocWidth(0),allocHeight(0), - width(w),height(h),horizontalAlignment(1),verticalAlignment(1),inited(false) -{ - if(initNow) - init(w, h, f); -} - -void TextureBuffer::init(uint32_t w, uint32_t h, GLenum f) -{ - assert(!inited); - inited=true; - - setAllocSize(w,h); - width=w; - height=h; - filtering=f; - - assert(texId==0); - glGenTextures(1,&texId); - assert(texId!=0); - - assert(filtering==GL_NEAREST || filtering==GL_LINEAR); - - //If the previous call has not failed these should not fail (in specs, we trust) - glBindTexture(GL_TEXTURE_2D,texId); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,filtering); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,filtering); - //Wrapping should not be very useful, we use textures carefully - //glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP); - - //Allocate the texture - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, allocWidth, allocHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0); - - glBindTexture(GL_TEXTURE_2D,0); - - if(GLRenderContext::handleGLErrors()) - { - LOG(LOG_ERROR,_("OpenGL error in TextureBuffer::init")); - throw RunTimeException("OpenGL error in TextureBuffer::init"); - } -} - -void TextureBuffer::resize(uint32_t w, uint32_t h) -{ - if(width!=w || height!=h) - { - if(w>allocWidth || h>allocHeight) //Destination texture should be reallocated - { - glBindTexture(GL_TEXTURE_2D,texId); - LOG_CALL(_("Reallocating texture to size ") << w << 'x' << h); - setAllocSize(w,h); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, allocWidth, allocHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0); - if(GLRenderContext::handleGLErrors()) - { - LOG(LOG_ERROR,_("OpenGL error in TextureBuffer::resize")); - throw RunTimeException("OpenGL error in TextureBuffer::resize"); - } - } - width=w; - height=h; - } -} - -void TextureBuffer::setRequestedAlignment(uint32_t w, uint32_t h) -{ - assert(w && h); - horizontalAlignment=w; - verticalAlignment=h; -} - -void TextureBuffer::setTexScale(GLuint uniformLocation) -{ - float v1=width; - float v2=height; - v1/=allocWidth; - v2/=allocHeight; - glUniform2f(uniformLocation,v1,v2); -} - -void TextureBuffer::bind() -{ - glBindTexture(GL_TEXTURE_2D,texId); -} - -void TextureBuffer::unbind() -{ - glBindTexture(GL_TEXTURE_2D,0); -} - -void TextureBuffer::shutdown() -{ - if(inited) - { - glDeleteTextures(1,&texId); - inited=false; - } -} - -TextureBuffer::~TextureBuffer() -{ - shutdown(); -} - TextureChunk::TextureChunk(uint32_t w, uint32_t h) { width=w;
View file
lightspark.tar.xz/src/backends/graphics.h
Changed
@@ -23,7 +23,6 @@ #define CHUNKSIZE 128 #include "compat.h" -#include "backends/lsopengl.h" #include <vector> #include "swftypes.h" #include "threading.h" @@ -38,86 +37,6 @@ class DisplayObject; class InvalidateQueue; -class TextureBuffer -{ -private: - GLuint texId; - GLenum filtering; - uint32_t allocWidth; - uint32_t allocHeight; - uint32_t width; - uint32_t height; - uint32_t horizontalAlignment; - uint32_t verticalAlignment; - bool inited; - uint32_t nearestPOT(uint32_t a) const; - void setAllocSize(uint32_t w, uint32_t h); -public: - /** - TextureBuffer constructor - - @param initNow Create right now the texture (can be true only if created inside the Render Thread) - @param width The requested width - @param height The requested height - @param filtering The requested texture filtering from OpenGL enumeration - */ - TextureBuffer(bool initNow, uint32_t width=0, uint32_t height=0, GLenum filtering=GL_NEAREST); - /** - TextureBuffer destructor - - Destroys the GL resources allocated for this texture - @pre Should be run inside the RenderThread or shutdown should be already run - */ - ~TextureBuffer(); - /** - Return the texture id - - @ret The OpenGL texture id - */ - GLuint getId() {return texId;} - /** - Initialize the texture using new values - - @param width The requested width - @param height The requested height - @param filtering The requested texture filtering from OpenGL enumeration - @pre Running inside the RenderThread - */ - void init(uint32_t width, uint32_t height, GLenum filtering=GL_NEAREST); - /** - Frees the GL resources - - @pre Running inside the RenderThread - */ - void shutdown(); - /** - Bind as the current texture - - @pre Running inside the RenderThread - */ - void bind(); - /** - Unbind the current texture - - @pre Running inside the RenderThread - */ - void unbind(); - /** - Set the given uniform with the coordinate scale of the current texture - - @pre Running inside the RenderThread - */ - void setTexScale(GLuint uniformLocation); - - void resize(uint32_t width, uint32_t height); - /** - Request a minimum alignment for width and height - */ - void setRequestedAlignment(uint32_t w, uint32_t h); - uint32_t getAllocWidth() const { return allocWidth;} - uint32_t getAllocHeight() const { return allocHeight;} -}; - class TextureChunk { friend class GLRenderContext;
View file
lightspark.tar.xz/src/backends/rendering.cpp
Changed
@@ -33,13 +33,6 @@ #define None 0L #endif -//The interpretation of texture data change with the endianness -#if __BYTE_ORDER == __BIG_ENDIAN -#define GL_UNSIGNED_INT_8_8_8_8_HOST GL_UNSIGNED_INT_8_8_8_8_REV -#else -#define GL_UNSIGNED_INT_8_8_8_8_HOST GL_UNSIGNED_BYTE -#endif - using namespace lightspark; using namespace std; @@ -67,12 +60,12 @@ } } -RenderThread::RenderThread(SystemState* s): +RenderThread::RenderThread(SystemState* s):GLRenderContext(), m_sys(s),status(CREATED),currentPixelBuffer(0),currentPixelBufferOffset(0), pixelBufferWidth(0),pixelBufferHeight(0),prevUploadJob(NULL), renderNeeded(false),uploadNeeded(false),resizeNeeded(false),newTextureNeeded(false),event(0),newWidth(0),newHeight(0),scaleX(1),scaleY(1), offsetX(0),offsetY(0),tempBufferAcquired(false),frameCount(0),secsCount(0),initialized(0), - hasNPOTTextures(false),cairoTextureContext(NULL) + cairoTextureContext(NULL) { LOG(LOG_INFO,_("RenderThread this=") << this); #ifdef _WIN32 @@ -111,7 +104,7 @@ Locker l(mutexLargeTexture); for(uint32_t i=0;i<largeTextures.size();i++) { - if(largeTextures[i].id==(GLuint)-1) + if(largeTextures[i].id==(uint32_t)-1) largeTextures[i].id=allocateNewGLTexture(); } newTextureNeeded=false; @@ -127,14 +120,14 @@ uint32_t w,h; u->sizeNeeded(w,h); const TextureChunk& tex=u->getTexture(); - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pixelBuffers[currentPixelBuffer]); + engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(pixelBuffers[currentPixelBuffer]); #ifndef ENABLE_GLES2 //Copy content of the pbo to the texture, currentPixelBufferOffset is the offset in the pbo loadChunkBGRA(tex, w, h, (uint8_t*)currentPixelBufferOffset); #else loadChunkBGRA(tex, w, h, pixelBuf); #endif - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(0); u->uploadFence(); prevUploadJob=NULL; } @@ -150,8 +143,8 @@ //Increment and wrap current buffer index #ifndef ENABLE_GLES2 unsigned int nextBuffer = (currentPixelBuffer + 1)%2; - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pixelBuffers[nextBuffer]); - uint8_t* buf=(uint8_t*)glMapBuffer(GL_PIXEL_UNPACK_BUFFER,GL_WRITE_ONLY); + engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(pixelBuffers[nextBuffer]); + uint8_t* buf=(uint8_t*)engineData->exec_glMapBuffer_GL_PIXEL_UNPACK_BUFFER_GL_WRITE_ONLY(); if(!buf) { handleGLErrors(); @@ -161,8 +154,8 @@ u->upload(alignedBuf, w, h); - glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + engineData->exec_glUnmapBuffer_GL_PIXEL_UNPACK_BUFFER(); + engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(0); currentPixelBufferOffset=alignedBuf-buf; currentPixelBuffer=nextBuffer; @@ -191,151 +184,11 @@ windowWidth=engineData->width; windowHeight=engineData->height; - if (SDL_GetWindowFlags(engineData->widget) & SDL_WINDOW_OPENGL) - { -#ifdef ENABLE_GLES2 - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); -#endif - mSDLContext = SDL_GL_CreateContext(engineData->widget); - if (!mSDLContext) - LOG(LOG_ERROR,"failed to create openGL context:"<<SDL_GetError()); - } - else - { - -#if defined(_WIN32) - PIXELFORMATDESCRIPTOR pfd = - { - sizeof(PIXELFORMATDESCRIPTOR), - 1, - PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, //Flags - PFD_TYPE_RGBA, //The kind of framebuffer. RGBA or palette. - 32, //Colordepth of the framebuffer. - 0, 0, 0, 0, 0, 0, - 0, - 0, - 0, - 0, 0, 0, 0, - 24, //Number of bits for the depthbuffer - 0, //Number of bits for the stencilbuffer - 0, //Number of Aux buffers in the framebuffer. - PFD_MAIN_PLANE, - 0, - 0, 0, 0 - }; - if(!(mDC = GetDC((HWND)engineData->window))) - throw RunTimeException("GetDC failed"); - int PixelFormat; - if (!(PixelFormat=ChoosePixelFormat(mDC,&pfd))) - throw RunTimeException("ChoosePixelFormat failed"); - if(!SetPixelFormat(mDC,PixelFormat,&pfd)) - throw RunTimeException("SetPixelFormat failed"); - if (!(mRC=wglCreateContext(mDC))) - throw RunTimeException("wglCreateContext failed"); - if(!wglMakeCurrent(mDC,mRC)) - throw RunTimeException("wglMakeCurrent failed"); -#elif !defined(ENABLE_GLES2) - mDisplay = XOpenDisplay(NULL); - int a,b; - Bool glx_present=glXQueryVersion(mDisplay, &a, &b); - if(!glx_present) - { - XCloseDisplay(mDisplay); - throw RunTimeException("glX not present"); - } - - int attrib[10]={GLX_DOUBLEBUFFER, True, None}; - GLXFBConfig* fb=glXChooseFBConfig(mDisplay, 0, attrib, &a); - if(!fb) - { - attrib[6]=None; - LOG(LOG_ERROR,_("Falling back to no double buffering")); - fb=glXChooseFBConfig(mDisplay, 0, attrib, &a); - } - if(!fb) - { - XCloseDisplay(mDisplay); - throw RunTimeException(_("Could not find any GLX configuration")); - } - int i; - for(i=0;i<a;i++) - { - int id; - glXGetFBConfigAttrib(mDisplay, fb[i],GLX_VISUAL_ID,&id); - if(id==(int)engineData->visual) - break; - } - if(i==a) - { - //No suitable id found - XCloseDisplay(mDisplay); - throw RunTimeException(_("No suitable graphics configuration available")); - } - mFBConfig=fb[i]; - LOG(LOG_INFO, "Chosen config " << hex << fb[i] << dec); - XFree(fb); - mContext = glXCreateNewContext(mDisplay, mFBConfig,GLX_RGBA_TYPE ,NULL,1); - glXMakeCurrent(mDisplay, engineData->windowID, mContext); - if(!glXIsDirect(mDisplay, mContext)) - LOG(LOG_INFO, "Indirect!!"); -#else //egl - mDisplay = XOpenDisplay(NULL); - int a; - eglBindAPI(EGL_OPENGL_ES_API); - mEGLDisplay = eglGetDisplay(mDisplay); - if (mEGLDisplay == EGL_NO_DISPLAY) - throw RunTimeException(_("EGL not present")); - EGLint major, minor; - if (eglInitialize(mEGLDisplay, &major, &minor) == EGL_FALSE) - throw RunTimeException(_("EGL initialization failed")); - - LOG(LOG_INFO, _("EGL version: ") << eglQueryString(mEGLDisplay, EGL_VERSION)); - EGLint config_attribs[] = { - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, - EGL_NONE - }; - EGLint context_attribs[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL_NONE - }; - if (!eglChooseConfig(mEGLDisplay, config_attribs, 0, 0, &a)) - throw RunTimeException(_("Could not get number of EGL configurations")); - else - LOG(LOG_INFO, "Number of EGL configurations: " << a); - EGLConfig *conf = new EGLConfig[a]; - if (!eglChooseConfig(mEGLDisplay, config_attribs, conf, a, &a)) - throw RunTimeException(_("Could not find any EGL configuration")); - - int i; - for(i=0;i<a;i++) - { - EGLint id; - eglGetConfigAttrib(mEGLDisplay, conf[i], EGL_NATIVE_VISUAL_ID, &id); - if(id==(int)engineData->visual) - break; - } - if(i==a) - { - //No suitable id found - throw RunTimeException(_("No suitable graphics configuration available")); - } - mEGLConfig=conf[i]; - LOG(LOG_INFO, "Chosen config " << hex << conf[i] << dec); - mEGLContext = eglCreateContext(mEGLDisplay, mEGLConfig, EGL_NO_CONTEXT, context_attribs); - if (mEGLContext == EGL_NO_CONTEXT) - throw RunTimeException(_("Could not create EGL context")); - mEGLSurface = eglCreateWindowSurface(mEGLDisplay, mEGLConfig, engineData->window, NULL); - if (mEGLSurface == EGL_NO_SURFACE) - throw RunTimeException(_("Could not create EGL surface")); - eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext); -#endif - } + + engineData->InitOpenGL(); commonGLInit(windowWidth, windowHeight); commonGLResize(); + } void RenderThread::worker() @@ -353,69 +206,13 @@ ThreadProfile* profile=m_sys->allocateProfiler(RGB(200,0,0)); profile->setTag("Render"); - glEnable(GL_TEXTURE_2D); + engineData->exec_glEnable_GL_TEXTURE_2D(); Chronometer chronometer; while(1) { - event.wait(); - if(m_sys->isShuttingDown()) + if (!doRender(profile,&chronometer)) break; - chronometer.checkpoint(); - - if(resizeNeeded) - { - //Order of the operations here matters for requestResize - windowWidth=newWidth; - windowHeight=newHeight; - resizeNeeded=false; - newWidth=0; - newHeight=0; - //End of order critical part - LOG(LOG_INFO,_("Window resized to ") << windowWidth << 'x' << windowHeight); - commonGLResize(); - m_sys->resizeCompleted(); - profile->accountTime(chronometer.checkpoint()); - continue; - } - - if(newTextureNeeded) - handleNewTexture(); - - if(prevUploadJob) - finalizeUpload(); - - if(uploadNeeded) - { - handleUpload(); - profile->accountTime(chronometer.checkpoint()); - continue; - } - - if(m_sys->isOnError()) - { - renderErrorPage(this, m_sys->standalone); - } - if (engineData->widget && (SDL_GetWindowFlags(engineData->widget) & SDL_WINDOW_OPENGL)) - SDL_GL_SwapWindow(engineData->widget); - else - { -#if defined(_WIN32) - SwapBuffers(mDC); -#elif !defined(ENABLE_GLES2) - glXSwapBuffers(mDisplay, engineData->windowID); -#else - eglSwapBuffers(mEGLDisplay, mEGLSurface); -#endif - } - if(!m_sys->isOnError()) - { - coreRendering(); - //Call glFlush to offload work on the GPU - glFlush(); - } - profile->accountTime(chronometer.checkpoint()); - renderNeeded=false; } deinit(); @@ -438,38 +235,72 @@ for(auto i=uploadJobs.begin(); i != uploadJobs.end(); ++i) (*i)->uploadFence(); } - -void RenderThread::deinit() +bool RenderThread::doRender(ThreadProfile* profile,Chronometer* chronometer) { - glDisable(GL_TEXTURE_2D); - commonGLDeinit(); - if (engineData->widget && (SDL_GetWindowFlags(engineData->widget) & SDL_WINDOW_OPENGL)) + event.wait(); + if(m_sys->isShuttingDown()) + return false; + if (chronometer) + chronometer->checkpoint(); + + if(resizeNeeded) + { + //Order of the operations here matters for requestResize + windowWidth=newWidth; + windowHeight=newHeight; + resizeNeeded=false; + newWidth=0; + newHeight=0; + //End of order critical part + LOG(LOG_INFO,_("Window resized to ") << windowWidth << 'x' << windowHeight); + commonGLResize(); + m_sys->resizeCompleted(); + if (profile && chronometer) + profile->accountTime(chronometer->checkpoint()); + return true; + } + if(newTextureNeeded) + handleNewTexture(); + + if(prevUploadJob) + finalizeUpload(); + + if(uploadNeeded) { - SDL_GL_DeleteContext(mSDLContext); + handleUpload(); + if (profile && chronometer) + profile->accountTime(chronometer->checkpoint()); + return true; } - else + + if(m_sys->isOnError()) { -#if defined(_WIN32) - wglMakeCurrent(NULL,NULL); - wglDeleteContext(mRC); - /* Do not ReleaseDC(e->window,hDC); as our window does not have CS_OWNDC */ -#elif !defined(ENABLE_GLES2) - glXMakeCurrent(mDisplay, None, NULL); - glXDestroyContext(mDisplay, mContext); - XCloseDisplay(mDisplay); -#else - eglMakeCurrent(mEGLDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglDestroyContext(mEGLDisplay, mEGLContext); - XCloseDisplay(mDisplay); -#endif + renderErrorPage(this, m_sys->standalone); + } + engineData->SwapBuffers(); + if(!m_sys->isOnError()) + { + coreRendering(); + //Call glFlush to offload work on the GPU + engineData->exec_glFlush(); } + if (profile && chronometer) + profile->accountTime(chronometer->checkpoint()); + renderNeeded=false; + + return true; +} +void RenderThread::deinit() +{ + engineData->exec_glDisable_GL_TEXTURE_2D(); + commonGLDeinit(); + engineData->DeinitOpenGL(); } bool RenderThread::loadShaderPrograms() { //Create render program - assert(glCreateShader); - GLuint f = glCreateShader(GL_FRAGMENT_SHADER); + uint32_t f = engineData->exec_glCreateShader_GL_FRAGMENT_SHADER(); const char *fs = NULL; fs = dataFileRead("lightspark.frag"); @@ -478,21 +309,18 @@ LOG(LOG_ERROR,_("Shader lightspark.frag not found")); throw RunTimeException("Fragment shader code not found"); } - assert(glShaderSource); - glShaderSource(f, 1, &fs,NULL); + engineData->exec_glShaderSource(f, 1, &fs,NULL); free((void*)fs); - GLuint g = glCreateShader(GL_VERTEX_SHADER); + uint32_t g = engineData->exec_glCreateShader_GL_VERTEX_SHADER(); bool ret=true; char str[1024]; int a; - GLint stat; - assert(glCompileShader); - glCompileShader(f); - assert(glGetShaderInfoLog); - glGetShaderInfoLog(f,1024,&a,str); + int stat; + engineData->exec_glCompileShader(f); + engineData->exec_glGetShaderInfoLog(f,1024,&a,str); LOG(LOG_INFO,_("Fragment shader compilation ") << str); - glGetShaderiv(f, GL_COMPILE_STATUS, &stat); + engineData->exec_glGetShaderiv_GL_COMPILE_STATUS(f, &stat); if (!stat) { throw RunTimeException("Could not compile fragment shader"); @@ -504,34 +332,30 @@ LOG(LOG_ERROR,_("Shader lightspark.vert not found")); throw RunTimeException("Vertex shader code not found"); } - glShaderSource(g, 1, &fs,NULL); + engineData->exec_glShaderSource(g, 1, &fs,NULL); free((void*)fs); - glGetShaderInfoLog(g,1024,&a,str); + engineData->exec_glGetShaderInfoLog(g,1024,&a,str); LOG(LOG_INFO,_("Vertex shader compilation ") << str); - glCompileShader(g); - glGetShaderiv(g, GL_COMPILE_STATUS, &stat); + engineData->exec_glCompileShader(g); + engineData->exec_glGetShaderiv_GL_COMPILE_STATUS(g, &stat); if (!stat) { throw RunTimeException("Could not compile vertex shader"); } - assert(glCreateProgram); - gpu_program = glCreateProgram(); - glBindAttribLocation(gpu_program, VERTEX_ATTRIB, "ls_Vertex"); - glBindAttribLocation(gpu_program, COLOR_ATTRIB, "ls_Color"); - glBindAttribLocation(gpu_program, TEXCOORD_ATTRIB, "ls_TexCoord"); - assert(glAttachShader); - glAttachShader(gpu_program,f); - glAttachShader(gpu_program,g); - - assert(glLinkProgram); - glLinkProgram(gpu_program); - - assert(glGetProgramiv); - glGetProgramiv(gpu_program,GL_LINK_STATUS,&a); - if(a==GL_FALSE) + gpu_program = engineData->exec_glCreateProgram(); + engineData->exec_glBindAttribLocation(gpu_program, VERTEX_ATTRIB, "ls_Vertex"); + engineData->exec_glBindAttribLocation(gpu_program, COLOR_ATTRIB, "ls_Color"); + engineData->exec_glBindAttribLocation(gpu_program, TEXCOORD_ATTRIB, "ls_TexCoord"); + engineData->exec_glAttachShader(gpu_program,f); + engineData->exec_glAttachShader(gpu_program,g); + + engineData->exec_glLinkProgram(gpu_program); + + engineData->exec_glGetProgramiv_GL_LINK_STATUS(gpu_program,&a); + if(!a) { ret=false; return ret; @@ -543,89 +367,61 @@ void RenderThread::commonGLDeinit() { - glBindFramebuffer(GL_FRAMEBUFFER,0); + engineData->exec_glBindFramebuffer_GL_FRAMEBUFFER(0); for(uint32_t i=0;i<largeTextures.size();i++) { - glDeleteTextures(1,&largeTextures[i].id); + engineData->exec_glDeleteTextures(1,&largeTextures[i].id); delete[] largeTextures[i].bitmap; } - glDeleteBuffers(2,pixelBuffers); - glDeleteTextures(1, &cairoTextureID); + engineData->exec_glDeleteBuffers(2,pixelBuffers); + engineData->exec_glDeleteTextures(1, &cairoTextureID); } void RenderThread::commonGLInit(int width, int height) { - GLenum err; -//For now GLEW does not work with GLES2 -#ifndef ENABLE_GLES2 - //Now we can initialize GLEW - glewExperimental = GL_TRUE; - err = glewInit(); - if (GLEW_OK != err) - { - LOG(LOG_ERROR,_("Cannot initialize GLEW: cause ") << glewGetErrorString(err)); - throw RunTimeException("Rendering: Cannot initialize GLEW!"); - } - - if(!GLEW_VERSION_2_0) - { - LOG(LOG_ERROR,_("Video card does not support OpenGL 2.0... Aborting")); - throw RunTimeException("Rendering: OpenGL driver does not support OpenGL 2.0"); - } - if(GLEW_ARB_texture_non_power_of_two) - hasNPOTTextures=true; - if(!GLEW_ARB_framebuffer_object) - { - LOG(LOG_ERROR,"OpenGL does not support framebuffer objects!"); - throw RunTimeException("Rendering: OpenGL driver does not support framebuffer objects"); - } -#else - //Open GLES 2.0 has NPOT textures - hasNPOTTextures=true; -#endif //Load shaders loadShaderPrograms(); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); + engineData->exec_glBlendFunc_GL_ONE_GL_ONE_MINUS_SRC_ALPHA(); + engineData->exec_glEnable_GL_BLEND(); - glActiveTexture(GL_TEXTURE0); + engineData->exec_glActiveTexture_GL_TEXTURE0(); //Viewport setup is left for GLResize //Get the maximum allowed texture size, up to 1024 int maxTexSize; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize); + engineData->exec_glGetIntegerv_GL_MAX_TEXTURE_SIZE(&maxTexSize); assert(maxTexSize>0); largeTextureSize=min(maxTexSize,1024); //Create the PBOs - glGenBuffers(2,pixelBuffers); + engineData->exec_glGenBuffers(2,pixelBuffers); //Set uniforms - glUseProgram(gpu_program); - int tex=glGetUniformLocation(gpu_program,"g_tex1"); + engineData->exec_glUseProgram(gpu_program); + int tex=engineData->exec_glGetUniformLocation(gpu_program,"g_tex1"); if(tex!=-1) - glUniform1i(tex,0); - tex=glGetUniformLocation(gpu_program,"g_tex2"); + engineData->exec_glUniform1i(tex,0); + tex=engineData->exec_glGetUniformLocation(gpu_program,"g_tex2"); if(tex!=-1) - glUniform1i(tex,1); + engineData->exec_glUniform1i(tex,1); //The uniform that enables YUV->RGB transform on the texels (needed for video) - yuvUniform =glGetUniformLocation(gpu_program,"yuv"); + yuvUniform =engineData->exec_glGetUniformLocation(gpu_program,"yuv"); //The uniform that tells the alpha value multiplied to the alpha of every pixel - alphaUniform =glGetUniformLocation(gpu_program,"alpha"); + alphaUniform =engineData->exec_glGetUniformLocation(gpu_program,"alpha"); //The uniform that tells to draw directly using the selected color - directUniform =glGetUniformLocation(gpu_program,"direct"); + directUniform =engineData->exec_glGetUniformLocation(gpu_program,"direct"); //The uniform that contains the coordinate matrix - projectionMatrixUniform =glGetUniformLocation(gpu_program,"ls_ProjectionMatrix"); - modelviewMatrixUniform =glGetUniformLocation(gpu_program,"ls_ModelViewMatrix"); + projectionMatrixUniform =engineData->exec_glGetUniformLocation(gpu_program,"ls_ProjectionMatrix"); + modelviewMatrixUniform =engineData->exec_glGetUniformLocation(gpu_program,"ls_ModelViewMatrix"); - fragmentTexScaleUniform=glGetUniformLocation(gpu_program,"texScale"); + fragmentTexScaleUniform=engineData->exec_glGetUniformLocation(gpu_program,"texScale"); //Texturing must be enabled otherwise no tex coord will be sent to the shaders - glEnable(GL_TEXTURE_2D); - - glGenTextures(1, &cairoTextureID); + engineData->exec_glEnable_GL_TEXTURE_2D(); + + engineData->exec_glGenTextures(1, &cairoTextureID); if(handleGLErrors()) { @@ -636,7 +432,7 @@ void RenderThread::commonGLResize() { m_sys->stageCoordinateMapping(windowWidth, windowHeight, offsetX, offsetY, scaleX, scaleY); - glViewport(0,0,windowWidth,windowHeight); + engineData->exec_glViewport(0,0,windowWidth,windowHeight); lsglLoadIdentity(); lsglOrtho(0,windowWidth,0,windowHeight,-100,0); //scaleY is negated to adapt the flash and gl coordinates system @@ -669,11 +465,11 @@ void RenderThread::resizePixelBuffers(uint32_t w, uint32_t h) { //Add enough room to realign to 16 - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pixelBuffers[0]); - glBufferData(GL_PIXEL_UNPACK_BUFFER, w*h*4+16, 0, GL_STREAM_DRAW); - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pixelBuffers[1]); - glBufferData(GL_PIXEL_UNPACK_BUFFER, w*h*4+16, 0, GL_STREAM_DRAW); - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(pixelBuffers[0]); + engineData->exec_glBufferData_GL_PIXEL_UNPACK_BUFFER_GL_STREAM_DRAW(w*h*4+16, 0); + engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(pixelBuffers[1]); + engineData->exec_glBufferData_GL_PIXEL_UNPACK_BUFFER_GL_STREAM_DRAW(w*h*4+16, 0); + engineData->exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(0); pixelBufferWidth=w; pixelBufferHeight=h; #ifdef ENABLE_GLES2 @@ -715,22 +511,22 @@ //Send the texture drawn by Cairo to the GPU void RenderThread::mapCairoTexture(int w, int h) { - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, cairoTextureID); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, cairoTextureData); - - GLfloat vertex_coords[] = {0,0, GLfloat(w),0, 0,GLfloat(h), GLfloat(w),GLfloat(h)}; - GLfloat texture_coords[] = {0,0, 1,0, 0,1, 1,1}; - glVertexAttribPointer(VERTEX_ATTRIB, 2, GL_FLOAT, GL_FALSE, 0, vertex_coords); - glVertexAttribPointer(TEXCOORD_ATTRIB, 2, GL_FLOAT, GL_FALSE, 0, texture_coords); - glEnableVertexAttribArray(VERTEX_ATTRIB); - glEnableVertexAttribArray(TEXCOORD_ATTRIB); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - glDisableVertexAttribArray(VERTEX_ATTRIB); - glDisableVertexAttribArray(TEXCOORD_ATTRIB); + engineData->exec_glEnable_GL_TEXTURE_2D(); + engineData->exec_glBindTexture_GL_TEXTURE_2D(cairoTextureID); + + engineData->exec_glTexParameteri_GL_TEXTURE_2D_GL_TEXTURE_MIN_FILTER_GL_LINEAR(); + engineData->exec_glTexParameteri_GL_TEXTURE_2D_GL_TEXTURE_MAG_FILTER_GL_LINEAR(); + engineData->exec_glTexImage2D_GL_TEXTURE_2D_GL_UNSIGNED_BYTE(0, w, h, 0, cairoTextureData); + + float vertex_coords[] = {0,0, float(w),0, 0,float(h), float(w),float(h)}; + float texture_coords[] = {0,0, 1,0, 0,1, 1,1}; + engineData->exec_glVertexAttribPointer(VERTEX_ATTRIB, 2, 0, vertex_coords); + engineData->exec_glVertexAttribPointer(TEXCOORD_ATTRIB, 2, 0, texture_coords); + engineData->exec_glEnableVertexAttribArray(VERTEX_ATTRIB); + engineData->exec_glEnableVertexAttribArray(TEXCOORD_ATTRIB); + engineData->exec_glDrawArrays_GL_TRIANGLE_STRIP(0, 4); + engineData->exec_glDisableVertexAttribArray(VERTEX_ATTRIB); + engineData->exec_glDisableVertexAttribArray(TEXCOORD_ATTRIB); } void RenderThread::plotProfilingData() @@ -742,13 +538,13 @@ cairo_t *cr = getCairoContext(windowWidth, windowHeight); - glUniform1f(directUniform, 1); + engineData->exec_glUniform1f(directUniform, 1); char frameBuf[20]; snprintf(frameBuf,20,"Frame %u",m_sys->mainClip->state.FP); - GLfloat vertex_coords[40]; - GLfloat color_coords[80]; + float vertex_coords[40]; + float color_coords[80]; //Draw bars for (int i=0;i<9;i++) @@ -761,18 +557,18 @@ for (int i=0;i<80;i++) color_coords[i] = 0.7; - glVertexAttribPointer(VERTEX_ATTRIB, 2, GL_FLOAT, GL_FALSE, 0, vertex_coords); - glVertexAttribPointer(COLOR_ATTRIB, 4, GL_FLOAT, GL_FALSE, 0, color_coords); - glEnableVertexAttribArray(VERTEX_ATTRIB); - glEnableVertexAttribArray(COLOR_ATTRIB); - glDrawArrays(GL_LINES, 0, 20); - glDisableVertexAttribArray(VERTEX_ATTRIB); - glDisableVertexAttribArray(COLOR_ATTRIB); + engineData->exec_glVertexAttribPointer(VERTEX_ATTRIB, 2, 0, vertex_coords); + engineData->exec_glVertexAttribPointer(COLOR_ATTRIB, 4, 0, color_coords); + engineData->exec_glEnableVertexAttribArray(VERTEX_ATTRIB); + engineData->exec_glEnableVertexAttribArray(COLOR_ATTRIB); + engineData->exec_glDrawArrays_GL_LINES(0, 20); + engineData->exec_glDisableVertexAttribArray(VERTEX_ATTRIB); + engineData->exec_glDisableVertexAttribArray(COLOR_ATTRIB); list<ThreadProfile*>::iterator it=m_sys->profilingData.begin(); for(;it!=m_sys->profilingData.end();++it) (*it)->plot(1000000/m_sys->mainClip->getFrameRate(),cr); - glUniform1f(directUniform, 0); + engineData->exec_glUniform1f(directUniform, 0); mapCairoTexture(windowWidth, windowHeight); @@ -787,12 +583,12 @@ void RenderThread::coreRendering() { Locker l(mutexRendering); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - glDrawBuffer(GL_BACK); + engineData->exec_glBindFramebuffer_GL_FRAMEBUFFER(0); + engineData->exec_glDrawBuffer_GL_BACK(); //Clear the back buffer RGB bg=m_sys->mainClip->getBackground(); - glClearColor(bg.Red/255.0F,bg.Green/255.0F,bg.Blue/255.0F,1); - glClear(GL_COLOR_BUFFER_BIT); + engineData->exec_glClearColor(bg.Red/255.0F,bg.Green/255.0F,bg.Blue/255.0F,1); + engineData->exec_glClear_GL_COLOR_BUFFER_BIT(); lsglLoadIdentity(); setMatrixUniform(LSGL_MODELVIEW); @@ -853,9 +649,9 @@ 0,y); } - glUniform1f(alphaUniform, 1); + engineData->exec_glUniform1f(alphaUniform, 1); mapCairoTexture(windowWidth, windowHeight); - glFlush(); + engineData->exec_glFlush(); } void RenderThread::addUploadJob(ITextureUploadable* u) @@ -925,18 +721,18 @@ } } -GLuint RenderThread::allocateNewGLTexture() const +uint32_t RenderThread::allocateNewGLTexture() const { //Set up the huge texture - GLuint tmp; - glGenTextures(1,&tmp); + uint32_t tmp; + engineData->exec_glGenTextures(1,&tmp); assert(tmp!=0); //If the previous call has not failed these should not fail (in specs, we trust) - glBindTexture(GL_TEXTURE_2D,tmp); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); + engineData->exec_glBindTexture_GL_TEXTURE_2D(tmp); + engineData->exec_glTexParameteri_GL_TEXTURE_2D_GL_TEXTURE_MIN_FILTER_GL_LINEAR(); + engineData->exec_glTexParameteri_GL_TEXTURE_2D_GL_TEXTURE_MAG_FILTER_GL_LINEAR(); //Allocate the texture - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, largeTextureSize, largeTextureSize, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_HOST, 0); + engineData->exec_glTexImage2D_GL_TEXTURE_2D_GL_UNSIGNED_INT_8_8_8_8_HOST(0, largeTextureSize, largeTextureSize, 0, 0); if(handleGLErrors()) { LOG(LOG_ERROR,_("Can't allocate large texture... Aborting")); @@ -1095,7 +891,7 @@ //Fast bailout if the TextureChunk is not valid if(chunk.chunks==NULL) return; - glBindTexture(GL_TEXTURE_2D, largeTextures[chunk.texId].id); + engineData->exec_glBindTexture_GL_TEXTURE_2D(largeTextures[chunk.texId].id); //TODO: Detect continuos //The size is ok if doesn't grow over the allocated size //this allows some alignment freedom @@ -1104,19 +900,19 @@ const uint32_t numberOfChunks=chunk.getNumberOfChunks(); const uint32_t blocksPerSide=largeTextureSize/CHUNKSIZE; const uint32_t blocksW=(w+CHUNKSIZE-1)/CHUNKSIZE; - glPixelStorei(GL_UNPACK_ROW_LENGTH,w); + engineData->exec_glPixelStorei_GL_UNPACK_ROW_LENGTH(w); for(uint32_t i=0;i<numberOfChunks;i++) { uint32_t curX=(i%blocksW)*CHUNKSIZE; uint32_t curY=(i/blocksW)*CHUNKSIZE; uint32_t sizeX=min(int(w-curX),CHUNKSIZE); uint32_t sizeY=min(int(h-curY),CHUNKSIZE); - glPixelStorei(GL_UNPACK_SKIP_PIXELS,curX); - glPixelStorei(GL_UNPACK_SKIP_ROWS,curY); + engineData->exec_glPixelStorei_GL_UNPACK_SKIP_PIXELS(curX); + engineData->exec_glPixelStorei_GL_UNPACK_SKIP_ROWS(curY); const uint32_t blockX=((chunk.chunks[i]%blocksPerSide)*CHUNKSIZE); const uint32_t blockY=((chunk.chunks[i]/blocksPerSide)*CHUNKSIZE); #ifndef ENABLE_GLES2 - glTexSubImage2D(GL_TEXTURE_2D, 0, blockX, blockY, sizeX, sizeY, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_HOST, data); + engineData->exec_glTexSubImage2D_GL_TEXTURE_2D(0, blockX, blockY, sizeX, sizeY, data); #else //We need to copy the texture area to a contiguous memory region first, //as GLES2 does not support UNPACK state (skip pixels, skip rows, row_lenght). @@ -1124,11 +920,11 @@ for(unsigned int j=0;j<sizeY;j++) { memcpy(gdata+4*j*sizeX, data+4*w*(j+curY)+4*curX, sizeX*4); } - glTexSubImage2D(GL_TEXTURE_2D, 0, blockX, blockY, sizeX, sizeY, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_HOST, gdata); + engineData->exec_glTexSubImage2D_GL_TEXTURE_2D(0, blockX, blockY, sizeX, sizeY, gdata); delete[] gdata; #endif } - glPixelStorei(GL_UNPACK_SKIP_PIXELS,0); - glPixelStorei(GL_UNPACK_SKIP_ROWS,0); - glPixelStorei(GL_UNPACK_ROW_LENGTH,0); + engineData->exec_glPixelStorei_GL_UNPACK_SKIP_PIXELS(0); + engineData->exec_glPixelStorei_GL_UNPACK_SKIP_ROWS(0); + engineData->exec_glPixelStorei_GL_UNPACK_ROW_LENGTH(0); }
View file
lightspark.tar.xz/src/backends/rendering.h
Changed
@@ -20,7 +20,6 @@ #ifndef BACKENDS_RENDERING_H #define BACKENDS_RENDERING_H 1 -#include "backends/lsopengl.h" #include "backends/rendering_context.h" #include "timer.h" #include <glibmm/timeval.h> @@ -31,8 +30,9 @@ namespace lightspark { +class ThreadProfile; -class RenderThread: public ITickJob, public GLRenderContext +class DLL_PUBLIC RenderThread: public ITickJob, public GLRenderContext { friend class DisplayObject; private: @@ -41,22 +41,19 @@ enum STATUS { CREATED=0, STARTED, TERMINATED }; volatile STATUS status; - EngineData* engineData; void worker(); - void init(); - void deinit(); void commonGLInit(int width, int height); void commonGLResize(); void commonGLDeinit(); - GLuint pixelBuffers[2]; + uint32_t pixelBuffers[2]; uint32_t currentPixelBuffer; intptr_t currentPixelBufferOffset; uint32_t pixelBufferWidth; uint32_t pixelBufferHeight; void resizePixelBuffers(uint32_t w, uint32_t h); ITextureUploadable* prevUploadJob; - GLuint allocateNewGLTexture() const; + uint32_t allocateNewGLTexture() const; LargeTexture& allocateNewTexture(); bool allocateChunkOnTextureCompact(LargeTexture& tex, TextureChunk& ret, uint32_t blocksW, uint32_t blocksH); bool allocateChunkOnTextureSparse(LargeTexture& tex, TextureChunk& ret, uint32_t blocksW, uint32_t blocksH); @@ -77,24 +74,7 @@ float scaleY; int offsetX; int offsetY; - SDL_GLContext mSDLContext; -#ifdef _WIN32 - HGLRC mRC; - HDC mDC; -#else - Display* mDisplay; - Window mWindow; -#ifndef ENABLE_GLES2 - GLXFBConfig mFBConfig; - GLXContext mContext; -#else - EGLDisplay mEGLDisplay; - EGLContext mEGLContext; - EGLConfig mEGLConfig; - EGLSurface mEGLSurface; -#endif -#endif Glib::TimeVal time_s, time_d; static const Glib::TimeVal FPS_time; @@ -132,6 +112,10 @@ void wait(); void draw(bool force); + void init(); + void deinit(); + bool doRender(ThreadProfile *profile=NULL, Chronometer *chronometer=NULL); + /** Allocates a chunk from the shared texture */ @@ -163,16 +147,15 @@ int gpu_program; volatile uint32_t windowWidth; volatile uint32_t windowHeight; - bool hasNPOTTextures; - GLint fragmentTexScaleUniform; - GLint directUniform; + int fragmentTexScaleUniform; + int directUniform; void renderErrorPage(RenderThread *rt, bool standalone); cairo_t *cairoTextureContext; cairo_surface_t *cairoTextureSurface; uint8_t *cairoTextureData; - GLuint cairoTextureID; + uint32_t cairoTextureID; cairo_t* getCairoContext(int w, int h); void mapCairoTexture(int w, int h); void renderText(cairo_t *cr, const char *text, int x, int y);
View file
lightspark.tar.xz/src/backends/rendering_context.cpp
Changed
@@ -38,9 +38,9 @@ using namespace std; using namespace lightspark; -#define LSGL_MATRIX_SIZE (16*sizeof(GLfloat)) +#define LSGL_MATRIX_SIZE (16*sizeof(float)) -const GLfloat RenderContext::lsIdentityMatrix[16] = { +const float RenderContext::lsIdentityMatrix[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, @@ -54,7 +54,7 @@ lsglLoadIdentity(); } -void RenderContext::lsglLoadMatrixf(const GLfloat *m) +void RenderContext::lsglLoadMatrixf(const float *m) { memcpy(lsMVPMatrix, m, LSGL_MATRIX_SIZE); } @@ -64,14 +64,14 @@ lsglLoadMatrixf(lsIdentityMatrix); } -void RenderContext::lsglMultMatrixf(const GLfloat *m) +void RenderContext::lsglMultMatrixf(const float *m) { - GLfloat tmp[16]; + float tmp[16]; for(int i=0;i<4;i++) { for(int j=0;j<4;j++) { - GLfloat sum=0; + float sum=0; for (int k=0;k<4;k++) { sum += lsMVPMatrix[i+k*4]*m[j*4+k]; @@ -82,9 +82,9 @@ memcpy(lsMVPMatrix, tmp, LSGL_MATRIX_SIZE); } -void RenderContext::lsglScalef(GLfloat scaleX, GLfloat scaleY, GLfloat scaleZ) +void RenderContext::lsglScalef(float scaleX, float scaleY, float scaleZ) { - static GLfloat scale[16]; + static float scale[16]; memcpy(scale, lsIdentityMatrix, LSGL_MATRIX_SIZE); scale[0] = scaleX; @@ -93,9 +93,9 @@ lsglMultMatrixf(scale); } -void RenderContext::lsglTranslatef(GLfloat translateX, GLfloat translateY, GLfloat translateZ) +void RenderContext::lsglTranslatef(float translateX, float translateY, float translateZ) { - static GLfloat trans[16]; + static float trans[16]; memcpy(trans, lsIdentityMatrix, LSGL_MATRIX_SIZE); trans[12] = translateX; @@ -104,9 +104,9 @@ lsglMultMatrixf(trans); } -void GLRenderContext::lsglOrtho(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) +void GLRenderContext::lsglOrtho(float l, float r, float b, float t, float n, float f) { - GLfloat ortho[16]; + float ortho[16]; memset(ortho, 0, sizeof(ortho)); ortho[0] = 2/(r-l); ortho[5] = 2/(t-b); @@ -128,13 +128,13 @@ float alpha, COLOR_MODE colorMode) { //Set color mode - glUniform1f(yuvUniform, (colorMode==YUV_MODE)?1:0); + engineData->exec_glUniform1f(yuvUniform, (colorMode==YUV_MODE)?1:0); //Set alpha - glUniform1f(alphaUniform, alpha); + engineData->exec_glUniform1f(alphaUniform, alpha); //Set matrix setMatrixUniform(LSGL_MODELVIEW); - glBindTexture(GL_TEXTURE_2D, largeTextures[chunk.texId].id); + engineData->exec_glBindTexture_GL_TEXTURE_2D(largeTextures[chunk.texId].id); const uint32_t blocksPerSide=largeTextureSize/CHUNKSIZE; uint32_t startX, startY, endX, endY; assert(chunk.getNumberOfChunks()==((chunk.width+CHUNKSIZE-1)/CHUNKSIZE)*((chunk.height+CHUNKSIZE-1)/CHUNKSIZE)); @@ -143,8 +143,8 @@ //The 4 corners of each texture are specified as the vertices of 2 triangles, //so there are 6 vertices per quad, two of them duplicated (the diagonal) //Allocate the data on the stack to reduce heap fragmentation - GLfloat *vertex_coords = g_newa(GLfloat,chunk.getNumberOfChunks()*12); - GLfloat *texture_coords = g_newa(GLfloat,chunk.getNumberOfChunks()*12); + float *vertex_coords = g_newa(float,chunk.getNumberOfChunks()*12); + float *texture_coords = g_newa(float,chunk.getNumberOfChunks()*12); for(uint32_t i=0, k=0;i<chunk.height;i+=CHUNKSIZE) { startY=h*i/chunk.height; @@ -211,24 +211,23 @@ } } - glVertexAttribPointer(VERTEX_ATTRIB, 2, GL_FLOAT, GL_FALSE, 0, vertex_coords); - glVertexAttribPointer(TEXCOORD_ATTRIB, 2, GL_FLOAT, GL_FALSE, 0, texture_coords); - glEnableVertexAttribArray(VERTEX_ATTRIB); - glEnableVertexAttribArray(TEXCOORD_ATTRIB); - glDrawArrays(GL_TRIANGLES, 0, curChunk*6); - glDisableVertexAttribArray(VERTEX_ATTRIB); - glDisableVertexAttribArray(TEXCOORD_ATTRIB); + engineData->exec_glVertexAttribPointer(VERTEX_ATTRIB, 2, 0, vertex_coords); + engineData->exec_glVertexAttribPointer(TEXCOORD_ATTRIB, 2, 0, texture_coords); + engineData->exec_glEnableVertexAttribArray(VERTEX_ATTRIB); + engineData->exec_glEnableVertexAttribArray(TEXCOORD_ATTRIB); + engineData->exec_glDrawArrays_GL_TRIANGLES( 0, curChunk*6); + engineData->exec_glDisableVertexAttribArray(VERTEX_ATTRIB); + engineData->exec_glDisableVertexAttribArray(TEXCOORD_ATTRIB); handleGLErrors(); } -bool GLRenderContext::handleGLErrors() +int GLRenderContext::errorCount = 0; +bool GLRenderContext::handleGLErrors() const { - int errorCount = 0; - GLenum err; + uint32_t err; while(1) { - err=glGetError(); - if(err!=GL_NO_ERROR) + if(engineData && engineData->getGLError(err)) { errorCount++; LOG(LOG_ERROR,_("GL error ")<< err); @@ -246,9 +245,9 @@ void GLRenderContext::setMatrixUniform(LSGL_MATRIX m) const { - GLint uni = (m == LSGL_MODELVIEW) ? modelviewMatrixUniform:projectionMatrixUniform; + int uni = (m == LSGL_MODELVIEW) ? modelviewMatrixUniform:projectionMatrixUniform; - glUniformMatrix4fv(uni, 1, GL_FALSE, lsMVPMatrix); + engineData->exec_glUniformMatrix4fv(uni, 1, false, lsMVPMatrix); } CairoRenderContext::CairoRenderContext(uint8_t* buf, uint32_t width, uint32_t height):RenderContext(CAIRO)
View file
lightspark.tar.xz/src/backends/rendering_context.h
Changed
@@ -21,8 +21,8 @@ #define BACKENDS_RENDERING_CONTEXT_H 1 #include <stack> -#include "backends/lsopengl.h" #include "backends/graphics.h" +#include "platforms/engineutils.h" namespace lightspark { @@ -36,11 +36,11 @@ { protected: /* Modelview matrix manipulation */ - static const GLfloat lsIdentityMatrix[16]; - GLfloat lsMVPMatrix[16]; - std::stack<GLfloat*> lsglMatrixStack; + static const float lsIdentityMatrix[16]; + float lsMVPMatrix[16]; + std::stack<float*> lsglMatrixStack; ~RenderContext(){} - void lsglMultMatrixf(const GLfloat *m); + void lsglMultMatrixf(const float *m); public: enum CONTEXT_TYPE { CAIRO=0, GL }; RenderContext(CONTEXT_TYPE t); @@ -48,9 +48,9 @@ /* Modelview matrix manipulation */ void lsglLoadIdentity(); - void lsglLoadMatrixf(const GLfloat *m); - void lsglScalef(GLfloat scaleX, GLfloat scaleY, GLfloat scaleZ); - void lsglTranslatef(GLfloat translateX, GLfloat translateY, GLfloat translateZ); + void lsglLoadMatrixf(const float *m); + void lsglScalef(float scaleX, float scaleY, float scaleZ); + void lsglTranslatef(float translateX, float translateY, float translateZ); enum COLOR_MODE { RGB_MODE=0, YUV_MODE }; enum MASK_MODE { NO_MASK = 0, ENABLE_MASK }; @@ -68,12 +68,15 @@ class GLRenderContext: public RenderContext { +private: + static int errorCount; protected: - GLint projectionMatrixUniform; - GLint modelviewMatrixUniform; + EngineData* engineData; + int projectionMatrixUniform; + int modelviewMatrixUniform; - GLint yuvUniform; - GLint alphaUniform; + int yuvUniform; + int alphaUniform; /* Textures */ Mutex mutexLargeTexture; @@ -81,7 +84,7 @@ class LargeTexture { public: - GLuint id; + uint32_t id; uint8_t* bitmap; LargeTexture(uint8_t* b):id(-1),bitmap(b){} ~LargeTexture(){/*delete[] bitmap;*/} @@ -96,10 +99,11 @@ */ void setMatrixUniform(LSGL_MATRIX m) const; public: - GLRenderContext() : RenderContext(GL), largeTextureSize(0) + GLRenderContext() : RenderContext(GL),engineData(NULL), largeTextureSize(0) { } - void lsglOrtho(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); + void SetEngineData(EngineData* data) { engineData = data;} + void lsglOrtho(float l, float r, float b, float t, float n, float f); void renderTextured(const TextureChunk& chunk, int32_t x, int32_t y, uint32_t w, uint32_t h, float alpha, COLOR_MODE colorMode); @@ -110,7 +114,7 @@ const CachedSurface& getCachedSurface(const DisplayObject* obj) const; /* Utility */ - static bool handleGLErrors(); + bool handleGLErrors() const; }; class CairoRenderContext: public RenderContext
View file
lightspark.tar.xz/src/main.cpp
Changed
@@ -31,6 +31,7 @@ class StandaloneEngineData: public EngineData { + SDL_GLContext mSDLContext; public: StandaloneEngineData() { @@ -92,6 +93,24 @@ return 96.0; #endif } + void SwapBuffers() + { + uint32_t err; + if (getGLError(err)) + LOG(LOG_ERROR,"swapbuffers:"<<widget<<" "<<err); + SDL_GL_SwapWindow(widget); + } + void InitOpenGL() + { + mSDLContext = SDL_GL_CreateContext(widget); + if (!mSDLContext) + LOG(LOG_ERROR,"failed to create openGL context:"<<SDL_GetError()); + initGLEW(); + } + void DeinitOpenGL() + { + SDL_GL_DeleteContext(mSDLContext); + } }; int main(int argc, char* argv[])
View file
lightspark.tar.xz/src/platforms/engineutils.cpp
Changed
@@ -24,6 +24,14 @@ #include <SDL2/SDL_mouse.h> #include "backends/input.h" #include "backends/rendering.h" +#include "backends/lsopengl.h" + +//The interpretation of texture data change with the endianness +#if __BYTE_ORDER == __BIG_ENDIAN +#define GL_UNSIGNED_INT_8_8_8_8_HOST GL_UNSIGNED_INT_8_8_8_8_REV +#else +#define GL_UNSIGNED_INT_8_8_8_8_HOST GL_UNSIGNED_BYTE +#endif using namespace std; using namespace lightspark; @@ -32,7 +40,7 @@ Thread* EngineData::mainLoopThread = NULL; bool EngineData::mainthread_running = false; Semaphore EngineData::mainthread_initialized(0); -EngineData::EngineData() : widget(0), width(0), height(0),windowID(0),visual(0) +EngineData::EngineData() : widget(0), width(0), height(0),needrenderthread(true),windowID(0),visual(0) { } @@ -151,6 +159,31 @@ return mainthread_running; } +void EngineData::initGLEW() +{ +//For now GLEW does not work with GLES2 +#ifndef ENABLE_GLES2 + //Now we can initialize GLEW + GLenum err = glewInit(); + if (GLEW_OK != err) + { + LOG(LOG_ERROR,_("Cannot initialize GLEW: cause ") << glewGetErrorString(err)); + throw RunTimeException("Rendering: Cannot initialize GLEW!"); + } + + if(!GLEW_VERSION_2_0) + { + LOG(LOG_ERROR,_("Video card does not support OpenGL 2.0... Aborting")); + throw RunTimeException("Rendering: OpenGL driver does not support OpenGL 2.0"); + } + if(!GLEW_ARB_framebuffer_object) + { + LOG(LOG_ERROR,"OpenGL does not support framebuffer objects!"); + throw RunTimeException("Rendering: OpenGL driver does not support framebuffer objects"); + } +#endif +} + void EngineData::showWindow(uint32_t w, uint32_t h) { RecMutex::Lock l(mutex); @@ -159,7 +192,8 @@ widget = createWidget(w,h); this->width = w; this->height = h; - SDL_ShowWindow(widget); + if (widget) + SDL_ShowWindow(widget); grabFocus(); } @@ -183,3 +217,258 @@ LOG(LOG_ERROR, "copying text to clipboard failed:"<<SDL_GetError()); } +bool EngineData::getGLError(uint32_t &errorCode) const +{ + errorCode=glGetError(); + return errorCode!=GL_NO_ERROR; +} + +void EngineData::exec_glUniform1f(int location,float v0) +{ + glUniform1f(location,v0); +} + +void EngineData::exec_glBindTexture_GL_TEXTURE_2D(uint32_t id) +{ + glBindTexture(GL_TEXTURE_2D, id); +} + +void EngineData::exec_glVertexAttribPointer(uint32_t index,int32_t size, int32_t stride, const void* coords) +{ + glVertexAttribPointer(index, size, GL_FLOAT, GL_FALSE, stride, coords); +} + +void EngineData::exec_glEnableVertexAttribArray(uint32_t index) +{ + glEnableVertexAttribArray(index); +} + +void EngineData::exec_glDrawArrays_GL_TRIANGLES(int32_t first,int32_t count) +{ + glDrawArrays(GL_TRIANGLES,first,count); +} +void EngineData::exec_glDrawArrays_GL_LINE_STRIP(int32_t first,int32_t count) +{ + glDrawArrays(GL_LINE_STRIP,first,count); +} + +void EngineData::exec_glDrawArrays_GL_TRIANGLE_STRIP(int32_t first, int32_t count) +{ + glDrawArrays(GL_TRIANGLE_STRIP,first,count); +} + +void EngineData::exec_glDrawArrays_GL_LINES(int32_t first, int32_t count) +{ + glDrawArrays(GL_LINES,first,count); +} + +void EngineData::exec_glDisableVertexAttribArray(uint32_t index) +{ + glDisableVertexAttribArray(index); +} + +void EngineData::exec_glUniformMatrix4fv(int32_t location,int32_t count, bool transpose,const float* value) +{ + glUniformMatrix4fv(location, count, transpose, value); +} +void EngineData::exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(uint32_t buffer) +{ + glBindBuffer(GL_PIXEL_UNPACK_BUFFER,buffer); +} +uint8_t* EngineData::exec_glMapBuffer_GL_PIXEL_UNPACK_BUFFER_GL_WRITE_ONLY() +{ + return (uint8_t*)glMapBuffer(GL_PIXEL_UNPACK_BUFFER,GL_WRITE_ONLY); +} +void EngineData::exec_glUnmapBuffer_GL_PIXEL_UNPACK_BUFFER() +{ + glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); +} +void EngineData::exec_glEnable_GL_TEXTURE_2D() +{ + glEnable(GL_TEXTURE_2D); +} +void EngineData::exec_glEnable_GL_BLEND() +{ + glEnable(GL_BLEND); +} + +void EngineData::exec_glDisable_GL_TEXTURE_2D() +{ + glDisable(GL_TEXTURE_2D); +} +void EngineData::exec_glFlush() +{ + glFlush(); +} + +uint32_t EngineData::exec_glCreateShader_GL_FRAGMENT_SHADER() +{ + return glCreateShader(GL_FRAGMENT_SHADER); +} + +uint32_t EngineData::exec_glCreateShader_GL_VERTEX_SHADER() +{ + return glCreateShader(GL_VERTEX_SHADER); +} + +void EngineData::exec_glShaderSource(uint32_t shader, int32_t count, const char** name, int32_t* length) +{ + glShaderSource(shader,count,name,length); +} + +void EngineData::exec_glCompileShader(uint32_t shader) +{ + glCompileShader(shader); +} + +void EngineData::exec_glGetShaderInfoLog(uint32_t shader,int32_t bufSize,int32_t* length,char* infoLog) +{ + glGetShaderInfoLog(shader,bufSize,length,infoLog); +} + +void EngineData::exec_glGetShaderiv_GL_COMPILE_STATUS(uint32_t shader,int32_t* params) +{ + glGetShaderiv(shader,GL_COMPILE_STATUS,params); +} + +uint32_t EngineData::exec_glCreateProgram() +{ + return glCreateProgram(); +} + +void EngineData::exec_glBindAttribLocation(uint32_t program,uint32_t index, const char* name) +{ + glBindAttribLocation(program,index,name); +} + +void EngineData::exec_glAttachShader(uint32_t program, uint32_t shader) +{ + glAttachShader(program,shader); +} + +void EngineData::exec_glLinkProgram(uint32_t program) +{ + glLinkProgram(program); +} + +void EngineData::exec_glGetProgramiv_GL_LINK_STATUS(uint32_t program,int32_t* params) +{ + glGetProgramiv(program,GL_LINK_STATUS,params); +} + +void EngineData::exec_glBindFramebuffer_GL_FRAMEBUFFER(uint32_t framebuffer) +{ + glBindFramebuffer(GL_FRAMEBUFFER,framebuffer); +} + +void EngineData::exec_glDeleteTextures(int32_t n,uint32_t* textures) +{ + glDeleteTextures(n,textures); +} + +void EngineData::exec_glDeleteBuffers(int32_t n,uint32_t* buffers) +{ + glDeleteBuffers(n,buffers); +} + +void EngineData::exec_glBlendFunc_GL_ONE_GL_ONE_MINUS_SRC_ALPHA() +{ + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); +} + +void EngineData::exec_glActiveTexture_GL_TEXTURE0() +{ + glActiveTexture(GL_TEXTURE0); +} + +void EngineData::exec_glGenBuffers(int32_t n,uint32_t* buffers) +{ + glGenBuffers(n,buffers); +} + +void EngineData::exec_glUseProgram(uint32_t program) +{ + glUseProgram(program); +} + +int32_t EngineData::exec_glGetUniformLocation(uint32_t program,const char* name) +{ + return glGetUniformLocation(program,name); +} + +void EngineData::exec_glUniform1i(int32_t location,int32_t v0) +{ + glUniform1i(location,v0); +} + +void EngineData::exec_glGenTextures(int32_t n,uint32_t* textures) +{ + glGenTextures(n,textures); +} + +void EngineData::exec_glViewport(int32_t x,int32_t y,int32_t width,int32_t height) +{ + glViewport(x,y,width,height); +} + +void EngineData::exec_glBufferData_GL_PIXEL_UNPACK_BUFFER_GL_STREAM_DRAW(int32_t size,const void* data) +{ + glBufferData(GL_PIXEL_UNPACK_BUFFER,size, data,GL_STREAM_DRAW); +} + +void EngineData::exec_glTexParameteri_GL_TEXTURE_2D_GL_TEXTURE_MIN_FILTER_GL_LINEAR() +{ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); +} +void EngineData::exec_glTexParameteri_GL_TEXTURE_2D_GL_TEXTURE_MAG_FILTER_GL_LINEAR() +{ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); +} + +void EngineData::exec_glTexImage2D_GL_TEXTURE_2D_GL_UNSIGNED_BYTE(int32_t level,int32_t width, int32_t height,int32_t border, const void* pixels) +{ + glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA8, width, height, border, GL_BGRA, GL_UNSIGNED_BYTE, pixels); +} +void EngineData::exec_glTexImage2D_GL_TEXTURE_2D_GL_UNSIGNED_INT_8_8_8_8_HOST(int32_t level,int32_t width, int32_t height,int32_t border, const void* pixels) +{ + glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA8, width, height, border, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_HOST, pixels); +} + +void EngineData::exec_glDrawBuffer_GL_BACK() +{ + glDrawBuffer(GL_BACK); +} + +void EngineData::exec_glClearColor(float red,float green,float blue,float alpha) +{ + glClearColor(red,green,blue,alpha); +} + +void EngineData::exec_glClear_GL_COLOR_BUFFER_BIT() +{ + glClear(GL_COLOR_BUFFER_BIT); +} + +void EngineData::exec_glPixelStorei_GL_UNPACK_ROW_LENGTH(int32_t param) +{ + glPixelStorei(GL_UNPACK_ROW_LENGTH,param); +} + +void EngineData::exec_glPixelStorei_GL_UNPACK_SKIP_PIXELS(int32_t param) +{ + glPixelStorei(GL_UNPACK_SKIP_PIXELS,param); +} + +void EngineData::exec_glPixelStorei_GL_UNPACK_SKIP_ROWS(int32_t param) +{ + glPixelStorei(GL_UNPACK_SKIP_ROWS,param); +} + +void EngineData::exec_glTexSubImage2D_GL_TEXTURE_2D(int32_t level,int32_t xoffset,int32_t yoffset,int32_t width,int32_t height,const void* pixels) +{ + glTexSubImage2D(GL_TEXTURE_2D, level, xoffset, yoffset, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_HOST, pixels); +} +void EngineData::exec_glGetIntegerv_GL_MAX_TEXTURE_SIZE(int32_t* data) +{ + glGetIntegerv(GL_MAX_TEXTURE_SIZE,data); +}
View file
lightspark.tar.xz/src/platforms/engineutils.h
Changed
@@ -51,6 +51,7 @@ static Thread* mainLoopThread; int width; int height; + bool needrenderthread; #ifndef _WIN32 XID windowID; VisualID visual; @@ -85,13 +86,72 @@ static Semaphore mainthread_initialized; static bool startSDLMain(); + void initGLEW(); + /* show/hide mouse cursor, must be called from mainLoopThread */ static void showMouseCursor(SystemState *sys); static void hideMouseCursor(SystemState *sys); virtual void setClipboardText(const std::string txt); virtual bool getScreenData(SDL_DisplayMode* screen) = 0; virtual double getScreenDPI() = 0; + + virtual void SwapBuffers() = 0; + virtual void InitOpenGL() = 0; + virtual void DeinitOpenGL() = 0; + virtual bool getGLError(uint32_t& errorCode) const; + virtual void exec_glUniform1f(int location,float v0); + virtual void exec_glBindTexture_GL_TEXTURE_2D(uint32_t id); + virtual void exec_glVertexAttribPointer(uint32_t index,int32_t size, int32_t stride, const void* coords); + virtual void exec_glEnableVertexAttribArray(uint32_t index); + virtual void exec_glDrawArrays_GL_TRIANGLES(int32_t first, int32_t count); + virtual void exec_glDrawArrays_GL_LINE_STRIP(int32_t first, int32_t count); + virtual void exec_glDrawArrays_GL_TRIANGLE_STRIP(int32_t first, int32_t count); + virtual void exec_glDrawArrays_GL_LINES(int32_t first, int32_t count); + virtual void exec_glDisableVertexAttribArray(uint32_t index); + virtual void exec_glUniformMatrix4fv(int32_t location,int32_t count, bool transpose,const float* value); + virtual void exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(uint32_t buffer); + virtual uint8_t* exec_glMapBuffer_GL_PIXEL_UNPACK_BUFFER_GL_WRITE_ONLY(); + virtual void exec_glUnmapBuffer_GL_PIXEL_UNPACK_BUFFER(); + virtual void exec_glEnable_GL_TEXTURE_2D(); + virtual void exec_glEnable_GL_BLEND(); + virtual void exec_glDisable_GL_TEXTURE_2D(); + virtual void exec_glFlush(); + virtual uint32_t exec_glCreateShader_GL_FRAGMENT_SHADER(); + virtual uint32_t exec_glCreateShader_GL_VERTEX_SHADER(); + virtual void exec_glShaderSource(uint32_t shader, int32_t count, const char **name, int32_t* length); + virtual void exec_glCompileShader(uint32_t shader); + virtual void exec_glGetShaderInfoLog(uint32_t shader,int32_t bufSize,int32_t* length,char* infoLog); + virtual void exec_glGetShaderiv_GL_COMPILE_STATUS(uint32_t shader,int32_t* params); + virtual uint32_t exec_glCreateProgram(); + virtual void exec_glBindAttribLocation(uint32_t program,uint32_t index, const char* name); + virtual void exec_glAttachShader(uint32_t program, uint32_t shader); + virtual void exec_glLinkProgram(uint32_t program); + virtual void exec_glGetProgramiv_GL_LINK_STATUS(uint32_t program,int32_t* params); + virtual void exec_glBindFramebuffer_GL_FRAMEBUFFER(uint32_t framebuffer); + virtual void exec_glDeleteTextures(int32_t n,uint32_t* textures); + virtual void exec_glDeleteBuffers(int32_t n,uint32_t* buffers); + virtual void exec_glBlendFunc_GL_ONE_GL_ONE_MINUS_SRC_ALPHA(); + virtual void exec_glActiveTexture_GL_TEXTURE0(); + virtual void exec_glGenBuffers(int32_t n,uint32_t* buffers); + virtual void exec_glUseProgram(uint32_t program); + virtual int32_t exec_glGetUniformLocation(uint32_t program,const char* name); + virtual void exec_glUniform1i(int32_t location,int32_t v0); + virtual void exec_glGenTextures(int32_t n,uint32_t* textures); + virtual void exec_glViewport(int32_t x,int32_t y,int32_t width,int32_t height); + virtual void exec_glBufferData_GL_PIXEL_UNPACK_BUFFER_GL_STREAM_DRAW(int32_t size, const void* data); + virtual void exec_glTexParameteri_GL_TEXTURE_2D_GL_TEXTURE_MIN_FILTER_GL_LINEAR(); + virtual void exec_glTexParameteri_GL_TEXTURE_2D_GL_TEXTURE_MAG_FILTER_GL_LINEAR(); + virtual void exec_glTexImage2D_GL_TEXTURE_2D_GL_UNSIGNED_BYTE(int32_t level,int32_t width, int32_t height,int32_t border, const void* pixels); + virtual void exec_glTexImage2D_GL_TEXTURE_2D_GL_UNSIGNED_INT_8_8_8_8_HOST(int32_t level,int32_t width, int32_t height,int32_t border, const void* pixels); + virtual void exec_glDrawBuffer_GL_BACK(); + virtual void exec_glClearColor(float red,float green,float blue,float alpha); + virtual void exec_glClear_GL_COLOR_BUFFER_BIT(); + virtual void exec_glPixelStorei_GL_UNPACK_ROW_LENGTH(int32_t param); + virtual void exec_glPixelStorei_GL_UNPACK_SKIP_PIXELS(int32_t param); + virtual void exec_glPixelStorei_GL_UNPACK_SKIP_ROWS(int32_t param); + virtual void exec_glTexSubImage2D_GL_TEXTURE_2D(int32_t level,int32_t xoffset,int32_t yoffset,int32_t width,int32_t height,const void* pixels); + virtual void exec_glGetIntegerv_GL_MAX_TEXTURE_SIZE(int32_t* data); }; -}; +} #endif /* PLATFORMS_ENGINEUTILS_H */
View file
lightspark.tar.xz/src/plugin/plugin.cpp
Changed
@@ -829,7 +829,8 @@ //mDisplay = ws_info->display; //mDepth = ws_info->depth; //mColormap = ws_info->colormap; - e->visual = XVisualIDFromVisual(ws_info->visual); + if (ws_info->visual) + e->visual = XVisualIDFromVisual(ws_info->visual); #endif m_sys->setParamsAndEngine(e, false); return NPERR_NO_ERROR; @@ -1100,6 +1101,168 @@ { instance->openLink(url, window); } +void PluginEngineData::SwapBuffers() +{ +#if defined(_WIN32) + SwapBuffers(mDC); +#elif !defined(ENABLE_GLES2) + glXSwapBuffers(mDisplay, windowID); +#else + eglSwapBuffers(mEGLDisplay, mEGLSurface); +#endif +} +void PluginEngineData::InitOpenGL() +{ +#if defined(_WIN32) + PIXELFORMATDESCRIPTOR pfd = + { + sizeof(PIXELFORMATDESCRIPTOR), + 1, + PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, //Flags + PFD_TYPE_RGBA, //The kind of framebuffer. RGBA or palette. + 32, //Colordepth of the framebuffer. + 0, 0, 0, 0, 0, 0, + 0, + 0, + 0, + 0, 0, 0, 0, + 24, //Number of bits for the depthbuffer + 0, //Number of bits for the stencilbuffer + 0, //Number of Aux buffers in the framebuffer. + PFD_MAIN_PLANE, + 0, + 0, 0, 0 + }; + if(!(mDC = GetDC((HWND)engineData->window))) + throw RunTimeException("GetDC failed"); + int PixelFormat; + if (!(PixelFormat=ChoosePixelFormat(mDC,&pfd))) + throw RunTimeException("ChoosePixelFormat failed"); + if(!SetPixelFormat(mDC,PixelFormat,&pfd)) + throw RunTimeException("SetPixelFormat failed"); + if (!(mRC=wglCreateContext(mDC))) + throw RunTimeException("wglCreateContext failed"); + if(!wglMakeCurrent(mDC,mRC)) + throw RunTimeException("wglMakeCurrent failed"); +#elif !defined(ENABLE_GLES2) + mDisplay = XOpenDisplay(NULL); + int a,b; + Bool glx_present=glXQueryVersion(mDisplay, &a, &b); + if(!glx_present) + { + XCloseDisplay(mDisplay); + throw RunTimeException("glX not present"); + } + + int attrib[10]={GLX_DOUBLEBUFFER, True, 0L}; + GLXFBConfig* fb=glXChooseFBConfig(mDisplay, 0, attrib, &a); + if(!fb) + { + attrib[6]=0L; + LOG(LOG_ERROR,_("Falling back to no double buffering")); + fb=glXChooseFBConfig(mDisplay, 0, attrib, &a); + } + if(!fb) + { + XCloseDisplay(mDisplay); + throw RunTimeException(_("Could not find any GLX configuration")); + } + int i; + for(i=0;i<a;i++) + { + int id; + glXGetFBConfigAttrib(mDisplay, fb[i],GLX_VISUAL_ID,&id); + if(visual == 0 || id==(int)visual) + break; + } + if(i==a) + { + //No suitable id found + XCloseDisplay(mDisplay); + throw RunTimeException(_("No suitable graphics configuration available")); + } + mFBConfig=fb[i]; + LOG(LOG_INFO, "Chosen config " << hex << fb[i] << dec); + XFree(fb); + mContext = glXCreateNewContext(mDisplay, mFBConfig,GLX_RGBA_TYPE ,NULL,1); + glXMakeCurrent(mDisplay, windowID, mContext); + if(!glXIsDirect(mDisplay, mContext)) + LOG(LOG_INFO, "Indirect!!"); +#else //egl + mDisplay = XOpenDisplay(NULL); + int a; + eglBindAPI(EGL_OPENGL_ES_API); + mEGLDisplay = eglGetDisplay(mDisplay); + if (mEGLDisplay == EGL_NO_DISPLAY) + throw RunTimeException(_("EGL not present")); + EGLint major, minor; + if (eglInitialize(mEGLDisplay, &major, &minor) == EGL_FALSE) + throw RunTimeException(_("EGL initialization failed")); + + LOG(LOG_INFO, _("EGL version: ") << eglQueryString(mEGLDisplay, EGL_VERSION)); + EGLint config_attribs[] = { + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_NONE + }; + EGLint context_attribs[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE + }; + if (!eglChooseConfig(mEGLDisplay, config_attribs, 0, 0, &a)) + throw RunTimeException(_("Could not get number of EGL configurations")); + else + LOG(LOG_INFO, "Number of EGL configurations: " << a); + EGLConfig *conf = new EGLConfig[a]; + if (!eglChooseConfig(mEGLDisplay, config_attribs, conf, a, &a)) + throw RunTimeException(_("Could not find any EGL configuration")); + + int i; + for(i=0;i<a;i++) + { + EGLint id; + eglGetConfigAttrib(mEGLDisplay, conf[i], EGL_NATIVE_VISUAL_ID, &id); + if(visual == 0 || id==(int)visual) + break; + } + if(i==a) + { + //No suitable id found + throw RunTimeException(_("No suitable graphics configuration available")); + } + mEGLConfig=conf[i]; + LOG(LOG_INFO, "Chosen config " << hex << conf[i] << dec); + mEGLContext = eglCreateContext(mEGLDisplay, mEGLConfig, EGL_NO_CONTEXT, context_attribs); + if (mEGLContext == EGL_NO_CONTEXT) + throw RunTimeException(_("Could not create EGL context")); + mEGLSurface = eglCreateWindowSurface(mEGLDisplay, mEGLConfig, windowID, NULL); + if (mEGLSurface == EGL_NO_SURFACE) + throw RunTimeException(_("Could not create EGL surface")); + eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext); +#endif + + initGLEW(); +} + +void PluginEngineData::DeinitOpenGL() +{ +#if defined(_WIN32) + wglMakeCurrent(NULL,NULL); + wglDeleteContext(mRC); + /* Do not ReleaseDC(e->window,hDC); as our window does not have CS_OWNDC */ +#elif !defined(ENABLE_GLES2) + glXMakeCurrent(mDisplay, 0L, NULL); + glXDestroyContext(mDisplay, mContext); + XCloseDisplay(mDisplay); +#else + eglMakeCurrent(mEGLDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglDestroyContext(mEGLDisplay, mEGLContext); + XCloseDisplay(mDisplay); +#endif +} #ifdef _WIN32 /* Setup for getExectuablePath() */
View file
lightspark.tar.xz/src/plugin/plugin.h
Changed
@@ -33,6 +33,7 @@ #include "plugin/npscriptobject.h" #include <gtk/gtk.h> #include <gdk/gdk.h> +#include "backends/lsopengl.h" namespace lightspark { @@ -80,6 +81,22 @@ gulong inputHandlerId; gulong sizeHandlerId; GtkWidget* widget_gtk; +#ifdef _WIN32 + HGLRC mRC; + HDC mDC; +#else + Display* mDisplay; + Window mWindow; +#ifndef ENABLE_GLES2 + GLXFBConfig mFBConfig; + GLXContext mContext; +#else + EGLDisplay mEGLDisplay; + EGLContext mEGLContext; + EGLConfig mEGLConfig; + EGLSurface mEGLSurface; +#endif +#endif public: SystemState* sys; PluginEngineData(nsPluginInstance* i, uint32_t w, uint32_t h,SystemState* _sys) : instance(i),inputHandlerId(0),sizeHandlerId(0),widget_gtk(NULL),sys(_sys) @@ -106,6 +123,9 @@ void setClipboardText(const std::string txt); bool getScreenData(SDL_DisplayMode* screen); double getScreenDPI(); + void SwapBuffers(); + void InitOpenGL(); + void DeinitOpenGL(); }; class nsPluginInstance : public nsPluginInstanceBase
View file
lightspark.tar.xz/src/plugin_ppapi
Added
+(directory)
View file
lightspark.tar.xz/src/plugin_ppapi/CMakeLists.txt
Added
@@ -0,0 +1,39 @@ +#************************************************************************** +# Lightspark, a free flash player implementation +# +# Copyright (C) 2016 Ludger Krämer <dbluelle@onlinehome.de> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +#************************************************************************** + +include_directories(.) + +# PPAPI plugin target +SET(PPAPI_PLUGIN_SOURCES ${PPAPI_PLUGIN_SOURCES} + plugin.cpp + ) + +ADD_LIBRARY(pepflashplayer MODULE ${PPAPI_PLUGIN_SOURCES}) + +TARGET_LINK_LIBRARIES(pepflashplayer spark) + +#With STATICDEPS, all deps are compiled into spark +IF(NOT STATICDEPS) +TARGET_LINK_LIBRARIES(pepflashplayer spark ${X11_LIBRARIES} ${GLIBMM_LIBRARIES}) +ENDIF() + +PACK_LIBRARY(pepflashplayer) +INSTALL(TARGETS pepflashplayer DESTINATION ${PPAPI_PLUGIN_DIRECTORY}) +INSTALL(FILES manifest.json DESTINATION ${PPAPI_PLUGIN_DIRECTORY}) +
View file
lightspark.tar.xz/src/plugin_ppapi/GLES2
Added
+(directory)
View file
lightspark.tar.xz/src/plugin_ppapi/GLES2/gl2.h
Added
@@ -0,0 +1,789 @@ +#ifndef __gl2_h_ +#define __gl2_h_ + +/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ + +#include <GLES2/gl2platform.h> + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +/*------------------------------------------------------------------------- + * Data type definitions + *-----------------------------------------------------------------------*/ + +typedef void GLvoid; +typedef char GLchar; +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef khronos_int8_t GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef khronos_uint8_t GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef khronos_float_t GLfloat; +typedef khronos_float_t GLclampf; +typedef khronos_int32_t GLfixed; + +/* GL types for handling large vertex buffer objects */ +typedef khronos_intptr_t GLintptr; +typedef khronos_ssize_t GLsizeiptr; + +/* OpenGL ES core versions */ +#define GL_ES_VERSION_2_0 1 + +/* ClearBufferMask */ +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 + +/* Boolean */ +#define GL_FALSE 0 +#define GL_TRUE 1 + +/* BeginMode */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 + +/* AlphaFunction (not supported in ES20) */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* BlendingFactorDest */ +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 + +/* BlendingFactorSrc */ +/* GL_ZERO */ +/* GL_ONE */ +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +/* GL_SRC_ALPHA */ +/* GL_ONE_MINUS_SRC_ALPHA */ +/* GL_DST_ALPHA */ +/* GL_ONE_MINUS_DST_ALPHA */ + +/* BlendEquationSeparate */ +#define GL_FUNC_ADD 0x8006 +#define GL_BLEND_EQUATION 0x8009 +#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */ +#define GL_BLEND_EQUATION_ALPHA 0x883D + +/* BlendSubtract */ +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B + +/* Separate Blend Functions */ +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 + +/* Buffer Objects */ +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 + +#define GL_STREAM_DRAW 0x88E0 +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 + +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 + +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 + +/* CullFaceMode */ +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 + +/* DepthFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* EnableCap */ +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_BLEND 0x0BE2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_COVERAGE 0x80A0 + +/* ErrorCode */ +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_CONTEXT_LOST 0x300E // TODO(gman): What value? + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +/* GetPName */ +#define GL_LINE_WIDTH 0x0B21 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VIEWPORT 0x0BA2 +#define GL_SCISSOR_BOX 0x0C10 +/* GL_SCISSOR_TEST */ +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +/* GL_POLYGON_OFFSET_FILL */ +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB + +/* GetTextureParameter */ +/* GL_TEXTURE_MAG_FILTER */ +/* GL_TEXTURE_MIN_FILTER */ +/* GL_TEXTURE_WRAP_S */ +/* GL_TEXTURE_WRAP_T */ + +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 + +/* HintMode */ +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* HintTarget */ +#define GL_GENERATE_MIPMAP_HINT 0x8192 + +/* DataType */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_FIXED 0x140C + +/* PixelFormat */ +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A + +/* PixelType */ +/* GL_UNSIGNED_BYTE */ +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 + +/* Shaders */ +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_SHADER_TYPE 0x8B4F +#define GL_DELETE_STATUS 0x8B80 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D + +/* StencilFunction */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 + +/* StencilOp */ +/* GL_ZERO */ +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_INVERT 0x150A +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 + +/* StringName */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* TextureMagFilter */ +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 + +/* TextureMinFilter */ +/* GL_NEAREST */ +/* GL_LINEAR */ +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 + +/* TextureParameterName */ +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 + +/* TextureTarget */ +/* GL_TEXTURE_2D */ +#define GL_TEXTURE 0x1702 + +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C + +/* TextureUnit */ +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 + +/* TextureWrapMode */ +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MIRRORED_REPEAT 0x8370 + +/* Uniform Types */ +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_CUBE 0x8B60 + +/* Vertex Arrays */ +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F + +/* Read Format */ +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B + +/* Shader Source */ +#define GL_COMPILE_STATUS 0x8B81 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_SHADER_COMPILER 0x8DFA + +/* Shader Binary */ +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 + +/* Shader Precision-Specified Types */ +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 + +/* Framebuffer Object. */ +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 + +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGB565 0x8D62 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_STENCIL_INDEX 0x1901 +#define GL_STENCIL_INDEX8 0x8D48 + +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 + +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 + +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 + +#define GL_NONE 0 + +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD + +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 + +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 + +// Note: If your program is written in C++ you can define +// GLES2_INLINE_OPTIMIZATION to get an inline version of the OpenGL ES 2.0 +// code for your program. The advantage is a program compiled with high +// optimization settings can generate very efficient code for issuing OpenGL ES +// commands. The disadvantage is there is a small possibility of conflicts with +// your code as we need to include lots of class definitions and a few +// macros. + +#if defined(__cplusplus) && defined(GLES2_INLINE_OPTIMIZATION) +#include "../command_buffer/client/gles2_lib.h" +#define GLES2_USE_CPP_BINDINGS +#endif + +#if defined(GLES2_USE_CPP_BINDINGS) +#define GLES2_GET_FUN(name) gles2::GetGLContext()->name +#else +#define GLES2_GET_FUN(name) GLES2 ## name +#endif + +/*------------------------------------------------------------------------- + * GL core functions. + *-----------------------------------------------------------------------*/ + +#define glActiveTexture GLES2_GET_FUN(ActiveTexture) +#define glAttachShader GLES2_GET_FUN(AttachShader) +#define glBindAttribLocation GLES2_GET_FUN(BindAttribLocation) +#define glBindBuffer GLES2_GET_FUN(BindBuffer) +#define glBindFramebuffer GLES2_GET_FUN(BindFramebuffer) +#define glBindRenderbuffer GLES2_GET_FUN(BindRenderbuffer) +#define glBindTexture GLES2_GET_FUN(BindTexture) +#define glBlendColor GLES2_GET_FUN(BlendColor) +#define glBlendEquation GLES2_GET_FUN(BlendEquation) +#define glBlendEquationSeparate GLES2_GET_FUN(BlendEquationSeparate) +#define glBlendFunc GLES2_GET_FUN(BlendFunc) +#define glBlendFuncSeparate GLES2_GET_FUN(BlendFuncSeparate) +#define glBufferData GLES2_GET_FUN(BufferData) +#define glBufferSubData GLES2_GET_FUN(BufferSubData) +#define glCheckFramebufferStatus GLES2_GET_FUN(CheckFramebufferStatus) +#define glClear GLES2_GET_FUN(Clear) +#define glClearColor GLES2_GET_FUN(ClearColor) +#define glClearDepthf GLES2_GET_FUN(ClearDepthf) +#define glClearStencil GLES2_GET_FUN(ClearStencil) +#define glColorMask GLES2_GET_FUN(ColorMask) +#define glCompileShader GLES2_GET_FUN(CompileShader) +#define glCompressedTexImage2D GLES2_GET_FUN(CompressedTexImage2D) +#define glCompressedTexSubImage2D GLES2_GET_FUN(CompressedTexSubImage2D) +#define glCopyTexImage2D GLES2_GET_FUN(CopyTexImage2D) +#define glCopyTexSubImage2D GLES2_GET_FUN(CopyTexSubImage2D) +#define glCreateProgram GLES2_GET_FUN(CreateProgram) +#define glCreateShader GLES2_GET_FUN(CreateShader) +#define glCullFace GLES2_GET_FUN(CullFace) +#define glDeleteBuffers GLES2_GET_FUN(DeleteBuffers) +#define glDeleteFramebuffers GLES2_GET_FUN(DeleteFramebuffers) +#define glDeleteProgram GLES2_GET_FUN(DeleteProgram) +#define glDeleteRenderbuffers GLES2_GET_FUN(DeleteRenderbuffers) +#define glDeleteShader GLES2_GET_FUN(DeleteShader) +#define glDeleteTextures GLES2_GET_FUN(DeleteTextures) +#define glDepthFunc GLES2_GET_FUN(DepthFunc) +#define glDepthMask GLES2_GET_FUN(DepthMask) +#define glDepthRangef GLES2_GET_FUN(DepthRangef) +#define glDetachShader GLES2_GET_FUN(DetachShader) +#define glDisable GLES2_GET_FUN(Disable) +#define glDisableVertexAttribArray GLES2_GET_FUN(DisableVertexAttribArray) +#define glDrawArrays GLES2_GET_FUN(DrawArrays) +#define glDrawElements GLES2_GET_FUN(DrawElements) +#define glEnable GLES2_GET_FUN(Enable) +#define glEnableVertexAttribArray GLES2_GET_FUN(EnableVertexAttribArray) +#define glFinish GLES2_GET_FUN(Finish) +#define glFlush GLES2_GET_FUN(Flush) +#define glFramebufferRenderbuffer GLES2_GET_FUN(FramebufferRenderbuffer) +#define glFramebufferTexture2D GLES2_GET_FUN(FramebufferTexture2D) +#define glFrontFace GLES2_GET_FUN(FrontFace) +#define glGenBuffers GLES2_GET_FUN(GenBuffers) +#define glGenerateMipmap GLES2_GET_FUN(GenerateMipmap) +#define glGenFramebuffers GLES2_GET_FUN(GenFramebuffers) +#define glGenRenderbuffers GLES2_GET_FUN(GenRenderbuffers) +#define glGenTextures GLES2_GET_FUN(GenTextures) +#define glGetActiveAttrib GLES2_GET_FUN(GetActiveAttrib) +#define glGetActiveUniform GLES2_GET_FUN(GetActiveUniform) +#define glGetAttachedShaders GLES2_GET_FUN(GetAttachedShaders) +#define glGetAttribLocation GLES2_GET_FUN(GetAttribLocation) +#define glGetBooleanv GLES2_GET_FUN(GetBooleanv) +#define glGetBufferParameteriv GLES2_GET_FUN(GetBufferParameteriv) +#define glGetError GLES2_GET_FUN(GetError) +#define glGetFloatv GLES2_GET_FUN(GetFloatv) +#define glGetFramebufferAttachmentParameteriv GLES2_GET_FUN(GetFramebufferAttachmentParameteriv) +#define glGetIntegerv GLES2_GET_FUN(GetIntegerv) +#define glGetProgramiv GLES2_GET_FUN(GetProgramiv) +#define glGetProgramInfoLog GLES2_GET_FUN(GetProgramInfoLog) +#define glGetRenderbufferParameteriv GLES2_GET_FUN(GetRenderbufferParameteriv) +#define glGetShaderiv GLES2_GET_FUN(GetShaderiv) +#define glGetShaderInfoLog GLES2_GET_FUN(GetShaderInfoLog) +#define glGetShaderPrecisionFormat GLES2_GET_FUN(GetShaderPrecisionFormat) +#define glGetShaderSource GLES2_GET_FUN(GetShaderSource) +#define glGetString GLES2_GET_FUN(GetString) +#define glGetTexParameterfv GLES2_GET_FUN(GetTexParameterfv) +#define glGetTexParameteriv GLES2_GET_FUN(GetTexParameteriv) +#define glGetUniformfv GLES2_GET_FUN(GetUniformfv) +#define glGetUniformiv GLES2_GET_FUN(GetUniformiv) +#define glGetUniformLocation GLES2_GET_FUN(GetUniformLocation) +#define glGetVertexAttribfv GLES2_GET_FUN(GetVertexAttribfv) +#define glGetVertexAttribiv GLES2_GET_FUN(GetVertexAttribiv) +#define glGetVertexAttribPointerv GLES2_GET_FUN(GetVertexAttribPointerv) +#define glHint GLES2_GET_FUN(Hint) +#define glIsBuffer GLES2_GET_FUN(IsBuffer) +#define glIsEnabled GLES2_GET_FUN(IsEnabled) +#define glIsFramebuffer GLES2_GET_FUN(IsFramebuffer) +#define glIsProgram GLES2_GET_FUN(IsProgram) +#define glIsRenderbuffer GLES2_GET_FUN(IsRenderbuffer) +#define glIsShader GLES2_GET_FUN(IsShader) +#define glIsTexture GLES2_GET_FUN(IsTexture) +#define glLineWidth GLES2_GET_FUN(LineWidth) +#define glLinkProgram GLES2_GET_FUN(LinkProgram) +#define glPixelStorei GLES2_GET_FUN(PixelStorei) +#define glPolygonOffset GLES2_GET_FUN(PolygonOffset) +#define glReadPixels GLES2_GET_FUN(ReadPixels) +#define glReleaseShaderCompiler GLES2_GET_FUN(ReleaseShaderCompiler) +#define glRenderbufferStorage GLES2_GET_FUN(RenderbufferStorage) +#define glSampleCoverage GLES2_GET_FUN(SampleCoverage) +#define glScissor GLES2_GET_FUN(Scissor) +#define glShaderBinary GLES2_GET_FUN(ShaderBinary) +#define glShaderSource GLES2_GET_FUN(ShaderSource) +#define glStencilFunc GLES2_GET_FUN(StencilFunc) +#define glStencilFuncSeparate GLES2_GET_FUN(StencilFuncSeparate) +#define glStencilMask GLES2_GET_FUN(StencilMask) +#define glStencilMaskSeparate GLES2_GET_FUN(StencilMaskSeparate) +#define glStencilOp GLES2_GET_FUN(StencilOp) +#define glStencilOpSeparate GLES2_GET_FUN(StencilOpSeparate) +#define glTexImage2D GLES2_GET_FUN(TexImage2D) +#define glTexParameterf GLES2_GET_FUN(TexParameterf) +#define glTexParameterfv GLES2_GET_FUN(TexParameterfv) +#define glTexParameteri GLES2_GET_FUN(TexParameteri) +#define glTexParameteriv GLES2_GET_FUN(TexParameteriv) +#define glTexSubImage2D GLES2_GET_FUN(TexSubImage2D) +#define glUniform1f GLES2_GET_FUN(Uniform1f) +#define glUniform1fv GLES2_GET_FUN(Uniform1fv) +#define glUniform1i GLES2_GET_FUN(Uniform1i) +#define glUniform1iv GLES2_GET_FUN(Uniform1iv) +#define glUniform2f GLES2_GET_FUN(Uniform2f) +#define glUniform2fv GLES2_GET_FUN(Uniform2fv) +#define glUniform2i GLES2_GET_FUN(Uniform2i) +#define glUniform2iv GLES2_GET_FUN(Uniform2iv) +#define glUniform3f GLES2_GET_FUN(Uniform3f) +#define glUniform3fv GLES2_GET_FUN(Uniform3fv) +#define glUniform3i GLES2_GET_FUN(Uniform3i) +#define glUniform3iv GLES2_GET_FUN(Uniform3iv) +#define glUniform4f GLES2_GET_FUN(Uniform4f) +#define glUniform4fv GLES2_GET_FUN(Uniform4fv) +#define glUniform4i GLES2_GET_FUN(Uniform4i) +#define glUniform4iv GLES2_GET_FUN(Uniform4iv) +#define glUniformMatrix2fv GLES2_GET_FUN(UniformMatrix2fv) +#define glUniformMatrix3fv GLES2_GET_FUN(UniformMatrix3fv) +#define glUniformMatrix4fv GLES2_GET_FUN(UniformMatrix4fv) +#define glUseProgram GLES2_GET_FUN(UseProgram) +#define glValidateProgram GLES2_GET_FUN(ValidateProgram) +#define glVertexAttrib1f GLES2_GET_FUN(VertexAttrib1f) +#define glVertexAttrib1fv GLES2_GET_FUN(VertexAttrib1fv) +#define glVertexAttrib2f GLES2_GET_FUN(VertexAttrib2f) +#define glVertexAttrib2fv GLES2_GET_FUN(VertexAttrib2fv) +#define glVertexAttrib3f GLES2_GET_FUN(VertexAttrib3f) +#define glVertexAttrib3fv GLES2_GET_FUN(VertexAttrib3fv) +#define glVertexAttrib4f GLES2_GET_FUN(VertexAttrib4f) +#define glVertexAttrib4fv GLES2_GET_FUN(VertexAttrib4fv) +#define glVertexAttribPointer GLES2_GET_FUN(VertexAttribPointer) +#define glViewport GLES2_GET_FUN(Viewport) + +#if !defined(GLES2_USE_CPP_BINDINGS) + +#if defined(__cplusplus) +extern "C" { +#endif + +GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); +GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name); +GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode ); +GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); +GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); +GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); +GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); +GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); +GL_APICALL void GL_APIENTRY glClearStencil (GLint s); +GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); +GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); +GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); +GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); +GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers); +GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers); +GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); +GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers); +GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); +GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures); +GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); +GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); +GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); +GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glDisable (GLenum cap); +GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); +GL_APICALL void GL_APIENTRY glEnable (GLenum cap); +GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glFinish (void); +GL_APICALL void GL_APIENTRY glFlush (void); +GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); +GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); +GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); +GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers); +GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers); +GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); +GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); +GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); +GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); +GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL GLenum GL_APIENTRY glGetError (void); +GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); +GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); +GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); +GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); +GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); +GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); +GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); +GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); +GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); +GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); +GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); +GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); +GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); +GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); +GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); +GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); +GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); +GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length); +GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params); +GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params); +GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); +GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); +GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); +GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); +GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); +GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); +GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); +GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); +GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); + +#if defined(__cplusplus) +} +#endif + +#endif // !GLES2_USE_CPP_BINDINGS + +#endif /* __gl2_h_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/GLES2/gl2ext.h
Added
@@ -0,0 +1,1967 @@ +#ifndef __gl2ext_h_ +#define __gl2ext_h_ + +/* $Revision: 16619 $ on $Date:: 2012-01-18 10:00:14 -0800 #$ */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +#ifndef GL_APIENTRYP +# define GL_APIENTRYP GL_APIENTRY* +#endif + +/*------------------------------------------------------------------------* + * OES extension tokens + *------------------------------------------------------------------------*/ + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_ETC1_RGB8_OES 0x8D64 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#endif + +/* GL_OES_depth_texture */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +typedef void* GLeglImageOES; +#endif + +/* GL_OES_EGL_image_external */ +#ifndef GL_OES_EGL_image_external +/* GLeglImageOES defined in GL_OES_EGL_image already. */ +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_SAMPLER_EXTERNAL_OES 0x8D66 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 +#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_UNSIGNED_INT 0x1405 +#endif + +/* GL_OES_get_program_binary */ +#ifndef GL_OES_get_program_binary +#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE +#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_POINTER_OES 0x88BD +#endif + +/* GL_OES_packed_depth_stencil */ +#ifndef GL_OES_packed_depth_stencil +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_RGB8_OES 0x8051 +#define GL_RGBA8_OES 0x8058 +#endif + +/* GL_OES_standard_derivatives */ +#ifndef GL_OES_standard_derivatives +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_STENCIL_INDEX1_OES 0x8D46 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_STENCIL_INDEX4_OES 0x8D47 +#endif + +/* GL_OES_texture_3D */ +#ifndef GL_OES_texture_3D +#define GL_TEXTURE_WRAP_R_OES 0x8072 +#define GL_TEXTURE_3D_OES 0x806F +#define GL_TEXTURE_BINDING_3D_OES 0x806A +#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 +#define GL_SAMPLER_3D_OES 0x8B5F +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 +#endif + +/* GL_OES_texture_float */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_float_linear */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_half_float */ +#ifndef GL_OES_texture_half_float +#define GL_HALF_FLOAT_OES 0x8D61 +#endif + +/* GL_OES_texture_half_float_linear */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_npot */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_vertex_array_object */ +#ifndef GL_OES_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 +#endif + +/* GL_OES_vertex_half_float */ +/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */ + +/* GL_OES_vertex_type_10_10_10_2 */ +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 +#define GL_INT_10_10_10_2_OES 0x8DF7 +#endif + +/*------------------------------------------------------------------------* + * AMD extension tokens + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_3DC_X_AMD 0x87F9 +#define GL_3DC_XY_AMD 0x87FA +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#endif + +/* GL_AMD_performance_monitor */ +#ifndef GL_AMD_performance_monitor +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +#endif + +/* GL_AMD_program_binary_Z400 */ +#ifndef GL_AMD_program_binary_Z400 +#define GL_Z400_BINARY_AMD 0x8740 +#endif + +/*------------------------------------------------------------------------* + * ANGLE extension tokens + *------------------------------------------------------------------------*/ + +/* GL_ANGLE_framebuffer_blit */ +#ifndef GL_ANGLE_framebuffer_blit +#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA +#endif + +/* GL_ANGLE_framebuffer_multisample */ +#ifndef GL_ANGLE_framebuffer_multisample +#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 +#define GL_MAX_SAMPLES_ANGLE 0x8D57 +#endif + +/* GL_ANGLE_pack_reverse_row_order */ +#ifndef GL_ANGLE_pack_reverse_row_order +#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 +#endif + +/* GL_ANGLE_texture_usage */ +#ifndef GL_ANGLE_texture_usage +#define GL_TEXTURE_USAGE_ANGLE 0x93A2 +#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 +#endif + +/* GL_ANGLE_instanced_arrays */ +#ifndef GL_ANGLE_instanced_arrays +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE +#endif + +/*------------------------------------------------------------------------* + * APPLE extension tokens + *------------------------------------------------------------------------*/ + +/* GL_APPLE_rgb_422 */ +#ifndef GL_APPLE_rgb_422 +#define GL_RGB_422_APPLE 0x8A1F +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#endif + +/* GL_APPLE_framebuffer_multisample */ +#ifndef GL_APPLE_framebuffer_multisample +#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 +#define GL_MAX_SAMPLES_APPLE 0x8D57 +#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA +#endif + +/* GL_APPLE_texture_format_BGRA8888 */ +#ifndef GL_APPLE_texture_format_BGRA8888 +#define GL_BGRA_EXT 0x80E1 +#endif + +/* GL_APPLE_texture_max_level */ +#ifndef GL_APPLE_texture_max_level +#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D +#endif + +/*------------------------------------------------------------------------* + * ARM extension tokens + *------------------------------------------------------------------------*/ + +/* GL_ARM_mali_shader_binary */ +#ifndef GL_ARM_mali_shader_binary +#define GL_MALI_SHADER_BINARY_ARM 0x8F60 +#endif + +/* GL_ARM_rgba8 */ +/* No new tokens introduced by this extension. */ + +/*------------------------------------------------------------------------* + * EXT extension tokens + *------------------------------------------------------------------------*/ + +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#endif + +/* GL_EXT_color_buffer_half_float */ +#ifndef GL_EXT_color_buffer_half_float +#define GL_RGBA16F_EXT 0x881A +#define GL_RGB16F_EXT 0x881B +#define GL_RG16F_EXT 0x822F +#define GL_R16F_EXT 0x822D +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 +#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 +#endif + +/* GL_EXT_debug_label */ +#ifndef GL_EXT_debug_label +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +#endif + +/* GL_EXT_debug_marker */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_discard_framebuffer */ +#ifndef GL_EXT_discard_framebuffer +#define GL_COLOR_EXT 0x1800 +#define GL_DEPTH_EXT 0x1801 +#define GL_STENCIL_EXT 0x1802 +#endif + +/* GL_EXT_multisampled_render_to_texture */ +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 +#endif + +/* GL_EXT_multi_draw_arrays */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_occlusion_query_boolean */ +#ifndef GL_EXT_occlusion_query_boolean +#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A +#define GL_CURRENT_QUERY_EXT 0x8865 +#define GL_QUERY_RESULT_EXT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 +#endif + +/* GL_EXT_read_format_bgra */ +#ifndef GL_EXT_read_format_bgra +#define GL_BGRA_EXT 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 +#endif + +/* GL_EXT_robustness */ +#ifndef GL_EXT_robustness +/* reuse GL_NO_ERROR */ +#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 +#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 +#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 +#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 +#endif + +/* GL_EXT_separate_shader_objects */ +#ifndef GL_EXT_separate_shader_objects +#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 +#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE_EXT 0x8258 +#define GL_ACTIVE_PROGRAM_EXT 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A +#endif + +/* GL_EXT_shader_texture_lod */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_shadow_samplers */ +#ifndef GL_EXT_shadow_samplers +#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C +#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D +#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E +#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 +#endif + +/* GL_EXT_sRGB */ +#ifndef GL_EXT_sRGB +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 +#endif + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +/* GL_EXT_texture_format_BGRA8888 */ +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_BGRA_EXT 0x80E1 +#endif + +/* GL_EXT_texture_rg */ +#ifndef GL_EXT_texture_rg +#define GL_RED_EXT 0x1903 +#define GL_RG_EXT 0x8227 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#endif + +/* GL_EXT_texture_storage */ +#ifndef GL_EXT_texture_storage +#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F +#define GL_ALPHA8_EXT 0x803C +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_RGBA32F_EXT 0x8814 +#define GL_RGB32F_EXT 0x8815 +#define GL_ALPHA32F_EXT 0x8816 +#define GL_LUMINANCE32F_EXT 0x8818 +#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 +/* reuse GL_RGBA16F_EXT */ +#define GL_RGB16F_EXT 0x881B +#define GL_ALPHA16F_EXT 0x881C +#define GL_LUMINANCE16F_EXT 0x881E +#define GL_LUMINANCE_ALPHA16F_EXT 0x881F +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGB10_EXT 0x8052 +#define GL_BGRA8_EXT 0x93A1 +#endif + +/* GL_EXT_texture_type_2_10_10_10_REV */ +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 +#endif + +/* GL_EXT_unpack_subimage */ +#ifndef GL_EXT_unpack_subimage +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#endif + +/*------------------------------------------------------------------------* + * DMP extension tokens + *------------------------------------------------------------------------*/ + +/* GL_DMP_shader_binary */ +#ifndef GL_DMP_shader_binary +#define GL_SHADER_BINARY_DMP 0x9250 +#endif + +/*------------------------------------------------------------------------* + * IMG extension tokens + *------------------------------------------------------------------------*/ + +/* GL_IMG_program_binary */ +#ifndef GL_IMG_program_binary +#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 +#endif + +/* GL_IMG_read_format */ +#ifndef GL_IMG_read_format +#define GL_BGRA_IMG 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 +#endif + +/* GL_IMG_shader_binary */ +#ifndef GL_IMG_shader_binary +#define GL_SGX_BINARY_IMG 0x8C0A +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 +#endif + +/* GL_IMG_multisampled_render_to_texture */ +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 +#define GL_MAX_SAMPLES_IMG 0x9135 +#define GL_TEXTURE_SAMPLES_IMG 0x9136 +#endif + +/*------------------------------------------------------------------------* + * NV extension tokens + *------------------------------------------------------------------------*/ + +/* GL_NV_coverage_sample */ +#ifndef GL_NV_coverage_sample +#define GL_COVERAGE_COMPONENT_NV 0x8ED0 +#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 +#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 +#define GL_COVERAGE_BUFFERS_NV 0x8ED3 +#define GL_COVERAGE_SAMPLES_NV 0x8ED4 +#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 +#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 +#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 +#define GL_COVERAGE_BUFFER_BIT_NV 0x8000 +#endif + +/* GL_NV_depth_nonlinear */ +#ifndef GL_NV_depth_nonlinear +#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C +#endif + +/* GL_NV_draw_buffers */ +#ifndef GL_NV_draw_buffers +#define GL_MAX_DRAW_BUFFERS_NV 0x8824 +#define GL_DRAW_BUFFER0_NV 0x8825 +#define GL_DRAW_BUFFER1_NV 0x8826 +#define GL_DRAW_BUFFER2_NV 0x8827 +#define GL_DRAW_BUFFER3_NV 0x8828 +#define GL_DRAW_BUFFER4_NV 0x8829 +#define GL_DRAW_BUFFER5_NV 0x882A +#define GL_DRAW_BUFFER6_NV 0x882B +#define GL_DRAW_BUFFER7_NV 0x882C +#define GL_DRAW_BUFFER8_NV 0x882D +#define GL_DRAW_BUFFER9_NV 0x882E +#define GL_DRAW_BUFFER10_NV 0x882F +#define GL_DRAW_BUFFER11_NV 0x8830 +#define GL_DRAW_BUFFER12_NV 0x8831 +#define GL_DRAW_BUFFER13_NV 0x8832 +#define GL_DRAW_BUFFER14_NV 0x8833 +#define GL_DRAW_BUFFER15_NV 0x8834 +#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 +#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 +#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 +#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 +#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 +#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 +#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 +#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 +#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 +#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 +#define GL_COLOR_ATTACHMENT10_NV 0x8CEA +#define GL_COLOR_ATTACHMENT11_NV 0x8CEB +#define GL_COLOR_ATTACHMENT12_NV 0x8CEC +#define GL_COLOR_ATTACHMENT13_NV 0x8CED +#define GL_COLOR_ATTACHMENT14_NV 0x8CEE +#define GL_COLOR_ATTACHMENT15_NV 0x8CEF +#endif + +/* GL_NV_fbo_color_attachments */ +#ifndef GL_NV_fbo_color_attachments +#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF +/* GL_COLOR_ATTACHMENT{0-15}_NV defined in GL_NV_draw_buffers already. */ +#endif + +/* GL_NV_fence */ +#ifndef GL_NV_fence +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif + +/* GL_NV_read_buffer */ +#ifndef GL_NV_read_buffer +#define GL_READ_BUFFER_NV 0x0C02 +#endif + +/* GL_NV_read_buffer_front */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_read_depth */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_read_depth_stencil */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_read_stencil */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_texture_compression_s3tc_update */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_texture_npot_2D_mipmap */ +/* No new tokens introduced by this extension. */ + +/*------------------------------------------------------------------------* + * QCOM extension tokens + *------------------------------------------------------------------------*/ + +/* GL_QCOM_alpha_test */ +#ifndef GL_QCOM_alpha_test +#define GL_ALPHA_TEST_QCOM 0x0BC0 +#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 +#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 +#endif + +/* GL_QCOM_driver_control */ +/* No new tokens introduced by this extension. */ + +/* GL_QCOM_extended_get */ +#ifndef GL_QCOM_extended_get +#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 +#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 +#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 +#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 +#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 +#define GL_TEXTURE_TYPE_QCOM 0x8BD7 +#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 +#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 +#define GL_TEXTURE_TARGET_QCOM 0x8BDA +#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB +#define GL_STATE_RESTORE 0x8BDC +#endif + +/* GL_QCOM_extended_get2 */ +/* No new tokens introduced by this extension. */ + +/* GL_QCOM_perfmon_global_mode */ +#ifndef GL_QCOM_perfmon_global_mode +#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 +#endif + +/* GL_QCOM_writeonly_rendering */ +#ifndef GL_QCOM_writeonly_rendering +#define GL_WRITEONLY_RENDERING_QCOM 0x8823 +#endif + +/* GL_QCOM_tiled_rendering */ +#ifndef GL_QCOM_tiled_rendering +#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 +#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 +#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 +#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 +#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 +#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 +#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 +#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 +#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 +#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 +#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 +#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 +#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 +#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 +#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 +#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 +#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 +#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 +#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 +#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 +#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 +#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 +#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 +#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 +#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 +#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 +#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 +#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 +#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 +#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 +#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 +#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 +#endif + +/*------------------------------------------------------------------------* + * VIV extension tokens + *------------------------------------------------------------------------*/ + +/* GL_VIV_shader_binary */ +#ifndef GL_VIV_shader_binary +#define GL_SHADER_BINARY_VIV 0x8FC4 +#endif + +/*------------------------------------------------------------------------* + * End of extension tokens, start of corresponding extension functions + *------------------------------------------------------------------------*/ + +/*------------------------------------------------------------------------* + * OES extension functions + *------------------------------------------------------------------------*/ + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_OES_compressed_ETC1_RGB8_texture 1 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_OES_depth24 1 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_OES_depth32 1 +#endif + +/* GL_OES_depth_texture */ +#ifndef GL_OES_depth_texture +#define GL_OES_depth_texture 1 +#endif + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glEGLImageTargetTexture2DOES GLES2_GET_FUN(EGLImageTargetTexture2DOES) +#define glEGLImageTargetRenderbufferStorageOES GLES2_GET_FUN(EGLImageTargetRenderbufferStorageOES) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +#endif + +/* GL_OES_EGL_image_external */ +#ifndef GL_OES_EGL_image_external +#define GL_OES_EGL_image_external 1 +/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */ +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_OES_element_index_uint 1 +#endif + +/* GL_OES_fbo_render_mipmap */ +#ifndef GL_OES_fbo_render_mipmap +#define GL_OES_fbo_render_mipmap 1 +#endif + +/* GL_OES_fragment_precision_high */ +#ifndef GL_OES_fragment_precision_high +#define GL_OES_fragment_precision_high 1 +#endif + +/* GL_OES_get_program_binary */ +#ifndef GL_OES_get_program_binary +#define GL_OES_get_program_binary 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glGetProgramBinaryOES GLES2_GET_FUN(GetProgramBinaryOES) +#define glProgramBinaryOES GLES2_GET_FUN(ProgramBinaryOES) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_OES_mapbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glMapBufferOES GLES2_GET_FUN(MapBufferOES) +#define glUnmapBufferOES GLES2_GET_FUN(UnmapBufferOES) +#define glGetBufferPointervOES GLES2_GET_FUN(GetBufferPointervOES) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); +GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); +GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params); +#endif +#endif +typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params); +#endif + +/* GL_OES_packed_depth_stencil */ +#ifndef GL_OES_packed_depth_stencil +#define GL_OES_packed_depth_stencil 1 +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_OES_rgb8_rgba8 1 +#endif + +/* GL_OES_standard_derivatives */ +#ifndef GL_OES_standard_derivatives +#define GL_OES_standard_derivatives 1 +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_OES_stencil1 1 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_OES_stencil4 1 +#endif + +/* GL_OES_texture_3D */ +#ifndef GL_OES_texture_3D +#define GL_OES_texture_3D 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glTexImage3DOES GLES2_GET_FUN(TexImage3DOES) +#define glTexSubImage3DOES GLES2_GET_FUN(TexSubImage3DOES) +#define glCopyTexSubImage3DOES GLES2_GET_FUN(CopyTexSubImage3DOES) +#define glCompressedTexImage3DOES GLES2_GET_FUN(CompressedTexImage3DOES) +#define glCompressedTexSubImage3DOES GLES2_GET_FUN(CompressedTexSubImage3DOES) +#define glFramebufferTexture3DOES GLES2_GET_FUN(FramebufferTexture3DOES) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif + +/* GL_OES_texture_float */ +#ifndef GL_OES_texture_float +#define GL_OES_texture_float 1 +#endif + +/* GL_OES_texture_float_linear */ +#ifndef GL_OES_texture_float_linear +#define GL_OES_texture_float_linear 1 +#endif + +/* GL_OES_texture_half_float */ +#ifndef GL_OES_texture_half_float +#define GL_OES_texture_half_float 1 +#endif + +/* GL_OES_texture_half_float_linear */ +#ifndef GL_OES_texture_half_float_linear +#define GL_OES_texture_half_float_linear 1 +#endif + +/* GL_OES_texture_npot */ +#ifndef GL_OES_texture_npot +#define GL_OES_texture_npot 1 +#endif + +/* GL_OES_vertex_array_object */ +#ifndef GL_OES_vertex_array_object +#define GL_OES_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glBindVertexArrayOES GLES2_GET_FUN(BindVertexArrayOES) +#define glDeleteVertexArraysOES GLES2_GET_FUN(DeleteVertexArraysOES) +#define glGenVertexArraysOES GLES2_GET_FUN(GenVertexArraysOES) +#define glIsVertexArrayOES GLES2_GET_FUN(IsVertexArrayOES) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array); +GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); +GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); +GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); +typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); +typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); +#endif + +/* GL_OES_vertex_half_float */ +#ifndef GL_OES_vertex_half_float +#define GL_OES_vertex_half_float 1 +#endif + +/* GL_OES_vertex_type_10_10_10_2 */ +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_OES_vertex_type_10_10_10_2 1 +#endif + +/*------------------------------------------------------------------------* + * AMD extension functions + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_AMD_compressed_3DC_texture 1 +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_AMD_compressed_ATC_texture 1 +#endif + +/* AMD_performance_monitor */ +#ifndef GL_AMD_performance_monitor +#define GL_AMD_performance_monitor 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glGetPerfMonitorGroupsAMD GLES2_GET_FUN(GetPerfMonitorGroupsAMD) +#define glGetPerfMonitorCountersAMD GLES2_GET_FUN(GetPerfMonitorCountersAMD) +#define glGetPerfMonitorGroupStringAMD GLES2_GET_FUN(GetPerfMonitorGroupStringAMD) +#define glGetPerfMonitorCounterStringAMD GLES2_GET_FUN(GetPerfMonitorCounterStringAMD) +#define glGetPerfMonitorCounterInfoAMD GLES2_GET_FUN(GetPerfMonitorCounterInfoAMD) +#define glGenPerfMonitorsAMD GLES2_GET_FUN(GenPerfMonitorsAMD) +#define glDeletePerfMonitorsAMD GLES2_GET_FUN(DeletePerfMonitorsAMD) +#define glSelectPerfMonitorCountersAMD GLES2_GET_FUN(SelectPerfMonitorCountersAMD) +#define glBeginPerfMonitorAMD GLES2_GET_FUN(BeginPerfMonitorAMD) +#define glEndPerfMonitorAMD GLES2_GET_FUN(EndPerfMonitorAMD) +#define glGetPerfMonitorCounterDataAMD GLES2_GET_FUN(GetPerfMonitorCounterDataAMD) + +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data); +GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); +GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data); +typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); +typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif + +/* GL_AMD_program_binary_Z400 */ +#ifndef GL_AMD_program_binary_Z400 +#define GL_AMD_program_binary_Z400 1 +#endif + +/*------------------------------------------------------------------------* + * ANGLE extension functions + *------------------------------------------------------------------------*/ + +/* GL_ANGLE_framebuffer_blit */ +#ifndef GL_ANGLE_framebuffer_blit +#define GL_ANGLE_framebuffer_blit 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glBlitFramebufferANGLE GLES2_GET_FUN(BlitFramebufferANGLE) + +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif + +/* GL_ANGLE_framebuffer_multisample */ +#ifndef GL_ANGLE_framebuffer_multisample +#define GL_ANGLE_framebuffer_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glRenderbufferStorageMultisampleANGLE GLES2_GET_FUN(RenderbufferStorageMultisampleANGLE) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif + +/* GL_ANGLE_instanced_arrays */ +#ifndef GL_ANGLE_instanced_arrays +#define GL_ANGLE_instanced_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE(GLuint index, GLuint divisor); +GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +#endif +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +#endif + +/*------------------------------------------------------------------------* + * APPLE extension functions + *------------------------------------------------------------------------*/ + +/* GL_APPLE_rgb_422 */ +#ifndef GL_APPLE_rgb_422 +#define GL_APPLE_rgb_422 1 +#endif + +/* GL_APPLE_framebuffer_multisample */ +#ifndef GL_APPLE_framebuffer_multisample +#define GL_APPLE_framebuffer_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glRenderbufferStorageMultisampleAPPLE GLES2_GET_FUN(RenderbufferStorageMultisampleAPPLE) +#define glResolveMultisampleFramebufferAPPLE GLES2_GET_FUN(ResolveMultisampleFramebufferAPPLE) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void); +#endif +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); +#endif + +/* GL_APPLE_texture_format_BGRA8888 */ +#ifndef GL_APPLE_texture_format_BGRA8888 +#define GL_APPLE_texture_format_BGRA8888 1 +#endif + +/* GL_APPLE_texture_max_level */ +#ifndef GL_APPLE_texture_max_level +#define GL_APPLE_texture_max_level 1 +#endif + +/*------------------------------------------------------------------------* + * ARM extension functions + *------------------------------------------------------------------------*/ + +/* GL_ARM_mali_shader_binary */ +#ifndef GL_ARM_mali_shader_binary +#define GL_ARM_mali_shader_binary 1 +#endif + +/* GL_ARM_rgba8 */ +#ifndef GL_ARM_rgba8 +#define GL_ARM_rgba8 1 +#endif + +/*------------------------------------------------------------------------* + * EXT extension functions + *------------------------------------------------------------------------*/ + +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#endif + +/* GL_EXT_color_buffer_half_float */ +#ifndef GL_EXT_color_buffer_half_float +#define GL_EXT_color_buffer_half_float 1 +#endif + +/* GL_EXT_debug_label */ +#ifndef GL_EXT_debug_label +#define GL_EXT_debug_label 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glLabelObjectEXT GLES2_GET_FUN(LabelObjectEXT) +#define glGetObjectLabelEXT GLES2_GET_FUN(GetObjectLabelEXT) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif + +/* GL_EXT_debug_marker */ +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glInsertEventMarkerEXT GLES2_GET_FUN(InsertEventMarkerEXT) +#define glPushGroupMarkerEXT GLES2_GET_FUN(PushGroupMarkerEXT) +#define glPopGroupMarkerEXT GLES2_GET_FUN(PopGroupMarkerEXT) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); +#endif + +/* GL_EXT_discard_framebuffer */ +#ifndef GL_EXT_discard_framebuffer +#define GL_EXT_discard_framebuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glDiscardFramebufferEXT GLES2_GET_FUN(DiscardFramebufferEXT) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif + +/* GL_EXT_multisampled_render_to_texture */ +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_EXT_multisampled_render_to_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glRenderbufferStorageMultisampleEXT GLES2_GET_FUN(RenderbufferStorageMultisampleEXT) +#define glFramebufferTexture2DMultisampleEXT GLES2_GET_FUN(FramebufferTexture2DMultisampleEXT) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glMultiDrawArraysEXT GLES2_GET_FUN(MultiDrawArraysEXT) +#define glMultiDrawElementsEXT GLES2_GET_FUN(MultiDrawElementsEXT) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +#endif +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif + +/* GL_EXT_occlusion_query_boolean */ +#ifndef GL_EXT_occlusion_query_boolean +#define GL_EXT_occlusion_query_boolean 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glGenQueriesEXT GLES2_GET_FUN(GenQueriesEXT) +#define glDeleteQueriesEXT GLES2_GET_FUN(DeleteQueriesEXT) +#define glIsQueryEXT GLES2_GET_FUN(IsQueryEXT) +#define glBeginQueryEXT GLES2_GET_FUN(BeginQueryEXT) +#define glEndQueryEXT GLES2_GET_FUN(EndQueryEXT) +#define glGetQueryivEXT GLES2_GET_FUN(GetQueryivEXT) +#define glGetQueryObjectuivEXT GLES2_GET_FUN(GetQueryObjectuivEXT) + +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); +GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); +GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id); +GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id); +GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target); +GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); +typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); +typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); +typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +/* GL_EXT_read_format_bgra */ +#ifndef GL_EXT_read_format_bgra +#define GL_EXT_read_format_bgra 1 +#endif + +/* GL_EXT_robustness */ +#ifndef GL_EXT_robustness +#define GL_EXT_robustness 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glGetGraphicsResetStatusEXT GLES2_GET_FUN(GetGraphicsResetStatusEXT) +#define glReadnPixelsEXT GLES2_GET_FUN(ReadnPixelsEXT) +#define glGetnUniformfvEXT GLES2_GET_FUN(GetnUniformfvEXT) +#define glGetnUniformivEXT GLES2_GET_FUN(GetnUniformivEXT) + +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void); +GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params); +GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif +#endif +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif + +/* GL_EXT_separate_shader_objects */ +#ifndef GL_EXT_separate_shader_objects +#define GL_EXT_separate_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glUseProgramStagesEXT GLES2_GET_FUN(UseProgramStagesEXT) +#define glActiveShaderProgramEXT GLES2_GET_FUN(ActiveShaderProgramEXT) +#define glCreateShaderProgramvEXT GLES2_GET_FUN(CreateShaderProgramvEXT) +#define glBindProgramPipelineEXT GLES2_GET_FUN(BindProgramPipelineEXT) +#define glDeleteProgramPipelinesEXT GLES2_GET_FUN(DeleteProgramPipelinesEXT) +#define glGenProgramPipelinesEXT GLES2_GET_FUN(GenProgramPipelinesEXT) +#define glIsProgramPipelineEXT GLES2_GET_FUN(IsProgramPipelineEXT) +#define glProgramParameteriEXT GLES2_GET_FUN(ProgramParameteriEXT) +#define glGetProgramPipelineivEXT GLES2_GET_FUN(GetProgramPipelineivEXT) +#define glProgramUniform1iEXT GLES2_GET_FUN(ProgramUniform1iEXT) +#define glProgramUniform2iEXT GLES2_GET_FUN(ProgramUniform2iEXT) +#define glProgramUniform3iEXT GLES2_GET_FUN(ProgramUniform3iEXT) +#define glProgramUniform4iEXT GLES2_GET_FUN(ProgramUniform4iEXT) +#define glProgramUniform1fEXT GLES2_GET_FUN(ProgramUniform1fEXT) +#define glProgramUniform2fEXT GLES2_GET_FUN(ProgramUniform2fEXT) +#define glProgramUniform3fEXT GLES2_GET_FUN(ProgramUniform3fEXT) +#define glProgramUniform4fEXT GLES2_GET_FUN(ProgramUniform4fEXT) +#define glProgramUniform1ivEXT GLES2_GET_FUN(ProgramUniform1ivEXT) +#define glProgramUniform2ivEXT GLES2_GET_FUN(ProgramUniform2ivEXT) +#define glProgramUniform3ivEXT GLES2_GET_FUN(ProgramUniform3ivEXT) +#define glProgramUniform4ivEXT GLES2_GET_FUN(ProgramUniform4ivEXT) +#define glProgramUniform1fvEXT GLES2_GET_FUN(ProgramUniform1fvEXT) +#define glProgramUniform2fvEXT GLES2_GET_FUN(ProgramUniform2fvEXT) +#define glProgramUniform3fvEXT GLES2_GET_FUN(ProgramUniform3fvEXT) +#define glProgramUniform4fvEXT GLES2_GET_FUN(ProgramUniform4fvEXT) +#define glProgramUniformMatrix2fvEXT GLES2_GET_FUN(ProgramUniformMatrix2fvEXT) +#define glProgramUniformMatrix3fvEXT GLES2_GET_FUN(ProgramUniformMatrix3fvEXT) +#define glProgramUniformMatrix4fvEXT GLES2_GET_FUN(ProgramUniformMatrix4fvEXT) +#define glValidateProgramPipelineEXT GLES2_GET_FUN(ValidateProgramPipelineEXT) +#define glGetProgramPipelineInfoLogEXT GLES2_GET_FUN(GetProgramPipelineInfoLogEXT) + +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); +GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program); +GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); +GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines); +GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines); +GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x); +GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y); +GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z); +GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); +GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x); +GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); +typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); +typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); +typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif + +/* GL_EXT_shader_texture_lod */ +#ifndef GL_EXT_shader_texture_lod +#define GL_EXT_shader_texture_lod 1 +#endif + +/* GL_EXT_shadow_samplers */ +#ifndef GL_EXT_shadow_samplers +#define GL_EXT_shadow_samplers 1 +#endif + +/* GL_EXT_sRGB */ +#ifndef GL_EXT_sRGB +#define GL_EXT_sRGB 1 +#endif + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_EXT_texture_compression_dxt1 1 +#endif + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +/* GL_EXT_texture_format_BGRA8888 */ +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_EXT_texture_format_BGRA8888 1 +#endif + +/* GL_EXT_texture_rg */ +#ifndef GL_EXT_texture_rg +#define GL_EXT_texture_rg 1 +#endif + +/* GL_EXT_texture_storage */ +#ifndef GL_EXT_texture_storage +#define GL_EXT_texture_storage 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glTexStorage1DEXT GLES2_GET_FUN(TexStorage1DEXT) +#define glTexStorage2DEXT GLES2_GET_FUN(TexStorage2DEXT) +#define glTexStorage3DEXT GLES2_GET_FUN(TexStorage3DEXT) +#define glTextureStorage1DEXT GLES2_GET_FUN(TextureStorage1DEXT) +#define glTextureStorage2DEXT GLES2_GET_FUN(TextureStorage2DEXT) +#define glTextureStorage3DEXT GLES2_GET_FUN(TextureStorage3DEXT) + +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif + +/* GL_EXT_texture_type_2_10_10_10_REV */ +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_EXT_texture_type_2_10_10_10_REV 1 +#endif + +/* GL_EXT_unpack_subimage */ +#ifndef GL_EXT_unpack_subimage +#define GL_EXT_unpack_subimage 1 +#endif + +/*------------------------------------------------------------------------* + * DMP extension functions + *------------------------------------------------------------------------*/ + +/* GL_DMP_shader_binary */ +#ifndef GL_DMP_shader_binary +#define GL_DMP_shader_binary 1 +#endif + +/*------------------------------------------------------------------------* + * IMG extension functions + *------------------------------------------------------------------------*/ + +/* GL_IMG_program_binary */ +#ifndef GL_IMG_program_binary +#define GL_IMG_program_binary 1 +#endif + +/* GL_IMG_read_format */ +#ifndef GL_IMG_read_format +#define GL_IMG_read_format 1 +#endif + +/* GL_IMG_shader_binary */ +#ifndef GL_IMG_shader_binary +#define GL_IMG_shader_binary 1 +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_IMG_texture_compression_pvrtc 1 +#endif + +/* GL_IMG_multisampled_render_to_texture */ +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_IMG_multisampled_render_to_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glRenderbufferStorageMultisampleIMG GLES2_GET_FUN(RenderbufferStorageMultisampleIMG) +#define glFramebufferTexture2DMultisampleIMG GLES2_GET_FUN(FramebufferTexture2DMultisampleIMG) + +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif + +/*------------------------------------------------------------------------* + * NV extension functions + *------------------------------------------------------------------------*/ + +/* GL_NV_coverage_sample */ +#ifndef GL_NV_coverage_sample +#define GL_NV_coverage_sample 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glCoverageMaskNV GLES2_GET_FUN(CoverageMaskNV) +#define glCoverageOperationNV GLES2_GET_FUN(CoverageOperationNV) + +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask); +GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); +typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); +#endif + +/* GL_NV_depth_nonlinear */ +#ifndef GL_NV_depth_nonlinear +#define GL_NV_depth_nonlinear 1 +#endif + +/* GL_NV_draw_buffers */ +#ifndef GL_NV_draw_buffers +#define GL_NV_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glDrawBuffersNV GLES2_GET_FUN(DrawBuffersNV) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); +#endif + +/* GL_NV_fbo_color_attachments */ +#ifndef GL_NV_fbo_color_attachments +#define GL_NV_fbo_color_attachments 1 +#endif + +/* GL_NV_fence */ +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glDeleteFencesNV GLES2_GET_FUN(DeleteFencesNV) +#define glGenFencesNV GLES2_GET_FUN(GenFencesNV) +#define glIsFenceNV GLES2_GET_FUN(IsFenceNV) +#define glTestFenceNV GLES2_GET_FUN(TestFenceNV) +#define glGetFenceivNV GLES2_GET_FUN(GetFenceivNV) +#define glFinishFenceNV GLES2_GET_FUN(FinishFenceNV) +#define glSetFenceNV GLES2_GET_FUN(SetFenceNV) + +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); +GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *); +GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint); +GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint); +GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); +GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint); +GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint, GLenum); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#endif + +/* GL_NV_read_buffer */ +#ifndef GL_NV_read_buffer +#define GL_NV_read_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glReadBufferNV GLES2_GET_FUN(ReadBufferNV) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); +#endif + +/* GL_NV_read_buffer_front */ +#ifndef GL_NV_read_buffer_front +#define GL_NV_read_buffer_front 1 +#endif + +/* GL_NV_read_depth */ +#ifndef GL_NV_read_depth +#define GL_NV_read_depth 1 +#endif + +/* GL_NV_read_depth_stencil */ +#ifndef GL_NV_read_depth_stencil +#define GL_NV_read_depth_stencil 1 +#endif + +/* GL_NV_read_stencil */ +#ifndef GL_NV_read_stencil +#define GL_NV_read_stencil 1 +#endif + +/* GL_NV_texture_compression_s3tc_update */ +#ifndef GL_NV_texture_compression_s3tc_update +#define GL_NV_texture_compression_s3tc_update 1 +#endif + +/* GL_NV_texture_npot_2D_mipmap */ +#ifndef GL_NV_texture_npot_2D_mipmap +#define GL_NV_texture_npot_2D_mipmap 1 +#endif + +/*------------------------------------------------------------------------* + * QCOM extension functions + *------------------------------------------------------------------------*/ + +/* GL_QCOM_alpha_test */ +#ifndef GL_QCOM_alpha_test +#define GL_QCOM_alpha_test 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glAlphaFuncQCOM GLES2_GET_FUN(AlphaFuncQCOM) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref); +#endif + +/* GL_QCOM_driver_control */ +#ifndef GL_QCOM_driver_control +#define GL_QCOM_driver_control 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glGetDriverControlsQCOM GLES2_GET_FUN(GetDriverControlsQCOM) +#define glGetDriverControlStringQCOM GLES2_GET_FUN(GetDriverControlStringQCOM) +#define glEnableDriverControlQCOM GLES2_GET_FUN(EnableDriverControlQCOM) +#define glDisableDriverControlQCOM GLES2_GET_FUN(DisableDriverControlQCOM) + +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); +GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); +GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +#endif + +/* GL_QCOM_extended_get */ +#ifndef GL_QCOM_extended_get +#define GL_QCOM_extended_get 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glExtGetTexturesQCOM GLES2_GET_FUN(ExtGetTexturesQCOM) +#define glExtGetBuffersQCOM GLES2_GET_FUN(ExtGetBuffersQCOM) +#define glExtGetRenderbuffersQCOM GLES2_GET_FUN(ExtGetRenderbuffersQCOM) +#define glExtGetFramebuffersQCOM GLES2_GET_FUN(ExtGetFramebuffersQCOM) +#define glExtGetTexLevelParameterivQCOM GLES2_GET_FUN(ExtGetTexLevelParameterivQCOM) +#define glExtTexObjectStateOverrideiQCOM GLES2_GET_FUN(ExtTexObjectStateOverrideiQCOM) +#define glExtGetTexSubImageQCOM GLES2_GET_FUN(ExtGetTexSubImageQCOM) +#define glExtGetBufferPointervQCOM GLES2_GET_FUN(ExtGetBufferPointervQCOM) + +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); +GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params); +#endif + +/* GL_QCOM_extended_get2 */ +#ifndef GL_QCOM_extended_get2 +#define GL_QCOM_extended_get2 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glExtGetShadersQCOM GLES2_GET_FUN(ExtGetShadersQCOM) +#define glExtGetProgramsQCOM GLES2_GET_FUN(ExtGetProgramsQCOM) +#define glExtIsProgramBinaryQCOM GLES2_GET_FUN(ExtIsProgramBinaryQCOM) +#define glExtGetProgramBinarySourceQCOM GLES2_GET_FUN(ExtGetProgramBinarySourceQCOM) + +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); +GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); +GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif + +/* GL_QCOM_perfmon_global_mode */ +#ifndef GL_QCOM_perfmon_global_mode +#define GL_QCOM_perfmon_global_mode 1 +#endif + +/* GL_QCOM_writeonly_rendering */ +#ifndef GL_QCOM_writeonly_rendering +#define GL_QCOM_writeonly_rendering 1 +#endif + +/* GL_QCOM_tiled_rendering */ +#ifndef GL_QCOM_tiled_rendering +#define GL_QCOM_tiled_rendering 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glStartTilingQCOM GLES2_GET_FUN(StartTilingQCOM) +#define glEndTilingQCOM GLES2_GET_FUN(EndTilingQCOM) + +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); +#endif + +/*------------------------------------------------------------------------* + * VIV extension tokens + *------------------------------------------------------------------------*/ + +/* GL_VIV_shader_binary */ +#ifndef GL_VIV_shader_binary +#define GL_VIV_shader_binary 1 +#endif + +/* GL_EXT_framebuffer_multisample */ +#ifndef GL_EXT_framebuffer_multisample +#define GL_EXT_framebuffer_multisample 1 + +#ifndef GL_DRAW_FRAMEBUFFER_BINDING +#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 +#endif +#ifndef GL_DRAW_FRAMEBUFFER_BINDING_EXT +#define GL_DRAW_FRAMEBUFFER_BINDING_EXT GL_DRAW_FRAMEBUFFER_BINDING +#endif +#ifndef GL_FRAMEBUFFER_BINDING +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#endif +#ifndef GL_FRAMEBUFFER_BINDING_EXT +#define GL_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING +#endif +#ifndef GL_RENDERBUFFER_BINDING +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#endif +#ifndef GL_RENDERBUFFER_BINDING_EXT +#define GL_RENDERBUFFER_BINDING_EXT GL_RENDERBUFFER_BINDING +#endif +#ifndef GL_READ_FRAMEBUFFER +#define GL_READ_FRAMEBUFFER 0x8CA8 +#endif +#ifndef GL_READ_FRAMEBUFFER_EXT +#define GL_READ_FRAMEBUFFER_EXT GL_READ_FRAMEBUFFER +#endif +#ifndef GL_DRAW_FRAMEBUFFER +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#endif +#ifndef GL_DRAW_FRAMEBUFFER_EXT +#define GL_DRAW_FRAMEBUFFER_EXT GL_DRAW_FRAMEBUFFER +#endif +#ifndef GL_READ_FRAMEBUFFER_BINDING +#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA +#endif +#ifndef GL_READ_FRAMEBUFFER_BINDING_EXT +#define GL_READ_FRAMEBUFFER_BINDING_EXT GL_READ_FRAMEBUFFER_BINDING +#endif +#ifndef GL_RENDERBUFFER_SAMPLES +#define GL_RENDERBUFFER_SAMPLES 0x8CAB +#endif +#ifndef GL_RENDERBUFFER_SAMPLES_EXT +#define GL_RENDERBUFFER_SAMPLES_EXT GL_RENDERBUFFER_SAMPLES +#endif +#ifndef GL_MAX_SAMPLES +#define GL_MAX_SAMPLES 0x8D57 +#endif +#ifndef GL_MAX_SAMPLES_EXT +#define GL_MAX_SAMPLES_EXT GL_MAX_SAMPLES +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 +#endif +#ifndef GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE +#endif + +#if 0 // Defined in GL_EXT_multisampled_render_to_texture +#ifdef GL_GLEXT_PROTOTYPES +#define glRenderbufferStorageMultisampleEXT GLES2_GET_FUN(RenderbufferStorageMultisampleEXT) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif + +#ifndef GL_EXT_framebuffer_blit +#define GL_EXT_framebuffer_blit 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glBlitFramebufferEXT GLES2_GET_FUN(BlitFramebufferEXT) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glBlitFramebufferEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif + +/* GL_CHROMIUM_map_sub */ +#ifndef GL_CHROMIUM_map_sub +#define GL_CHROMIUM_map_sub 1 +#ifndef GL_READ_ONLY +#define GL_READ_ONLY 0x88B8 +#endif +#ifndef GL_WRITE_ONLY +#define GL_WRITE_ONLY 0x88B9 +#endif +#ifdef GL_GLEXT_PROTOTYPES +#define glMapBufferSubDataCHROMIUM GLES2_GET_FUN(MapBufferSubDataCHROMIUM) +#define glUnmapBufferSubDataCHROMIUM GLES2_GET_FUN(UnmapBufferSubDataCHROMIUM) +#define glMapTexSubImage2DCHROMIUM GLES2_GET_FUN(MapTexSubImage2DCHROMIUM) +#define glUnmapTexSubImage2DCHROMIUM GLES2_GET_FUN(UnmapTexSubImage2DCHROMIUM) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void* GL_APIENTRY glMapBufferSubDataCHROMIUM (GLuint target, GLintptr offset, GLsizeiptr size, GLenum access); +GL_APICALL void GL_APIENTRY glUnmapBufferSubDataCHROMIUM (const void* mem); +GL_APICALL void* GL_APIENTRY glMapTexSubImage2DCHROMIUM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access); +GL_APICALL void GL_APIENTRY glUnmapTexSubImage2DCHROMIUM (const void* mem); +#endif +#endif +typedef void* (GL_APIENTRYP PFNGLMAPBUFFERSUBDATACHROMIUM) (GLuint target, GLintptr offset, GLsizeiptr size, GLenum access); +typedef void (GL_APIENTRYP PFNGLUNMAPBUFFERSUBDATACHROMIUM) (const void* mem); +typedef void* (GL_APIENTRYP PFNGLMAPTEXSUBIMAGE2DCHROMIUM) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access); +typedef void (GL_APIENTRYP PFNGLUNMAPTEXSUBIMAGE2DCHROMIUM) (const void* mem); +#endif + +/* GL_CHROMIUM_resize */ +#ifndef GL_CHROMIUM_resize +#define GL_CHROMIUM_resize 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glResizeCHROMIUM GLES2_GET_FUN(ResizeCHROMIUM) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glResizeCHROMIUM ( + GLuint width, GLuint height, GLfloat scale_factor); +#endif +#else +typedef void (GL_APIENTRYP PFNGLRESIZECHROMIUM) (GLuint width, GLuint height); +#endif +#endif + +/* GL_CHROMIUM_request_extension */ +/* + * This extension allows other extensions to be turned on at run time. + * + * glGetRequestableExtensionsCHROMIUM returns a space-separated and + * null-terminated string containing all of the extension names that + * can be successfully requested on the current hardware. This may + * include the names of extensions that have already been enabled. + * + * glRequestExtensionCHROMIUM requests that the given extension be + * enabled. Call glGetString(GL_EXTENSIONS) to find out whether the + * extension request succeeded. + */ +#ifndef GL_CHROMIUM_request_extension +#define GL_CHROMIUM_request_extension 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glGetRequestableExtensionsCHROMIUM GLES2_GET_FUN(GetRequestableExtensionsCHROMIUM) +#define glRequestExtensionCHROMIUM GLES2_GET_FUN(RequestExtensionCHROMIUM) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL const GLchar* GL_APIENTRY glGetRequestableExtensionsCHROMIUM (void); +GL_APICALL void GL_APIENTRY glRequestExtensionCHROMIUM (const GLchar *extension); +#endif +#else +typedef const GLchar* (GL_APIENTRYP PFNGLGETREQUESTABLEEXTENSIONSCHROMIUM) (void); +typedef void (GL_APIENTRYP PFNGLREQUESTEXTENSIONCHROMIUM) (const GLchar *extension); +#endif +#endif + +/* GL_CHROMIUM_get_multiple */ +/* + * This extension provides functions for quering multiple GL state with a single + * call. + */ +#ifndef GL_CHROMIUM_get_multiple +#define GL_CHROMIUM_get_multiple 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glGetProgramInfoCHROMIUM GLES2_GET_FUN(GetProgramInfovCHROMIUM) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glGetProgramInfoCHROMIUM (GLuint program, GLsizei bufsize, GLsizei* size, void* info); +#endif +#else +typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOCHROMIUM) (); +#endif +#endif + +/* GL_CHROMIUM_texture_compression_dxt3 */ +#ifndef GL_CHROMIUM_texture_compression_dxt3 +#define GL_CHROMIUM_texture_compression_dxt3 1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#endif + +/* GL_CHROMIUM_texture_compression_dxt5 */ +#ifndef GL_CHROMIUM_texture_compression_dxt5 +#define GL_CHROMIUM_texture_compression_dxt5 1 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif + +/* GL_CHROMIUM_enable_feature */ +#ifndef GL_CHROMIUM_enable_feature +#define GL_CHROMIUM_enable_feature 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glEnableFeatureCHROMIUM GLES2_GET_FUN(EnableFeatureCHROMIUM) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL GLboolean GL_APIENTRY glEnableFeatureCHROMIUM (const GLchar *feature); +#endif +#else +typedef void (GL_APIENTRYP PFNGLENABLEFEATURECHROMIUM) (const GLchar *feature); +#endif +#endif + +/* GL_CHROMIUM_post_sub_buffer */ +/* This extension is modeled after EGL_NV_post_sub_buffer and + * GLX_MESA_copy_sub_buffer. It's like a SwapBuffers, but it pushes a region + * of the back buffer to the front buffer. + */ +#ifndef GL_CHROMIUM_post_sub_buffer +#define GL_CHROMIUM_post_sub_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +#define glPostSubBufferCHROMIUM GLES2_GET_FUN(PostSubBufferCHROMIUM) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glPostSubBufferCHROMIUM (GLint x, GLint y, GLint width, GLint height); +#endif +#else +typedef void (GL_APIENTRYP PFNGLPOSTSUBBUFFERCHROMIUM) (GLint x, GLint y, GLint width, GLint height); +#endif +#endif + +/* GL_ARB_robustness */ +/* This extension is subsetted for the moment, incorporating only the + * enums necessary to describe the reasons that we might encounter for + * losing the context. The entry point querying the reset status is + * not yet incorporated; to do so, a spec will be needed of a GLES2 + * subset of GL_ARB_robustness. + */ +#ifndef GL_ARB_robustness +#define GL_ARB_robustness 1 +#ifndef GL_GUILTY_CONTEXT_RESET_ARB +#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 +#endif +#ifndef GL_INNOCENT_CONTEXT_RESET_ARB +#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 +#endif +#ifndef GL_UNKNOWN_CONTEXT_RESET_ARB +#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 +#endif +#endif + +/* GL_ANGLE_translated_shader_source */ +#ifndef GL_ANGLE_translated_shader_source +#define GL_ANGLE_translated_shader_source 1 +#ifndef GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE +#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 +#endif +#ifdef GL_GLEXT_PROTOTYPES +#define glGetTranslatedShaderSourceANGLE GLES2_GET_FUN(GetTranslatedShaderSourceANGLE) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); +#endif +#endif +typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); +#endif + +/* GL_ARB_texture_rectangle */ +/* Exposes only the subset necessary to support GL_CHROMIUM_iosurface. + */ +#ifndef GL_ARB_texture_rectangle +#define GL_ARB_texture_rectangle 1 +#ifndef GL_TEXTURE_RECTANGLE_ARB +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#endif +#ifndef GL_TEXTURE_BINDING_RECTANGLE_ARB +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#endif +#ifndef GL_SAMPLER_2D_RECT_ARB +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#endif +#endif + +/* GL_CHROMIUM_copy_texture */ +#ifndef GL_CHROMIUM_copy_texture +#ifndef GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM +#define GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM 0x9241 +#endif +#ifndef GL_UNPACK_COLORSPACE_CONVERSION_CHROMIUM +#define GL_UNPACK_COLORSPACE_CONVERSION_CHROMIUM 0x9243 +#endif +#ifdef GL_GLEXT_PROTOTYPES +#define glCopyTextureCHROMIUM GLES2_GET_FUN(CopyTextureCHROMIUM) +#define glCopySubTextureCHROMIUM GLES2_GET_FUN(CopySubTextureCHROMIUM) +#if !defined(GLES2_USE_CPP_BINDINGS) +GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM( + GLenum source_id, + GLenum dest_id, + GLint internalformat, + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha); +GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM( + GLenum source_id, + GLenum dest_id, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha); +#endif +#else +typedef void(GL_APIENTRYP PFNGLCOPYTEXTURECHROMIUM)( + GLenum source_id, + GLenum dest_id, + GLint internalformat, + GLenum dest_type, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha); +typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUM)( + GLenum source_id, + GLenum dest_id, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLboolean unpack_flip_y, + GLboolean unpack_premultiply_alpha, + GLboolean unpack_unmultiply_alpha); +#endif +#endif + +/* GL_CHROMIUM_command_buffer_query */ +/* Exposes GL_CHROMIUM_command_buffer_query. + */ +#ifndef GL_CHROMIUM_command_buffer_query +#define GL_CHROMIUM_command_buffer_query 1 +// TODO(gman): Get official numbers for these constants. +#define GL_COMMANDS_ISSUED_CHROMIUM 0x84F2 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __gl2ext_h_ */
View file
lightspark.tar.xz/src/plugin_ppapi/GLES2/gl2platform.h
Added
@@ -0,0 +1,30 @@ +#ifndef __gl2platform_h_ +#define __gl2platform_h_ + +/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * You are encouraged to submit all modifications to the Khronos group so that + * they can be included in future versions of this file. Please submit changes + * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) + * by filing a bug against product "OpenGL-ES" component "Registry". + */ + +#include <KHR/khrplatform.h> + +#ifndef GL_APICALL +#define GL_APICALL KHRONOS_APICALL +#endif + +#ifndef GL_APIENTRY +#define GL_APIENTRY KHRONOS_APIENTRY +#endif + +#endif /* __gl2platform_h_ */
View file
lightspark.tar.xz/src/plugin_ppapi/manifest.json
Added
@@ -0,0 +1,47 @@ +{ + "description": "Lightspark Flash Player", + "name": "Flapper", + "version": "20.0.0.267", + "x-ppapi-required-interfaces": [ + "PPB_AudioConfig;1.1|PPB_AudioConfig;1.0", + "PPB_AudioInput(Dev);0.4|PPB_AudioInput(Dev);0.3", + "PPB_Audio;1.0", + "PPB_BrowserFont_Trusted;1.0", + "PPB_Buffer(Dev);0.4", + "PPB_CharSet(Dev);0.4", + "PPB_Core;1.0", + "PPB_Crypto(Dev);0.1", + "PPB_CursorControl(Dev);0.4", + "PPB_FileChooser(Dev);0.6|PPB_FileChooser(Dev);0.5", + "PPB_FileChooserTrusted;0.6|PPB_FileChooserTrusted;0.5", + "PPB_FileRef;1.0", + "PPB_Flash_Clipboard;5.0|PPB_Flash_Clipboard;4.0", + "PPB_Flash_File_FileRef;2", + "PPB_Flash_File_ModuleLocal;3", + "PPB_Flash_FontFile;0.1|PPB_PDF;1", + "PPB_FlashFullscreen;1.0|PPB_FlashFullscreen;0.1", + "PPB_Flash;13.0|PPB_Flash;12.6|PPB_Flash;12.5|PPB_Flash;12.4", + "PPB_Flash_Menu;0.2", + "PPB_Graphics2D;1.0", + "PPB_Graphics3D;1.0", + "PPB_ImageData;1.0", + "PPB_IMEInputEvent(Dev);0.2|PPB_IMEInputEvent(Dev);0.1", + "PPB_InputEvent;1.0", + "PPB_Instance;1.0", + "PPB_Memory(Dev);0.1", + "PPB_NetAddress_Private;1.1|PPB_NetAddress_Private;1.0|PPB_NetAddress_Private;0.1", + "PPB_OpenGLES2ChromiumMapSub;1.0|PPB_OpenGLES2ChromiumMapSub(Dev);1.0|PPB_GLESChromiumTextureMapping(Dev);0.1", + "PPB_OpenGLES2;1.0", + "PPB_TCPSocket_Private;0.4|PPB_TCPSocket_Private;0.3", + "PPB_TextInput(Dev);0.2|PPB_TextInput(Dev);0.1", + "PPB_UDPSocket_Private;0.4|PPB_UDPSocket_Private;0.3", + "PPB_URLLoader;1.0", + "PPB_URLLoaderTrusted;0.3", + "PPB_URLRequestInfo;1.0", + "PPB_URLResponseInfo;1.0", + "PPB_URLUtil(Dev);0.7|PPB_URLUtil(Dev);0.6", + "PPB_Var;1.1|PPB_Var;1.0", + "PPB_VideoCapture(Dev);0.3", + "PPB_View;1.0" + ] +}
View file
lightspark.tar.xz/src/plugin_ppapi/plugin.cpp
Added
@@ -0,0 +1,851 @@ +/************************************************************************** + Lighspark, a free flash player implementation + + Copyright (C) 2009-2013 Alessandro Pignotti (a.pignotti@sssup.it) + Copyright (C) 2010-2011 Timon Van Overveldt (timonvo@gmail.com) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +**************************************************************************/ + + +// TODO +// - download +// - rendering +// - javascript communication with browser +// - sound +// - keyboard/mouse handling +// - run within sandbox +// - register as separate plugin + +#include "version.h" +#include "logger.h" +#include "compat.h" +#include "swf.h" +#include "backends/security.h" +#include "backends/rendering.h" +#include <string> +#include <algorithm> +#include "threading.h" +#include "plugin_ppapi/plugin.h" + +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/ppb.h" +#include "ppapi/c/ppb_core.h" +#include "ppapi/c/ppb_instance.h" +#include "ppapi/c/ppb_messaging.h" +#include "ppapi/c/ppb_var.h" +#include "ppapi/c/ppb_view.h" +#include "ppapi/c/ppb_url_loader.h" +#include "ppapi/c/ppb_url_request_info.h" +#include "ppapi/c/ppb_url_response_info.h" +#include "ppapi/c/ppp.h" +#include "ppapi/c/ppp_instance.h" +#include "ppapi/c/ppp_messaging.h" +#include "ppapi/c/ppb_opengles2.h" +#include "ppapi/c/ppb_graphics_3d.h" +#include "GLES2/gl2.h" + +//The interpretation of texture data change with the endianness +#if __BYTE_ORDER == __BIG_ENDIAN +#define GL_UNSIGNED_INT_8_8_8_8_HOST GL_UNSIGNED_INT_8_8_8_8_REV +#else +#define GL_UNSIGNED_INT_8_8_8_8_HOST GL_UNSIGNED_BYTE +#endif + +using namespace lightspark; +using namespace std; + +static PPB_GetInterface g_get_browser_interface = NULL; +static const PPB_Core* g_core_interface = NULL; +static const PPB_Graphics3D* g_graphics_3d_interface = NULL; +static const PPB_Instance* g_instance_interface = NULL; +static const PPB_View* g_view_interface = NULL; +static const PPB_Var* g_var_interface = NULL; +static const PPB_URLLoader* g_urlloader_interface = NULL; +static const PPB_URLRequestInfo* g_urlrequestinfo_interface = NULL; +static const PPB_URLResponseInfo* g_urlresponseinfo_interface = NULL; +static const PPB_OpenGLES2* g_gles2_interface = NULL; + + +ppDownloadManager::ppDownloadManager(PP_Instance _instance, SystemState *sys):instance(_instance),m_sys(sys) +{ + type = NPAPI; +} + +lightspark::Downloader* ppDownloadManager::download(const lightspark::URLInfo& url, _R<StreamCache> cache, lightspark::ILoadable* owner) +{ + // empty URL means data is generated from calls to NetStream::appendBytes + if(!url.isValid() && url.getInvalidReason() == URLInfo::IS_EMPTY) + { + return StandaloneDownloadManager::download(url, cache, owner); + } + // Handle RTMP requests internally, not through PPAPI + if(url.isRTMP()) + { + return StandaloneDownloadManager::download(url, cache, owner); + } + + bool cached = false; + LOG(LOG_INFO, _("NET: PLUGIN: DownloadManager::download '") << url.getParsedURL() << + "'" << (cached ? _(" - cached") : "")); + //Register this download + ppDownloader* downloader=new ppDownloader(url.getParsedURL(), cache, instance, owner); + addDownloader(downloader); + return downloader; +} +lightspark::Downloader* ppDownloadManager::downloadWithData(const lightspark::URLInfo& url, + _R<StreamCache> cache, const std::vector<uint8_t>& data, + const std::list<tiny_string>& headers, lightspark::ILoadable* owner) +{ + // Handle RTMP requests internally, not through PPAPI + if(url.isRTMP()) + { + return StandaloneDownloadManager::downloadWithData(url, cache, data, headers, owner); + } + + LOG(LOG_INFO, _("NET: PLUGIN: DownloadManager::downloadWithData '") << url.getParsedURL()); + //Register this download + ppDownloader* downloader=new ppDownloader(url.getParsedURL(), cache, data, headers, instance, owner); + addDownloader(downloader); + return downloader; +} + +void ppDownloadManager::destroy(lightspark::Downloader* downloader) +{ + ppDownloader* d=dynamic_cast<ppDownloader*>(downloader); + if(!d) + { + StandaloneDownloadManager::destroy(downloader); + return; + } + if(d->state!=ppDownloader::STREAM_DESTROYED && d->state!=ppDownloader::ASYNC_DESTROY) + { + //The NP stream is still alive. Flag this downloader for aync destruction + d->state=ppDownloader::ASYNC_DESTROY; + return; + } + //If the downloader was still in the active-downloader list, delete it + if(removeDownloader(downloader)) + { + downloader->waitForTermination(); + delete downloader; + } +} + + +void ppDownloader::dlStartCallback(void* userdata,int result) +{ + ppDownloader* th = (ppDownloader*)userdata; + if (result < 0) + { + LOG(LOG_ERROR,"download failed:"<<result<<" "<<th->getURL()); + th->setFailed(); + return; + } + PP_Resource response = g_urlloader_interface->GetResponseInfo(th->ppurlloader); + PP_Var v; + uint32_t len; + v = g_urlresponseinfo_interface->GetProperty(response,PP_URLRESPONSEPROPERTY_STATUSCODE); + LOG(LOG_INFO,"statuscode:"<<v.value.as_int); + v = g_urlresponseinfo_interface->GetProperty(response,PP_URLRESPONSEPROPERTY_STATUSLINE); + tiny_string statusline = g_var_interface->VarToUtf8(v,&len); + LOG(LOG_INFO,"statusline:"<<statusline); + v = g_urlresponseinfo_interface->GetProperty(response,PP_URLRESPONSEPROPERTY_HEADERS); + tiny_string headers = g_var_interface->VarToUtf8(v,&len); + LOG(LOG_INFO,"headers:"<<len<<" "<<headers); + //th->parseHeaders(headers.raw_buf(),true); + + int64_t bytes_received; + int64_t total_bytes_to_be_received; + g_urlloader_interface->GetDownloadProgress(th->ppurlloader,&bytes_received,&total_bytes_to_be_received); + if (total_bytes_to_be_received >0) + th->setLength(total_bytes_to_be_received); + if (th->isMainClipDownloader) + { + v = g_urlresponseinfo_interface->GetProperty(response,PP_URLRESPONSEPROPERTY_URL); + tiny_string url = g_var_interface->VarToUtf8(v,&len); + LOG(LOG_INFO,"mainclip url:"<<url); + + th->m_sys->mainClip->setOrigin(url); + th->m_sys->mainClip->setBaseURL(url); + } + + struct PP_CompletionCallback cb; + cb.func = dlReadResponseCallback; + cb.flags = 0; + cb.user_data = th; + g_urlloader_interface->ReadResponseBody(th->ppurlloader,th->buffer,4096,cb); +} +void ppDownloader::dlReadResponseCallback(void* userdata,int result) +{ + ppDownloader* th = (ppDownloader*)userdata; + if (result < 0) + { + LOG(LOG_ERROR,"download failed:"<<result<<" "<<th->getURL()<<" "<<th->getReceivedLength()<<"/"<<th->getLength()); + th->setFailed(); + return; + } + bool haslength = th->getReceivedLength() < th->getLength(); + th->append(th->buffer,result); + if ((haslength && th->getReceivedLength() == th->getLength())|| + (!haslength && result == 0)) // no content-length header set and no bytes read => finish download + + { + th->setFinished(); + LOG(LOG_INFO,"download done:"<<th->getURL()<<" "<<th->getReceivedLength()<<" "<<th->getLength()); + return; + } + struct PP_CompletionCallback cb; + cb.func = dlReadResponseCallback; + cb.flags = 0; + cb.user_data = th; + g_urlloader_interface->ReadResponseBody(th->ppurlloader,th->buffer,4096,cb); +} +ppDownloader::ppDownloader(const lightspark::tiny_string& _url, PP_Instance _instance, lightspark::ILoadable* owner,SystemState* sys): + Downloader(_url, _MR(new MemoryStreamCache), owner),isMainClipDownloader(true),m_sys(sys),state(INIT) +{ + PP_Var btrue; + btrue.type = PP_VARTYPE_BOOL; + btrue.value.as_bool = PP_TRUE; + + ppurlloader = g_urlloader_interface->Create(_instance); + PP_Resource pprequest_info = g_urlrequestinfo_interface->Create(_instance); + PP_Var url = g_var_interface->VarFromUtf8(_url.raw_buf(),_url.numBytes()); + g_urlrequestinfo_interface->SetProperty(pprequest_info,PP_URLREQUESTPROPERTY_URL,url); + g_urlrequestinfo_interface->SetProperty(pprequest_info,PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS,btrue); + LOG(LOG_INFO,"constructing downloader:"<<_url); + + + if (_url.startsWith("//")) + { + g_urlrequestinfo_interface->SetProperty(pprequest_info,PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS,btrue); + } + + struct PP_CompletionCallback cb; + cb.func = dlStartCallback; + cb.flags = 0; + cb.user_data = this; + + int res = g_urlloader_interface->Open(ppurlloader,pprequest_info,cb); + if (res != PP_OK_COMPLETIONPENDING) + LOG(LOG_ERROR,"url opening failed:"<<res<<" "<<_url); +} + +ppDownloader::ppDownloader(const lightspark::tiny_string& _url, _R<StreamCache> _cache, PP_Instance _instance, lightspark::ILoadable* owner): + Downloader(_url, _cache, owner),isMainClipDownloader(false),m_sys(NULL),state(INIT) +{ + ppurlloader = g_urlloader_interface->Create(_instance); +} + +ppDownloader::ppDownloader(const lightspark::tiny_string& _url, _R<StreamCache> _cache, + const std::vector<uint8_t>& _data, + const std::list<tiny_string>& headers, PP_Instance _instance, lightspark::ILoadable* owner): + Downloader(_url, _cache, _data, headers, owner),isMainClipDownloader(false),m_sys(NULL),state(INIT) +{ + ppurlloader = g_urlloader_interface->Create(_instance); +} + +ppPluginInstance::ppPluginInstance(PP_Instance instance, int16_t argc, const char *argn[], const char *argv[]) : + m_ppinstance(instance), + mainDownloaderStreambuf(NULL),mainDownloaderStream(NULL), + mainDownloader(NULL), + //scriptObject(NULL), + m_pt(NULL) +{ + m_last_size.width = 0; + m_last_size.height = 0; + m_graphics = 0; + LOG(LOG_INFO, "Lightspark version " << VERSION << " Copyright 2009-2013 Alessandro Pignotti and others"); + setTLSSys( NULL ); + m_sys=new lightspark::SystemState(0, lightspark::SystemState::FLASH); + //Files running in the plugin have REMOTE sandbox + m_sys->securityManager->setSandboxType(lightspark::SecurityManager::REMOTE); + +// scriptObject = +// (NPScriptObjectGW *) NPN_CreateObject(mInstance, &NPScriptObjectGW::npClass); +// m_sys->extScriptObject = scriptObject->getScriptObject(); +// scriptObject->m_sys = m_sys; + //Parse OBJECT/EMBED tag attributes + tiny_string swffile; + for(int i=0;i<argc;i++) + { + if(argn[i]==NULL || argv[i]==NULL) + continue; + LOG(LOG_INFO,"param:"<<argn[i]<<" "<<argv[i]); + if(strcasecmp(argn[i],"flashvars")==0) + { + m_sys->parseParametersFromFlashvars(argv[i]); + } + else if(strcasecmp(argn[i],"name")==0) + { + //m_sys->extScriptObject->setProperty(argn[i],argv[i]); + } + else if(strcasecmp(argn[i],"src")==0) + { + swffile = argv[i]; + } + } + if (!swffile.empty()) + { + m_sys->downloadManager=new ppDownloadManager(m_ppinstance,m_sys); + + EngineData::startSDLMain(); + mainDownloader=new ppDownloader(swffile,m_ppinstance,m_sys->mainClip->loaderInfo.getPtr(),m_sys); + mainDownloaderStreambuf = mainDownloader->getCache()->createReader(); + mainDownloaderStream.rdbuf(mainDownloaderStreambuf); + m_pt=new lightspark::ParseThread(mainDownloaderStream,m_sys->mainClip); + m_sys->addJob(m_pt); + + //EngineData::mainthread_running = true; + } + //The sys var should be NULL in this thread + setTLSSys( NULL ); +} + +ppPluginInstance::~ppPluginInstance() +{ + //Shutdown the system + setTLSSys(m_sys); + if(mainDownloader) + mainDownloader->stop(); + if (mainDownloaderStreambuf) + delete mainDownloaderStreambuf; + + // Kill all stuff relating to NPScriptObject which is still running +// static_cast<NPScriptObject*>(m_sys->extScriptObject)->destroy(); + + m_sys->setShutdownFlag(); + + m_sys->destroy(); + delete m_sys; + delete m_pt; + setTLSSys(NULL); +} +void swapbuffer_callback(void* userdata,int result) +{ + SystemState* sys = (SystemState*)userdata; + setTLSSys(sys); + + sys->getRenderThread()->doRender(); + + struct PP_CompletionCallback cb; + cb.func = swapbuffer_callback; + cb.flags = 0; + cb.user_data = sys; + g_graphics_3d_interface->SwapBuffers(((ppPluginEngineData*)sys->getEngineData())->getGraphics(),cb); +} +void ppPluginInstance::handleResize(PP_Resource view) +{ + struct PP_Rect position; + if (g_view_interface->GetRect(view, &position) == PP_FALSE) + { + LOG(LOG_ERROR,"Instance_DidChangeView: couldn't get rect"); + return; + } + if (m_last_size.width != position.size.width || + m_last_size.height != position.size.height) { + + if (!m_graphics) { + int32_t attribs[] = { + PP_GRAPHICS3DATTRIB_WIDTH, position.size.width, + PP_GRAPHICS3DATTRIB_HEIGHT, position.size.height, + PP_GRAPHICS3DATTRIB_NONE, + }; + m_graphics = g_graphics_3d_interface->Create(m_ppinstance, 0, attribs); + g_instance_interface->BindGraphics(m_ppinstance, m_graphics); + if (!m_graphics) + { + LOG(LOG_ERROR,"Instance_DidChangeView: couldn't create graphics"); + return; + } + ppPluginEngineData* e = new ppPluginEngineData(this, position.size.width, position.size.height,m_sys); + m_sys->setParamsAndEngine(e, false); + } + else + { + g_graphics_3d_interface->ResizeBuffers(m_graphics,position.size.width, position.size.height); + m_sys->getRenderThread()->SetEngineData(m_sys->getEngineData()); + m_sys->getRenderThread()->init(); + struct PP_CompletionCallback cb; + cb.func = swapbuffer_callback; + cb.flags = 0; + cb.user_data = m_sys; + g_graphics_3d_interface->SwapBuffers(m_graphics,cb); + } + m_last_size.width = position.size.width; + m_last_size.height = position.size.height; + } +} + + +std::map<PP_Instance,ppPluginInstance*> all_instances; + +static PP_Bool Instance_DidCreate(PP_Instance instance,uint32_t argc,const char* argn[],const char* argv[]) +{ + LOG(LOG_INFO,"Instance_DidCreate:"<<instance); + ppPluginInstance* newinstance = new ppPluginInstance(instance,argc,argn,argv); + + all_instances[instance] = newinstance; + return PP_TRUE; +} +static void Instance_DidDestroy(PP_Instance instance) +{ + LOG(LOG_INFO,"Instance_DidDestroy:"<<instance); + ppPluginInstance* it = all_instances[instance]; + all_instances.erase(instance); + if (it) + delete it; +} +static void Instance_DidChangeView(PP_Instance instance,PP_Resource view) +{ + LOG(LOG_INFO,"Instance_DidChangeView:"<<instance); + auto it = all_instances.find(instance); + if (it == all_instances.end()) + { + LOG(LOG_ERROR,"Instance_DidChangeView: no matching PPPluginInstance found"); + return; + } + ppPluginInstance* info = it->second; + info->handleResize(view); +} + +static void Instance_DidChangeFocus(PP_Instance instance, PP_Bool has_focus) {} + +static PP_Bool Instance_HandleDocumentLoad(PP_Instance instance,PP_Resource url_loader) +{ + LOG(LOG_INFO,"HandleDocumentLoad"); + return PP_FALSE; +} +static void Messaging_HandleMessage(PP_Instance instance, struct PP_Var message) +{ + LOG(LOG_INFO,"handleMessage:"<<(int)message.type); +} +static PPP_Instance instance_interface = { + &Instance_DidCreate, + &Instance_DidDestroy, + &Instance_DidChangeView, + &Instance_DidChangeFocus, + &Instance_HandleDocumentLoad +}; +static PPP_Messaging messaging_interface = { + &Messaging_HandleMessage, +}; + +extern "C" +{ + PP_EXPORT int32_t PPP_InitializeModule(PP_Module module_id,PPB_GetInterface get_browser_interface) + { + LOG_LEVEL log_level = LOG_NOT_IMPLEMENTED; + + char *envvar = getenv("LIGHTSPARK_PLUGIN_LOGLEVEL"); + if (envvar) + log_level=(LOG_LEVEL) min(4, max(0, atoi(envvar))); + + envvar = getenv("LIGHTSPARK_PLUGIN_LOGFILE"); + if (envvar) + Log::redirect(envvar); + + Log::setLogLevel(log_level); + lightspark::SystemState::staticInit(); + + LOG(LOG_INFO, "Lightspark version " << VERSION << " Copyright 2009-2013 Alessandro Pignotti and others"); + g_get_browser_interface = get_browser_interface; + g_core_interface = (const PPB_Core*)get_browser_interface(PPB_CORE_INTERFACE); + g_instance_interface = (const PPB_Instance*)get_browser_interface(PPB_INSTANCE_INTERFACE); + g_graphics_3d_interface = (const PPB_Graphics3D*)get_browser_interface(PPB_GRAPHICS_3D_INTERFACE); + g_view_interface = (const PPB_View*)get_browser_interface(PPB_VIEW_INTERFACE); + g_var_interface = (const PPB_Var*)get_browser_interface(PPB_VAR_INTERFACE); + g_urlloader_interface = (const PPB_URLLoader*)get_browser_interface(PPB_URLLOADER_INTERFACE); + g_urlrequestinfo_interface = (const PPB_URLRequestInfo*)get_browser_interface(PPB_URLREQUESTINFO_INTERFACE); + g_urlresponseinfo_interface = (const PPB_URLResponseInfo*)get_browser_interface(PPB_URLRESPONSEINFO_INTERFACE); + g_gles2_interface = (PPB_OpenGLES2*)get_browser_interface(PPB_OPENGLES2_INTERFACE); + + if (!g_core_interface || + !g_instance_interface || + !g_graphics_3d_interface || + !g_view_interface || + !g_var_interface || + !g_urlloader_interface || + !g_urlrequestinfo_interface || + !g_urlresponseinfo_interface || + !g_gles2_interface) + { + LOG(LOG_ERROR,"get_browser_interface failed:" + << g_core_interface <<" " + << g_instance_interface <<" " + << g_graphics_3d_interface <<" " + << g_view_interface<<" " + << g_var_interface<<" " + << g_urlloader_interface<<" " + << g_urlrequestinfo_interface<<" " + << g_urlresponseinfo_interface<<" " + << g_gles2_interface); + return PP_ERROR_NOINTERFACE; + } + return PP_OK; + } + PP_EXPORT void PPP_ShutdownModule() + { + LOG(LOG_INFO,"PPP_ShutdownModule"); + SystemState::staticDeinit(); + } + PP_EXPORT const void* PPP_GetInterface(const char* interface_name) + { + LOG(LOG_INFO,"PPP_getInterface:"<<interface_name); + if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) + { + return &instance_interface; + } + if (strcmp(interface_name, PPP_MESSAGING_INTERFACE) == 0) + { + return &messaging_interface; + } + return NULL; + } + +} + +void ppPluginEngineData::stopMainDownload() +{ +// if(instance->mainDownloader) +// instance->mainDownloader->stop(); +} + +uint32_t ppPluginEngineData::getWindowForGnash() +{ +// return instance->mWindow; + return 0; +} + +void ppPluginEngineData::openPageInBrowser(const tiny_string& url, const tiny_string& window) +{ + //instance->openLink(url, window); +} + +SDL_Window* ppPluginEngineData::createWidget(uint32_t w,uint32_t h) +{ + return 0; +} + +void ppPluginEngineData::grabFocus() +{ + /* + if (!widget_gtk) + return; + + gtk_widget_grab_focus(widget_gtk); + */ +} + +void ppPluginEngineData::setClipboardText(const std::string txt) +{ + LOG(LOG_NOT_IMPLEMENTED,"setCLipboardText"); +} + +bool ppPluginEngineData::getScreenData(SDL_DisplayMode *screen) +{ + LOG(LOG_NOT_IMPLEMENTED,"getScreenData"); + return true; +} + +double ppPluginEngineData::getScreenDPI() +{ + LOG(LOG_NOT_IMPLEMENTED,"getScreenDPI"); + return 0; +} + +void ppPluginEngineData::SwapBuffers() +{ + //SwapBuffers is handled in callback +} + +void ppPluginEngineData::InitOpenGL() +{ + +} + +void ppPluginEngineData::DeinitOpenGL() +{ + +} + +bool ppPluginEngineData::getGLError(uint32_t &errorCode) const +{ + errorCode = g_gles2_interface->GetError(instance->m_graphics); + return errorCode!=GL_NO_ERROR; +} + +void ppPluginEngineData::exec_glUniform1f(int location, float v0) +{ + g_gles2_interface->Uniform1f(instance->m_graphics,location,v0); +} + +void ppPluginEngineData::exec_glBindTexture_GL_TEXTURE_2D(uint32_t id) +{ + g_gles2_interface->BindTexture(instance->m_graphics,GL_TEXTURE_2D,id); +} + +void ppPluginEngineData::exec_glVertexAttribPointer(uint32_t index, int32_t size, int32_t stride, const void *coords) +{ + g_gles2_interface->VertexAttribPointer(instance->m_graphics,index, size, GL_FLOAT, GL_FALSE, stride, coords); +} + +void ppPluginEngineData::exec_glEnableVertexAttribArray(uint32_t index) +{ + g_gles2_interface->EnableVertexAttribArray(instance->m_graphics,index); +} + +void ppPluginEngineData::exec_glDrawArrays_GL_TRIANGLES(int32_t first, int32_t count) +{ + g_gles2_interface->DrawArrays(instance->m_graphics,GL_TRIANGLES,first,count); +} +void ppPluginEngineData::exec_glDrawArrays_GL_LINE_STRIP(int32_t first, int32_t count) +{ + g_gles2_interface->DrawArrays(instance->m_graphics,GL_LINE_STRIP,first,count); +} + +void ppPluginEngineData::exec_glDrawArrays_GL_TRIANGLE_STRIP(int32_t first, int32_t count) +{ + g_gles2_interface->DrawArrays(instance->m_graphics,GL_TRIANGLE_STRIP,first,count); +} + +void ppPluginEngineData::exec_glDrawArrays_GL_LINES(int32_t first, int32_t count) +{ + g_gles2_interface->DrawArrays(instance->m_graphics,GL_LINES,first,count); +} + +void ppPluginEngineData::exec_glDisableVertexAttribArray(uint32_t index) +{ + g_gles2_interface->DisableVertexAttribArray(instance->m_graphics,index); +} + +void ppPluginEngineData::exec_glUniformMatrix4fv(int32_t location, int32_t count, bool transpose, const float *value) +{ + g_gles2_interface->UniformMatrix4fv(instance->m_graphics,location, count, transpose, value); +} + +void ppPluginEngineData::exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(uint32_t buffer) +{ + // PPAPI has no BindBuffer + //g_gles2_interface->BindBuffer(instance->m_graphics,GL_PIXEL_UNPACK_BUFFER, buffer); +} +uint8_t* ppPluginEngineData::exec_glMapBuffer_GL_PIXEL_UNPACK_BUFFER_GL_WRITE_ONLY() +{ + // PPAPI has no GLEW + return NULL; +} +void ppPluginEngineData::exec_glUnmapBuffer_GL_PIXEL_UNPACK_BUFFER() +{ + // PPAPI has no GLEW +} + +void ppPluginEngineData::exec_glEnable_GL_TEXTURE_2D() +{ + g_gles2_interface->Enable(instance->m_graphics,GL_TEXTURE_2D); +} + +void ppPluginEngineData::exec_glEnable_GL_BLEND() +{ + g_gles2_interface->Enable(instance->m_graphics,GL_BLEND); +} + +void ppPluginEngineData::exec_glDisable_GL_TEXTURE_2D() +{ + g_gles2_interface->Disable(instance->m_graphics,GL_TEXTURE_2D); +} +void ppPluginEngineData::exec_glFlush() +{ + g_gles2_interface->Flush(instance->m_graphics); +} + +uint32_t ppPluginEngineData::exec_glCreateShader_GL_FRAGMENT_SHADER() +{ + return g_gles2_interface->CreateShader(instance->m_graphics,GL_FRAGMENT_SHADER); +} + +uint32_t ppPluginEngineData::exec_glCreateShader_GL_VERTEX_SHADER() +{ + return g_gles2_interface->CreateShader(instance->m_graphics,GL_VERTEX_SHADER); +} + +void ppPluginEngineData::exec_glShaderSource(uint32_t shader, int32_t count, const char **name, int32_t* length) +{ + g_gles2_interface->ShaderSource(instance->m_graphics,shader,count,name,length); +} + +void ppPluginEngineData::exec_glCompileShader(uint32_t shader) +{ + g_gles2_interface->CompileShader(instance->m_graphics,shader); +} + +void ppPluginEngineData::exec_glGetShaderInfoLog(uint32_t shader,int32_t bufSize,int32_t* length,char* infoLog) +{ + g_gles2_interface->GetShaderInfoLog(instance->m_graphics,shader,bufSize,length,infoLog); +} + +void ppPluginEngineData::exec_glGetShaderiv_GL_COMPILE_STATUS(uint32_t shader,int32_t* params) +{ + g_gles2_interface->GetShaderiv(instance->m_graphics,shader,GL_COMPILE_STATUS,params); +} + +uint32_t ppPluginEngineData::exec_glCreateProgram() +{ + return g_gles2_interface->CreateProgram(instance->m_graphics); +} + +void ppPluginEngineData::exec_glBindAttribLocation(uint32_t program,uint32_t index, const char* name) +{ + g_gles2_interface->BindAttribLocation(instance->m_graphics,program,index,name); +} + +void ppPluginEngineData::exec_glAttachShader(uint32_t program, uint32_t shader) +{ + g_gles2_interface->AttachShader(instance->m_graphics,program,shader); +} + +void ppPluginEngineData::exec_glLinkProgram(uint32_t program) +{ + g_gles2_interface->LinkProgram(instance->m_graphics,program); +} + +void ppPluginEngineData::exec_glGetProgramiv_GL_LINK_STATUS(uint32_t program,int32_t* params) +{ + g_gles2_interface->GetProgramiv(instance->m_graphics,program,GL_LINK_STATUS,params); +} + +void ppPluginEngineData::exec_glBindFramebuffer_GL_FRAMEBUFFER(uint32_t framebuffer) +{ + g_gles2_interface->BindFramebuffer(instance->m_graphics,GL_FRAMEBUFFER,framebuffer); +} + +void ppPluginEngineData::exec_glDeleteTextures(int32_t n,uint32_t* textures) +{ + g_gles2_interface->DeleteTextures(instance->m_graphics,n,textures); +} + +void ppPluginEngineData::exec_glDeleteBuffers(int32_t n,uint32_t* buffers) +{ + g_gles2_interface->DeleteBuffers(instance->m_graphics,n,buffers); +} + +void ppPluginEngineData::exec_glBlendFunc_GL_ONE_GL_ONE_MINUS_SRC_ALPHA() +{ + g_gles2_interface->BlendFunc(instance->m_graphics,GL_ONE, GL_ONE_MINUS_SRC_ALPHA); +} + +void ppPluginEngineData::exec_glActiveTexture_GL_TEXTURE0() +{ + g_gles2_interface->ActiveTexture(instance->m_graphics,GL_TEXTURE0); +} + +void ppPluginEngineData::exec_glGenBuffers(int32_t n,uint32_t* buffers) +{ + g_gles2_interface->GenBuffers(instance->m_graphics,n,buffers); +} + +void ppPluginEngineData::exec_glUseProgram(uint32_t program) +{ + g_gles2_interface->UseProgram(instance->m_graphics,program); +} + +int32_t ppPluginEngineData::exec_glGetUniformLocation(uint32_t program,const char* name) +{ + return g_gles2_interface->GetUniformLocation(instance->m_graphics,program,name); +} + +void ppPluginEngineData::exec_glUniform1i(int32_t location,int32_t v0) +{ + g_gles2_interface->Uniform1i(instance->m_graphics,location,v0); +} + +void ppPluginEngineData::exec_glGenTextures(int32_t n,uint32_t* textures) +{ + g_gles2_interface->GenTextures(instance->m_graphics,n,textures); +} + +void ppPluginEngineData::exec_glViewport(int32_t x,int32_t y,int32_t width,int32_t height) +{ + g_gles2_interface->Viewport(instance->m_graphics,x,y,width,height); +} + +void ppPluginEngineData::exec_glBufferData_GL_PIXEL_UNPACK_BUFFER_GL_STREAM_DRAW(int32_t size,const void* data) +{ + // PPAPI has no BufferData + //g_gles2_interface->BufferData(instance->m_graphics,GL_PIXEL_UNPACK_BUFFER,size, data,GL_STREAM_DRAW); +} + +void ppPluginEngineData::exec_glTexParameteri_GL_TEXTURE_2D_GL_TEXTURE_MIN_FILTER_GL_LINEAR() +{ + g_gles2_interface->TexParameteri(instance->m_graphics,GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); +} + +void ppPluginEngineData::exec_glTexParameteri_GL_TEXTURE_2D_GL_TEXTURE_MAG_FILTER_GL_LINEAR() +{ + g_gles2_interface->TexParameteri(instance->m_graphics,GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); +} + +void ppPluginEngineData::exec_glTexImage2D_GL_TEXTURE_2D_GL_UNSIGNED_BYTE(int32_t level,int32_t width, int32_t height,int32_t border, const void* pixels) +{ + g_gles2_interface->TexImage2D(instance->m_graphics,GL_TEXTURE_2D, level, GL_RGBA, width, height, border, GL_RGBA, GL_UNSIGNED_BYTE, pixels); +} +void ppPluginEngineData::exec_glTexImage2D_GL_TEXTURE_2D_GL_UNSIGNED_INT_8_8_8_8_HOST(int32_t level,int32_t width, int32_t height,int32_t border, const void* pixels) +{ + g_gles2_interface->TexImage2D(instance->m_graphics,GL_TEXTURE_2D, level, GL_RGBA, width, height, border, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_HOST, pixels); +} + +void ppPluginEngineData::exec_glDrawBuffer_GL_BACK() +{ + // PPAPI has no DrawBuffer + //g_gles2_interface->DrawBuffer(instance->m_graphics,GL_BACK); +} + +void ppPluginEngineData::exec_glClearColor(float red,float green,float blue,float alpha) +{ + g_gles2_interface->ClearColor(instance->m_graphics,red,green,blue,alpha); +} + +void ppPluginEngineData::exec_glClear_GL_COLOR_BUFFER_BIT() +{ + g_gles2_interface->Clear(instance->m_graphics,GL_COLOR_BUFFER_BIT); +} + +void ppPluginEngineData::exec_glPixelStorei_GL_UNPACK_ROW_LENGTH(int32_t param) +{ + // PPAPI has no PixelStorei + //g_gles2_interface->PixelStorei(instance->m_graphics,GL_UNPACK_ROW_LENGTH,param); +} + +void ppPluginEngineData::exec_glPixelStorei_GL_UNPACK_SKIP_PIXELS(int32_t param) +{ + // PPAPI has no PixelStorei + //g_gles2_interface->PixelStorei(instance->m_graphics,GL_UNPACK_SKIP_PIXELS,param); +} + +void ppPluginEngineData::exec_glPixelStorei_GL_UNPACK_SKIP_ROWS(int32_t param) +{ + // PPAPI has no PixelStorei + //g_gles2_interface->PixelStorei(instance->m_graphics,GL_UNPACK_SKIP_ROWS,param); +} + +void ppPluginEngineData::exec_glTexSubImage2D_GL_TEXTURE_2D(int32_t level,int32_t xoffset,int32_t yoffset,int32_t width,int32_t height,const void* pixels) +{ + g_gles2_interface->TexSubImage2D(instance->m_graphics,GL_TEXTURE_2D, level, xoffset, yoffset, width, height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_HOST, pixels); +} +void ppPluginEngineData::exec_glGetIntegerv_GL_MAX_TEXTURE_SIZE(int32_t* data) +{ + g_gles2_interface->GetIntegerv(instance->m_graphics,GL_MAX_TEXTURE_SIZE,data); +}
View file
lightspark.tar.xz/src/plugin_ppapi/plugin.h
Added
@@ -0,0 +1,148 @@ +#ifndef PPAPI_PLUGIN_H +#define PPAPI_PLUGIN_H + +#include "swf.h" +#include "ppapi/c/ppp_instance.h" + +namespace lightspark +{ + +class ppDownloader; + +class ppDownloadManager: public lightspark::StandaloneDownloadManager +{ +private: + PP_Instance instance; + SystemState* m_sys; +public: + ppDownloadManager(PP_Instance _instance,SystemState* sys); + lightspark::Downloader* download(const lightspark::URLInfo& url, + _R<StreamCache> cache, + lightspark::ILoadable* owner); + lightspark::Downloader* downloadWithData(const lightspark::URLInfo& url, + _R<StreamCache> cache, const std::vector<uint8_t>& data, + const std::list<tiny_string>& headers, lightspark::ILoadable* owner); + void destroy(lightspark::Downloader* downloader); +}; + +class ppDownloader: public lightspark::Downloader +{ +private: + bool isMainClipDownloader; + SystemState* m_sys; + PP_Resource ppurlloader; + uint8_t buffer[4096]; + static void dlStartCallback(void* userdata,int result); + static void dlReadResponseCallback(void* userdata,int result); +public: + enum STATE { INIT=0, STREAM_DESTROYED, ASYNC_DESTROY }; + STATE state; + //Constructor used for the main file + ppDownloader(const lightspark::tiny_string& _url, PP_Instance _instance, lightspark::ILoadable* owner, SystemState *sys); + ppDownloader(const lightspark::tiny_string& _url, _R<StreamCache> cache, PP_Instance _instance, lightspark::ILoadable* owner); + ppDownloader(const lightspark::tiny_string& _url, _R<StreamCache> cache, const std::vector<uint8_t>& _data, + const std::list<tiny_string>& headers, PP_Instance _instance, lightspark::ILoadable* owner); +}; + +class ppPluginInstance +{ +friend class ppPluginEngineData; + PP_Instance m_ppinstance; + struct PP_Size m_last_size; + PP_Resource m_graphics; + lightspark::SystemState* m_sys; + std::streambuf *mainDownloaderStreambuf; + std::istream mainDownloaderStream; + ppDownloader* mainDownloader; + //NPScriptObjectGW* scriptObject; + lightspark::ParseThread* m_pt; +public: + ppPluginInstance(PP_Instance instance, int16_t argc,const char* argn[],const char* argv[]); + virtual ~ppPluginInstance(); + void handleResize(PP_Resource view); +}; + +class ppPluginEngineData: public EngineData +{ +private: + ppPluginInstance* instance; +public: + SystemState* sys; + ppPluginEngineData(ppPluginInstance* i, uint32_t w, uint32_t h,SystemState* _sys) : EngineData(), instance(i),sys(_sys) + { + width = w; + height = h; + needrenderthread=false; + } + PP_Resource getGraphics() { return instance->m_graphics;} + void stopMainDownload(); + bool isSizable() const { return false; } + uint32_t getWindowForGnash(); + /* must be called within mainLoopThread */ + SDL_Window* createWidget(uint32_t w,uint32_t h); + /* must be called within mainLoopThread */ + void grabFocus(); + void openPageInBrowser(const tiny_string& url, const tiny_string& window); + void setClipboardText(const std::string txt); + bool getScreenData(SDL_DisplayMode* screen); + double getScreenDPI(); + void SwapBuffers(); + void InitOpenGL(); + void DeinitOpenGL(); + bool getGLError(uint32_t &errorCode) const; + void exec_glUniform1f(int location,float v0); + void exec_glBindTexture_GL_TEXTURE_2D(uint32_t id); + void exec_glVertexAttribPointer(uint32_t index,int32_t size, int32_t stride, const void* coords); + void exec_glEnableVertexAttribArray(uint32_t index); + void exec_glDrawArrays_GL_TRIANGLES(int32_t first, int32_t count); + void exec_glDrawArrays_GL_LINE_STRIP(int32_t first, int32_t count); + void exec_glDrawArrays_GL_TRIANGLE_STRIP(int32_t first, int32_t count); + void exec_glDrawArrays_GL_LINES(int32_t first, int32_t count); + void exec_glDisableVertexAttribArray(uint32_t index); + void exec_glUniformMatrix4fv(int32_t location,int32_t count, bool transpose,const float* value); + void exec_glBindBuffer_GL_PIXEL_UNPACK_BUFFER(uint32_t buffer); + uint8_t* exec_glMapBuffer_GL_PIXEL_UNPACK_BUFFER_GL_WRITE_ONLY(); + void exec_glUnmapBuffer_GL_PIXEL_UNPACK_BUFFER(); + void exec_glEnable_GL_TEXTURE_2D(); + void exec_glEnable_GL_BLEND(); + void exec_glDisable_GL_TEXTURE_2D(); + void exec_glFlush(); + uint32_t exec_glCreateShader_GL_FRAGMENT_SHADER(); + uint32_t exec_glCreateShader_GL_VERTEX_SHADER(); + void exec_glShaderSource(uint32_t shader, int32_t count, const char** name, int32_t* length); + void exec_glCompileShader(uint32_t shader); + void exec_glGetShaderInfoLog(uint32_t shader,int32_t bufSize,int32_t* length,char* infoLog); + void exec_glGetShaderiv_GL_COMPILE_STATUS(uint32_t shader,int32_t* params); + uint32_t exec_glCreateProgram(); + void exec_glBindAttribLocation(uint32_t program,uint32_t index, const char* name); + void exec_glAttachShader(uint32_t program, uint32_t shader); + void exec_glLinkProgram(uint32_t program); + void exec_glGetProgramiv_GL_LINK_STATUS(uint32_t program,int32_t* params); + void exec_glBindFramebuffer_GL_FRAMEBUFFER(uint32_t framebuffer); + void exec_glDeleteTextures(int32_t n,uint32_t* textures); + void exec_glDeleteBuffers(int32_t n,uint32_t* buffers); + void exec_glBlendFunc_GL_ONE_GL_ONE_MINUS_SRC_ALPHA(); + void exec_glActiveTexture_GL_TEXTURE0(); + void exec_glGenBuffers(int32_t n,uint32_t* buffers); + void exec_glUseProgram(uint32_t program); + int32_t exec_glGetUniformLocation(uint32_t program,const char* name); + void exec_glUniform1i(int32_t location,int32_t v0); + void exec_glGenTextures(int32_t n,uint32_t* textures); + void exec_glViewport(int32_t x,int32_t y,int32_t width,int32_t height); + void exec_glBufferData_GL_PIXEL_UNPACK_BUFFER_GL_STREAM_DRAW(int32_t size,const void* data); + void exec_glTexParameteri_GL_TEXTURE_2D_GL_TEXTURE_MIN_FILTER_GL_LINEAR(); + void exec_glTexParameteri_GL_TEXTURE_2D_GL_TEXTURE_MAG_FILTER_GL_LINEAR(); + void exec_glTexImage2D_GL_TEXTURE_2D_GL_UNSIGNED_BYTE(int32_t level,int32_t width, int32_t height,int32_t border, const void* pixels); + void exec_glTexImage2D_GL_TEXTURE_2D_GL_UNSIGNED_INT_8_8_8_8_HOST(int32_t level,int32_t width, int32_t height,int32_t border, const void* pixels); + void exec_glDrawBuffer_GL_BACK(); + void exec_glClearColor(float red,float green,float blue,float alpha); + void exec_glClear_GL_COLOR_BUFFER_BIT(); + void exec_glPixelStorei_GL_UNPACK_ROW_LENGTH(int32_t param); + void exec_glPixelStorei_GL_UNPACK_SKIP_PIXELS(int32_t param); + void exec_glPixelStorei_GL_UNPACK_SKIP_ROWS(int32_t param); + void exec_glTexSubImage2D_GL_TEXTURE_2D(int32_t level,int32_t xoffset,int32_t yoffset,int32_t width,int32_t height,const void* pixels); + void exec_glGetIntegerv_GL_MAX_TEXTURE_SIZE(int32_t* data); +}; + +} +#endif // PPAPI_PLUGIN_H
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi
Added
+(directory)
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c
Added
+(directory)
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev
Added
+(directory)
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/deprecated_bool.h
Added
@@ -0,0 +1,43 @@ +/* Copyright (c) 2010 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef PPAPI_C_DEV_DEPRECATED_BOOL_H_ +#define PPAPI_C_DEV_DEPRECATED_BOOL_H_ + +/** + * @file + * Defines the API ... + * + * @addtogroup PP + * @{ + */ +// TODO(ppapi authors): Remove ppp_class_deprecated.h and ppb_var_deprecated.h +// and remove this file. This is only here to ease the transition from +// deprecated interfaces to the new ones. Add a usable definition of bool for +// C code. +#if !defined(__cplusplus) +# if defined(_MSC_VER) || !defined(__STDC_VERSION__) || \ + (__STDC_VERSION__ < 199901L) +// The Visual Studio C compiler and older versions of GCC do not support C99 +// and thus have no bool or stdbool.h. Make a simple definition of bool, +// true, and false to make this deprecated interface compile in C. Force it +// to 1 byte to have some chance of ABI compatibility between C and C++, in +// case we don't remove this. +typedef char bool; +# define false 0 +# define true 1 +# else +// In C99-compliant compilers, we can include stdbool.h to get a bool +// definition. +# include <stdbool.h> +# endif +#endif + +/** + * @} + * End addtogroup PP + */ + +#endif /* PPAPI_C_DEV_DEPRECATED_BOOL_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/pp_cursor_type_dev.h
Added
@@ -0,0 +1,75 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/pp_cursor_type_dev.idl modified Thu Nov 17 15:27:17 2011. */ + +#ifndef PPAPI_C_DEV_PP_CURSOR_TYPE_DEV_H_ +#define PPAPI_C_DEV_PP_CURSOR_TYPE_DEV_H_ + +#include "ppapi/c/pp_macros.h" + +/** + * @file + * This file defines enumerations for cursor types. + */ + + +/** + * @addtogroup Enums + * @{ + */ +enum PP_CursorType_Dev { + PP_CURSORTYPE_CUSTOM = -1, + PP_CURSORTYPE_POINTER = 0, + PP_CURSORTYPE_CROSS = 1, + PP_CURSORTYPE_HAND = 2, + PP_CURSORTYPE_IBEAM = 3, + PP_CURSORTYPE_WAIT = 4, + PP_CURSORTYPE_HELP = 5, + PP_CURSORTYPE_EASTRESIZE = 6, + PP_CURSORTYPE_NORTHRESIZE = 7, + PP_CURSORTYPE_NORTHEASTRESIZE = 8, + PP_CURSORTYPE_NORTHWESTRESIZE = 9, + PP_CURSORTYPE_SOUTHRESIZE = 10, + PP_CURSORTYPE_SOUTHEASTRESIZE = 11, + PP_CURSORTYPE_SOUTHWESTRESIZE = 12, + PP_CURSORTYPE_WESTRESIZE = 13, + PP_CURSORTYPE_NORTHSOUTHRESIZE = 14, + PP_CURSORTYPE_EASTWESTRESIZE = 15, + PP_CURSORTYPE_NORTHEASTSOUTHWESTRESIZE = 16, + PP_CURSORTYPE_NORTHWESTSOUTHEASTRESIZE = 17, + PP_CURSORTYPE_COLUMNRESIZE = 18, + PP_CURSORTYPE_ROWRESIZE = 19, + PP_CURSORTYPE_MIDDLEPANNING = 20, + PP_CURSORTYPE_EASTPANNING = 21, + PP_CURSORTYPE_NORTHPANNING = 22, + PP_CURSORTYPE_NORTHEASTPANNING = 23, + PP_CURSORTYPE_NORTHWESTPANNING = 24, + PP_CURSORTYPE_SOUTHPANNING = 25, + PP_CURSORTYPE_SOUTHEASTPANNING = 26, + PP_CURSORTYPE_SOUTHWESTPANNING = 27, + PP_CURSORTYPE_WESTPANNING = 28, + PP_CURSORTYPE_MOVE = 29, + PP_CURSORTYPE_VERTICALTEXT = 30, + PP_CURSORTYPE_CELL = 31, + PP_CURSORTYPE_CONTEXTMENU = 32, + PP_CURSORTYPE_ALIAS = 33, + PP_CURSORTYPE_PROGRESS = 34, + PP_CURSORTYPE_NODROP = 35, + PP_CURSORTYPE_COPY = 36, + PP_CURSORTYPE_NONE = 37, + PP_CURSORTYPE_NOTALLOWED = 38, + PP_CURSORTYPE_ZOOMIN = 39, + PP_CURSORTYPE_ZOOMOUT = 40, + PP_CURSORTYPE_GRAB = 41, + PP_CURSORTYPE_GRABBING = 42 +}; +PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_CursorType_Dev, 4); +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PP_CURSOR_TYPE_DEV_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/pp_print_settings_dev.h
Added
@@ -0,0 +1,76 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/pp_print_settings_dev.idl modified Fri Jan 16 13:30:14 2015. */ + +#ifndef PPAPI_C_DEV_PP_PRINT_SETTINGS_DEV_H_ +#define PPAPI_C_DEV_PP_PRINT_SETTINGS_DEV_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines the struct for PrintSettings. + */ + + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + PP_PRINTORIENTATION_NORMAL = 0, + PP_PRINTORIENTATION_ROTATED_90_CW = 1, + PP_PRINTORIENTATION_ROTATED_180 = 2, + PP_PRINTORIENTATION_ROTATED_90_CCW = 3 +} PP_PrintOrientation_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4); + +typedef enum { + PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0, + PP_PRINTOUTPUTFORMAT_PDF = 1u << 1, + PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2, + PP_PRINTOUTPUTFORMAT_EMF = 1u << 3 +} PP_PrintOutputFormat_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4); + +typedef enum { + PP_PRINTSCALINGOPTION_NONE = 0, + PP_PRINTSCALINGOPTION_FIT_TO_PRINTABLE_AREA = 1, + PP_PRINTSCALINGOPTION_SOURCE_SIZE = 2 +} PP_PrintScalingOption_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintScalingOption_Dev, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct PP_PrintSettings_Dev { + /** This is the size of the printable area in points (1/72 of an inch). */ + struct PP_Rect printable_area; + struct PP_Rect content_area; + struct PP_Size paper_size; + int32_t dpi; + PP_PrintOrientation_Dev orientation; + PP_PrintScalingOption_Dev print_scaling_option; + PP_Bool grayscale; + /** Note that Chrome currently only supports PDF printing. */ + PP_PrintOutputFormat_Dev format; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintSettings_Dev, 60); +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PP_PRINT_SETTINGS_DEV_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/ppb_cursor_control_dev.h
Added
@@ -0,0 +1,85 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppb_cursor_control_dev.idl modified Fri Nov 18 15:58:00 2011. */ + +#ifndef PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ +#define PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ + +#include "ppapi/c/dev/pp_cursor_type_dev.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4 "PPB_CursorControl(Dev);0.4" +#define PPB_CURSOR_CONTROL_DEV_INTERFACE PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4 + +/** + * @file + * This file defines the <code>PPB_CursorControl_Dev</code> interface + * implemented by the browser for controlling the cursor. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_CursorControl_Dev_0_4 { + /** + * Set a cursor. If "type" is PP_CURSORTYPE_CUSTOM, then "custom_image" + * must be an ImageData resource containing the cursor and "hot_spot" must + * contain the offset within that image that refers to the cursor's position. + */ + PP_Bool (*SetCursor)(PP_Instance instance, + enum PP_CursorType_Dev type, + PP_Resource custom_image, + const struct PP_Point* hot_spot); + /** + * This method causes the cursor to be moved to the center of the + * instance and be locked, preventing the user from moving it. + * The cursor is implicitly hidden from the user while locked. + * Cursor lock may only be requested in response to a + * PP_InputEvent_MouseDown, and then only if the event was generated via + * user gesture. + * + * While the cursor is locked, any movement of the mouse will + * generate a PP_InputEvent_Type_MouseMove, whose x and y values + * indicate the position the cursor would have been moved to had + * the cursor not been locked, and had the screen been infinite in size. + * + * The browser may revoke cursor lock for reasons including but not + * limited to the user pressing the ESC key, the user activating + * another program via a reserved keystroke (e.g., ALT+TAB), or + * some other system event. + * + * Returns PP_TRUE if the cursor could be locked, PP_FALSE otherwise. + */ + PP_Bool (*LockCursor)(PP_Instance instance); + /** + * Causes the cursor to be unlocked, allowing it to track user + * movement again. + */ + PP_Bool (*UnlockCursor)(PP_Instance instance); + /** + * Returns PP_TRUE if the cursor is locked, PP_FALSE otherwise. + */ + PP_Bool (*HasCursorLock)(PP_Instance instance); + /** + * Returns PP_TRUE if the cursor can be locked, PP_FALSE otherwise. + */ + PP_Bool (*CanLockCursor)(PP_Instance instance); +}; + +typedef struct PPB_CursorControl_Dev_0_4 PPB_CursorControl_Dev; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/ppb_file_chooser_dev.h
Added
@@ -0,0 +1,142 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppb_file_chooser_dev.idl modified Mon Jun 4 12:44:29 2012. */ + +#ifndef PPAPI_C_DEV_PPB_FILE_CHOOSER_DEV_H_ +#define PPAPI_C_DEV_PPB_FILE_CHOOSER_DEV_H_ + +#include "ppapi/c/pp_array_output.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_FILECHOOSER_DEV_INTERFACE_0_5 "PPB_FileChooser(Dev);0.5" +#define PPB_FILECHOOSER_DEV_INTERFACE_0_6 "PPB_FileChooser(Dev);0.6" +#define PPB_FILECHOOSER_DEV_INTERFACE PPB_FILECHOOSER_DEV_INTERFACE_0_6 + +/** + * @file + * This file defines the <code>PPB_FileChooser_Dev</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains constants to control the behavior of the file + * chooser dialog. + */ +typedef enum { + /** + * Mode for choosing a single existing file. + */ + PP_FILECHOOSERMODE_OPEN = 0, + /** + * Mode for choosing multiple existing files. + */ + PP_FILECHOOSERMODE_OPENMULTIPLE = 1 +} PP_FileChooserMode_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileChooserMode_Dev, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_FileChooser_Dev_0_6 { + /** + * This function creates a file chooser dialog resource. The chooser is + * associated with a particular instance, so that it may be positioned on the + * screen relative to the tab containing the instance. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] mode A <code>PP_FileChooserMode_Dev</code> value that controls + * the behavior of the file chooser dialog. + * @param[in] accept_types A comma-separated list of MIME types and file + * extensions such as "audio/ *,text/plain,.html" (note there should be no + * space between the '/' and the '*', but one is added to avoid confusing C++ + * comments). The dialog may restrict selectable files to the specified MIME + * types and file extensions. If a string in the comma-separated list begins + * with a period (.) then the string is interpreted as a file extension, + * otherwise it is interpreted as a MIME-type. An empty string or an undefined + * var may be given to indicate that all types should be accepted. + * + * @return A <code>PP_Resource</code> containing the file chooser if + * successful or 0 if it could not be created. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_FileChooserMode_Dev mode, + struct PP_Var accept_types); + /** + * Determines if the provided resource is a file chooser. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a generic + * resource. + * + * @return A <code>PP_Bool</code> that is <code>PP_TRUE</code> if the given + * resource is a file chooser resource, otherwise <code>PP_FALSE</code>. + */ + PP_Bool (*IsFileChooser)(PP_Resource resource); + /** + * This function displays a previously created file chooser resource as a + * dialog box, prompting the user to choose a file or files. This function + * must be called in response to a user gesture, such as a mouse click or + * touch event. The callback is called with PP_OK on successful completion + * with a file (or files) selected, PP_ERROR_USERCANCEL if the user selected + * no file, or another error code from pp_errors.h on failure. + * + * <b>Subtle note:</b> This function will only work when the tab containing + * the plugin is visible. Show() will fail if the tab is in the background. + * Since it's not normally possible to get input events while invisible, this + * is not normally an issue. But there is a race condition because events are + * processed asynchronously. If the user clicks and switches tabs very + * quickly, a plugin could believe the tab is visible while Chrome believes + * it is invisible and the Show() call will fail. This will not generally + * cause user confusion since the user will have switched tabs and will not + * want to see a file chooser from a different tab. + * + * @param[in] chooser The file chooser resource. + * + * @param[in] output An output array which will receive PP_Resource(s) + * identifying the <code>PPB_FileRef</code> objects that the user selected on + * success. + * + * @param[in] callback A <code>CompletionCallback</code> to be called after + * the user has closed the file chooser dialog. + * + * @return PP_OK_COMPLETIONPENDING if request to show the dialog was + * successful, another error code from pp_errors.h on failure. + */ + int32_t (*Show)(PP_Resource chooser, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_FileChooser_Dev_0_6 PPB_FileChooser_Dev; + +struct PPB_FileChooser_Dev_0_5 { + PP_Resource (*Create)(PP_Instance instance, + PP_FileChooserMode_Dev mode, + struct PP_Var accept_types); + PP_Bool (*IsFileChooser)(PP_Resource resource); + int32_t (*Show)(PP_Resource chooser, struct PP_CompletionCallback callback); + PP_Resource (*GetNextChosenFile)(PP_Resource chooser); +}; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_FILE_CHOOSER_DEV_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/ppb_memory_dev.h
Added
@@ -0,0 +1,57 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppb_memory_dev.idl modified Fri Nov 18 15:58:00 2011. */ + +#ifndef PPAPI_C_DEV_PPB_MEMORY_DEV_H_ +#define PPAPI_C_DEV_PPB_MEMORY_DEV_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_MEMORY_DEV_INTERFACE_0_1 "PPB_Memory(Dev);0.1" +#define PPB_MEMORY_DEV_INTERFACE PPB_MEMORY_DEV_INTERFACE_0_1 + +/** + * @file + * This file defines the <code>PPB_Memory interface</code> for functions + * related to memory management. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Memory_Dev interface contains pointers to functions related to memory + * management. + * + */ +struct PPB_Memory_Dev_0_1 { + /** + * MemAlloc is a pointer to a function that allocate memory. + * + * @param[in] num_bytes A number of bytes to allocate. + * @return A pointer to the memory if successful, NULL If the + * allocation fails. + */ + void* (*MemAlloc)(uint32_t num_bytes); + /** + * MemFree is a pointer to a function that deallocates memory. + * + * @param[in] ptr A pointer to the memory to deallocate. It is safe to + * pass NULL to this function. + */ + void (*MemFree)(void* ptr); +}; + +typedef struct PPB_Memory_Dev_0_1 PPB_Memory_Dev; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_MEMORY_DEV_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/ppb_opengles2ext_dev.h
Added
@@ -0,0 +1,53 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +/* From dev/ppb_opengles2ext_dev.idl modified Fri Sep 5 14:52:51 2014. */ + +#ifndef PPAPI_C_DEV_PPB_OPENGLES2EXT_DEV_H_ +#define PPAPI_C_DEV_PPB_OPENGLES2EXT_DEV_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/ppb_opengles2.h" + +#define PPB_OPENGLES2_DRAWBUFFERS_DEV_INTERFACE_1_0 \ + "PPB_OpenGLES2DrawBuffers(Dev);1.0" +#define PPB_OPENGLES2_DRAWBUFFERS_DEV_INTERFACE \ + PPB_OPENGLES2_DRAWBUFFERS_DEV_INTERFACE_1_0 + +/** + * @file + * This file is auto-generated from + * gpu/command_buffer/build_gles2_cmd_buffer.py + * It's formatted by clang-format using chromium coding style: + * clang-format -i -style=chromium filename + * DO NOT EDIT! */ + + +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/ppb_opengles2.h" + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_OpenGLES2DrawBuffers_Dev_1_0 { + void (*DrawBuffersEXT)(PP_Resource context, + GLsizei count, + const GLenum* bufs); +}; + +struct PPB_OpenGLES2DrawBuffers_Dev { + void (*DrawBuffersEXT)(PP_Resource context, + GLsizei count, + const GLenum* bufs); +}; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_OPENGLES2EXT_DEV_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/ppb_printing_dev.h
Added
@@ -0,0 +1,70 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppb_printing_dev.idl modified Fri Apr 19 10:45:09 2013. */ + +#ifndef PPAPI_C_DEV_PPB_PRINTING_DEV_H_ +#define PPAPI_C_DEV_PPB_PRINTING_DEV_H_ + +#include "ppapi/c/dev/pp_print_settings_dev.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_PRINTING_DEV_INTERFACE_0_7 "PPB_Printing(Dev);0.7" +#define PPB_PRINTING_DEV_INTERFACE PPB_PRINTING_DEV_INTERFACE_0_7 + +/** + * @file + * Definition of the PPB_Printing interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Printing_Dev_0_7 { + /** Create a resource for accessing printing functionality. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * + * @return A <code>PP_Resource</code> containing the printing resource if + * successful or 0 if it could not be created. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Outputs the default print settings for the default printer into + * <code>print_settings</code>. The callback is called with + * <code>PP_OK</code> when the settings have been retrieved successfully. + * + * @param[in] resource The printing resource. + * + * @param[in] callback A <code>CompletionCallback</code> to be called when + * <code>print_settings</code> have been retrieved. + * + * @return PP_OK_COMPLETIONPENDING if request for the default print settings + * was successful, another error code from pp_errors.h on failure. + */ + int32_t (*GetDefaultPrintSettings)( + PP_Resource resource, + struct PP_PrintSettings_Dev* print_settings, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_Printing_Dev_0_7 PPB_Printing_Dev; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_PRINTING_DEV_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/ppb_trace_event_dev.h
Added
@@ -0,0 +1,118 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppb_trace_event_dev.idl modified Tue Jun 25 16:12:08 2013. */ + +#ifndef PPAPI_C_DEV_PPB_TRACE_EVENT_DEV_H_ +#define PPAPI_C_DEV_PPB_TRACE_EVENT_DEV_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_TRACE_EVENT_DEV_INTERFACE_0_1 "PPB_Trace_Event(Dev);0.1" +#define PPB_TRACE_EVENT_DEV_INTERFACE_0_2 "PPB_Trace_Event(Dev);0.2" +#define PPB_TRACE_EVENT_DEV_INTERFACE PPB_TRACE_EVENT_DEV_INTERFACE_0_2 + +/** + * @file + * This file defines the <code>PPB_Trace_Event</code> interface. It is meant + * to be used in plugins as the API that trace macros from trace_event.h use. + */ + + +/** + * @addtogroup Typedefs + * @{ + */ +/** + * A trace event timestamp. + */ +typedef int64_t PP_TraceEventTime; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Trace_Event_Dev_0_2 { + /** + * Gets a pointer to a character for identifying a category name in the + * tracing system as well as for being able to early exit in client-side + * tracing code. + * + * NB: This mem_t return value should technically be const, but return values + * for Pepper IDL of mem_t type are not const. The same is true for the arg + * |category_enabled| for AddTraceEvent. + */ + void* (*GetCategoryEnabled)(const char* category_name); + /** + * Adds a trace event to the platform tracing system. This function call is + * usually the result of a TRACE_* macro from trace_event.h when tracing and + * the category of the particular trace are enabled. It is not advisable to + * call this function on its own; it is really only meant to be used by the + * trace macros. + */ + void (*AddTraceEvent)(int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags); + /** + * Version of the above interface that allows specifying a custom thread id + * and timestamp. This is useful for when tracing data cannot be registered + * in real time. For example, this could be used by storing timestamps + * internally and then registering the events retroactively. + */ + void (*AddTraceEventWithThreadIdAndTimestamp)(int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + int32_t thread_id, + PP_TraceEventTime timestamp, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags); + /** + * Get the current clock value. Since this uses the same function as the trace + * events use internally, it can be used to create events with explicit time + * stamps. + */ + PP_TraceEventTime (*Now)(void); + /** + * Sets the thread name of the calling thread in the tracing system so it will + * show up properly in chrome://tracing. + */ + void (*SetThreadName)(const char* thread_name); +}; + +typedef struct PPB_Trace_Event_Dev_0_2 PPB_Trace_Event_Dev; + +struct PPB_Trace_Event_Dev_0_1 { + void* (*GetCategoryEnabled)(const char* category_name); + void (*AddTraceEvent)(int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags); + void (*SetThreadName)(const char* thread_name); +}; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_TRACE_EVENT_DEV_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/ppb_truetype_font_dev.h
Added
@@ -0,0 +1,295 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppb_truetype_font_dev.idl modified Tue Oct 15 05:52:52 2013. */ + +#ifndef PPAPI_C_DEV_PPB_TRUETYPE_FONT_DEV_H_ +#define PPAPI_C_DEV_PPB_TRUETYPE_FONT_DEV_H_ + +#include "ppapi/c/pp_array_output.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_TRUETYPEFONT_DEV_INTERFACE_0_1 "PPB_TrueTypeFont(Dev);0.1" +#define PPB_TRUETYPEFONT_DEV_INTERFACE PPB_TRUETYPEFONT_DEV_INTERFACE_0_1 + +/** + * @file + * This file defines the <code>PPB_TrueTypeFont_Dev</code> interface. This + * interface exposes font table data for 'sfnt' fonts on the host system. These + * include TrueType and OpenType fonts. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * The PP_TrueTypeFontFamily_Dev defines generic font families. These can be + * used to create generic fonts consistent with the user's browser settings. + */ +typedef enum { + /** + * For a description of these default families, see the + * <a href="http://www.w3.org/TR/css3-fonts/#generic-font-families"> + * 3.1.1 Generic font families</a> documentation. + */ + PP_TRUETYPEFONTFAMILY_SERIF = 0, + PP_TRUETYPEFONTFAMILY_SANSSERIF = 1, + PP_TRUETYPEFONTFAMILY_CURSIVE = 2, + PP_TRUETYPEFONTFAMILY_FANTASY = 3, + PP_TRUETYPEFONTFAMILY_MONOSPACE = 4 +} PP_TrueTypeFontFamily_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontFamily_Dev, 4); + +/** + * The PP_TrueTypeFontStyle_Dev enum defines font styles. + */ +typedef enum { + PP_TRUETYPEFONTSTYLE_NORMAL = 0, + PP_TRUETYPEFONTSTYLE_ITALIC = 1 +} PP_TrueTypeFontStyle_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontStyle_Dev, 4); + +/** + * The PP_TrueTypeFontWeight_Dev enum defines font weights. + */ +typedef enum { + PP_TRUETYPEFONTWEIGHT_THIN = 100, + PP_TRUETYPEFONTWEIGHT_ULTRALIGHT = 200, + PP_TRUETYPEFONTWEIGHT_LIGHT = 300, + PP_TRUETYPEFONTWEIGHT_NORMAL = 400, + PP_TRUETYPEFONTWEIGHT_MEDIUM = 500, + PP_TRUETYPEFONTWEIGHT_SEMIBOLD = 600, + PP_TRUETYPEFONTWEIGHT_BOLD = 700, + PP_TRUETYPEFONTWEIGHT_ULTRABOLD = 800, + PP_TRUETYPEFONTWEIGHT_HEAVY = 900 +} PP_TrueTypeFontWeight_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontWeight_Dev, 4); + +/** + * The PP_TrueTypeFontWidth_Dev enum defines font widths. + */ +typedef enum { + PP_TRUETYPEFONTWIDTH_ULTRACONDENSED = 0, + PP_TRUETYPEFONTWIDTH_EXTRACONDENSED = 1, + PP_TRUETYPEFONTWIDTH_CONDENSED = 2, + PP_TRUETYPEFONTWIDTH_SEMICONDENSED = 3, + PP_TRUETYPEFONTWIDTH_NORMAL = 4, + PP_TRUETYPEFONTWIDTH_SEMIEXPANDED = 5, + PP_TRUETYPEFONTWIDTH_EXPANDED = 6, + PP_TRUETYPEFONTWIDTH_EXTRAEXPANDED = 7, + PP_TRUETYPEFONTWIDTH_ULTRAEXPANDED = 8 +} PP_TrueTypeFontWidth_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontWidth_Dev, 4); + +/** + * The PP_TrueTypeFontCharset enum defines font character sets. + */ +typedef enum { + PP_TRUETYPEFONTCHARSET_ANSI = 0, + PP_TRUETYPEFONTCHARSET_DEFAULT = 1, + PP_TRUETYPEFONTCHARSET_SYMBOL = 2, + PP_TRUETYPEFONTCHARSET_MAC = 77, + PP_TRUETYPEFONTCHARSET_SHIFTJIS = 128, + PP_TRUETYPEFONTCHARSET_HANGUL = 129, + PP_TRUETYPEFONTCHARSET_JOHAB = 130, + PP_TRUETYPEFONTCHARSET_GB2312 = 134, + PP_TRUETYPEFONTCHARSET_CHINESEBIG5 = 136, + PP_TRUETYPEFONTCHARSET_GREEK = 161, + PP_TRUETYPEFONTCHARSET_TURKISH = 162, + PP_TRUETYPEFONTCHARSET_VIETNAMESE = 163, + PP_TRUETYPEFONTCHARSET_HEBREW = 177, + PP_TRUETYPEFONTCHARSET_ARABIC = 178, + PP_TRUETYPEFONTCHARSET_BALTIC = 186, + PP_TRUETYPEFONTCHARSET_RUSSIAN = 204, + PP_TRUETYPEFONTCHARSET_THAI = 222, + PP_TRUETYPEFONTCHARSET_EASTEUROPE = 238, + PP_TRUETYPEFONTCHARSET_OEM = 255 +} PP_TrueTypeFontCharset_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontCharset_Dev, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * The <code>PP_TrueTypeFontDesc</code> struct describes a TrueType font. It is + * passed to Create(), and returned by Describe(). + */ +struct PP_TrueTypeFontDesc_Dev { + /** + * Font family name as a string. This can also be an undefined var, in which + * case the generic family will be obeyed. If the face is not available on + * the system, the browser will attempt to do font fallback or pick a default + * font. + */ + struct PP_Var family; + /** This value specifies a generic font family. If a family name string is + * provided when creating a font, this is ignored. */ + PP_TrueTypeFontFamily_Dev generic_family; + /** This value specifies the font style. */ + PP_TrueTypeFontStyle_Dev style; + /** This value specifies the font weight. */ + PP_TrueTypeFontWeight_Dev weight; + /** This value specifies the font width, for condensed or expanded fonts */ + PP_TrueTypeFontWidth_Dev width; + /** This value specifies a character set. */ + PP_TrueTypeFontCharset_Dev charset; + /** + * Ensure that this struct is 40-bytes wide by padding the end. In some + * compilers, PP_Var is 8-byte aligned, so those compilers align this struct + * on 8-byte boundaries as well and pad it to 16 bytes even without this + * padding attribute. This padding makes its size consistent across + * compilers. + */ + int32_t padding; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_TrueTypeFontDesc_Dev, 40); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_TrueTypeFont_Dev_0_1 { + /** + * Gets an array of TrueType font family names available on the host. + * These names can be used to create a font from a specific family. + * + * @param[in] instance A <code>PP_Instance</code> requesting the family names. + * @param[in] output A <code>PP_ArrayOutput</code> to hold the names. + * The output is an array of PP_Vars, each holding a family name. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of GetFontFamilies. + * + * @return If >= 0, the number of family names returned, otherwise an error + * code from <code>pp_errors.h</code>. + */ + int32_t (*GetFontFamilies)(PP_Instance instance, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + /** + * Gets an array of TrueType font descriptors for a given font family. These + * descriptors can be used to create a font in that family and matching the + * descriptor attributes. + * + * @param[in] instance A <code>PP_Instance</code> requesting the font + * descriptors. + * @param[in] family A <code>PP_Var</code> holding a string specifying the + * font family. + * @param[in] output A <code>PP_ArrayOutput</code> to hold the descriptors. + * The output is an array of <code>PP_TrueTypeFontDesc</code> structs. Each + * desc contains a PP_Var for the family name which must be released. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of GetFontsInFamily. + * + * @return If >= 0, the number of font descriptors returned, otherwise an + * error code from <code>pp_errors.h</code>. + */ + int32_t (*GetFontsInFamily)(PP_Instance instance, + struct PP_Var family, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + /** + * Creates a font resource matching the given font characteristics. The + * resource id will be non-zero on success, or zero on failure. + * + * @param[in] instance A <code>PP_Instance</code> to own the font. + * @param[in] desc A pointer to a <code>PP_TrueTypeFontDesc</code> describing + * the font. + */ + PP_Resource (*Create)(PP_Instance instance, + const struct PP_TrueTypeFontDesc_Dev* desc); + /** + * Determines if the given resource is a TrueType font. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a resource. + * + * @return <code>PP_TRUE</code> if the resource is a + * <code>PPB_TrueTypeFont_Dev</code>, <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsTrueTypeFont)(PP_Resource resource); + /** + * Returns a description of the given font resource. This description may + * differ from the description passed to Create, reflecting the host's font + * matching and fallback algorithm. + * + * @param[in] font A <code>PP_Resource</code> corresponding to a font. + * @param[out] desc A pointer to a <code>PP_TrueTypeFontDesc</code> to hold + * the description. The internal 'family' PP_Var should be set to undefined, + * since this function overwrites the <code>PP_TrueTypeFontDesc</code>. After + * successful completion, the family will be set to a PP_Var with a single + * reference, which the caller must release after use. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Describe. + * + * @return A return code from <code>pp_errors.h</code>. If an error code is + * returned, the <code>PP_TrueTypeFontDesc</code> will be unchanged. + */ + int32_t (*Describe)(PP_Resource font, + struct PP_TrueTypeFontDesc_Dev* desc, + struct PP_CompletionCallback callback); + /** + * Gets an array of identifying tags for each table in the font. These tags + * can be used to request specific tables using GetTable. + * + * @param[in] font A <code>PP_Resource</code> corresponding to a font. + * @param[in] output A <code>PP_ArrayOutput</code> to hold the tags. + * The output is an array of 4 byte integers, each representing a table tag. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of GetTableTags. + * + * @return If >= 0, the number of table tags returned, otherwise an error + * code from <code>pp_errors.h</code>. + */ + int32_t (*GetTableTags)(PP_Resource font, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + /** + * Copies the given font table into client memory. + * + * @param[in] font A <code>PP_Resource</code> corresponding to a font. + * @param[in] table A 4 byte value indicating which table to copy. + * For example, 'glyf' will cause the outline table to be copied into the + * output array. A zero tag value will cause the entire font to be copied. + * @param[in] offset The offset into the font table. Passing an offset + * greater than or equal to the table size will succeed with 0 bytes copied. + * @param[in] max_data_length The maximum number of bytes to transfer from + * <code>offset</code>. + * @param[in] output A <code>PP_ArrayOutput</code> to hold the font data. + * The output is an array of bytes. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of GetTable. + * + * @return If >= 0, the table size in bytes, otherwise an error code from + * <code>pp_errors.h</code>. + */ + int32_t (*GetTable)(PP_Resource font, + uint32_t table, + int32_t offset, + int32_t max_data_length, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_TrueTypeFont_Dev_0_1 PPB_TrueTypeFont_Dev; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_TRUETYPE_FONT_DEV_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/ppb_var_deprecated.h
Added
@@ -0,0 +1,254 @@ +/* Copyright (c) 2010 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef PPAPI_C_PPB_VAR_DEPRECATED_H_ +#define PPAPI_C_PPB_VAR_DEPRECATED_H_ + +#include "ppapi/c/dev/deprecated_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +struct PPP_Class_Deprecated; + +#define PPB_VAR_DEPRECATED_INTERFACE_0_3 "PPB_Var(Deprecated);0.3" +#define PPB_VAR_DEPRECATED_INTERFACE PPB_VAR_DEPRECATED_INTERFACE_0_3 + +/** + * @file + * Defines the PPB_Var_Deprecated struct. + * See http://code.google.com/p/ppapi/wiki/InterfacingWithJavaScript + * for general information on using this interface. + * {PENDING: Should the generated doc really be pointing to methods?} + * + * @addtogroup PPB + * @{ + */ + +struct PPB_Var_Deprecated { + /** + * Adds a reference to the given var. If this is not a refcounted object, + * this function will do nothing so you can always call it no matter what the + * type. + */ + void (*AddRef)(struct PP_Var var); + + /** + * Removes a reference to given var, deleting it if the internal refcount + * becomes 0. If the given var is not a refcounted object, this function will + * do nothing so you can always call it no matter what the type. + */ + void (*Release)(struct PP_Var var); + + /** + * Creates a string var from a string. The string must be encoded in valid + * UTF-8 and is NOT NULL-terminated, the length must be specified in |len|. + * It is an error if the string is not valid UTF-8. + * + * If the length is 0, the |data| pointer will not be dereferenced and may + * be NULL. Note, however, that if you do this, the "NULL-ness" will not be + * preserved, as VarToUtf8 will never return NULL on success, even for empty + * strings. + * + * The resulting object will be a refcounted string object. It will be + * AddRef()ed for the caller. When the caller is done with it, it should be + * Release()d. + * + * On error (basically out of memory to allocate the string, or input that + * is not valid UTF-8), this function will return a Null var. + */ + struct PP_Var (*VarFromUtf8)(PP_Module module, + const char* data, uint32_t len); + + /** + * Converts a string-type var to a char* encoded in UTF-8. This string is NOT + * NULL-terminated. The length will be placed in |*len|. If the string is + * valid but empty the return value will be non-NULL, but |*len| will still + * be 0. + * + * If the var is not a string, this function will return NULL and |*len| will + * be 0. + * + * The returned buffer will be valid as long as the underlying var is alive. + * If the plugin frees its reference, the string will be freed and the pointer + * will be to random memory. + */ + const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); + + /** + * Returns true if the property with the given name exists on the given + * object, false if it does not. Methods are also counted as properties. + * + * The name can either be a string or an integer var. It is an error to pass + * another type of var as the name. + * + * If you pass an invalid name or object, the exception will be set (if it is + * non-NULL, and the return value will be false). + */ + bool (*HasProperty)(struct PP_Var object, + struct PP_Var name, + struct PP_Var* exception); + + /** + * Identical to HasProperty, except that HasMethod additionally checks if the + * property is a function. + */ + bool (*HasMethod)(struct PP_Var object, + struct PP_Var name, + struct PP_Var* exception); + + /** + * Returns the value of the given property. If the property doesn't exist, the + * exception (if non-NULL) will be set and a "Void" var will be returned. + */ + struct PP_Var (*GetProperty)(struct PP_Var object, + struct PP_Var name, + struct PP_Var* exception); + + /** + * Retrieves all property names on the given object. Property names include + * methods. + * + * If there is a failure, the given exception will be set (if it is non-NULL). + * On failure, |*properties| will be set to NULL and |*property_count| will be + * set to 0. + * + * A pointer to the array of property names will be placesd in |*properties|. + * The caller is responsible for calling Release() on each of these properties + * (as per normal refcounted memory management) as well as freeing the array + * pointer with PPB_Core.MemFree(). + * + * This function returns all "enumerable" properties. Some JavaScript + * properties are "hidden" and these properties won't be retrieved by this + * function, yet you can still set and get them. + * + * Example: + * <pre> uint32_t count; + * PP_Var* properties; + * ppb_var.GetAllPropertyNames(object, &count, &properties); + * + * ...use the properties here... + * + * for (uint32_t i = 0; i < count; i++) + * ppb_var.Release(properties[i]); + * ppb_core.MemFree(properties); </pre> + */ + void (*GetAllPropertyNames)(struct PP_Var object, + uint32_t* property_count, + struct PP_Var** properties, + struct PP_Var* exception); + + /** + * Sets the property with the given name on the given object. The exception + * will be set, if it is non-NULL, on failure. + */ + void (*SetProperty)(struct PP_Var object, + struct PP_Var name, + struct PP_Var value, + struct PP_Var* exception); + + /** + * Removes the given property from the given object. The property name must + * be an string or integer var, using other types will throw an exception + * (assuming the exception pointer is non-NULL). + */ + void (*RemoveProperty)(struct PP_Var object, + struct PP_Var name, + struct PP_Var* exception); + + // TODO(brettw) need native array access here. + + /** + * Invoke the function |method_name| on the given object. If |method_name| + * is a Null var, the default method will be invoked, which is how you can + * invoke function objects. + * + * Unless it is type Null, |method_name| must be a string. Unlike other + * Var functions, integer lookup is not supported since you can't call + * functions on integers in JavaScript. + * + * Pass the arguments to the function in order in the |argv| array, and the + * number of arguments in the |argc| parameter. |argv| can be NULL if |argc| + * is zero. + * + * Example: + * Call(obj, VarFromUtf8("DoIt"), 0, NULL, NULL) = obj.DoIt() in JavaScript. + * Call(obj, PP_MakeNull(), 0, NULL, NULL) = obj() in JavaScript. + */ + struct PP_Var (*Call)(struct PP_Var object, + struct PP_Var method_name, + uint32_t argc, + struct PP_Var* argv, + struct PP_Var* exception); + + /** + * Invoke the object as a constructor. + * + * For example, if |object| is |String|, this is like saying |new String| in + * JavaScript. + */ + struct PP_Var (*Construct)(struct PP_Var object, + uint32_t argc, + struct PP_Var* argv, + struct PP_Var* exception); + + /** + * If the object is an instance of the given class, then this method returns + * true and sets *object_data to the value passed to CreateObject provided + * object_data is non-NULL. Otherwise, this method returns false. + */ + bool (*IsInstanceOf)(struct PP_Var var, + const struct PPP_Class_Deprecated* object_class, + void** object_data); + + /** + * Creates an object that the plugin implements. The plugin supplies a + * pointer to the class interface it implements for that object, and its + * associated internal data that represents that object. This object data + * must be unique among all "live" objects. + * + * The returned object will have a reference count of 1. When the reference + * count reached 0, the class' Destruct function wlil be called. + * + * On failure, this will return a null var. This probably means the module + * was invalid. + * + * Example: Say we're implementing a "Point" object. + * <pre> void PointDestruct(void* object) { + * delete (Point*)object; + * } + * + * const PPP_Class_Deprecated point_class = { + * ... all the other class functions go here ... + * &PointDestruct + * }; + * + * * The plugin's internal object associated with the point. + * class Point { + * ... + * }; + * + * PP_Var MakePoint(int x, int y) { + * return CreateObject(&point_class, new Point(x, y)); + * }</pre> + */ + struct PP_Var (*CreateObject)(PP_Instance instance, + const struct PPP_Class_Deprecated* object_class, + void* object_data); + + // Like CreateObject but takes a module. This will be deleted when all callers + // can be changed to use the PP_Instance CreateObject one. + struct PP_Var (*CreateObjectWithModuleDeprecated)( + PP_Module module, + const struct PPP_Class_Deprecated* object_class, + void* object_data); +}; + +/** + * @} + * End addtogroup PPB + */ +#endif /* PPAPI_C_PPB_VAR_DEPRECATED_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/ppb_view_dev.h
Added
@@ -0,0 +1,65 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppb_view_dev.idl modified Mon Jun 18 14:55:58 2012. */ + +#ifndef PPAPI_C_DEV_PPB_VIEW_DEV_H_ +#define PPAPI_C_DEV_PPB_VIEW_DEV_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_VIEW_DEV_INTERFACE_0_1 "PPB_View(Dev);0.1" +#define PPB_VIEW_DEV_INTERFACE PPB_VIEW_DEV_INTERFACE_0_1 + +/** + * @file + * This file contains the <code>PPB_View_Dev</code> interface. */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/* PPB_View_Dev interface */ +struct PPB_View_Dev_0_1 { + /** + * GetDeviceScale returns the scale factor between device pixels and DIPs + * (also known as logical pixels or UI pixels on some platforms). This allows + * the developer to render their contents at device resolution, even as + * coordinates / sizes are given in DIPs through the API. + * + * Note that the coordinate system for Pepper APIs is DIPs. Also note that + * one DIP might not equal one CSS pixel - when page scale/zoom is in effect. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_View</code> resource. + * + * @return A <code>float</code> value representing the number of device pixels + * per DIP. If the resource is invalid, the value will be 0.0. + */ + float (*GetDeviceScale)(PP_Resource resource); + /** + * GetCSSScale returns the scale factor between DIPs and CSS pixels. This + * allows proper scaling between DIPs - as sent via the Pepper API - and CSS + * pixel coordinates used for Web content. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_View</code> resource. + * + * @return css_scale A <code>float</code> value representing the number of + * DIPs per CSS pixel. If the resource is invalid, the value will be 0.0. + */ + float (*GetCSSScale)(PP_Resource resource); +}; + +typedef struct PPB_View_Dev_0_1 PPB_View_Dev; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_VIEW_DEV_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/ppp_class_deprecated.h
Added
@@ -0,0 +1,135 @@ +/* Copyright (c) 2010 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef PPAPI_C_PPP_CLASS_DEPRECATED_H_ +#define PPAPI_C_PPP_CLASS_DEPRECATED_H_ + +#include "ppapi/c/dev/deprecated_bool.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +/** + * @file + * Defines the PPP_Class_Deprecated struct. + * + * @addtogroup PPP + * @{ + */ + +struct PP_Var; + +/** + * Interface for the plugin to implement JavaScript-accessible objects. + * + * This interface has no interface name. Instead, the plugin passes a pointer + * to this interface to PPB_Var_Deprecated.CreateObject that corresponds to the + * object being implemented. + * + * See the PPB_Var_Deprecated interface for more information on these functions. + * This interface just allows you to implement the "back end" of those + * functions, so most of the contract is specified in that interface. + * + * See + * http://code.google.com/p/ppapi/wiki/InterfacingWithJavaScript + * for general information on using and implementing vars. + */ +struct PPP_Class_Deprecated { + /** + * |name| is guaranteed to be an integer or string type var. Exception is + * guaranteed non-NULL. An integer is used for |name| when implementing + * array access into the object. This test should only return true for + * properties that are not methods. Use HasMethod() to handle methods. + */ + bool (*HasProperty)(void* object, + struct PP_Var name, + struct PP_Var* exception); + + /** + * |name| is guaranteed to be a string-type. Exception is guaranteed non-NULL. + * If the method does not exist, return false and don't set the exception. + * Errors in this function will probably not occur in general usage, but + * if you need to throw an exception, still return false. + */ + bool (*HasMethod)(void* object, + struct PP_Var name, + struct PP_Var* exception); + + /** + * |name| is guaranteed to be a string-type or an integer-type var. Exception + * is guaranteed non-NULL. An integer is used for |name| when implementing + * array access into the object. If the property does not exist, set the + * exception and return a var of type Void. A property does not exist if + * a call HasProperty() for the same |name| would return false. + */ + struct PP_Var (*GetProperty)(void* object, + struct PP_Var name, + struct PP_Var* exception); + + /** + * Exception is guaranteed non-NULL. + * + * This should include all enumerable properties, including methods. Be sure + * to set |*property_count| to 0 and |properties| to NULL in all failure + * cases, these should never be unset when calling this function. The + * pointers passed in are guaranteed not to be NULL, so you don't have to + * NULL check them. + * + * If you have any properties, allocate the property array with + * PPB_Core.MemAlloc(sizeof(PP_Var) * property_count) and add a reference + * to each property on behalf of the caller. The caller is responsible for + * Release()ing each var and calling PPB_Core.MemFree on the property pointer. + */ + void (*GetAllPropertyNames)(void* object, + uint32_t* property_count, + struct PP_Var** properties, + struct PP_Var* exception); + + /** + * |name| is guaranteed to be an integer or string type var. Exception is + * guaranteed non-NULL. + */ + void (*SetProperty)(void* object, + struct PP_Var name, + struct PP_Var value, + struct PP_Var* exception); + + /** + * |name| is guaranteed to be an integer or string type var. Exception is + * guaranteed non-NULL. + */ + void (*RemoveProperty)(void* object, + struct PP_Var name, + struct PP_Var* exception); + + // TODO(brettw) need native array access here. + + /** + * |name| is guaranteed to be a string type var. Exception is guaranteed + * non-NULL + */ + struct PP_Var (*Call)(void* object, + struct PP_Var method_name, + uint32_t argc, + struct PP_Var* argv, + struct PP_Var* exception); + + /** Exception is guaranteed non-NULL. */ + struct PP_Var (*Construct)(void* object, + uint32_t argc, + struct PP_Var* argv, + struct PP_Var* exception); + + /** + * Called when the reference count of the object reaches 0. Normally, plugins + * would free their internal data pointed to by the |object| pointer. + */ + void (*Deallocate)(void* object); +}; + +/** + * @} + * End addtogroup PPP + */ +#endif /* PPAPI_C_PPP_CLASS_DEPRECATED_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/ppp_network_state_dev.h
Added
@@ -0,0 +1,46 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppp_network_state_dev.idl modified Wed Nov 7 09:50:23 2012. */ + +#ifndef PPAPI_C_DEV_PPP_NETWORK_STATE_DEV_H_ +#define PPAPI_C_DEV_PPP_NETWORK_STATE_DEV_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPP_NETWORK_STATE_DEV_INTERFACE_0_1 "PPP_NetworkState(Dev);0.1" +#define PPP_NETWORK_STATE_DEV_INTERFACE PPP_NETWORK_STATE_DEV_INTERFACE_0_1 + +/** + * @file + * This file defines the PPP_NetworkState interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPP_NetworkState_Dev_0_1 { + /** + * Notification that the online state has changed for the user's network. + * This will change as a result of a network cable being plugged or + * unplugged, WiFi connections going up and down, or other events. + * + * Note that being "online" isn't a guarantee that any particular connections + * will succeed. + */ + void (*SetOnLine)(PP_Bool is_online); +}; + +typedef struct PPP_NetworkState_Dev_0_1 PPP_NetworkState_Dev; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPP_NETWORK_STATE_DEV_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/ppp_printing_dev.h
Added
@@ -0,0 +1,91 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppp_printing_dev.idl modified Wed Jun 13 09:20:40 2012. */ + +#ifndef PPAPI_C_DEV_PPP_PRINTING_DEV_H_ +#define PPAPI_C_DEV_PPP_PRINTING_DEV_H_ + +#include "ppapi/c/dev/pp_print_settings_dev.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +#define PPP_PRINTING_DEV_INTERFACE_0_6 "PPP_Printing(Dev);0.6" +#define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_6 + +/** + * @file + * Definition of the PPP_Printing interface. + */ + + +/** + * @addtogroup Structs + * @{ + */ +/** + * Specifies a contiguous range of page numbers to be printed. + * The page numbers use a zero-based index. + */ +struct PP_PrintPageNumberRange_Dev { + uint32_t first_page_number; + uint32_t last_page_number; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPP_Printing_Dev_0_6 { + /** + * Returns a bit field representing the supported print output formats. For + * example, if only PDF and PostScript are supported, + * QuerySupportedFormats returns a value equivalent to: + * (PP_PRINTOUTPUTFORMAT_PDF | PP_PRINTOUTPUTFORMAT_POSTSCRIPT) + */ + uint32_t (*QuerySupportedFormats)(PP_Instance instance); + /** + * Begins a print session with the given print settings. Calls to PrintPages + * can only be made after a successful call to Begin. Returns the number of + * pages required for the print output at the given page size (0 indicates + * a failure). + */ + int32_t (*Begin)(PP_Instance instance, + const struct PP_PrintSettings_Dev* print_settings); + /** + * Prints the specified pages using the format specified in Begin. + * Returns a PPB_Buffer resource that represents the printed output. Returns + * 0 on failure. + */ + PP_Resource (*PrintPages)( + PP_Instance instance, + const struct PP_PrintPageNumberRange_Dev* page_ranges, + uint32_t page_range_count); + /** Ends the print session. Further calls to PrintPages will fail. */ + void (*End)(PP_Instance instance); + /** + * Returns true if the current content should be printed into the full page + * and not scaled down to fit within the printer's printable area. + */ + PP_Bool (*IsScalingDisabled)(PP_Instance instance); +}; + +typedef struct PPP_Printing_Dev_0_6 PPP_Printing_Dev; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPP_PRINTING_DEV_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/dev/ppp_text_input_dev.h
Added
@@ -0,0 +1,49 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppp_text_input_dev.idl modified Thu Mar 28 10:55:30 2013. */ + +#ifndef PPAPI_C_DEV_PPP_TEXT_INPUT_DEV_H_ +#define PPAPI_C_DEV_PPP_TEXT_INPUT_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPP_TEXTINPUT_DEV_INTERFACE_0_1 "PPP_TextInput(Dev);0.1" +#define PPP_TEXTINPUT_DEV_INTERFACE PPP_TEXTINPUT_DEV_INTERFACE_0_1 + +/** + * @file + * This file defines the <code>PPP_TextInput_Dev</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * <code>PPP_TextInput_Dev</code> is a set of function pointers that the + * plugin has to implement to provide hints for text input system (IME). + */ +struct PPP_TextInput_Dev_0_1 { + /** + * Requests the plugin to send back the text around the current caret or + * selection by <code>PPB_TextInput_Dev::UpdateSurroundingText</code>. + * It is recommended to include the <code>desired_number_of_characters</code> + * characters before and after the selection, but not mandatory. + */ + void (*RequestSurroundingText)(PP_Instance instance, + uint32_t desired_number_of_characters); +}; + +typedef struct PPP_TextInput_Dev_0_1 PPP_TextInput_Dev; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPP_TEXT_INPUT_DEV_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_array_output.h
Added
@@ -0,0 +1,119 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_array_output.idl modified Tue Oct 22 15:09:25 2013. */ + +#ifndef PPAPI_C_PP_ARRAY_OUTPUT_H_ +#define PPAPI_C_PP_ARRAY_OUTPUT_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * PP_ArrayOutput_GetDataBuffer is a callback function to allocate plugin + * memory for an array. It returns the allocated memory or null on failure. + * + * This function will be called reentrantly. This means that if you call a + * function PPB_Foo.GetData(&array_output), GetData will call your + * GetDataBuffer function before it returns. + * + * This function will be called even when returning 0-length arrays, so be sure + * your implementation can support that. You can return NULL for 0 length + * arrays and it will not be treated as a failure. + * + * You should not perform any processing in this callback, including calling + * other PPAPI functions, outside of allocating memory. You should not throw + * any exceptions. In C++, this means using "new (nothrow)" or being sure to + * catch any exceptions before returning. + * + * The C++ wrapper provides a convenient templatized implementation around + * std::vector which you should generally use instead of coding this + * specifically. + * + * @param user_data The pointer provided in the PP_ArrayOutput structure. This + * has no meaning to the browser, it is intended to be used by the + * implementation to figure out where to put the data. + * + * @param element_count The number of elements in the array. This will be 0 + * if there is no data to return. + * + * @param element_size The size of each element in bytes. + * + * @return Returns a pointer to the allocated memory. On failure, returns null. + * You can also return null if the element_count is 0. When a non-null value is + * returned, the buffer must remain valid until after the callback runs. If used + * with a blocking callback, the buffer must remain valid until after the + * function returns. The plugin can then free any memory that it allocated. + */ + + +/** + * @addtogroup Typedefs + * @{ + */ +typedef void* (*PP_ArrayOutput_GetDataBuffer)(void* user_data, + uint32_t element_count, + uint32_t element_size); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * A structure that defines a way for the browser to return arrays of data + * to the plugin. The browser can not allocate memory on behalf of the plugin + * because the plugin and browser may have different allocators. + * + * Array output works by having the browser call to the plugin to allocate a + * buffer, and then the browser will copy the contents of the array into that + * buffer. + * + * In C, you would typically implement this as follows: + * + * @code + * struct MyArrayOutput { + * void* data; + * int element_count; + * }; + * void* MyGetDataBuffer(void* user_data, uint32_t count, uint32_t size) { + * MyArrayOutput* output = (MyArrayOutput*)user_data; + * output->element_count = count; + * if (size) { + * output->data = malloc(count * size); + * if (!output->data) // Be careful to set size properly on malloc failure. + * output->element_count = 0; + * } else { + * output->data = NULL; + * } + * return output->data; + * } + * void MyFunction() { + * MyArrayOutput array = { NULL, 0 }; + * PP_ArrayOutput output = { &MyGetDataBuffer, &array }; + * ppb_foo->GetData(&output); + * } + * @endcode + */ +struct PP_ArrayOutput { + /** + * A pointer to the allocation function that the browser will call. + */ + PP_ArrayOutput_GetDataBuffer GetDataBuffer; + /** + * Data that is passed to the allocation function. Typically, this is used + * to communicate how the data should be stored. + */ + void* user_data; +}; +/** + * @} + */ + +#endif /* PPAPI_C_PP_ARRAY_OUTPUT_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_bool.h
Added
@@ -0,0 +1,65 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_bool.idl modified Thu Nov 1 13:48:33 2012. */ + +#ifndef PPAPI_C_PP_BOOL_H_ +#define PPAPI_C_PP_BOOL_H_ + +#include "ppapi/c/pp_macros.h" + +/** + * @file + * This file defines the <code>PP_Bool</code> enumeration for use in PPAPI C + * headers. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * The <code>PP_Bool</code> enum is a boolean value for use in PPAPI C headers. + * The standard bool type is not available to pre-C99 compilers, and is not + * guaranteed to be compatible between C and C++, whereas the PPAPI C headers + * can be included from C or C++ code. + */ +typedef enum { + PP_FALSE = 0, + PP_TRUE = 1 +} PP_Bool; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Bool, 4); +/** + * @} + */ + +#ifdef __cplusplus +/** + * Converts a C++ "bool" type to a PP_Bool. + * + * @param[in] b A C++ "bool" type. + * + * @return A PP_Bool. + */ +inline PP_Bool PP_FromBool(bool b) { + return b ? PP_TRUE : PP_FALSE; +} + +/** + * Converts a PP_Bool to a C++ "bool" type. + * + * @param[in] b A PP_Bool. + * + * @return A C++ "bool" type. + */ +inline bool PP_ToBool(PP_Bool b) { + return (b != PP_FALSE); +} + +#endif /* __cplusplus */ + +#endif /* PPAPI_C_PP_BOOL_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_codecs.h
Added
@@ -0,0 +1,261 @@ +/* Copyright (c) 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_codecs.idl modified Fri Sep 18 10:42:55 2015. */ + +#ifndef PPAPI_C_PP_CODECS_H_ +#define PPAPI_C_PP_CODECS_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * Video profiles. + */ + + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + PP_VIDEOPROFILE_H264BASELINE = 0, + PP_VIDEOPROFILE_H264MAIN = 1, + PP_VIDEOPROFILE_H264EXTENDED = 2, + PP_VIDEOPROFILE_H264HIGH = 3, + PP_VIDEOPROFILE_H264HIGH10PROFILE = 4, + PP_VIDEOPROFILE_H264HIGH422PROFILE = 5, + PP_VIDEOPROFILE_H264HIGH444PREDICTIVEPROFILE = 6, + PP_VIDEOPROFILE_H264SCALABLEBASELINE = 7, + PP_VIDEOPROFILE_H264SCALABLEHIGH = 8, + PP_VIDEOPROFILE_H264STEREOHIGH = 9, + PP_VIDEOPROFILE_H264MULTIVIEWHIGH = 10, + PP_VIDEOPROFILE_VP8_ANY = 11, + PP_VIDEOPROFILE_VP9_ANY = 12, + PP_VIDEOPROFILE_MAX = PP_VIDEOPROFILE_VP9_ANY +} PP_VideoProfile; + +/** + * Audio profiles. + */ +typedef enum { + PP_AUDIOPROFILE_OPUS = 0, + PP_AUDIOPROFILE_MAX = PP_AUDIOPROFILE_OPUS +} PP_AudioProfile; + +/** + * Hardware acceleration options. + */ +typedef enum { + /** Create a hardware accelerated resource only. */ + PP_HARDWAREACCELERATION_ONLY = 0, + /** + * Create a hardware accelerated resource if possible. Otherwise, fall back + * to the software implementation. + */ + PP_HARDWAREACCELERATION_WITHFALLBACK = 1, + /** Create the software implementation only. */ + PP_HARDWAREACCELERATION_NONE = 2, + PP_HARDWAREACCELERATION_LAST = PP_HARDWAREACCELERATION_NONE +} PP_HardwareAcceleration; +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * Struct describing a decoded video picture. The decoded picture data is stored + * in the GL texture corresponding to |texture_id|. The plugin can determine + * which Decode call generated the picture using |decode_id|. + */ +struct PP_VideoPicture { + /** + * |decode_id| parameter of the Decode call which generated this picture. + * See the PPB_VideoDecoder function Decode() for more details. + */ + uint32_t decode_id; + /** + * Texture ID in the plugin's GL context. The plugin can use this to render + * the decoded picture. + */ + uint32_t texture_id; + /** + * The GL texture target for the decoded picture. Possible values are: + * GL_TEXTURE_2D + * GL_TEXTURE_RECTANGLE_ARB + * GL_TEXTURE_EXTERNAL_OES + * + * The pixel format of the texture is GL_RGBA. + */ + uint32_t texture_target; + /** + * Dimensions of the texture holding the decoded picture. + */ + struct PP_Size texture_size; + /** + * The visible subrectangle of the picture. The plugin should display only + * this part of the picture. + */ + struct PP_Rect visible_rect; +}; + +/** + * Struct describing a decoded video picture. The decoded picture data is stored + * in the GL texture corresponding to |texture_id|. The plugin can determine + * which Decode call generated the picture using |decode_id|. + */ +struct PP_VideoPicture_0_1 { + /** + * |decode_id| parameter of the Decode call which generated this picture. + * See the PPB_VideoDecoder function Decode() for more details. + */ + uint32_t decode_id; + /** + * Texture ID in the plugin's GL context. The plugin can use this to render + * the decoded picture. + */ + uint32_t texture_id; + /** + * The GL texture target for the decoded picture. Possible values are: + * GL_TEXTURE_2D + * GL_TEXTURE_RECTANGLE_ARB + * GL_TEXTURE_EXTERNAL_OES + * + * The pixel format of the texture is GL_RGBA. + */ + uint32_t texture_target; + /** + * Dimensions of the texture holding the decoded picture. + */ + struct PP_Size texture_size; +}; + +/** + * Supported video profile information. See the PPB_VideoEncoder function + * GetSupportedProfiles() for more details. + */ +struct PP_VideoProfileDescription { + /** + * The codec profile. + */ + PP_VideoProfile profile; + /** + * Dimensions of the maximum resolution of video frames, in pixels. + */ + struct PP_Size max_resolution; + /** + * The numerator of the maximum frame rate. + */ + uint32_t max_framerate_numerator; + /** + * The denominator of the maximum frame rate. + */ + uint32_t max_framerate_denominator; + /** + * Whether the profile is hardware accelerated. + */ + PP_Bool hardware_accelerated; +}; + +/** + * Supported video profile information. See the PPB_VideoEncoder function + * GetSupportedProfiles() for more details. + */ +struct PP_VideoProfileDescription_0_1 { + /** + * The codec profile. + */ + PP_VideoProfile profile; + /** + * Dimensions of the maximum resolution of video frames, in pixels. + */ + struct PP_Size max_resolution; + /** + * The numerator of the maximum frame rate. + */ + uint32_t max_framerate_numerator; + /** + * The denominator of the maximum frame rate. + */ + uint32_t max_framerate_denominator; + /** + * A value indicating if the profile is available in hardware, software, or + * both. + */ + PP_HardwareAcceleration acceleration; +}; + +/** + * Supported audio profile information. See the PPB_AudioEncoder function + * GetSupportedProfiles() for more details. + */ +struct PP_AudioProfileDescription { + /** + * The codec profile. + */ + PP_AudioProfile profile; + /** + * Maximum number of channels that can be encoded. + */ + uint32_t max_channels; + /** + * Sample size. + */ + uint32_t sample_size; + /** + * Sampling rate that can be encoded + */ + uint32_t sample_rate; + /** + * Whether the profile is hardware accelerated. + */ + PP_Bool hardware_accelerated; +}; + +/** + * Struct describing a bitstream buffer. + */ +struct PP_BitstreamBuffer { + /** + * The size, in bytes, of the bitstream data. + */ + uint32_t size; + /** + * The base address of the bitstream data. + */ + void* buffer; + /** + * Whether the buffer represents a key frame. + */ + PP_Bool key_frame; +}; + +/** + * Struct describing an audio bitstream buffer. + */ +struct PP_AudioBitstreamBuffer { + /** + * The size, in bytes, of the bitstream data. + */ + uint32_t size; + /** + * The base address of the bitstream data. + */ + void* buffer; +}; +/** + * @} + */ + +#endif /* PPAPI_C_PP_CODECS_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_completion_callback.h
Added
@@ -0,0 +1,289 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_completion_callback.idl modified Thu May 9 14:59:57 2013. */ + +#ifndef PPAPI_C_PP_COMPLETION_CALLBACK_H_ +#define PPAPI_C_PP_COMPLETION_CALLBACK_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines the API to create and run a callback. + */ + + +/** + * @addtogroup Typedefs + * @{ + */ +/** + * This typedef defines the signature that you implement to receive callbacks + * on asynchronous completion of an operation. + * + * @param[in] user_data A pointer to user data passed to a callback function. + * @param[in] result If result is 0 (PP_OK), the operation succeeded. Negative + * values (other than -1 or PP_OK_COMPLETE) indicate error and are specified + * in pp_errors.h. Positive values for result usually indicate success and have + * some operation-dependent meaning (such as bytes read). + */ +typedef void (*PP_CompletionCallback_Func)(void* user_data, int32_t result); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains flags used to control how non-NULL callbacks are + * scheduled by asynchronous methods. + */ +typedef enum { + /** + * By default any non-NULL callback will always invoked asynchronously, + * on success or error, even if the operation could complete synchronously + * without blocking. + * + * The method taking such callback will always return PP_OK_COMPLETIONPENDING. + * The callback will be invoked on the same thread on which the method was + * invoked. + * + * NOTE: If the method taking the callback is invoked on a background + * thread that has no valid PPB_MessageLoop resource attached, the system has + * no way to run the callback on the correct thread. In this case, a log + * message will be emitted and the plugin will be made to crash. + */ + PP_COMPLETIONCALLBACK_FLAG_NONE = 0 << 0, + /** + * This flag allows any method taking such callback to complete synchronously + * and not call the callback if the operation would not block. This is useful + * when performance is an issue, and the operation bandwidth should not be + * limited to the processing speed of the message loop. + * + * On synchronous method completion, the completion result will be returned + * by the method itself. Otherwise, the method will return + * PP_OK_COMPLETIONPENDING, and the callback will be invoked asynchronously on + * the same thread on which the method was invoked. If there is no valid + * PPB_MessageLoop attached to that thread, and the callback would normally + * run asynchronously, the invoked method will return + * PP_ERROR_NO_MESSAGE_LOOP. + */ + PP_COMPLETIONCALLBACK_FLAG_OPTIONAL = 1 << 0 +} PP_CompletionCallback_Flag; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Flag, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * <code>PP_CompletionCallback</code> is a common mechanism for supporting + * potentially asynchronous calls in browser interfaces. Any method that takes a + * <code>PP_CompletionCallback</code> can be used in one of three different + * ways: + * - Required: The callback will always be invoked asynchronously on the + * thread where the associated PPB method was invoked. The method + * will always return PP_OK_COMPLETIONPENDING when a required + * callback, and the callback will be invoked later (barring + * system or thread shutdown; see PPB_MessageLoop for details). + * Required callbacks are the default. + * <br /><br /> + * NOTE: If you use a required callback on a background thread, + * you must have created and attached a PPB_MessageLoop. + * Otherwise, the system can not run your callback on that thread, + * and will instead emit a log message and crash your plugin to + * make the problem more obvious. + * + * - Optional: The callback may be invoked asynchronously, or the PPB method + * may complete synchronously if it can do so without blocking. + * If the method will complete asynchronously, it will return + * PP_OK_COMPLETIONPENDING. Otherwise, it will complete + * synchronously and return an appropriate code (see below for + * more information on the return code). Optional callbacks are + * generally more difficult to use correctly than Required + * callbacks, but can provide better performance for some APIs + * (especially APIs with buffered reads, such as PPB_URLLoader or + * PPB_FileIO). + * <br /><br /> + * NOTE: If you use an optional callback on a background thread, + * and you have not created and attached a PPB_MessageLoop, then + * the method you invoke will fail without running and return + * PP_ERROR_NO_MESSAGE_LOOP. + * + * - Blocking: In this case, the callback's function pointer is NULL, and the + * invoked method must complete synchronously. The method will + * run to completion and return an appropriate code when finished + * (see below for more information). Blocking completion + * callbacks are only supported on background threads. + * <br /><br /> + * <code>PP_BlockUntilComplete()</code> provides a convenient way + * to specify blocking behavior. Refer to + * <code>PP_BlockUntilComplete</code> for more information. + * + * When the callback is run asynchronously, the result parameter passed to + * <code>func</code> is an int32_t that, if negative indicates an error code + * whose meaning is specific to the calling method (refer to + * <code>pp_error.h</code> for further information). A positive or 0 value is a + * return result indicating success whose meaning depends on the calling method + * (e.g. number of bytes read). + */ +struct PP_CompletionCallback { + /** + * This value is a callback function that will be called, or NULL if this is + * a blocking completion callback. + */ + PP_CompletionCallback_Func func; + /** + * This value is a pointer to user data passed to a callback function. + */ + void* user_data; + /** + * Flags used to control how non-NULL callbacks are scheduled by + * asynchronous methods. + */ + int32_t flags; +}; +/** + * @} + */ + +#include <stdlib.h> + +/** + * @addtogroup Functions + * @{ + */ +/** + * PP_MakeCompletionCallback() is used to create a + * <code>PP_CompletionCallback</code>. + * + * <strong>Example, creating a Required callback:</strong> + * + * @code + * struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL); + * @endcode + * + * <strong>Example, creating an Optional callback:</strong> + * + * @code + * struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL); + * cc.flags = cc.flags | PP_COMPLETIONCALLBACK_FLAG_OPTIONAL; + * @endcode + * + * @param[in] func A <code>PP_CompletionCallback_Func</code> that will be + * called. + * @param[in] user_data A pointer to user data passed to your callback + * function. This is optional and is typically used to help track state + * when you may have multiple callbacks pending. + * + * @return A <code>PP_CompletionCallback</code> structure. + */ +PP_INLINE struct PP_CompletionCallback PP_MakeCompletionCallback( + PP_CompletionCallback_Func func, + void* user_data) { + struct PP_CompletionCallback cc; + cc.func = func; + cc.user_data = user_data; + cc.flags = PP_COMPLETIONCALLBACK_FLAG_NONE; + return cc; +} + +/** + * PP_MakeOptionalCompletionCallback() is used to create a PP_CompletionCallback + * with PP_COMPLETIONCALLBACK_FLAG_OPTIONAL set. + * + * @param[in] func A PP_CompletionCallback_Func to be called on completion. + * @param[in] user_data A pointer to user data passed to be passed to the + * callback function. This is optional and is typically used to help track state + * in case of multiple pending callbacks. + * + * @return A PP_CompletionCallback structure. + */ +PP_INLINE struct PP_CompletionCallback PP_MakeOptionalCompletionCallback( + PP_CompletionCallback_Func func, + void* user_data) { + struct PP_CompletionCallback cc = PP_MakeCompletionCallback(func, user_data); + cc.flags = cc.flags | PP_COMPLETIONCALLBACK_FLAG_OPTIONAL; + return cc; +} +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_RunCompletionCallback() is used to run a callback. It invokes + * the callback function passing it user data specified on creation and + * completion |result|. + * + * @param[in] cc A pointer to a <code>PP_CompletionCallback</code> that will be + * run. + * @param[in] result The result of the operation. Non-positive values correspond + * to the error codes from pp_errors.h (excluding PP_OK_COMPLETIONPENDING). + * Positive values indicate additional information such as bytes read. + */ +PP_INLINE void PP_RunCompletionCallback(struct PP_CompletionCallback* cc, + int32_t result) { + cc->func(cc->user_data, result); +} + +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + + /** + * PP_BlockUntilComplete() is used in place of an actual completion callback + * to request blocking behavior. If specified, the calling thread will block + * until the function completes. Blocking completion callbacks are only allowed + * from background threads. + * + * @return A <code>PP_CompletionCallback</code> structure. + */ +PP_INLINE struct PP_CompletionCallback PP_BlockUntilComplete(void) { + return PP_MakeCompletionCallback(NULL, NULL); +} + +/** + * PP_RunAndClearCompletionCallback() runs a callback and clears the reference + * to that callback. + * + * This function is used when the null-ness of a completion callback is used as + * a signal for whether a completion callback has been registered. In this + * case, after the execution of the callback, it should be cleared. However, + * this introduces a conflict if the completion callback wants to schedule more + * work that involves the same completion callback again (for example, when + * reading data from an URLLoader, one would typically queue up another read + * callback). As a result, this function clears the pointer + * before the provided callback is executed. + */ +PP_INLINE void PP_RunAndClearCompletionCallback( + struct PP_CompletionCallback* cc, + int32_t res) { + struct PP_CompletionCallback temp = *cc; + *cc = PP_BlockUntilComplete(); + PP_RunCompletionCallback(&temp, res); +} +/** + * @} + */ + +#endif /* PPAPI_C_PP_COMPLETION_CALLBACK_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_directory_entry.h
Added
@@ -0,0 +1,37 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_directory_entry.idl modified Tue Apr 30 05:44:50 2013. */ + +#ifndef PPAPI_C_PP_DIRECTORY_ENTRY_H_ +#define PPAPI_C_PP_DIRECTORY_ENTRY_H_ + +#include "ppapi/c/pp_file_info.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * + * This file defines the <code>PP_DirectoryEntry</code> struct. + */ + + +/** + * @addtogroup Structs + * @{ + */ +struct PP_DirectoryEntry { + PP_Resource file_ref; + PP_FileType file_type; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DirectoryEntry, 8); +/** + * @} + */ + +#endif /* PPAPI_C_PP_DIRECTORY_ENTRY_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_errors.h
Added
@@ -0,0 +1,206 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_errors.idl modified Tue Sep 23 15:37:27 2014. */ + +#ifndef PPAPI_C_PP_ERRORS_H_ +#define PPAPI_C_PP_ERRORS_H_ + +#include "ppapi/c/pp_macros.h" + +/** + * @file + * This file defines an enumeration of all PPAPI error codes. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains enumerators of all PPAPI error codes. + * + * Errors are negative valued. Callers should treat all negative values as a + * failure, even if it's not in the list, since the possible errors are likely + * to expand and change over time. + */ +enum { + /** + * This value is returned by a function on successful synchronous completion + * or is passed as a result to a PP_CompletionCallback_Func on successful + * asynchronous completion. + */ + PP_OK = 0, + /** + * This value is returned by a function that accepts a PP_CompletionCallback + * and cannot complete synchronously. This code indicates that the given + * callback will be asynchronously notified of the final result once it is + * available. + */ + PP_OK_COMPLETIONPENDING = -1, + /**This value indicates failure for unspecified reasons. */ + PP_ERROR_FAILED = -2, + /** + * This value indicates failure due to an asynchronous operation being + * interrupted. The most common cause of this error code is destroying a + * resource that still has a callback pending. All callbacks are guaranteed + * to execute, so any callbacks pending on a destroyed resource will be + * issued with PP_ERROR_ABORTED. + * + * If you get an aborted notification that you aren't expecting, check to + * make sure that the resource you're using is still in scope. A common + * mistake is to create a resource on the stack, which will destroy the + * resource as soon as the function returns. + */ + PP_ERROR_ABORTED = -3, + /** This value indicates failure due to an invalid argument. */ + PP_ERROR_BADARGUMENT = -4, + /** This value indicates failure due to an invalid PP_Resource. */ + PP_ERROR_BADRESOURCE = -5, + /** This value indicates failure due to an unavailable PPAPI interface. */ + PP_ERROR_NOINTERFACE = -6, + /** This value indicates failure due to insufficient privileges. */ + PP_ERROR_NOACCESS = -7, + /** This value indicates failure due to insufficient memory. */ + PP_ERROR_NOMEMORY = -8, + /** This value indicates failure due to insufficient storage space. */ + PP_ERROR_NOSPACE = -9, + /** This value indicates failure due to insufficient storage quota. */ + PP_ERROR_NOQUOTA = -10, + /** + * This value indicates failure due to an action already being in + * progress. + */ + PP_ERROR_INPROGRESS = -11, + /** + * The requested command is not supported by the browser. + */ + PP_ERROR_NOTSUPPORTED = -12, + /** + * Returned if you try to use a null completion callback to "block until + * complete" on the main thread. Blocking the main thread is not permitted + * to keep the browser responsive (otherwise, you may not be able to handle + * input events, and there are reentrancy and deadlock issues). + */ + PP_ERROR_BLOCKS_MAIN_THREAD = -13, + /** + * This value indicates that the plugin sent bad input data to a resource, + * leaving it in an invalid state. The resource can't be used after returning + * this error and should be released. + */ + PP_ERROR_MALFORMED_INPUT = -14, + /** + * This value indicates that a resource has failed. The resource can't be + * used after returning this error and should be released. + */ + PP_ERROR_RESOURCE_FAILED = -15, + /** This value indicates failure due to a file that does not exist. */ + PP_ERROR_FILENOTFOUND = -20, + /** This value indicates failure due to a file that already exists. */ + PP_ERROR_FILEEXISTS = -21, + /** This value indicates failure due to a file that is too big. */ + PP_ERROR_FILETOOBIG = -22, + /** + * This value indicates failure due to a file having been modified + * unexpectedly. + */ + PP_ERROR_FILECHANGED = -23, + /** This value indicates that the pathname does not reference a file. */ + PP_ERROR_NOTAFILE = -24, + /** This value indicates failure due to a time limit being exceeded. */ + PP_ERROR_TIMEDOUT = -30, + /** + * This value indicates that the user cancelled rather than providing + * expected input. + */ + PP_ERROR_USERCANCEL = -40, + /** + * This value indicates failure due to lack of a user gesture such as a + * mouse click or key input event. Examples of actions requiring a user + * gesture are showing the file chooser dialog and going into fullscreen + * mode. + */ + PP_ERROR_NO_USER_GESTURE = -41, + /** + * This value indicates that the graphics context was lost due to a + * power management event. + */ + PP_ERROR_CONTEXT_LOST = -50, + /** + * Indicates an attempt to make a PPAPI call on a thread without previously + * registering a message loop via PPB_MessageLoop.AttachToCurrentThread. + * Without this registration step, no PPAPI calls are supported. + */ + PP_ERROR_NO_MESSAGE_LOOP = -51, + /** + * Indicates that the requested operation is not permitted on the current + * thread. + */ + PP_ERROR_WRONG_THREAD = -52, + /** + * Indicates that a null completion callback was used on a thread handling a + * blocking message from JavaScript. Null completion callbacks "block until + * complete", which could cause the main JavaScript thread to be blocked + * excessively. + */ + PP_ERROR_WOULD_BLOCK_THREAD = -53, + /** + * This value indicates that the connection was closed. For TCP sockets, it + * corresponds to a TCP FIN. + */ + PP_ERROR_CONNECTION_CLOSED = -100, + /** + * This value indicates that the connection was reset. For TCP sockets, it + * corresponds to a TCP RST. + */ + PP_ERROR_CONNECTION_RESET = -101, + /** + * This value indicates that the connection attempt was refused. + */ + PP_ERROR_CONNECTION_REFUSED = -102, + /** + * This value indicates that the connection was aborted. For TCP sockets, it + * means the connection timed out as a result of not receiving an ACK for data + * sent. This can include a FIN packet that did not get ACK'd. + */ + PP_ERROR_CONNECTION_ABORTED = -103, + /** + * This value indicates that the connection attempt failed. + */ + PP_ERROR_CONNECTION_FAILED = -104, + /** + * This value indicates that the connection attempt timed out. + */ + PP_ERROR_CONNECTION_TIMEDOUT = -105, + /** + * This value indicates that the IP address or port number is invalid. + */ + PP_ERROR_ADDRESS_INVALID = -106, + /** + * This value indicates that the IP address is unreachable. This usually means + * that there is no route to the specified host or network. + */ + PP_ERROR_ADDRESS_UNREACHABLE = -107, + /** + * This value is returned when attempting to bind an address that is already + * in use. + */ + PP_ERROR_ADDRESS_IN_USE = -108, + /** + * This value indicates that the message was too large for the transport. + */ + PP_ERROR_MESSAGE_TOO_BIG = -109, + /** + * This value indicates that the host name could not be resolved. + */ + PP_ERROR_NAME_NOT_RESOLVED = -110 +}; +/** + * @} + */ + +#endif /* PPAPI_C_PP_ERRORS_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_file_info.h
Added
@@ -0,0 +1,98 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_file_info.idl modified Thu May 2 16:41:50 2013. */ + +#ifndef PPAPI_C_PP_FILE_INFO_H_ +#define PPAPI_C_PP_FILE_INFO_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" + +/** + * @file + * This file defines three enumerations for use in the PPAPI C file IO APIs. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * The <code>PP_FileType</code> enum contains file type constants. + */ +typedef enum { + /** A regular file type */ + PP_FILETYPE_REGULAR = 0, + /** A directory */ + PP_FILETYPE_DIRECTORY = 1, + /** A catch-all for unidentified types */ + PP_FILETYPE_OTHER = 2 +} PP_FileType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileType, 4); + +/** + * The <code>PP_FileSystemType</code> enum contains file system type constants. + */ +typedef enum { + /** For identified invalid return values */ + PP_FILESYSTEMTYPE_INVALID = 0, + /** For external file system types */ + PP_FILESYSTEMTYPE_EXTERNAL = 1, + /** For local persistent file system types */ + PP_FILESYSTEMTYPE_LOCALPERSISTENT = 2, + /** For local temporary file system types */ + PP_FILESYSTEMTYPE_LOCALTEMPORARY = 3, + /** For isolated file system types */ + PP_FILESYSTEMTYPE_ISOLATED = 4 +} PP_FileSystemType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileSystemType, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * The <code>PP_FileInfo</code> struct represents all information about a file, + * such as size, type, and creation time. + */ +struct PP_FileInfo { + /** This value represents the size of the file measured in bytes */ + int64_t size; + /** + * This value represents the type of file as defined by the + * <code>PP_FileType</code> enum + */ + PP_FileType type; + /** + * This value represents the file system type of the file as defined by the + * <code>PP_FileSystemType</code> enum. + */ + PP_FileSystemType system_type; + /** + * This value represents the creation time of the file. + */ + PP_Time creation_time; + /** + * This value represents the last time the file was accessed. + */ + PP_Time last_access_time; + /** + * This value represents the last time the file was modified. + */ + PP_Time last_modified_time; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_FileInfo, 40); +/** + * @} + */ + +#endif /* PPAPI_C_PP_FILE_INFO_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_graphics_3d.h
Added
@@ -0,0 +1,103 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_graphics_3d.idl modified Wed Oct 3 15:55:01 2012. */ + +#ifndef PPAPI_C_PP_GRAPHICS_3D_H_ +#define PPAPI_C_PP_GRAPHICS_3D_H_ + +#include "ppapi/c/pp_macros.h" + +/** + * @file + * This file defines the <code>PP_Graphics3DAttrib</code> enumeration for use in + * PPAPI C headers. + */ + + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * Bits of Alpha in the color buffer. + */ + PP_GRAPHICS3DATTRIB_ALPHA_SIZE = 0x3021, + /** + * Bits of Blue in the color buffer. + */ + PP_GRAPHICS3DATTRIB_BLUE_SIZE = 0x3022, + /** + * Bits of Green in the color buffer. + */ + PP_GRAPHICS3DATTRIB_GREEN_SIZE = 0x3023, + /** + * Bits of Red in the color buffer. + */ + PP_GRAPHICS3DATTRIB_RED_SIZE = 0x3024, + /** + * Bits of Z in the depth buffer. + */ + PP_GRAPHICS3DATTRIB_DEPTH_SIZE = 0x3025, + /** + * Bits of Stencil in the stencil buffer. + */ + PP_GRAPHICS3DATTRIB_STENCIL_SIZE = 0x3026, + /** + * Number of samples per pixel. + */ + PP_GRAPHICS3DATTRIB_SAMPLES = 0x3031, + /** + * Number of multisample buffers. + */ + PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS = 0x3032, + /** + * Attrib list terminator. + */ + PP_GRAPHICS3DATTRIB_NONE = 0x3038, + /** + * Height of surface in pixels. + */ + PP_GRAPHICS3DATTRIB_HEIGHT = 0x3056, + /** + * Width of surface in pixels. + */ + PP_GRAPHICS3DATTRIB_WIDTH = 0x3057, + /** + * Specifies the effect on the color buffer of posting a surface + * with SwapBuffers. The initial value is chosen by the implementation. + */ + PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR = 0x3093, + /** + * Indicates that color buffer contents are unaffected. + */ + PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED = 0x3094, + /** + * Indicates that color buffer contents may be destroyed or changed. + */ + PP_GRAPHICS3DATTRIB_BUFFER_DESTROYED = 0x3095, + /** + * Specifies whether the context is intended to be low-power or + * high-performance. The initial value is + * PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_PERFORMANCE. + */ + PP_GRAPHICS3DATTRIB_GPU_PREFERENCE = 0x11000, + /** + * The context should be low-power, and may be created on an integrated gpu. + */ + PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_LOW_POWER = 0x11001, + /** + * The context may be high-power and may be created on a discrete gpu. + */ + PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_PERFORMANCE = 0x11002 +} PP_Graphics3DAttrib; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Graphics3DAttrib, 4); +/** + * @} + */ + +#endif /* PPAPI_C_PP_GRAPHICS_3D_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_input_event.h
Added
@@ -0,0 +1,213 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_input_event.idl modified Thu Mar 28 10:52:59 2013. */ + +#ifndef PPAPI_C_PP_INPUT_EVENT_H_ +#define PPAPI_C_PP_INPUT_EVENT_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/ppb_input_event.h" + +/** + * @file + * This file defines the API used to handle mouse and keyboard input events. + */ + + +/** + * @addtogroup Structs + * @{ + */ +/** + * The <code>PP_InputEvent_Key</code> struct represents a key up or key down + * event. + * + * Key up and key down events correspond to physical keys on the keyboard. The + * actual character that the user typed (if any) will be delivered in a + * "character" event. + * + * If the user loses focus on the module while a key is down, a key up + * event might not occur. For example, if the module has focus and the user + * presses and holds the shift key, the module will see a "shift down" message. + * Then if the user clicks elsewhere on the web page, the module's focus will + * be lost and no more input events will be delivered. + * + * If your module depends on receiving key up events, it should also handle + * "lost focus" as the equivalent of "all keys up." + */ +struct PP_InputEvent_Key { + /** This value is a bit field combination of the EVENT_MODIFIER flags. */ + uint32_t modifier; + /** + * This value reflects the DOM KeyboardEvent <code>keyCode</code> field. + * Chrome populates this with the Windows-style Virtual Key code of the key. + */ + uint32_t key_code; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Key, 8); + +/** + * The <code>PP_InputEvent_Character</code> struct represents a typed character + * event. + * + * Normally, the program will receive a key down event, followed by a character + * event, followed by a key up event. The character event will have any + * modifier keys applied. Obvious examples are symbols, where Shift-5 gives you + * a '%'. The key down and up events will give you the scan code for the "5" + * key, and the character event will give you the '%' character. + * + * You may not get a character event for all key down events if the key doesn't + * generate a character. Likewise, you may actually get multiple character + * events in a row. For example, some locales have an accent key that modifies + * the next character typed. You might get this stream of events: accent down, + * accent up (it didn't generate a character), letter key down, letter with + * accent character event (it was modified by the previous accent key), letter + * key up. If the letter can't be combined with the accent, like an umlaut and + * an 'R', the system might send umlaut down, umlaut up, 'R' key down, umlaut + * character (can't combine it with 'R', so just send the raw umlaut so it + * isn't lost"), 'R' character event, 'R' key up. + */ +struct PP_InputEvent_Character { + /** A combination of the <code>PP_InputEvent_Modifier</code> flags. */ + uint32_t modifier; + /** + * This value represents the typed character as a single null-terminated UTF-8 + * character. Any unused bytes will be filled with null bytes. Since the + * maximum UTF-8 character is 4 bytes, there will always be at least one null + * at the end so you can treat this as a null-terminated UTF-8 string. + */ + int8_t text[5]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Character, 12); + +/** + * The <code>PP_InputEvent_Mouse</code> struct represents all mouse events + * except mouse wheel events. + */ +struct PP_InputEvent_Mouse { + /** + * This value is a bit field combination of the + * <code>PP_InputEvent_Modifier</code> flags. + */ + uint32_t modifier; + /** + * This value represents the button that changed for mouse down or up events. + * This value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for mouse move, + * enter, and leave events. + */ + PP_InputEvent_MouseButton button; + /** + * This values represents the x coordinate of the mouse when the event + * occurred. + * + * In most, but not all, cases these coordinates will just be integers. + * For example, the plugin element might be arbitrarily scaled or transformed + * in the DOM, and translating a mouse event into the coordinate space of the + * plugin will give non-integer values. + */ + float x; + /** + * This values represents the y coordinate of the mouse when the event + * occurred. + * + * In most, but not all, cases these coordinates will just be integers. + * For example, the plugin element might be arbitrarily scaled or transformed + * in the DOM, and translating a mouse event into the coordinate space of the + * plugin will give non-integer values. + */ + float y; + int32_t click_count; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Mouse, 20); + +/** + * The <code>PP_InputEvent_Wheel</code> struct represents all mouse wheel + * events. + */ +struct PP_InputEvent_Wheel { + /** + * This value represents a combination of the <code>EVENT_MODIFIER</code> + * flags. + */ + uint32_t modifier; + /** + * The mouse wheel's horizontal scroll amount. A scroll to the right + * (where the content moves left) is represented as positive values, + * and a scroll to the left (where the content moves right) is + * represented as negative values. + * + * The units are either in pixels (when scroll_by_page is false) or pages + * (when scroll_by_page is true). For example, delta_y = -3 means scroll up 3 + * pixels when scroll_by_page is false, and scroll up 3 pages when + * scroll_by_page is true. + * + * This amount is system dependent and will take into account the user's + * preferred scroll sensitivity and potentially also nonlinear acceleration + * based on the speed of the scrolling. + * + * Devices will be of varying resolution. Some mice with large detents will + * only generate integer scroll amounts. But fractional values are also + * possible, for example, on some trackpads and newer mice that don't have + * "clicks". + */ + float delta_x; + /** + * The mouse wheel's vertical scroll amount. A scroll down (where the + * content moves up) is represented as positive values, and a scroll up + * (where the content moves down) is represented as negative values. + * + * The units are either in pixels (when scroll_by_page is false) or pages + * (when scroll_by_page is true). For example, delta_y = -3 means scroll up 3 + * pixels when scroll_by_page is false, and scroll up 3 pages when + * scroll_by_page is true. + * + * This amount is system dependent and will take into account the user's + * preferred scroll sensitivity and potentially also nonlinear acceleration + * based on the speed of the scrolling. + * + * Devices will be of varying resolution. Some mice with large detents will + * only generate integer scroll amounts. But fractional values are also + * possible, for example, on some trackpads and newer mice that don't have + * "clicks". + */ + float delta_y; + /** + * The number of "clicks" of the scroll wheel that have produced the + * event. The value may have system-specific acceleration applied to it, + * depending on the device. The positive and negative meanings are the same + * as for <code>delta_x</code> and <code>delta_y</code>. + * + * If you are scrolling, you probably want to use the delta values above. + * These tick events can be useful if you aren't doing actual scrolling and + * don't want or pixel values. An example may be cycling between different + * items in a game. + * + * You may receive fractional values for the wheel ticks if the mouse wheel + * is high resolution or doesn't have "clicks". If your program wants + * discrete events (as in the "picking items" example) you should accumulate + * fractional click values from multiple messages until the total value + * reaches positive or negative one. This should represent a similar amount + * of scrolling as for a mouse that has a discrete mouse wheel. + */ + float wheel_ticks_x; + /** This value represents */ + float wheel_ticks_y; + /** + * Indicates if the scroll <code>delta_x</code>/<code>delta_y</code> + * indicates pages or lines to scroll by. When true, the user is requesting + * to scroll by pages. + */ + PP_Bool scroll_by_page; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Wheel, 24); +/** + * @} + */ + +#endif /* PPAPI_C_PP_INPUT_EVENT_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_instance.h
Added
@@ -0,0 +1,41 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_instance.idl modified Sat Jul 16 16:50:26 2011. */ + +#ifndef PPAPI_C_PP_INSTANCE_H_ +#define PPAPI_C_PP_INSTANCE_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines the PP_Instance type which uniquely identifies one module + * instance. + */ + + +/** + * @addtogroup Typedefs + * @{ + */ +/** + * The <code>PP_Instance</code> value uniquely identifies one instance of a + * module (.nexe/PP_Module). There will be one module instance for every + * \<embed> tag on a page. + * + * This identifier is an opaque handle assigned by the browser to the module. + * It is guaranteed never to be 0, so a module can initialize it to 0 to + * indicate a "NULL handle." + */ +typedef int32_t PP_Instance; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Instance, 4); +/** + * @} + */ + +#endif /* PPAPI_C_PP_INSTANCE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_macros.h
Added
@@ -0,0 +1,104 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_macros.idl modified Thu Oct 15 10:46:35 2015. */ + +#ifndef PPAPI_C_PP_MACROS_H_ +#define PPAPI_C_PP_MACROS_H_ + + +#define PPAPI_RELEASE 55 + +/** + * @file + * Defines the common macros such as assert, inline, ... + */ + + + +/* + * @addtogroup PP + * @{ + */ + +/* Use PP_INLINE to tell the compiler to inline functions. The main purpose of + * inline functions in ppapi is to allow us to define convenience functions in + * the ppapi header files, without requiring clients or implementers to link a + * PPAPI C library. The "inline" keyword is not supported by pre-C99 C + * compilers (such as MS Visual Studio 2008 and older versions of GCC). MSVS + * supports __forceinline and GCC supports __inline__. Use of the static + * keyword ensures (in C) that the function is not compiled on its own, which + * could cause multiple definition errors. + * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx + * http://gcc.gnu.org/onlinedocs/gcc/Inline.html + */ +#if defined(__cplusplus) +/* The inline keyword is part of C++ and guarantees we won't get multiple + * definition errors. + */ +# define PP_INLINE inline +#else +# if defined(_MSC_VER) +# define PP_INLINE static __forceinline +# else +# define PP_INLINE static __inline__ +# endif +#endif + +/* This is a compile-time assertion useful for ensuring that a given type is + a given number of bytes wide. The size of the array is designed to be 1 + (which should always be valid) if the enum's size is SIZE, and otherwise the + size of the array will be -1 (which all/most compilers should flag as an + error). This is wrapped inside a struct, because if it is a simple global + we get multiple definition errors at link time. + + NAME is the name of the type without any spaces or the struct or enum + keywords. + + CTYPENAME is the typename required by C. I.e., for a struct or enum, the + appropriate keyword must be included. + + SIZE is the expected size in bytes. + */ +#define PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, CTYPENAME, SIZE) \ +struct PP_Dummy_Struct_For_##NAME { \ +char _COMPILE_ASSERT_FAILED_The_type_named_ \ +## NAME ## _is_not_ ## SIZE ## \ +_bytes_wide[(sizeof(CTYPENAME) == SIZE) ? 1 : -1]; } + +/* PP_COMPILE_ASSERT_SIZE_IN_BYTES is for typenames that contain no spaces. + E.g.: + PP_COMPILE_ASSERT_SIZE_IN_BYTES(int, 4); + typedef struct { int a; } Foo; + PP_COMPILE_ASSERT_SIZE_IN_BYTES(Foo, 4); + */ +#define PP_COMPILE_ASSERT_SIZE_IN_BYTES(NAME, SIZE) \ +PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, NAME, SIZE) + +/* PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES is for typenames that contain 'struct' + in C. That is, struct names that are not typedefs. + E.g.: + struct Foo { int a; }; + PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(Foo, 4); + */ +#define PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(NAME, SIZE) \ +PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, struct NAME, SIZE) + +/* PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES is for typenames that contain 'enum' + in C. That is, enum names that are not typedefs. + E.g.: + enum Bar { A = 0, B = 1 }; + PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(Foo, 4); + */ +#define PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(NAME, SIZE) \ +PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, enum NAME, SIZE) + +/** + * @} + * End of addtogroup PP + */ + +#endif /* PPAPI_C_PP_MACROS_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_module.h
Added
@@ -0,0 +1,39 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_module.idl modified Sat Jul 16 16:50:26 2011. */ + +#ifndef PPAPI_C_PP_MODULE_H_ +#define PPAPI_C_PP_MODULE_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines the PP_Module type which uniquely identifies the module + * or .nexe. + */ + + +/** + * @addtogroup Typedefs + * @{ + */ +/** + * The PP_Module value uniquely identifies the module or .nexe. + * + * This identifier is an opaque handle assigned by the browser to the module. It + * is guaranteed never to be 0, so a module can initialize it to 0 to + * indicate a "NULL handle." + */ +typedef int32_t PP_Module; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Module, 4); +/** + * @} + */ + +#endif /* PPAPI_C_PP_MODULE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_point.h
Added
@@ -0,0 +1,89 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_point.idl modified Wed Oct 5 14:06:02 2011. */ + +#ifndef PPAPI_C_PP_POINT_H_ +#define PPAPI_C_PP_POINT_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines the API to create a 2 dimensional point. + * 0,0 is the upper-left starting coordinate. + */ + + +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_Point structure defines the integer x and y coordinates of a point. + */ +struct PP_Point { + /** + * This value represents the horizontal coordinate of a point, starting with 0 + * as the left-most coordinate. + */ + int32_t x; + /** + * This value represents the vertical coordinate of a point, starting with 0 + * as the top-most coordinate. + */ + int32_t y; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Point, 8); + +/** + * The PP_FloatPoint structure defines the floating-point x and y coordinates + * of a point. + */ +struct PP_FloatPoint { + float x; + float y; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_FloatPoint, 8); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakePoint() creates a <code>PP_Point</code> given the x and y coordinates + * as int32_t values. + * + * @param[in] x An int32_t value representing a horizontal coordinate of a + * point, starting with 0 as the left-most coordinate. + * @param[in] y An int32_t value representing a vertical coordinate of a point, + * starting with 0 as the top-most coordinate. + * + * @return A <code>PP_Point</code> structure. + */ +PP_INLINE struct PP_Point PP_MakePoint(int32_t x, int32_t y) { + struct PP_Point ret; + ret.x = x; + ret.y = y; + return ret; +} + +PP_INLINE struct PP_FloatPoint PP_MakeFloatPoint(float x, float y) { + struct PP_FloatPoint ret; + ret.x = x; + ret.y = y; + return ret; +} +/** + * @} + */ + +#endif /* PPAPI_C_PP_POINT_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_rect.h
Added
@@ -0,0 +1,115 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_rect.idl modified Tue Jun 3 12:31:06 2014. */ + +#ifndef PPAPI_C_PP_RECT_H_ +#define PPAPI_C_PP_RECT_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines the APIs for creating a 2 dimensional rectangle. + */ + + +/** + * @addtogroup Structs + * @{ + */ +/** + * The <code>PP_Rect</code> struct contains the size and location of a 2D + * rectangle. + */ +struct PP_Rect { + /** + * This value represents the x and y coordinates of the upper-left corner of + * the rectangle. + */ + struct PP_Point point; + /** This value represents the width and height of the rectangle. */ + struct PP_Size size; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Rect, 16); + +/** + * The <code>PP_FloatRect</code> struct contains the size and location of a 2D + * rectangle. + */ +struct PP_FloatRect { + /** + * This value represents the x and y coordinates of the upper-left corner of + * the rectangle. + */ + struct PP_FloatPoint point; + /** This value represents the width and height of the rectangle. */ + struct PP_FloatSize size; +}; +/** + * @} + */ + + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakeRectFromXYWH() creates a <code>PP_Rect</code> given x and y + * coordinates and width and height dimensions as int32_t values. + * + * @param[in] x An int32_t value representing a horizontal coordinate of a + * point, starting with 0 as the left-most coordinate. + * @param[in] y An int32_t value representing a vertical coordinate of a point, + * starting with 0 as the top-most coordinate. + * @param[in] w An int32_t value representing a width. + * @param[in] h An int32_t value representing a height. + * + * @return A <code>PP_Rect</code> structure. + */ +PP_INLINE struct PP_Rect PP_MakeRectFromXYWH(int32_t x, int32_t y, + int32_t w, int32_t h) { + struct PP_Rect ret; + ret.point.x = x; + ret.point.y = y; + ret.size.width = w; + ret.size.height = h; + return ret; +} + +/** + * PP_MakeFloatRectFromXYWH() creates a <code>PP_FloatRect</code> given x and y + * coordinates and width and height dimensions as float values. + * + * @param[in] x An float value representing a horizontal coordinate of a + * point, starting with 0 as the left-most coordinate. + * @param[in] y An float value representing a vertical coordinate of a point, + * starting with 0 as the top-most coordinate. + * @param[in] w An float value representing a width. + * @param[in] h An float value representing a height. + * + * @return A <code>PP_FloatRect</code> structure. + */ +PP_INLINE struct PP_FloatRect PP_MakeFloatRectFromXYWH(float x, float y, + float w, float h) { + struct PP_FloatRect ret; + ret.point.x = x; + ret.point.y = y; + ret.size.width = w; + ret.size.height = h; + return ret; +} + +/** + * @} + */ + +#endif /* PPAPI_C_PP_RECT_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_resource.h
Added
@@ -0,0 +1,47 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_resource.idl modified Thu Mar 28 10:09:51 2013. */ + +#ifndef PPAPI_C_PP_RESOURCE_H_ +#define PPAPI_C_PP_RESOURCE_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines the <code>PP_Resource</code> type which represents data + * associated with the module. + */ + + +/** + * @addtogroup Typedefs + * @{ + */ +/** + * This typedef represents an opaque handle assigned by the browser to the + * resource. The handle is guaranteed never to be 0 for a valid resource, so a + * module can initialize it to 0 to indicate a "NULL handle." Some interfaces + * may return a NULL resource to indicate failure. + * + * While a Var represents something callable to JS or from the module to + * the DOM, a resource has no meaning or visibility outside of the module + * interface. + * + * Resources are reference counted. Use <code>AddRefResource()</code> + * and <code>ReleaseResource()</code> in <code>ppb_core.h</code> to manage the + * reference count of a resource. The data will be automatically destroyed when + * the internal reference count reaches 0. + */ +typedef int32_t PP_Resource; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Resource, 4); +/** + * @} + */ + +#endif /* PPAPI_C_PP_RESOURCE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_size.h
Added
@@ -0,0 +1,88 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_size.idl modified Tue Jun 3 12:31:20 2014. */ + +#ifndef PPAPI_C_PP_SIZE_H_ +#define PPAPI_C_PP_SIZE_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines the width and height of a 2D rectangle. + */ + + +/** + * @addtogroup Structs + * @{ + */ +/** + * The <code>PP_Size</code> struct contains the size of a 2D rectangle. + */ +struct PP_Size { + /** This value represents the width of the rectangle. */ + int32_t width; + /** This value represents the height of the rectangle. */ + int32_t height; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Size, 8); + +/** + * The <code>PP_FloatSize</code> struct contains the size of a 2D rectangle. + */ +struct PP_FloatSize { + /** This value represents the width of the rectangle. */ + float width; + /** This value represents the height of the rectangle. */ + float height; +}; +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakeSize() creates a <code>PP_Size</code> given a width and height as + * int32_t values. + * + * @param[in] w An int32_t value representing a width. + * @param[in] h An int32_t value representing a height. + * + * @return A <code>PP_Size</code> structure. + */ +PP_INLINE struct PP_Size PP_MakeSize(int32_t w, int32_t h) { + struct PP_Size ret; + ret.width = w; + ret.height = h; + return ret; +} + +/** + * PP_MakeFloatSize() creates a <code>PP_FloatSize</code> given a + * width and height as float values. + * + * @param[in] w An float value representing a width. + * @param[in] h An float value representing a height. + * + * @return A <code>PP_FloatSize</code> structure. + */ +PP_INLINE struct PP_FloatSize PP_MakeFloatSize(float w, float h) { + struct PP_FloatSize ret; + ret.width = w; + ret.height = h; + return ret; +} +/** + * @} + */ +#endif /* PPAPI_C_PP_SIZE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_stdint.h
Added
@@ -0,0 +1,61 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_stdint.idl modified Mon Jul 18 17:53:53 2011. */ + +#ifndef PPAPI_C_PP_STDINT_H_ +#define PPAPI_C_PP_STDINT_H_ + +#include "ppapi/c/pp_macros.h" + +/** + * @file + * This file provides a definition of C99 sized types + * for Microsoft compilers. These definitions only apply + * for trusted modules. + */ + + + +/** + * + * @addtogroup Typedefs + * @{ + */ +#if defined(_MSC_VER) + +/** This value represents a guaranteed unsigned 8 bit integer. */ +typedef unsigned char uint8_t; + +/** This value represents a guaranteed signed 8 bit integer. */ +typedef signed char int8_t; + +/** This value represents a guaranteed unsigned 16 bit short. */ +typedef unsigned short uint16_t; + +/** This value represents a guaranteed signed 16 bit short. */ +typedef short int16_t; + +/** This value represents a guaranteed unsigned 32 bit integer. */ +typedef unsigned int uint32_t; + +/** This value represents a guaranteed signed 32 bit integer. */ +typedef int int32_t; + +/** This value represents a guaranteed signed 64 bit integer. */ +typedef __int64 int64_t; + +/** This value represents a guaranteed unsigned 64 bit integer. */ +typedef unsigned __int64 uint64_t; + +#else +#include <stdint.h> +#endif +/** + * @} + */ + +#endif /* PPAPI_C_PP_STDINT_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_time.h
Added
@@ -0,0 +1,56 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_time.idl modified Fri May 10 15:48:42 2013. */ + +#ifndef PPAPI_C_PP_TIME_H_ +#define PPAPI_C_PP_TIME_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines time, time ticks and time delta types. + */ + + +/** + * @addtogroup Typedefs + * @{ + */ +/** + * The <code>PP_Time</code> type represents the "wall clock time" according + * to the browser and is defined as the number of seconds since the Epoch + * (00:00:00 UTC, January 1, 1970). + */ +typedef double PP_Time; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Time, 8); + +/** + * A <code>PP_TimeTicks</code> value represents time ticks which are measured + * in seconds and are used for indicating the time that certain messages were + * received. In contrast to <code>PP_Time</code>, <code>PP_TimeTicks</code> + * does not correspond to any actual wall clock time and will not change + * discontinuously if the user changes their computer clock. + * + * The units are in seconds, but are not measured relative to any particular + * epoch, so the most you can do is compare two values. + */ +typedef double PP_TimeTicks; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TimeTicks, 8); + +/** + * A <code>PP_TimeDelta</code> value represents a duration of time which is + * measured in seconds. + */ +typedef double PP_TimeDelta; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TimeDelta, 8); +/** + * @} + */ + +#endif /* PPAPI_C_PP_TIME_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_touch_point.h
Added
@@ -0,0 +1,87 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_touch_point.idl modified Thu Mar 28 10:13:07 2013. */ + +#ifndef PPAPI_C_PP_TOUCH_POINT_H_ +#define PPAPI_C_PP_TOUCH_POINT_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines the API to create a touch point or position where fingers + * makes contact with touch screen device. + */ + + +/** + * @addtogroup Structs + * @{ + */ +/** + * The <code>PP_TouchPoint</code> struct represents all information about a + * single touch point, such as position, id, rotation angle, and pressure. + */ +struct PP_TouchPoint { + /** + * This value represents the identifier for this TouchPoint. The id + * corresponds to the order in which the points were pressed. For example, + * the first point to be pressed has an id of 0, the second has an id of 1, + * and so on. An id can be reused when a touch point is released. For + * example, if two fingers are down, with id 0 and 1, and finger 0 releases, + * the next finger to be pressed can be assigned to id 0. + */ + uint32_t id; + /** + * This value represents the x and y pixel position of this TouchPoint + * relative to the upper-left of the module instance receiving the event. + */ + struct PP_FloatPoint position; + /** + * This value represents the elliptical radii, in screen pixels, in the x + * and y direction of this TouchPoint. + */ + struct PP_FloatPoint radius; + /** + * This value represents the angle of rotation in degrees of the elliptical + * model of this TouchPoint clockwise from "up." + */ + float rotation_angle; + /** + * This value represents the pressure applied to this TouchPoint. This value + * is typically between 0 and 1, with 0 indicating no pressure and 1 + * indicating some maximum pressure. Scaling differs depending on the + * hardware and the value is not guaranteed to stay within that range. + */ + float pressure; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_TouchPoint, 28); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakeTouchPoint() creates a <code>PP_TouchPoint</code>. + * + * @return A <code>PP_TouchPoint</code> structure. + */ +PP_INLINE struct PP_TouchPoint PP_MakeTouchPoint(void) { + struct PP_TouchPoint result = { 0, {0, 0}, {0, 0}, 0, 0 }; + return result; +} +/** + * @} + */ + +#endif /* PPAPI_C_PP_TOUCH_POINT_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/pp_var.h
Added
@@ -0,0 +1,261 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From pp_var.idl modified Thu Apr 10 14:52:30 2014. */ + +#ifndef PPAPI_C_PP_VAR_H_ +#define PPAPI_C_PP_VAR_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines the API for handling the passing of data types between + * your module and the page. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * The <code>PP_VarType</code> is an enumeration of the different types that + * can be contained within a <code>PP_Var</code> structure. + */ +typedef enum { + /** + * An undefined value. + */ + PP_VARTYPE_UNDEFINED = 0, + /** + * A NULL value. This is similar to undefined, but JavaScript differentiates + * the two so it is exposed here as well. + */ + PP_VARTYPE_NULL = 1, + /** + * A boolean value, use the <code>as_bool</code> member of the var. + */ + PP_VARTYPE_BOOL = 2, + /** + * A 32-bit integer value. Use the <code>as_int</code> member of the var. + */ + PP_VARTYPE_INT32 = 3, + /** + * A double-precision floating point value. Use the <code>as_double</code> + * member of the var. + */ + PP_VARTYPE_DOUBLE = 4, + /** + * The Var represents a string. The <code>as_id</code> field is used to + * identify the string, which may be created and retrieved from the + * <code>PPB_Var</code> interface. These objects are reference counted, so + * AddRef() and Release() must be used properly to avoid memory leaks. + */ + PP_VARTYPE_STRING = 5, + /** + * Represents a JavaScript object. This vartype is not currently usable + * from modules, although it is used internally for some tasks. These objects + * are reference counted, so AddRef() and Release() must be used properly to + * avoid memory leaks. + */ + PP_VARTYPE_OBJECT = 6, + /** + * Represents an array of Vars. The <code>as_id</code> field is used to + * identify the array, which may be created and manipulated from the + * <code>PPB_VarArray</code> interface. These objects are reference counted, + * so AddRef() and Release() must be used properly to avoid memory leaks. + */ + PP_VARTYPE_ARRAY = 7, + /** + * Represents a mapping from strings to Vars. The <code>as_id</code> field is + * used to identify the dictionary, which may be created and manipulated from + * the <code>PPB_VarDictionary</code> interface. These objects are reference + * counted, so AddRef() and Release() must be used properly to avoid memory + * leaks. + */ + PP_VARTYPE_DICTIONARY = 8, + /** + * ArrayBuffer represents a JavaScript ArrayBuffer. This is the type which + * represents Typed Arrays in JavaScript. Unlike JavaScript 'Array', it is + * only meant to contain basic numeric types, and is always stored + * contiguously. See PPB_VarArrayBuffer_Dev for functions special to + * ArrayBuffer vars. These objects are reference counted, so AddRef() and + * Release() must be used properly to avoid memory leaks. + */ + PP_VARTYPE_ARRAY_BUFFER = 9, + /** + * This type allows the <code>PP_Var</code> to wrap a <code>PP_Resource + * </code>. This can be useful for sending or receiving some types of + * <code>PP_Resource</code> using <code>PPB_Messaging</code> or + * <code>PPP_Messaging</code>. + * + * These objects are reference counted, so AddRef() and Release() must be used + * properly to avoid memory leaks. Under normal circumstances, the + * <code>PP_Var</code> will implicitly hold a reference count on the + * <code>PP_Resource</code> on your behalf. For example, if you call + * VarFromResource(), it implicitly calls PPB_Core::AddRefResource() on the + * <code>PP_Resource</code>. Likewise, PPB_Var::Release() on a Resource + * <code>PP_Var</code> will invoke PPB_Core::ReleaseResource() when the Var + * reference count goes to zero. + */ + PP_VARTYPE_RESOURCE = 10 +} PP_VarType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VarType, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_VarValue union stores the data for any one of the types listed + * in the PP_VarType enum. + */ +union PP_VarValue { + /** + * If <code>type</code> is <code>PP_VARTYPE_BOOL</code>, + * <code>as_bool</code> represents the value of this <code>PP_Var</code> as + * <code>PP_Bool</code>. + */ + PP_Bool as_bool; + /** + * If <code>type</code> is <code>PP_VARTYPE_INT32</code>, + * <code>as_int</code> represents the value of this <code>PP_Var</code> as + * <code>int32_t</code>. + */ + int32_t as_int; + /** + * If <code>type</code> is <code>PP_VARTYPE_DOUBLE</code>, + * <code>as_double</code> represents the value of this <code>PP_Var</code> + * as <code>double</code>. + */ + double as_double; + /** + * If <code>type</code> is <code>PP_VARTYPE_STRING</code>, + * <code>PP_VARTYPE_OBJECT</code>, <code>PP_VARTYPE_ARRAY</code>, + * <code>PP_VARTYPE_DICTIONARY</code>, <code>PP_VARTYPE_ARRAY_BUFFER</code>, + * or <code>PP_VARTYPE_RESOURCE</code>, <code>as_id</code> represents the + * value of this <code>PP_Var</code> as an opaque handle assigned by the + * browser. This handle is guaranteed never to be 0, so a module can + * initialize this ID to 0 to indicate a "NULL handle." + */ + int64_t as_id; +}; + +/** + * The <code>PP_VAR</code> struct is a variant data type and can contain any + * value of one of the types named in the <code>PP_VarType</code> enum. This + * structure is for passing data between native code which can be strongly + * typed and the browser (JavaScript) which isn't strongly typed. + * + * JavaScript has a "number" type for holding a number, and does not + * differentiate between floating point and integer numbers. The + * JavaScript operations will try to optimize operations by using + * integers when possible, but could end up with doubles. Therefore, + * you can't assume a numeric <code>PP_Var</code> will be the type you expect. + * Your code should be capable of handling either int32_t or double for numeric + * PP_Vars sent from JavaScript. + */ +struct PP_Var { + PP_VarType type; + /** + * The <code>padding</code> ensures <code>value</code> is aligned on an + * 8-byte boundary relative to the start of the struct. Some compilers + * align doubles on 8-byte boundaries for 32-bit x86, and some align on + * 4-byte boundaries. + */ + int32_t padding; + /** + * This <code>value</code> represents the contents of the PP_Var. Only one of + * the fields of <code>value</code> is valid at a time based upon + * <code>type</code>. + */ + union PP_VarValue value; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Var, 16); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakeUndefined() is used to wrap an undefined value into a + * <code>PP_Var</code> struct for passing to the browser. + * + * @return A <code>PP_Var</code> structure. + */ +PP_INLINE struct PP_Var PP_MakeUndefined(void) { + struct PP_Var result = { PP_VARTYPE_UNDEFINED, 0, {PP_FALSE} }; + return result; +} + +/** + * PP_MakeNull() is used to wrap a null value into a + * <code>PP_Var</code> struct for passing to the browser. + * + * @return A <code>PP_Var</code> structure, + */ +PP_INLINE struct PP_Var PP_MakeNull(void) { + struct PP_Var result = { PP_VARTYPE_NULL, 0, {PP_FALSE} }; + return result; +} + +/** + * PP_MakeBool() is used to wrap a boolean value into a + * <code>PP_Var</code> struct for passing to the browser. + * + * @param[in] value A <code>PP_Bool</code> enumeration to + * wrap. + * + * @return A <code>PP_Var</code> structure. + */ +PP_INLINE struct PP_Var PP_MakeBool(PP_Bool value) { + struct PP_Var result = { PP_VARTYPE_BOOL, 0, {PP_FALSE} }; + result.value.as_bool = value; + return result; +} + +/** + * PP_MakeInt32() is used to wrap a 32 bit integer value + * into a <code>PP_Var</code> struct for passing to the browser. + * + * @param[in] value An int32 to wrap. + * + * @return A <code>PP_Var</code> structure. + */ +PP_INLINE struct PP_Var PP_MakeInt32(int32_t value) { + struct PP_Var result = { PP_VARTYPE_INT32, 0, {PP_FALSE} }; + result.value.as_int = value; + return result; +} + +/** + * PP_MakeDouble() is used to wrap a double value into a + * <code>PP_Var</code> struct for passing to the browser. + * + * @param[in] value A double to wrap. + * + * @return A <code>PP_Var</code> structure. + */ +PP_INLINE struct PP_Var PP_MakeDouble(double value) { + struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} }; + result.value.as_double = value; + return result; +} +/** + * @} + */ + +#endif /* PPAPI_C_PP_VAR_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb.h
Added
@@ -0,0 +1,48 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb.idl modified Fri Jan 24 16:19:56 2014. */ + +#ifndef PPAPI_C_PPB_H_ +#define PPAPI_C_PPB_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines a function pointer type for the + * <code>PPB_GetInterface</code> function. + */ + + +/** + * @addtogroup Typedefs + * @{ + */ +/** + * This function pointer type defines the signature for the + * <code>PPB_GetInterface</code> function. A generic + * <code>PPB_GetInterface</code> pointer is passed to + * <code>PPP_InitializedModule</code> when your module is loaded. You can use + * this pointer to request a pointer to a specific browser interface. Browser + * interface names are ASCII strings and are generally defined in the header + * file for the interface, such as <code>PPB_AUDIO_INTERFACE</code> found in + * <code>ppb.audio.h</code> or + * <code>PPB_GRAPHICS_2D_INTERFACE</code> in <code>ppb_graphics_2d.h</code>. + * Click + * <a href="globals_defs.html" + * title="macros">here</a> for a complete list of interface + * names. + * + * This value will be NULL if the interface is not supported on the browser. + */ +typedef const void* (*PPB_GetInterface)(const char* interface_name); +/** + * @} + */ + +#endif /* PPAPI_C_PPB_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_audio.h
Added
@@ -0,0 +1,190 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_audio.idl modified Fri Jan 24 16:18:44 2014. */ + +#ifndef PPAPI_C_PPB_AUDIO_H_ +#define PPAPI_C_PPB_AUDIO_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" + +#define PPB_AUDIO_INTERFACE_1_0 "PPB_Audio;1.0" +#define PPB_AUDIO_INTERFACE_1_1 "PPB_Audio;1.1" +#define PPB_AUDIO_INTERFACE PPB_AUDIO_INTERFACE_1_1 + +/** + * @file + * This file defines the <code>PPB_Audio</code> interface, which provides + * realtime stereo audio streaming capabilities. + */ + + +/** + * @addtogroup Typedefs + * @{ + */ +/** + * <code>PPB_Audio_Callback</code> defines the type of an audio callback + * function used to fill the audio buffer with data. Please see the + * Create() function in the <code>PPB_Audio</code> interface for + * more details on this callback. + * + * @param[in] sample_buffer A buffer to fill with audio data. + * @param[in] buffer_size_in_bytes The size of the buffer in bytes. + * @param[in] latency How long before the audio data is to be presented. + * @param[inout] user_data An opaque pointer that was passed into + * <code>PPB_Audio.Create()</code>. + */ +typedef void (*PPB_Audio_Callback)(void* sample_buffer, + uint32_t buffer_size_in_bytes, + PP_TimeDelta latency, + void* user_data); + +typedef void (*PPB_Audio_Callback_1_0)(void* sample_buffer, + uint32_t buffer_size_in_bytes, + void* user_data); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_Audio</code> interface contains pointers to several functions + * for handling audio resources. Refer to the + * <a href="/native-client/devguide/coding/audio.html">Audio</a> + * chapter in the Developer's Guide for information on using this interface. + * Please see descriptions for each <code>PPB_Audio</code> and + * <code>PPB_AudioConfig</code> function for more details. A C example using + * <code>PPB_Audio</code> and <code>PPB_AudioConfig</code> follows. + * + * <strong>Example: </strong> + * + * @code + * void audio_callback(void* sample_buffer, + * uint32_t buffer_size_in_bytes, + * void* user_data) { + * ... quickly fill in the buffer with samples and return to caller ... + * } + * + * ...Assume the application has cached the audio configuration interface in + * audio_config_interface and the audio interface in + * audio_interface... + * + * uint32_t count = audio_config_interface->RecommendSampleFrameCount( + * PP_AUDIOSAMPLERATE_44100, 4096); + * PP_Resource pp_audio_config = audio_config_interface->CreateStereo16Bit( + * pp_instance, PP_AUDIOSAMPLERATE_44100, count); + * PP_Resource pp_audio = audio_interface->Create(pp_instance, pp_audio_config, + * audio_callback, NULL); + * audio_interface->StartPlayback(pp_audio); + * + * ...audio_callback() will now be periodically invoked on a separate thread... + * @endcode + */ +struct PPB_Audio_1_1 { + /** + * Create() creates an audio resource. No sound will be heard until + * StartPlayback() is called. The callback is called with the buffer address + * and given user data whenever the buffer needs to be filled. From within the + * callback, you should not call <code>PPB_Audio</code> functions. The + * callback will be called on a different thread than the one which created + * the interface. For performance-critical applications (i.e. low-latency + * audio), the callback should avoid blocking or calling functions that can + * obtain locks, such as malloc. The layout and the size of the buffer passed + * to the audio callback will be determined by the device configuration and is + * specified in the <code>AudioConfig</code> documentation. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] config A <code>PP_Resource</code> corresponding to an audio + * config resource. + * @param[in] audio_callback A <code>PPB_Audio_Callback</code> callback + * function that the browser calls when it needs more samples to play. + * @param[in] user_data A pointer to user data used in the callback function. + * + * @return A <code>PP_Resource</code> containing the audio resource if + * successful or 0 if the configuration cannot be honored or the callback is + * null. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_Resource config, + PPB_Audio_Callback audio_callback, + void* user_data); + /** + * IsAudio() determines if the provided resource is an audio resource. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a generic + * resource. + * + * @return A <code>PP_Bool</code> containing containing <code>PP_TRUE</code> + * if the given resource is an Audio resource, otherwise + * <code>PP_FALSE</code>. + */ + PP_Bool (*IsAudio)(PP_Resource resource); + /** + * GetCurrrentConfig() returns an audio config resource for the given audio + * resource. + * + * @param[in] config A <code>PP_Resource</code> corresponding to an audio + * resource. + * + * @return A <code>PP_Resource</code> containing the audio config resource if + * successful. + */ + PP_Resource (*GetCurrentConfig)(PP_Resource audio); + /** + * StartPlayback() starts the playback of the audio resource and begins + * periodically calling the callback. + * + * @param[in] config A <code>PP_Resource</code> corresponding to an audio + * resource. + * + * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if + * successful, otherwise <code>PP_FALSE</code>. Also returns + * <code>PP_TRUE</code> (and be a no-op) if called while playback is already + * in progress. + */ + PP_Bool (*StartPlayback)(PP_Resource audio); + /** + * StopPlayback() stops the playback of the audio resource. + * + * @param[in] config A <code>PP_Resource</code> corresponding to an audio + * resource. + * + * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if + * successful, otherwise <code>PP_FALSE</code>. Also returns + * <code>PP_TRUE</code> (and is a no-op) if called while playback is already + * stopped. If a callback is in progress, StopPlayback() will block until the + * callback completes. + */ + PP_Bool (*StopPlayback)(PP_Resource audio); +}; + +typedef struct PPB_Audio_1_1 PPB_Audio; + +struct PPB_Audio_1_0 { + PP_Resource (*Create)(PP_Instance instance, + PP_Resource config, + PPB_Audio_Callback_1_0 audio_callback, + void* user_data); + PP_Bool (*IsAudio)(PP_Resource resource); + PP_Resource (*GetCurrentConfig)(PP_Resource audio); + PP_Bool (*StartPlayback)(PP_Resource audio); + PP_Bool (*StopPlayback)(PP_Resource audio); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_AUDIO_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_audio_buffer.h
Added
@@ -0,0 +1,156 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_audio_buffer.idl modified Tue Mar 25 18:29:27 2014. */ + +#ifndef PPAPI_C_PPB_AUDIO_BUFFER_H_ +#define PPAPI_C_PPB_AUDIO_BUFFER_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" + +#define PPB_AUDIOBUFFER_INTERFACE_0_1 "PPB_AudioBuffer;0.1" +#define PPB_AUDIOBUFFER_INTERFACE PPB_AUDIOBUFFER_INTERFACE_0_1 + +/** + * @file + * Defines the <code>PPB_AudioBuffer</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * PP_AudioBuffer_SampleRate is an enumeration of the different audio sample + * rates. + */ +typedef enum { + PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN = 0, + PP_AUDIOBUFFER_SAMPLERATE_8000 = 8000, + PP_AUDIOBUFFER_SAMPLERATE_16000 = 16000, + PP_AUDIOBUFFER_SAMPLERATE_22050 = 22050, + PP_AUDIOBUFFER_SAMPLERATE_32000 = 32000, + PP_AUDIOBUFFER_SAMPLERATE_44100 = 44100, + PP_AUDIOBUFFER_SAMPLERATE_48000 = 48000, + PP_AUDIOBUFFER_SAMPLERATE_96000 = 96000, + PP_AUDIOBUFFER_SAMPLERATE_192000 = 192000 +} PP_AudioBuffer_SampleRate; + +/** + * PP_AudioBuffer_SampleSize is an enumeration of the different audio sample + * sizes. + */ +typedef enum { + PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN = 0, + PP_AUDIOBUFFER_SAMPLESIZE_16_BITS = 2 +} PP_AudioBuffer_SampleSize; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_AudioBuffer_0_1 { + /** + * Determines if a resource is an AudioBuffer resource. + * + * @param[in] resource The <code>PP_Resource</code> to test. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is an AudioBuffer resource or <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsAudioBuffer)(PP_Resource resource); + /** + * Gets the timestamp of the audio buffer. + * + * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio + * buffer resource. + * + * @return A <code>PP_TimeDelta</code> containing the timestamp of the audio + * buffer. Given in seconds since the start of the containing audio stream. + */ + PP_TimeDelta (*GetTimestamp)(PP_Resource buffer); + /** + * Sets the timestamp of the audio buffer. + * + * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio + * buffer resource. + * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp + * of the audio buffer. Given in seconds since the start of the containing + * audio stream. + */ + void (*SetTimestamp)(PP_Resource buffer, PP_TimeDelta timestamp); + /** + * Gets the sample rate of the audio buffer. + * + * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio + * buffer resource. + * + * @return The sample rate of the audio buffer. + */ + PP_AudioBuffer_SampleRate (*GetSampleRate)(PP_Resource buffer); + /** + * Gets the sample size of the audio buffer. + * + * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio + * buffer resource. + * + * @return The sample size of the audio buffer. + */ + PP_AudioBuffer_SampleSize (*GetSampleSize)(PP_Resource buffer); + /** + * Gets the number of channels in the audio buffer. + * + * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio + * buffer resource. + * + * @return The number of channels in the audio buffer. + */ + uint32_t (*GetNumberOfChannels)(PP_Resource buffer); + /** + * Gets the number of samples in the audio buffer. + * + * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio + * buffer resource. + * + * @return The number of samples in the audio buffer. + * For example, at a sampling rate of 44,100 Hz in stereo audio, a buffer + * containing 4410 * 2 samples would have a duration of 100 milliseconds. + */ + uint32_t (*GetNumberOfSamples)(PP_Resource buffer); + /** + * Gets the data buffer containing the audio samples. + * + * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio + * buffer resource. + * + * @return A pointer to the beginning of the data buffer. + */ + void* (*GetDataBuffer)(PP_Resource buffer); + /** + * Gets the size of the data buffer in bytes. + * + * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio + * buffer resource. + * + * @return The size of the data buffer in bytes. + */ + uint32_t (*GetDataBufferSize)(PP_Resource buffer); +}; + +typedef struct PPB_AudioBuffer_0_1 PPB_AudioBuffer; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_AUDIO_BUFFER_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_audio_config.h
Added
@@ -0,0 +1,211 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_audio_config.idl modified Fri Jan 24 16:19:35 2014. */ + +#ifndef PPAPI_C_PPB_AUDIO_CONFIG_H_ +#define PPAPI_C_PPB_AUDIO_CONFIG_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_AUDIO_CONFIG_INTERFACE_1_0 "PPB_AudioConfig;1.0" +#define PPB_AUDIO_CONFIG_INTERFACE_1_1 "PPB_AudioConfig;1.1" +#define PPB_AUDIO_CONFIG_INTERFACE PPB_AUDIO_CONFIG_INTERFACE_1_1 + +/** + * @file + * This file defines the PPB_AudioConfig interface for establishing an + * audio configuration resource within the browser. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains audio frame count constants. + * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> is the minimum possible frame + * count. <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> is the maximum possible + * frame count. + */ +enum { + PP_AUDIOMINSAMPLEFRAMECOUNT = 64, + PP_AUDIOMAXSAMPLEFRAMECOUNT = 32768 +}; + +/** + * PP_AudioSampleRate is an enumeration of the different audio sampling rates. + * <code>PP_AUDIOSAMPLERATE_44100</code> is the sample rate used on CDs and + * <code>PP_AUDIOSAMPLERATE_48000</code> is the sample rate used on DVDs and + * Digital Audio Tapes. + */ +typedef enum { + PP_AUDIOSAMPLERATE_NONE = 0, + PP_AUDIOSAMPLERATE_44100 = 44100, + PP_AUDIOSAMPLERATE_48000 = 48000 +} PP_AudioSampleRate; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_AudioSampleRate, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_AudioConfig</code> interface contains pointers to several + * functions for establishing your audio configuration within the browser. + * This interface only supports 16-bit stereo output. + * + * Refer to the + * <a href="/native-client/devguide/coding/audio.html">Audio + * </a> chapter in the Developer's Guide for information on using this + * interface. + */ +struct PPB_AudioConfig_1_1 { + /** + * CreateStereo16bit() creates a 16 bit audio configuration resource. The + * <code>sample_rate</code> should be the result of calling + * <code>RecommendSampleRate</code> and <code>sample_frame_count</code> should + * be the result of calling <code>RecommendSampleFrameCount</code>. If the + * sample frame count or bit rate isn't supported, this function will fail and + * return a null resource. + * + * A single sample frame on a stereo device means one value for the left + * channel and one value for the right channel. + * + * Buffer layout for a stereo int16 configuration: + * <code>int16_t *buffer16;</code> + * <code>buffer16[0]</code> is the first left channel sample. + * <code>buffer16[1]</code> is the first right channel sample. + * <code>buffer16[2]</code> is the second left channel sample. + * <code>buffer16[3]</code> is the second right channel sample. + * ... + * <code>buffer16[2 * (sample_frame_count - 1)]</code> is the last left + * channel sample. + * <code>buffer16[2 * (sample_frame_count - 1) + 1]</code> is the last + * right channel sample. + * Data will always be in the native endian format of the platform. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either + * <code>PP_AUDIOSAMPLERATE_44100</code> or + * <code>PP_AUDIOSAMPLERATE_48000</code>. + * @param[in] sample_frame_count A <code>uint32_t</code> frame count returned + * from the <code>RecommendSampleFrameCount</code> function. + * + * @return A <code>PP_Resource</code> containing the + * <code>PPB_Audio_Config</code> if successful or a null resource if the + * sample frame count or bit rate are not supported. + */ + PP_Resource (*CreateStereo16Bit)(PP_Instance instance, + PP_AudioSampleRate sample_rate, + uint32_t sample_frame_count); + /** + * RecommendSampleFrameCount() returns the supported sample frame count + * closest to the requested count. The sample frame count determines the + * overall latency of audio. Since one "frame" is always buffered in advance, + * smaller frame counts will yield lower latency, but higher CPU utilization. + * + * Supported sample frame counts will vary by hardware and system (consider + * that the local system might be anywhere from a cell phone or a high-end + * audio workstation). Sample counts less than + * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than + * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any + * system, but values in between aren't necessarily valid. This function + * will return a supported count closest to the requested frame count. + * + * RecommendSampleFrameCount() result is intended for audio output devices. + * + * @param[in] instance + * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either + * <code>PP_AUDIOSAMPLERATE_44100</code> or + * <code>PP_AUDIOSAMPLERATE_48000.</code> + * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested + * frame count. + * + * @return A <code>uint32_t</code> containing the recommended sample frame + * count if successful. + */ + uint32_t (*RecommendSampleFrameCount)( + PP_Instance instance, + PP_AudioSampleRate sample_rate, + uint32_t requested_sample_frame_count); + /** + * IsAudioConfig() determines if the given resource is a + * <code>PPB_Audio_Config</code>. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to an audio + * config resource. + * + * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given + * resource is an <code>AudioConfig</code> resource, otherwise + * <code>PP_FALSE</code>. + */ + PP_Bool (*IsAudioConfig)(PP_Resource resource); + /** + * GetSampleRate() returns the sample rate for the given + * <code>PPB_Audio_Config</code>. + * + * @param[in] config A <code>PP_Resource</code> corresponding to a + * <code>PPB_Audio_Config</code>. + * + * @return A <code>PP_AudioSampleRate</code> containing sample rate or + * <code>PP_AUDIOSAMPLERATE_NONE</code> if the resource is invalid. + */ + PP_AudioSampleRate (*GetSampleRate)(PP_Resource config); + /** + * GetSampleFrameCount() returns the sample frame count for the given + * <code>PPB_Audio_Config</code>. + * + * @param[in] config A <code>PP_Resource</code> corresponding to an audio + * config resource. + * + * @return A <code>uint32_t</code> containing sample frame count or + * 0 if the resource is invalid. Refer to + * RecommendSampleFrameCount() for more on sample frame counts. + */ + uint32_t (*GetSampleFrameCount)(PP_Resource config); + /** + * RecommendSampleRate() returns the native sample rate that the browser + * is using in the backend. Applications that use the recommended sample + * rate will have potentially better latency and fidelity. The return value + * is intended for audio output devices. If the output sample rate cannot be + * determined, this function can return PP_AUDIOSAMPLERATE_NONE. + * + * @param[in] instance + * + * @return A <code>uint32_t</code> containing the recommended sample frame + * count if successful. + */ + PP_AudioSampleRate (*RecommendSampleRate)(PP_Instance instance); +}; + +typedef struct PPB_AudioConfig_1_1 PPB_AudioConfig; + +struct PPB_AudioConfig_1_0 { + PP_Resource (*CreateStereo16Bit)(PP_Instance instance, + PP_AudioSampleRate sample_rate, + uint32_t sample_frame_count); + uint32_t (*RecommendSampleFrameCount)( + PP_AudioSampleRate sample_rate, + uint32_t requested_sample_frame_count); + PP_Bool (*IsAudioConfig)(PP_Resource resource); + PP_AudioSampleRate (*GetSampleRate)(PP_Resource config); + uint32_t (*GetSampleFrameCount)(PP_Resource config); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_AUDIO_CONFIG_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_audio_encoder.h
Added
@@ -0,0 +1,222 @@ +/* Copyright 2015 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_audio_encoder.idl modified Mon Sep 7 10:17:53 2015. */ + +#ifndef PPAPI_C_PPB_AUDIO_ENCODER_H_ +#define PPAPI_C_PPB_AUDIO_ENCODER_H_ + +#include "ppapi/c/pp_array_output.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_codecs.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/ppb_audio_buffer.h" + +#define PPB_AUDIOENCODER_INTERFACE_0_1 "PPB_AudioEncoder;0.1" /* dev */ +/** + * @file + * This file defines the <code>PPB_AudioEncoder</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Audio encoder interface. + * + * Typical usage: + * - Call Create() to create a new audio encoder resource. + * - Call GetSupportedProfiles() to determine which codecs and profiles are + * available. + * - Call Initialize() to initialize the encoder for a supported profile. + * - Call GetBuffer() to get an empty buffer and fill it in, or get an audio + * buffer from another resource, e.g. <code>PPB_MediaStreamAudioTrack</code>. + * - Call Encode() to push the audio buffer to the encoder. If an external + * buffer is pushed, wait for completion to recycle the buffer. + * - Call GetBitstreamBuffer() continuously (waiting for each previous call to + * complete) to pull encoded buffers from the encoder. + * - Call RecycleBitstreamBuffer() after consuming the data in the bitstream + * buffer. + * - To destroy the encoder, the plugin should release all of its references to + * it. Any pending callbacks will abort before the encoder is destroyed. + * + * Available audio codecs vary by platform. + * All: opus. + */ +struct PPB_AudioEncoder_0_1 { /* dev */ + /** + * Creates a new audio encoder resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * with the audio encoder. + * + * @return A <code>PP_Resource</code> corresponding to an audio encoder if + * successful or 0 otherwise. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if the given resource is an audio encoder. + * + * @param[in] resource A <code>PP_Resource</code> identifying a resource. + * + * @return <code>PP_TRUE</code> if the resource is a + * <code>PPB_AudioEncoder</code>, <code>PP_FALSE</code> if the resource is + * invalid or some other type. + */ + PP_Bool (*IsAudioEncoder)(PP_Resource resource); + /** + * Gets an array of supported audio encoder profiles. + * These can be used to choose a profile before calling Initialize(). + * + * @param[in] audio_encoder A <code>PP_Resource</code> identifying the audio + * encoder. + * @param[in] output A <code>PP_ArrayOutput</code> to receive the supported + * <code>PP_AudioProfileDescription</code> structs. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return If >= 0, the number of supported profiles returned, otherwise an + * error code from <code>pp_errors.h</code>. + */ + int32_t (*GetSupportedProfiles)(PP_Resource audio_encoder, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + /** + * Initializes an audio encoder resource. The plugin should call Initialize() + * successfully before calling any of the functions below. + * + * @param[in] audio_encoder A <code>PP_Resource</code> identifying the audio + * encoder. + * @param[in] channels The number of audio channels to encode. + * @param[in] input_sampling_rate The sampling rate of the input audio buffer. + * @param[in] input_sample_size The sample size of the input audio buffer. + * @param[in] output_profile A <code>PP_AudioProfile</code> specifying the + * codec profile of the encoded output stream. + * @param[in] initial_bitrate The initial bitrate for the encoder. + * @param[in] acceleration A <code>PP_HardwareAcceleration</code> specifying + * whether to use a hardware accelerated or a software implementation. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_NOTSUPPORTED if audio encoding is not available, or the + * requested codec profile is not supported. + */ + int32_t (*Initialize)(PP_Resource audio_encoder, + uint32_t channels, + PP_AudioBuffer_SampleRate input_sample_rate, + PP_AudioBuffer_SampleSize input_sample_size, + PP_AudioProfile output_profile, + uint32_t initial_bitrate, + PP_HardwareAcceleration acceleration, + struct PP_CompletionCallback callback); + /** + * Gets the number of audio samples per channel that audio buffers must + * contain in order to be processed by the encoder. This will be the number of + * samples per channels contained in buffers returned by GetBuffer(). + * + * @param[in] audio_encoder A <code>PP_Resource</code> identifying the audio + * encoder. + * @return An int32_t containing the number of samples required, or an error + * code from <code>pp_errors.h</code>. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*GetNumberOfSamples)(PP_Resource audio_encoder); + /** + * Gets a blank audio buffer (with metadata given by the Initialize() + * call) which can be filled with audio data and passed to the encoder. + * + * @param[in] audio_encoder A <code>PP_Resource</code> identifying the audio + * encoder. + * @param[out] audio_buffer A blank <code>PPB_AudioBuffer</code> resource. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*GetBuffer)(PP_Resource audio_encoder, + PP_Resource* audio_buffer, + struct PP_CompletionCallback callback); + /** + * Encodes an audio buffer. + * + * @param[in] audio_encoder A <code>PP_Resource</code> identifying the audio + * encoder. + * @param[in] audio_buffer The <code>PPB_AudioBuffer</code> to be encoded. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. Plugins that pass <code>PPB_AudioBuffer</code> resources owned + * by other resources should wait for completion before reusing them. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*Encode)(PP_Resource audio_encoder, + PP_Resource audio_buffer, + struct PP_CompletionCallback callback); + /** + * Gets the next encoded bitstream buffer from the encoder. + * + * @param[in] audio_encoder A <code>PP_Resource</code> identifying the audio + * encoder. + * @param[out] bitstream_buffer A <code>PP_BitstreamBuffer</code> containing + * encoded audio data. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. The plugin can call GetBitstreamBuffer from the callback in + * order to continuously "pull" bitstream buffers from the encoder. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + * Returns PP_ERROR_INPROGRESS if a prior call to GetBitstreamBuffer() has + * not completed. + */ + int32_t (*GetBitstreamBuffer)( + PP_Resource audio_encoder, + struct PP_AudioBitstreamBuffer* bitstream_buffer, + struct PP_CompletionCallback callback); + /** + * Recycles a bitstream buffer back to the encoder. + * + * @param[in] audio_encoder A <code>PP_Resource</code> identifying the audio + * encoder. + * @param[in] bitstream_buffer A <code>PP_BitstreamBuffer</code> that is no + * longer needed by the plugin. + */ + void (*RecycleBitstreamBuffer)( + PP_Resource audio_encoder, + const struct PP_AudioBitstreamBuffer* bitstream_buffer); + /** + * Requests a change to the encoding bitrate. This is only a request, + * fulfilled on a best-effort basis. + * + * @param[in] audio_encoder A <code>PP_Resource</code> identifying the audio + * encoder. + * @param[in] bitrate The requested new bitrate, in bits per second. + */ + void (*RequestBitrateChange)(PP_Resource audio_encoder, uint32_t bitrate); + /** + * Closes the audio encoder, and cancels any pending encodes. Any pending + * callbacks will still run, reporting <code>PP_ERROR_ABORTED</code> . It is + * not valid to call any encoder functions after a call to this method. + * <strong>Note:</strong> Destroying the audio encoder closes it implicitly, + * so you are not required to call Close(). + * + * @param[in] audio_encoder A <code>PP_Resource</code> identifying the audio + * encoder. + */ + void (*Close)(PP_Resource audio_encoder); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_AUDIO_ENCODER_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_compositor.h
Added
@@ -0,0 +1,148 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_compositor.idl modified Tue Jun 3 12:44:44 2014. */ + +#ifndef PPAPI_C_PPB_COMPOSITOR_H_ +#define PPAPI_C_PPB_COMPOSITOR_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_COMPOSITOR_INTERFACE_0_1 "PPB_Compositor;0.1" /* dev */ +/** + * @file + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Defines the <code>PPB_Compositor</code> interface. Used for setting + * <code>PPB_CompositorLayer</code> layers to the Chromium compositor for + * compositing. This allows a plugin to combine different sources of visual + * data efficiently, such as <code>PPB_ImageData</code> images and + * OpenGL textures. See also <code>PPB_CompositorLayer</code> for more + * information. + * This interface is still in development (Dev API status) and may change, + * so is only supported on Dev channel and Canary currently. + * + * <strong>Example usage from plugin code:</strong> + * + * <strong>Setup:</strong> + * @code + * PP_Resource compositor; + * compositor = compositor_if->Create(instance); + * instance_if->BindGraphics(instance, compositor); + * @endcode + * + * <strong>Setup layer stack:</strong> + * @code + * PP_Resource color_layer = compositor_if->AddLayer(compositor); + * PP_Resource texture_layer = compositor_if->AddLayer(compositor); + * @endcode + * + * <strong> Present one frame:</strong> + * layer_if->SetColor(color_layer, 255, 255, 0, 255, PP_MakeSize(400, 400)); + * PP_CompletionCallback release_callback = { + * TextureReleasedCallback, 0, PP_COMPLETIONCALLBACK_FLAG_NONE, + * }; + * layer_if->SetTexture(texture_layer, graphics3d, texture_id, + * PP_MakeSize(300, 300), release_callback); + * + * PP_CompletionCallback callback = { + * DidFinishCommitLayersCallback, + * (void*) texture_id, + * PP_COMPLETIONCALLBACK_FLAG_NONE, + * }; + * compositor_if->CommitLayers(compositor, callback); + * @endcode + * + * <strong>release callback</strong> + * void ReleaseCallback(int32_t result, void* user_data) { + * if (result == PP_OK) { + * uint32_t texture_id = (uint32_t) user_data; + * // reuse the texture or delete it. + * } + * } + * + * <strong>Shutdown:</strong> + * @code + * core->ReleaseResource(color_layer); + * core->ReleaseResource(texture_layer); + * core->ReleaseResource(compositor); + * @endcode + */ +struct PPB_Compositor_0_1 { /* dev */ + /** + * Determines if a resource is a compositor resource. + * + * @param[in] resource The <code>PP_Resource</code> to test. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a compositor resource or <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsCompositor)(PP_Resource resource); + /** + * Creates a Compositor resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * + * @return A <code>PP_Resource</code> containing the compositor resource if + * successful or 0 otherwise. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Creates a new <code>PPB_CompositorLayer</code> and adds it to the end + * of the layer stack. A <code>PP_Resource</code> containing the layer is + * returned. It is uninitialized, <code>SetColor()</code>, + * <code>SetTexture</code> or <code>SetImage</code> should be used to + * initialize it. The layer will appear above other pre-existing layers. + * If <code>ResetLayers</code> is called or the <code>PPB_Compositor</code> is + * released, the returned layer will be invalidated, and any further calls on + * the layer will return <code>PP_ERROR_BADRESOURCE</code>. + * + * param[in] compositor A <code>PP_Resource</code> corresponding to + * a compositor layer resource. + * + * @return A <code>PP_Resource</code> containing the compositor layer + * resource if successful or 0 otherwise. + */ + PP_Resource (*AddLayer)(PP_Resource compositor); + /** + * Commits layers added by <code>AddLayer()</code> to the chromium compositor. + * + * param[in] compositor A <code>PP_Resource</code> corresponding to + * a compositor layer resource. + * @param[in] cc A <code>PP_CompletionCallback</code> to be called when + * layers have been represented on screen. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*CommitLayers)(PP_Resource compositor, + struct PP_CompletionCallback cc); + /** + * Resets layers added by <code>AddLayer()</code>. + * + * param[in] compositor A <code>PP_Resource</code> corresponding to + * a compositor layer resource. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*ResetLayers)(PP_Resource compositor); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_COMPOSITOR_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_compositor_layer.h
Added
@@ -0,0 +1,264 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_compositor_layer.idl modified Thu Aug 14 18:06:33 2014. */ + +#ifndef PPAPI_C_PPB_COMPOSITOR_LAYER_H_ +#define PPAPI_C_PPB_COMPOSITOR_LAYER_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_COMPOSITORLAYER_INTERFACE_0_1 "PPB_CompositorLayer;0.1" /* dev */ +#define PPB_COMPOSITORLAYER_INTERFACE_0_2 "PPB_CompositorLayer;0.2" /* dev */ +/** + * @file + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains blend modes used for computing the result pixels + * based on the source RGBA values in layers with the RGBA values that are + * already in the destination framebuffer. + * alpha_src, color_src: source alpha and color. + * alpha_dst, color_dst: destination alpha and color (before compositing). + * Below descriptions of the blend modes assume the colors are pre-multiplied. + * This interface is still in development (Dev API status) and may change, + * so is only supported on Dev channel and Canary currently. + */ +typedef enum { + /** + * No blending, copy source to the destination directly. + */ + PP_BLENDMODE_NONE, + /** + * Source is placed over the destination. + * Resulting alpha = alpha_src + alpha_dst - alpha_src * alpha_dst + * Resulting color = color_src + color_dst * (1 - alpha_src) + */ + PP_BLENDMODE_SRC_OVER, + /** + * The last blend mode. + */ + PP_BLENDMODE_LAST = PP_BLENDMODE_SRC_OVER +} PP_BlendMode; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Defines the <code>PPB_CompositorLayer</code> interface. It is used by + * <code>PPB_Compositor</code>. + */ +struct PPB_CompositorLayer_0_2 { /* dev */ + /** + * Determines if a resource is a compositor layer resource. + * + * @param[in] resource The <code>PP_Resource</code> to test. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a compositor layer resource or <code>PP_FALSE</code> + * otherwise. + */ + PP_Bool (*IsCompositorLayer)(PP_Resource resource); + /** + * Sets the color of a solid color layer. If the layer is uninitialized, + * it will initialize the layer first, and then set its color. + * If the layer has been initialized to another kind of layer, the layer will + * not be changed, and <code>PP_ERROR_BADARGUMENT</code> will be returned. + * + * param[in] layer A <code>PP_Resource</code> corresponding to a compositor + * layer resource. + * param[in] red A <code>float</code> for the red color component. It will be + * clamped to [0, 1]. + * param[in] green A <code>float</code> for the green color component. It will + * be clamped to [0, 1]. + * param[in] blue A <code>float</code> for the blue color component. It will + * be clamped to [0, 1]. + * param[in] alpha A <code>float</code> for the alpha color component. It will + * be clamped to [0, 1]. + * param[in] size A <code>PP_Size</code> for the size of the layer before + * transform. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*SetColor)(PP_Resource layer, + float red, + float green, + float blue, + float alpha, + const struct PP_Size* size); + /** + * Sets the texture of a texture layer. If the layer is uninitialized, + * it will initialize the layer first, and then set its texture. + * The source rect will be set to ((0, 0), (1, 1)). If the layer has been + * initialized to another kind of layer, the layer will not be changed, + * and <code>PP_ERROR_BADARGUMENT</code> will be returned. + * + * param[in] layer A <code>PP_Resource</code> corresponding to a compositor + * layer resource. + * param[in] context A <code>PP_Resource</code> corresponding to a graphics + * 3d resource which owns the GL texture. + * param[in] target GL texture target (GL_TEXTURE_2D, etc). + * param[in] texture A GL texture object id. + * param[in] size A <code>PP_Size</code> for the size of the layer before + * transform. + * param[in] cc A <code>PP_CompletionCallback</code> to be called when + * the texture is released by Chromium compositor. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*SetTexture)(PP_Resource layer, + PP_Resource context, + uint32_t target, + uint32_t texture, + const struct PP_Size* size, + struct PP_CompletionCallback cc); + /** + * Sets the image of an image layer. If the layer is uninitialized, + * it will initialize the layer first, and then set its image. + * The layer size will be set to the image's size. The source rect will be set + * to the full image. If the layer has been initialized to another kind of + * layer, the layer will not be changed, and <code>PP_ERROR_BADARGUMENT</code> + * will be returned. + * + * param[in] layer A <code>PP_Resource</code> corresponding to a compositor + * layer resource. + * param[in] image_data A <code>PP_Resource</code> corresponding to + * an image data resource. + * param[in] size A <code>PP_Size</code> for the size of the layer before + * transform. If NULL, the image's size will be used. + * param[in] cc A <code>PP_CompletionCallback</code> to be called when + * the image data is released by Chromium compositor. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*SetImage)(PP_Resource layer, + PP_Resource image_data, + const struct PP_Size* size, + struct PP_CompletionCallback cc); + /** + * Sets a clip rectangle for a compositor layer. The Chromium compositor + * applies a transform matrix on the layer first, and then clips the layer + * with the rectangle. + * + * param[in] layer A <code>PP_Resource</code> corresponding to a compositor + * layer resource. + * param[in] rect The clip rectangle. The origin is top-left corner of + * the plugin. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*SetClipRect)(PP_Resource layer, const struct PP_Rect* rect); + /** + * Sets a transform matrix which is used to composite the layer. + * + * param[in] layer A <code>PP_Resource</code> corresponding to a compositor + * layer resource. + * param[in] matrix A float array with 16 elements. The matrix is + * column major. The default transform matrix is an identity matrix. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*SetTransform)(PP_Resource layer, const float matrix[16]); + /** + * Sets the opacity value which will be applied to the layer. The effective + * value of each pixel is computed as: + * + * if (premult_alpha) + * pixel.rgb = pixel.rgb * opacity; + * pixel.a = pixel.a * opactiy; + * + * param[in] layer A <code>PP_Resource</code> corresponding to a compositor + * layer resource. + * param[in] opacity A <code>float</code> for the opacity value, The default + * value is 1.0f. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*SetOpacity)(PP_Resource layer, float opacity); + /** + * Sets the blend mode which is used to composite the layer. + * + * param[in] layer A <code>PP_Resource</code> corresponding to a compositor + * layer resource. + * param[in] mode A <code>PP_BlendMode</code>. The default mode is + * <code>PP_BLENDMODE_SRC_OVER</code>. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*SetBlendMode)(PP_Resource layer, PP_BlendMode mode); + /** + * Sets a source rectangle for a texture layer or an image layer. + * + * param[in] layer A <code>PP_Resource</code> corresponding to a compositor + * layer resource. + * param[in] rect A <code>PP_FloatRect</code> for an area of the source to + * consider. For a texture layer, rect is in uv coordinates. For an image + * layer, rect is in pixels. If the rect is beyond the dimensions of the + * texture or image, <code>PP_ERROR_BADARGUMENT</code> will be returned. + * If the layer size does not match the source rect size, bilinear scaling + * will be used. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*SetSourceRect)(PP_Resource layer, const struct PP_FloatRect* rect); + /** + * Sets the premultiplied alpha for an texture layer. + * + * param[in] layer A <code>PP_Resource</code> corresponding to a compositor + * layer resource. + * param[in] premult A <code>PP_Bool</code> with <code>PP_TRUE</code> if + * pre-multiplied alpha is used. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*SetPremultipliedAlpha)(PP_Resource layer, PP_Bool premult); +}; + +struct PPB_CompositorLayer_0_1 { /* dev */ + PP_Bool (*IsCompositorLayer)(PP_Resource resource); + int32_t (*SetColor)(PP_Resource layer, + float red, + float green, + float blue, + float alpha, + const struct PP_Size* size); + int32_t (*SetTexture)(PP_Resource layer, + PP_Resource context, + uint32_t texture, + const struct PP_Size* size, + struct PP_CompletionCallback cc); + int32_t (*SetImage)(PP_Resource layer, + PP_Resource image_data, + const struct PP_Size* size, + struct PP_CompletionCallback cc); + int32_t (*SetClipRect)(PP_Resource layer, const struct PP_Rect* rect); + int32_t (*SetTransform)(PP_Resource layer, const float matrix[16]); + int32_t (*SetOpacity)(PP_Resource layer, float opacity); + int32_t (*SetBlendMode)(PP_Resource layer, PP_BlendMode mode); + int32_t (*SetSourceRect)(PP_Resource layer, const struct PP_FloatRect* rect); + int32_t (*SetPremultipliedAlpha)(PP_Resource layer, PP_Bool premult); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_COMPOSITOR_LAYER_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_console.h
Added
@@ -0,0 +1,75 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_console.idl modified Fri Nov 16 15:28:43 2012. */ + +#ifndef PPAPI_C_PPB_CONSOLE_H_ +#define PPAPI_C_PPB_CONSOLE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_CONSOLE_INTERFACE_1_0 "PPB_Console;1.0" +#define PPB_CONSOLE_INTERFACE PPB_CONSOLE_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_Console</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + PP_LOGLEVEL_TIP = 0, + PP_LOGLEVEL_LOG = 1, + PP_LOGLEVEL_WARNING = 2, + PP_LOGLEVEL_ERROR = 3 +} PP_LogLevel; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_LogLevel, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Console_1_0 { + /** + * Logs the given message to the JavaScript console associated with the + * given plugin instance with the given logging level. The name of the plugin + * issuing the log message will be automatically prepended to the message. + * The value may be any type of Var. + */ + void (*Log)(PP_Instance instance, PP_LogLevel level, struct PP_Var value); + /** + * Logs a message to the console with the given source information rather + * than using the internal PPAPI plugin name. The name must be a string var. + * + * The regular log function will automatically prepend the name of your + * plugin to the message as the "source" of the message. Some plugins may + * wish to override this. For example, if your plugin is a Python + * interpreter, you would want log messages to contain the source .py file + * doing the log statement rather than have "python" show up in the console. + */ + void (*LogWithSource)(PP_Instance instance, + PP_LogLevel level, + struct PP_Var source, + struct PP_Var value); +}; + +typedef struct PPB_Console_1_0 PPB_Console; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_CONSOLE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_core.h
Added
@@ -0,0 +1,119 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_core.idl modified Mon Mar 19 12:02:10 2012. */ + +#ifndef PPAPI_C_PPB_CORE_H_ +#define PPAPI_C_PPB_CORE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" + +#define PPB_CORE_INTERFACE_1_0 "PPB_Core;1.0" +#define PPB_CORE_INTERFACE PPB_CORE_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_Core</code> interface defined by the browser + * and containing pointers to functions related to memory management, time, and + * threads. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_Core</code> interface contains pointers to functions related + * to memory management, time, and threads on the browser. + * + */ +struct PPB_Core_1_0 { + /** + * + * AddRefResource() adds a reference to a resource. + * + * @param[in] config A <code>PP_Resource</code> corresponding to a + * resource. + */ + void (*AddRefResource)(PP_Resource resource); + /** + * ReleaseResource() removes a reference from a resource. + * + * @param[in] config A <code>PP_Resource</code> corresponding to a + * resource. + */ + void (*ReleaseResource)(PP_Resource resource); + /** + * GetTime() returns the "wall clock time" according to the + * browser. + * + * @return A <code>PP_Time</code> containing the "wall clock time" according + * to the browser. + */ + PP_Time (*GetTime)(void); + /** + * GetTimeTicks() returns the "tick time" according to the browser. + * This clock is used by the browser when passing some event times to the + * module (e.g. using the <code>PP_InputEvent::time_stamp_seconds</code> + * field). It is not correlated to any actual wall clock time + * (like GetTime()). Because of this, it will not run change if the user + * changes their computer clock. + * + * @return A <code>PP_TimeTicks</code> containing the "tick time" according + * to the browser. + */ + PP_TimeTicks (*GetTimeTicks)(void); + /** + * CallOnMainThread() schedules work to be executed on the main module thread + * after the specified delay. The delay may be 0 to specify a call back as + * soon as possible. + * + * The <code>result</code> parameter will just be passed as the second + * argument to the callback. Many applications won't need this, but it allows + * a module to emulate calls of some callbacks which do use this value. + * + * <strong>Note:</strong> CallOnMainThread, even when used from the main + * thread with a delay of 0 milliseconds, will never directly invoke the + * callback. Even in this case, the callback will be scheduled + * asynchronously. + * + * <strong>Note:</strong> If the browser is shutting down or if the module + * has no instances, then the callback function may not be called. + * + * @param[in] delay_in_milliseconds An int32_t delay in milliseconds. + * @param[in] callback A <code>PP_CompletionCallback</code> callback function + * that the browser will call after the specified delay. + * @param[in] result An int32_t that the browser will pass to the given + * <code>PP_CompletionCallback</code>. + */ + void (*CallOnMainThread)(int32_t delay_in_milliseconds, + struct PP_CompletionCallback callback, + int32_t result); + /** + * IsMainThread() returns true if the current thread is the main pepper + * thread. + * + * This function is useful for implementing sanity checks, and deciding if + * dispatching using CallOnMainThread() is required. + * + * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the + * current thread is the main pepper thread, otherwise <code>PP_FALSE</code>. + */ + PP_Bool (*IsMainThread)(void); +}; + +typedef struct PPB_Core_1_0 PPB_Core; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_CORE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_file_io.h
Added
@@ -0,0 +1,337 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_file_io.idl modified Tue Oct 22 15:09:47 2013. */ + +#ifndef PPAPI_C_PPB_FILE_IO_H_ +#define PPAPI_C_PPB_FILE_IO_H_ + +#include "ppapi/c/pp_array_output.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_file_info.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" + +#define PPB_FILEIO_INTERFACE_1_0 "PPB_FileIO;1.0" +#define PPB_FILEIO_INTERFACE_1_1 "PPB_FileIO;1.1" +#define PPB_FILEIO_INTERFACE PPB_FILEIO_INTERFACE_1_1 + +/** + * @file + * This file defines the API to create a file i/o object. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * The PP_FileOpenFlags enum contains file open constants. + */ +typedef enum { + /** Requests read access to a file. */ + PP_FILEOPENFLAG_READ = 1 << 0, + /** + * Requests write access to a file. May be combined with + * <code>PP_FILEOPENFLAG_READ</code> to request read and write access. + */ + PP_FILEOPENFLAG_WRITE = 1 << 1, + /** + * Requests that the file be created if it does not exist. If the file + * already exists, then this flag is ignored unless + * <code>PP_FILEOPENFLAG_EXCLUSIVE</code> was also specified, in which case + * FileIO::Open() will fail. + */ + PP_FILEOPENFLAG_CREATE = 1 << 2, + /** + * Requests that the file be truncated to length 0 if it exists and is a + * regular file. <code>PP_FILEOPENFLAG_WRITE</code> must also be specified. + */ + PP_FILEOPENFLAG_TRUNCATE = 1 << 3, + /** + * Requests that the file is created when this flag is combined with + * <code>PP_FILEOPENFLAG_CREATE</code>. If this flag is specified, and the + * file already exists, then the FileIO::Open() call will fail. + */ + PP_FILEOPENFLAG_EXCLUSIVE = 1 << 4, + /** + * Requests write access to a file, but writes will always occur at the end of + * the file. Mututally exclusive with <code>PP_FILEOPENFLAG_WRITE</code>. + * + * This is only supported in version 1.2 (Chrome 29) and later. + */ + PP_FILEOPENFLAG_APPEND = 1 << 5 +} PP_FileOpenFlags; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileOpenFlags, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_FileIO</code> struct is used to operate on a regular file + * (PP_FileType_Regular). + */ +struct PPB_FileIO_1_1 { + /** + * Create() creates a new FileIO object. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * with the file. + * + * @return A <code>PP_Resource</code> corresponding to a FileIO if + * successful or 0 if the module is invalid. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsFileIO() determines if the provided resource is a FileIO. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a FileIO. + * + * @return <code>PP_TRUE</code> if the resource is a + * <code>PPB_FileIO</code>, <code>PP_FALSE</code> if the resource is + * invalid or some type other than <code>PPB_FileIO</code>. + */ + PP_Bool (*IsFileIO)(PP_Resource resource); + /** + * Open() opens the specified regular file for I/O according to the given + * open flags, which is a bit-mask of the <code>PP_FileOpenFlags</code> + * values. Upon success, the corresponding file is classified as "in use" + * by this FileIO object until such time as the FileIO object is closed + * or destroyed. + * + * @param[in] file_io A <code>PP_Resource</code> corresponding to a + * FileIO. + * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file + * reference. + * @param[in] open_flags A bit-mask of the <code>PP_FileOpenFlags</code> + * values. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*Open)(PP_Resource file_io, + PP_Resource file_ref, + int32_t open_flags, + struct PP_CompletionCallback callback); + /** + * Query() queries info about the file opened by this FileIO object. The + * FileIO object must be opened, and there must be no other operations + * pending. + * + * @param[in] file_io A <code>PP_Resource</code> corresponding to a + * FileIO. + * @param[out] info The <code>PP_FileInfo</code> structure representing all + * information about the file. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Query(). <code>info</code> must remain valid until after the + * callback runs. If you pass a blocking callback, <code>info</code> must + * remain valid until after Query() returns. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * PP_ERROR_FAILED will be returned if the file isn't opened, and + * PP_ERROR_INPROGRESS will be returned if there is another operation pending. + */ + int32_t (*Query)(PP_Resource file_io, + struct PP_FileInfo* info, + struct PP_CompletionCallback callback); + /** + * Touch() Updates time stamps for the file opened by this FileIO object. + * This function will fail if the FileIO object has not been opened. The + * FileIO object must be opened, and there must be no other operations + * pending. + * + * @param[in] file_io A <code>PP_Resource</code> corresponding to a file + * FileIO. + * @param[in] last_access_time The last time the FileIO was accessed. + * @param[in] last_modified_time The last time the FileIO was modified. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Touch(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * PP_ERROR_FAILED will be returned if the file isn't opened, and + * PP_ERROR_INPROGRESS will be returned if there is another operation pending. + */ + int32_t (*Touch)(PP_Resource file_io, + PP_Time last_access_time, + PP_Time last_modified_time, + struct PP_CompletionCallback callback); + /** + * Read() reads from an offset in the file. The size of the buffer must be + * large enough to hold the specified number of bytes to read. This function + * might perform a partial read, meaning all the requested bytes + * might not be returned, even if the end of the file has not been reached. + * The FileIO object must have been opened with read access. + * + * ReadToArray() is preferred to Read() when doing asynchronous operations. + * + * @param[in] file_io A <code>PP_Resource</code> corresponding to a file + * FileIO. + * @param[in] offset The offset into the file. + * @param[in] buffer The buffer to hold the specified number of bytes read. + * @param[in] bytes_to_read The number of bytes to read from + * <code>offset</code>. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Read(). <code>buffer</code> must remain valid until after + * the callback runs. If you pass a blocking callback, <code>buffer</code> + * must remain valid until after Read() returns. + * + * @return The number of bytes read or an error code from + * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was + * reached. It is valid to call Read() multiple times with a completion + * callback to queue up parallel reads from the file, but pending reads + * cannot be interleaved with other operations. + */ + int32_t (*Read)(PP_Resource file_io, + int64_t offset, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + /** + * Write() writes to an offset in the file. This function might perform a + * partial write. The FileIO object must have been opened with write access. + * + * @param[in] file_io A <code>PP_Resource</code> corresponding to a file + * FileIO. + * @param[in] offset The offset into the file. + * @param[in] buffer The buffer to hold the specified number of bytes read. + * @param[in] bytes_to_write The number of bytes to write to + * <code>offset</code>. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Write(). + * + * @return The number of bytes written or an error code from + * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was + * reached. It is valid to call Write() multiple times with a completion + * callback to queue up parallel writes to the file, but pending writes + * cannot be interleaved with other operations. + */ + int32_t (*Write)(PP_Resource file_io, + int64_t offset, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + /** + * SetLength() sets the length of the file. If the file size is extended, + * then the extended area of the file is zero-filled. The FileIO object must + * have been opened with write access and there must be no other operations + * pending. + * + * @param[in] file_io A <code>PP_Resource</code> corresponding to a file + * FileIO. + * @param[in] length The length of the file to be set. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of SetLength(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * PP_ERROR_FAILED will be returned if the file isn't opened, and + * PP_ERROR_INPROGRESS will be returned if there is another operation pending. + */ + int32_t (*SetLength)(PP_Resource file_io, + int64_t length, + struct PP_CompletionCallback callback); + /** + * Flush() flushes changes to disk. This call can be very expensive! The + * FileIO object must have been opened with write access and there must be no + * other operations pending. + * + * @param[in] file_io A <code>PP_Resource</code> corresponding to a file + * FileIO. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Flush(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * PP_ERROR_FAILED will be returned if the file isn't opened, and + * PP_ERROR_INPROGRESS will be returned if there is another operation pending. + */ + int32_t (*Flush)(PP_Resource file_io, struct PP_CompletionCallback callback); + /** + * Close() cancels any IO that may be pending, and closes the FileIO object. + * Any pending callbacks will still run, reporting + * <code>PP_ERROR_ABORTED</code> if pending IO was interrupted. It is not + * valid to call Open() again after a call to this method. + * <strong>Note:</strong> If the FileIO object is destroyed, and it is still + * open, then it will be implicitly closed, so you are not required to call + * Close(). + * + * @param[in] file_io A <code>PP_Resource</code> corresponding to a file + * FileIO. + */ + void (*Close)(PP_Resource file_io); + /** + * ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be + * provided so that output will be stored in its allocated buffer. This + * function might perform a partial read. The FileIO object must have been + * opened with read access. + * + * @param[in] file_io A <code>PP_Resource</code> corresponding to a file + * FileIO. + * @param[in] offset The offset into the file. + * @param[in] max_read_length The maximum number of bytes to read from + * <code>offset</code>. + * @param[in] output A <code>PP_ArrayOutput</code> to hold the output data. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of ReadToArray(). + * + * @return The number of bytes read or an error code from + * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was + * reached. It is valid to call ReadToArray() multiple times with a completion + * callback to queue up parallel reads from the file, but pending reads + * cannot be interleaved with other operations. + */ + int32_t (*ReadToArray)(PP_Resource file_io, + int64_t offset, + int32_t max_read_length, + struct PP_ArrayOutput* output, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_FileIO_1_1 PPB_FileIO; + +struct PPB_FileIO_1_0 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsFileIO)(PP_Resource resource); + int32_t (*Open)(PP_Resource file_io, + PP_Resource file_ref, + int32_t open_flags, + struct PP_CompletionCallback callback); + int32_t (*Query)(PP_Resource file_io, + struct PP_FileInfo* info, + struct PP_CompletionCallback callback); + int32_t (*Touch)(PP_Resource file_io, + PP_Time last_access_time, + PP_Time last_modified_time, + struct PP_CompletionCallback callback); + int32_t (*Read)(PP_Resource file_io, + int64_t offset, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + int32_t (*Write)(PP_Resource file_io, + int64_t offset, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + int32_t (*SetLength)(PP_Resource file_io, + int64_t length, + struct PP_CompletionCallback callback); + int32_t (*Flush)(PP_Resource file_io, struct PP_CompletionCallback callback); + void (*Close)(PP_Resource file_io); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_FILE_IO_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_file_ref.h
Added
@@ -0,0 +1,290 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_file_ref.idl modified Wed Jan 29 20:50:29 2014. */ + +#ifndef PPAPI_C_PPB_FILE_REF_H_ +#define PPAPI_C_PPB_FILE_REF_H_ + +#include "ppapi/c/pp_array_output.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_file_info.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" +#include "ppapi/c/pp_var.h" + +#define PPB_FILEREF_INTERFACE_1_0 "PPB_FileRef;1.0" +#define PPB_FILEREF_INTERFACE_1_1 "PPB_FileRef;1.1" +#define PPB_FILEREF_INTERFACE_1_2 "PPB_FileRef;1.2" +#define PPB_FILEREF_INTERFACE PPB_FILEREF_INTERFACE_1_2 + +/** + * @file + * This file defines the API to create a file reference or "weak pointer" to a + * file in a file system. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * The <code>PP_MakeDirectoryFlags</code> enum contains flags used to control + * behavior of <code>PPB_FileRef.MakeDirectory()</code>. + */ +typedef enum { + PP_MAKEDIRECTORYFLAG_NONE = 0 << 0, + /** Requests that ancestor directories are created if they do not exist. */ + PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS = 1 << 0, + /** + * Requests that the PPB_FileRef.MakeDirectory() call fails if the directory + * already exists. + */ + PP_MAKEDIRECTORYFLAG_EXCLUSIVE = 1 << 1 +} PP_MakeDirectoryFlags; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_FileRef</code> struct represents a "weak pointer" to a file in + * a file system. This struct contains a <code>PP_FileSystemType</code> + * identifier and a file path string. + */ +struct PPB_FileRef_1_2 { + /** + * Create() creates a weak pointer to a file in the given file system. File + * paths are POSIX style. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a file + * system. + * @param[in] path A path to the file. Must begin with a '/' character. + * + * @return A <code>PP_Resource</code> corresponding to a file reference if + * successful or 0 if the path is malformed. + */ + PP_Resource (*Create)(PP_Resource file_system, const char* path); + /** + * IsFileRef() determines if the provided resource is a file reference. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a file + * reference. + * + * @return <code>PP_TRUE</code> if the resource is a + * <code>PPB_FileRef</code>, <code>PP_FALSE</code> if the resource is + * invalid or some type other than <code>PPB_FileRef</code>. + */ + PP_Bool (*IsFileRef)(PP_Resource resource); + /** + * GetFileSystemType() returns the type of the file system. + * + * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file + * reference. + * + * @return A <code>PP_FileSystemType</code> with the file system type if + * valid or <code>PP_FILESYSTEMTYPE_INVALID</code> if the provided resource + * is not a valid file reference. + */ + PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); + /** + * GetName() returns the name of the file. + * + * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file + * reference. + * + * @return A <code>PP_Var</code> containing the name of the file. The value + * returned by this function does not include any path components (such as + * the name of the parent directory, for example). It is just the name of the + * file. Use GetPath() to get the full file path. + */ + struct PP_Var (*GetName)(PP_Resource file_ref); + /** + * GetPath() returns the absolute path of the file. + * + * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file + * reference. + * + * @return A <code>PP_Var</code> containing the absolute path of the file. + * This function fails if the file system type is + * <code>PP_FileSystemType_External</code>. + */ + struct PP_Var (*GetPath)(PP_Resource file_ref); + /** + * GetParent() returns the parent directory of this file. If + * <code>file_ref</code> points to the root of the filesystem, then the root + * is returned. + * + * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file + * reference. + * + * @return A <code>PP_Resource</code> containing the parent directory of the + * file. This function fails if the file system type is + * <code>PP_FileSystemType_External</code>. + */ + PP_Resource (*GetParent)(PP_Resource file_ref); + /** + * MakeDirectory() makes a new directory in the file system according to the + * given <code>make_directory_flags</code>, which is a bit-mask of the + * <code>PP_MakeDirectoryFlags</code> values. It is not valid to make a + * directory in the external file system. + * + * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file + * reference. + * @param[in] make_directory_flags A bit-mask of the + * <code>PP_MakeDirectoryFlags</code> values. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of MakeDirectory(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*MakeDirectory)(PP_Resource directory_ref, + int32_t make_directory_flags, + struct PP_CompletionCallback callback); + /** + * Touch() Updates time stamps for a file. You must have write access to the + * file if it exists in the external filesystem. + * + * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file + * reference. + * @param[in] last_access_time The last time the file was accessed. + * @param[in] last_modified_time The last time the file was modified. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Touch(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*Touch)(PP_Resource file_ref, + PP_Time last_access_time, + PP_Time last_modified_time, + struct PP_CompletionCallback callback); + /** + * Delete() deletes a file or directory. If <code>file_ref</code> refers to + * a directory, then the directory must be empty. It is an error to delete a + * file or directory that is in use. It is not valid to delete a file in + * the external file system. + * + * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file + * reference. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Delete(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*Delete)(PP_Resource file_ref, + struct PP_CompletionCallback callback); + /** + * Rename() renames a file or directory. Arguments <code>file_ref</code> and + * <code>new_file_ref</code> must both refer to files in the same file + * system. It is an error to rename a file or directory that is in use. It + * is not valid to rename a file in the external file system. + * + * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file + * reference. + * @param[in] new_file_ref A <code>PP_Resource</code> corresponding to a new + * file reference. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Rename(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*Rename)(PP_Resource file_ref, + PP_Resource new_file_ref, + struct PP_CompletionCallback callback); + /** + * Query() queries info about a file or directory. You must have access to + * read this file or directory if it exists in the external filesystem. + * + * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file + * reference. + * @param[out] info A pointer to a <code>PP_FileInfo</code> which will be + * populated with information about the file or directory. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Query(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*Query)(PP_Resource file_ref, + struct PP_FileInfo* info, + struct PP_CompletionCallback callback); + /** + * ReadDirectoryEntries() reads all entries in a directory. + * + * @param[in] file_ref A <code>PP_Resource</code> corresponding to a directory + * reference. + * @param[in] output An output array which will receive + * <code>PP_DirectoryEntry</code> objects on success. + * @param[in] callback A <code>PP_CompletionCallback</code> to run on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*ReadDirectoryEntries)(PP_Resource file_ref, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_FileRef_1_2 PPB_FileRef; + +struct PPB_FileRef_1_0 { + PP_Resource (*Create)(PP_Resource file_system, const char* path); + PP_Bool (*IsFileRef)(PP_Resource resource); + PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); + struct PP_Var (*GetName)(PP_Resource file_ref); + struct PP_Var (*GetPath)(PP_Resource file_ref); + PP_Resource (*GetParent)(PP_Resource file_ref); + int32_t (*MakeDirectory)(PP_Resource directory_ref, + PP_Bool make_ancestors, + struct PP_CompletionCallback callback); + int32_t (*Touch)(PP_Resource file_ref, + PP_Time last_access_time, + PP_Time last_modified_time, + struct PP_CompletionCallback callback); + int32_t (*Delete)(PP_Resource file_ref, + struct PP_CompletionCallback callback); + int32_t (*Rename)(PP_Resource file_ref, + PP_Resource new_file_ref, + struct PP_CompletionCallback callback); +}; + +struct PPB_FileRef_1_1 { + PP_Resource (*Create)(PP_Resource file_system, const char* path); + PP_Bool (*IsFileRef)(PP_Resource resource); + PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); + struct PP_Var (*GetName)(PP_Resource file_ref); + struct PP_Var (*GetPath)(PP_Resource file_ref); + PP_Resource (*GetParent)(PP_Resource file_ref); + int32_t (*MakeDirectory)(PP_Resource directory_ref, + PP_Bool make_ancestors, + struct PP_CompletionCallback callback); + int32_t (*Touch)(PP_Resource file_ref, + PP_Time last_access_time, + PP_Time last_modified_time, + struct PP_CompletionCallback callback); + int32_t (*Delete)(PP_Resource file_ref, + struct PP_CompletionCallback callback); + int32_t (*Rename)(PP_Resource file_ref, + PP_Resource new_file_ref, + struct PP_CompletionCallback callback); + int32_t (*Query)(PP_Resource file_ref, + struct PP_FileInfo* info, + struct PP_CompletionCallback callback); + int32_t (*ReadDirectoryEntries)(PP_Resource file_ref, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_FILE_REF_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_file_system.h
Added
@@ -0,0 +1,101 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_file_system.idl modified Thu Jun 13 14:30:40 2013. */ + +#ifndef PPAPI_C_PPB_FILE_SYSTEM_H_ +#define PPAPI_C_PPB_FILE_SYSTEM_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_file_info.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_FILESYSTEM_INTERFACE_1_0 "PPB_FileSystem;1.0" +#define PPB_FILESYSTEM_INTERFACE PPB_FILESYSTEM_INTERFACE_1_0 + +/** + * @file + * This file defines the API to create a file system associated with a file. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_FileSystem</code> struct identifies the file system type + * associated with a file. + */ +struct PPB_FileSystem_1_0 { + /** Create() creates a file system object of the given type. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * with the file. + * @param[in] type A file system type as defined by + * <code>PP_FileSystemType</code> enum (except PP_FILESYSTEMTYPE_ISOLATED, + * which is currently not supported). + * @return A <code>PP_Resource</code> corresponding to a file system if + * successful. + */ + PP_Resource (*Create)(PP_Instance instance, PP_FileSystemType type); + /** + * IsFileSystem() determines if the provided resource is a file system. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a file + * system. + * + * @return <code>PP_TRUE</code> if the resource is a + * <code>PPB_FileSystem</code>, <code>PP_FALSE</code> if the resource is + * invalid or some type other than <code>PPB_FileSystem</code>. + */ + PP_Bool (*IsFileSystem)(PP_Resource resource); + /** + * Open() opens the file system. A file system must be opened before running + * any other operation on it. + * + * @param[in] file_system A <code>PP_Resource</code> corresponding to a file + * system. + * + * @param[in] expected_size The expected size of the file system. Note that + * this does not request quota; to do that, you must either invoke + * requestQuota from JavaScript: + * http://www.html5rocks.com/en/tutorials/file/filesystem/#toc-requesting-quota + * or set the unlimitedStorage permission for Chrome Web Store apps: + * http://code.google.com/chrome/extensions/manifest.html#permissions + * + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*Open)(PP_Resource file_system, + int64_t expected_size, + struct PP_CompletionCallback callback); + /** + * GetType() returns the type of the provided file system. + * + * @param[in] file_system A <code>PP_Resource</code> corresponding to a file + * system. + * + * @return A <code>PP_FileSystemType</code> with the file system type if + * valid or <code>PP_FILESYSTEMTYPE_INVALID</code> if the provided resource + * is not a valid file system. It is valid to call this function even before + * Open() completes. + */ + PP_FileSystemType (*GetType)(PP_Resource file_system); +}; + +typedef struct PPB_FileSystem_1_0 PPB_FileSystem; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_FILE_SYSTEM_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_fullscreen.h
Added
@@ -0,0 +1,91 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_fullscreen.idl modified Wed Dec 21 19:08:34 2011. */ + +#ifndef PPAPI_C_PPB_FULLSCREEN_H_ +#define PPAPI_C_PPB_FULLSCREEN_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_FULLSCREEN_INTERFACE_1_0 "PPB_Fullscreen;1.0" +#define PPB_FULLSCREEN_INTERFACE PPB_FULLSCREEN_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_Fullscreen</code> interface for + * handling transitions of a module instance to and from fullscreen mode. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_Fullscreen</code> interface is implemented by the browser. + * This interface provides a way of checking the current screen mode and + * toggling fullscreen mode. + */ +struct PPB_Fullscreen_1_0 { + /** + * IsFullscreen() checks whether the module instance is currently in + * fullscreen mode. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * + * @return <code>PP_TRUE</code> if the module instance is in fullscreen mode, + * <code>PP_FALSE</code> if the module instance is not in fullscreen mode. + */ + PP_Bool (*IsFullscreen)(PP_Instance instance); + /** + * SetFullscreen() switches the module instance to and from fullscreen + * mode. + * + * The transition to and from fullscreen mode is asynchronous. During the + * transition, IsFullscreen() will return the previous value and + * no 2D or 3D device can be bound. The transition ends at DidChangeView() + * when IsFullscreen() returns the new value. You might receive other + * DidChangeView() calls while in transition. + * + * The transition to fullscreen mode can only occur while the browser is + * processing a user gesture, even if <code>PP_TRUE</code> is returned. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] fullscreen <code>PP_TRUE</code> to enter fullscreen mode, or + * <code>PP_FALSE</code> to exit fullscreen mode. + * + * @return <code>PP_TRUE</code> on success or <code>PP_FALSE</code> on + * failure. + */ + PP_Bool (*SetFullscreen)(PP_Instance instance, PP_Bool fullscreen); + /** + * GetScreenSize() gets the size of the screen in pixels. The module instance + * will be resized to this size when SetFullscreen() is called to enter + * fullscreen mode. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[out] size The size of the entire screen in pixels. + * + * @return <code>PP_TRUE</code> on success or <code>PP_FALSE</code> on + * failure. + */ + PP_Bool (*GetScreenSize)(PP_Instance instance, struct PP_Size* size); +}; + +typedef struct PPB_Fullscreen_1_0 PPB_Fullscreen; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_FULLSCREEN_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_gamepad.h
Added
@@ -0,0 +1,112 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_gamepad.idl modified Tue Apr 16 09:04:34 2013. */ + +#ifndef PPAPI_C_PPB_GAMEPAD_H_ +#define PPAPI_C_PPB_GAMEPAD_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_GAMEPAD_INTERFACE_1_0 "PPB_Gamepad;1.0" +#define PPB_GAMEPAD_INTERFACE PPB_GAMEPAD_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_Gamepad</code> interface, which + * provides access to gamepad devices. + */ + + +/** + * @addtogroup Structs + * @{ + */ +/** + * The data for one gamepad device. + */ +struct PP_GamepadSampleData { + /** + * Number of valid elements in the |axes| array. + */ + uint32_t axes_length; + /** + * Normalized values for the axes, indices valid up to |axes_length|-1. Axis + * values range from -1..1, and are in order of "importance". + */ + float axes[16]; + /** + * Number of valid elements in the |buttons| array. + */ + uint32_t buttons_length; + /** + * Normalized values for the buttons, indices valid up to |buttons_length| + * - 1. Button values range from 0..1, and are in order of importance. + */ + float buttons[32]; + /** + * Monotonically increasing value that is incremented when the data have + * been updated. + */ + double timestamp; + /** + * Identifier for the type of device/manufacturer. + */ + uint16_t id[128]; + /** + * Is there a gamepad connected at this index? If this is false, no other + * data in this structure is valid. + */ + PP_Bool connected; + /* Padding to make the struct the same size between 64 and 32. */ + int8_t unused_pad_[4]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_GamepadSampleData, 472); + +/** + * The data for all gamepads connected to the system. + */ +struct PP_GamepadsSampleData { + /** + * Number of valid elements in the |items| array. + */ + uint32_t length; + /* Padding to make the struct the same size between 64 and 32. */ + int8_t unused_pad_[4]; + /** + * Data for an individual gamepad device connected to the system. + */ + struct PP_GamepadSampleData items[4]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_GamepadsSampleData, 1896); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_Gamepad</code> interface allows retrieving data from + * gamepad/joystick devices that are connected to the system. + */ +struct PPB_Gamepad_1_0 { + /** + * Samples the current state of the available gamepads. + */ + void (*Sample)(PP_Instance instance, struct PP_GamepadsSampleData* data); +}; + +typedef struct PPB_Gamepad_1_0 PPB_Gamepad; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_GAMEPAD_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_graphics_2d.h
Added
@@ -0,0 +1,349 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_graphics_2d.idl modified Wed Apr 20 13:37:06 2016. */ + +#ifndef PPAPI_C_PPB_GRAPHICS_2D_H_ +#define PPAPI_C_PPB_GRAPHICS_2D_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_GRAPHICS_2D_INTERFACE_1_0 "PPB_Graphics2D;1.0" +#define PPB_GRAPHICS_2D_INTERFACE_1_1 "PPB_Graphics2D;1.1" +#define PPB_GRAPHICS_2D_INTERFACE_1_2 "PPB_Graphics2D;1.2" +#define PPB_GRAPHICS_2D_INTERFACE PPB_GRAPHICS_2D_INTERFACE_1_2 + +/** + * @file + * Defines the <code>PPB_Graphics2D</code> struct representing a 2D graphics + * context within the browser. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * <code>PPB_Graphics2D</code> defines the interface for a 2D graphics context. + */ +struct PPB_Graphics2D_1_2 { + /** + * Create() creates a 2D graphics context. The returned graphics context will + * not be bound to the module instance on creation (call BindGraphics() on + * the module instance to bind the returned graphics context to the module + * instance). + * + * @param[in] instance The module instance. + * @param[in] size The size of the graphic context. + * @param[in] is_always_opaque Set the <code>is_always_opaque</code> flag to + * <code>PP_TRUE</code> if you know that you will be painting only opaque + * data to this context. This option will disable blending when compositing + * the module with the web page, which might give higher performance on some + * computers. + * + * If you set <code>is_always_opaque</code>, your alpha channel should always + * be set to 0xFF or there may be painting artifacts. The alpha values + * overwrite the destination alpha values without blending when + * <code>is_always_opaque</code> is true. + * + * @return A <code>PP_Resource</code> containing the 2D graphics context if + * successful or 0 if unsuccessful. + */ + PP_Resource (*Create)(PP_Instance instance, + const struct PP_Size* size, + PP_Bool is_always_opaque); + /** + * IsGraphics2D() determines if the given resource is a valid + * <code>Graphics2D</code>. + * + * @param[in] resource A <code>Graphics2D</code> context resource. + * + * @return PP_TRUE if the given resource is a valid <code>Graphics2D</code>, + * <code>PP_FALSE</code> if it is an invalid resource or is a resource of + * another type. + */ + PP_Bool (*IsGraphics2D)(PP_Resource resource); + /** + * Describe() retrieves the configuration for the given graphics context, + * filling the given values (which must not be <code>NULL</code>). + * + * @param[in] resource The 2D Graphics resource. + * @param[in,out] size The size of the 2D graphics context in the browser. + * @param[in,out] is_always_opaque Identifies whether only opaque data + * will be painted. + * + * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if + * the resource is invalid. The output parameters will be set to 0 on a + * <code>PP_FALSE</code>. + */ + PP_Bool (*Describe)(PP_Resource graphics_2d, + struct PP_Size* size, + PP_Bool* is_always_opaque); + /** + * PaintImageData() enqueues a paint of the given image into the context. + * This function has no effect until you call Flush() As a result, what + * counts is the contents of the bitmap when you call Flush(), not when + * you call this function. + * + * The provided image will be placed at <code>top_left</code> from the top + * left of the context's internal backing store. Then the pixels contained + * in <code>src_rect</code> will be copied into the backing store. This + * means that the rectangle being painted will be at <code>src_rect</code> + * offset by <code>top_left</code>. + * + * The <code>src_rect</code> is specified in the coordinate system of the + * image being painted, not the context. For the common case of copying the + * entire image, you may specify an empty <code>src_rect</code>. + * + * The painted area of the source bitmap must fall entirely within the + * context. Attempting to paint outside of the context will result in an + * error. However, the source bitmap may fall outside the context, as long + * as the <code>src_rect</code> subset of it falls entirely within the + * context. + * + * There are two methods most modules will use for painting. The first + * method is to generate a new <code>ImageData</code> and then paint it. In + * this case, you'll set the location of your painting to + * <code>top_left</code> and set <code>src_rect</code> to <code>NULL</code>. + * The second is that you're generating small invalid regions out of a larger + * bitmap representing your entire instance. In this case, you would set the + * location of your image to (0,0) and then set <code>src_rect</code> to the + * pixels you changed. + * + * @param[in] resource The 2D Graphics resource. + * @param[in] image The <code>ImageData</code> to be painted. + * @param[in] top_left A <code>Point</code> representing the + * <code>top_left</code> location where the <code>ImageData</code> will be + * painted. + * @param[in] src_rect The rectangular area where the <code>ImageData</code> + * will be painted. + */ + void (*PaintImageData)(PP_Resource graphics_2d, + PP_Resource image_data, + const struct PP_Point* top_left, + const struct PP_Rect* src_rect); + /** + * Scroll() enqueues a scroll of the context's backing store. This + * function has no effect until you call Flush(). The data within the + * provided clipping rectangle will be shifted by (dx, dy) pixels. + * + * This function will result in some exposed region which will have undefined + * contents. The module should call PaintImageData() on these exposed regions + * to give the correct contents. + * + * The scroll can be larger than the area of the clipping rectangle, which + * means the current image will be scrolled out of the rectangle. This + * scenario is not an error but will result in a no-op. + * + * @param[in] graphics_2d The 2D Graphics resource. + * @param[in] clip The clipping rectangle. + * @param[in] amount The amount the area in the clipping rectangle will + * shifted. + */ + void (*Scroll)(PP_Resource graphics_2d, + const struct PP_Rect* clip_rect, + const struct PP_Point* amount); + /** + * ReplaceContents() provides a slightly more efficient way to paint the + * entire module's image. Normally, calling PaintImageData() requires that + * the browser copy the pixels out of the image and into the graphics + * context's backing store. This function replaces the graphics context's + * backing store with the given image, avoiding the copy. + * + * The new image must be the exact same size as this graphics context. If the + * new image uses a different image format than the browser's native bitmap + * format (use <code>PPB_ImageData.GetNativeImageDataFormat()</code> to + * retrieve the format), then a conversion will be done inside the browser + * which may slow the performance a little bit. + * + * <strong>Note:</strong> The new image will not be painted until you call + * Flush(). + * + * After this call, you should take care to release your references to the + * image. If you paint to the image after ReplaceContents(), there is the + * possibility of significant painting artifacts because the page might use + * partially-rendered data when copying out of the backing store. + * + * In the case of an animation, you will want to allocate a new image for the + * next frame. It is best if you wait until the flush callback has executed + * before allocating this bitmap. This gives the browser the option of + * caching the previous backing store and handing it back to you (assuming + * the sizes match). In the optimal case, this means no bitmaps are allocated + * during the animation, and the backing store and "front buffer" (which the + * plugin is painting into) are just being swapped back and forth. + * + * @param[in] graphics_2d The 2D Graphics resource. + * @param[in] image The <code>ImageData</code> to be painted. + */ + void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); + /** + * Flush() flushes any enqueued paint, scroll, and replace commands to the + * backing store. This function actually executes the updates, and causes a + * repaint of the webpage, assuming this graphics context is bound to a module + * instance. + * + * Flush() runs in asynchronous mode. Specify a callback function and the + * argument for that callback function. The callback function will be + * executed on the calling thread when the image has been painted to the + * screen. While you are waiting for a flush callback, additional calls to + * Flush() will fail. + * + * Because the callback is executed (or thread unblocked) only when the + * instance's image is actually on the screen, this function provides + * a way to rate limit animations. By waiting until the image is on the + * screen before painting the next frame, you can ensure you're not + * flushing 2D graphics faster than the screen can be updated. + * + * <strong>Unbound contexts</strong> + * If the context is not bound to a module instance, you will + * still get a callback. The callback will execute after Flush() returns + * to avoid reentrancy. The callback will not wait until anything is + * painted to the screen because there will be nothing on the screen. The + * timing of this callback is not guaranteed and may be deprioritized by + * the browser because it is not affecting the user experience. + * + * <strong>Off-screen instances</strong> + * If the context is bound to an instance that is currently not visible (for + * example, scrolled out of view) it will behave like the "unbound context" + * case. + * + * <strong>Detaching a context</strong> + * If you detach a context from a module instance, any pending flush + * callbacks will be converted into the "unbound context" case. + * + * <strong>Released contexts</strong> + * A callback may or may not get called even if you have released all + * of your references to the context. This scenario can occur if there are + * internal references to the context suggesting it has not been internally + * destroyed (for example, if it is still bound to an instance) or due to + * other implementation details. As a result, you should be careful to + * check that flush callbacks are for the context you expect and that + * you're capable of handling callbacks for unreferenced contexts. + * + * <strong>Shutdown</strong> + * If a module instance is removed when a flush is pending, the + * callback will not be executed. + * + * @param[in] graphics_2d The 2D Graphics resource. + * @param[in] callback A <code>CompletionCallback</code> to be called when + * the image has been painted on the screen. + * + * @return Returns <code>PP_OK</code> on success or + * <code>PP_ERROR_BADRESOURCE</code> if the graphics context is invalid, + * <code>PP_ERROR_BADARGUMENT</code> if the callback is null and flush is + * being called from the main thread of the module, or + * <code>PP_ERROR_INPROGRESS</code> if a flush is already pending that has + * not issued its callback yet. In the failure case, nothing will be updated + * and no callback will be scheduled. + */ + int32_t (*Flush)(PP_Resource graphics_2d, + struct PP_CompletionCallback callback); + /** + * SetScale() sets the scale factor that will be applied when painting the + * graphics context onto the output device. Typically, if rendering at device + * resolution is desired, the context would be created with the width and + * height scaled up by the view's GetDeviceScale and SetScale called with a + * scale of 1.0 / GetDeviceScale(). For example, if the view resource passed + * to DidChangeView has a rectangle of (w=200, h=100) and a device scale of + * 2.0, one would call Create with a size of (w=400, h=200) and then call + * SetScale with 0.5. One would then treat each pixel in the context as a + * single device pixel. + * + * @param[in] resource A <code>Graphics2D</code> context resource. + * @param[in] scale The scale to apply when painting. + * + * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> if + * the resource is invalid or the scale factor is 0 or less. + */ + PP_Bool (*SetScale)(PP_Resource resource, float scale); + /*** + * GetScale() gets the scale factor that will be applied when painting the + * graphics context onto the output device. + * + * @param[in] resource A <code>Graphics2D</code> context resource. + * + * @return Returns the scale factor for the graphics context. If the resource + * is not a valid <code>Graphics2D</code> context, this will return 0.0. + */ + float (*GetScale)(PP_Resource resource); + /** + * SetLayerTransform() sets a transformation factor that will be applied for + * the current graphics context displayed on the output device. If both + * SetScale and SetLayerTransform will be used, they are going to get combined + * for the final result. + * + * This function has no effect until you call Flush(). + * + * @param[in] scale The scale to be applied. + * @param[in] origin The origin of the scale. + * @param[in] translate The translation to be applied. + * + * @return Returns <code>PP_TRUE</code> on success or <code>PP_FALSE</code> + * if the resource is invalid or the scale factor is 0 or less. + */ + PP_Bool (*SetLayerTransform)(PP_Resource resource, + float scale, + const struct PP_Point* origin, + const struct PP_Point* translate); +}; + +typedef struct PPB_Graphics2D_1_2 PPB_Graphics2D; + +struct PPB_Graphics2D_1_0 { + PP_Resource (*Create)(PP_Instance instance, + const struct PP_Size* size, + PP_Bool is_always_opaque); + PP_Bool (*IsGraphics2D)(PP_Resource resource); + PP_Bool (*Describe)(PP_Resource graphics_2d, + struct PP_Size* size, + PP_Bool* is_always_opaque); + void (*PaintImageData)(PP_Resource graphics_2d, + PP_Resource image_data, + const struct PP_Point* top_left, + const struct PP_Rect* src_rect); + void (*Scroll)(PP_Resource graphics_2d, + const struct PP_Rect* clip_rect, + const struct PP_Point* amount); + void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); + int32_t (*Flush)(PP_Resource graphics_2d, + struct PP_CompletionCallback callback); +}; + +struct PPB_Graphics2D_1_1 { + PP_Resource (*Create)(PP_Instance instance, + const struct PP_Size* size, + PP_Bool is_always_opaque); + PP_Bool (*IsGraphics2D)(PP_Resource resource); + PP_Bool (*Describe)(PP_Resource graphics_2d, + struct PP_Size* size, + PP_Bool* is_always_opaque); + void (*PaintImageData)(PP_Resource graphics_2d, + PP_Resource image_data, + const struct PP_Point* top_left, + const struct PP_Rect* src_rect); + void (*Scroll)(PP_Resource graphics_2d, + const struct PP_Rect* clip_rect, + const struct PP_Point* amount); + void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); + int32_t (*Flush)(PP_Resource graphics_2d, + struct PP_CompletionCallback callback); + PP_Bool (*SetScale)(PP_Resource resource, float scale); + float (*GetScale)(PP_Resource resource); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_GRAPHICS_2D_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_graphics_3d.h
Added
@@ -0,0 +1,298 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_graphics_3d.idl modified Fri Aug 30 08:36:16 2013. */ + +#ifndef PPAPI_C_PPB_GRAPHICS_3D_H_ +#define PPAPI_C_PPB_GRAPHICS_3D_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_GRAPHICS_3D_INTERFACE_1_0 "PPB_Graphics3D;1.0" +#define PPB_GRAPHICS_3D_INTERFACE PPB_GRAPHICS_3D_INTERFACE_1_0 + +/** + * @file + * Defines the <code>PPB_Graphics3D</code> struct representing a 3D graphics + * context within the browser. + */ + + +/* Add 3D graphics enums */ +#include "ppapi/c/pp_graphics_3d.h" + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * <code>PPB_Graphics3D</code> defines the interface for a 3D graphics context. + * <strong>Example usage from plugin code:</strong> + * + * <strong>Setup:</strong> + * @code + * PP_Resource context; + * int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, 800, + * PP_GRAPHICS3DATTRIB_HEIGHT, 800, + * PP_GRAPHICS3DATTRIB_NONE}; + * context = g3d->Create(instance, 0, attribs); + * inst->BindGraphics(instance, context); + * @endcode + * + * <strong>Present one frame:</strong> + * @code + * PP_CompletionCallback callback = { + * DidFinishSwappingBuffers, 0, PP_COMPLETIONCALLBACK_FLAG_NONE, + * }; + * gles2->Clear(context, GL_COLOR_BUFFER_BIT); + * g3d->SwapBuffers(context, callback); + * @endcode + * + * <strong>Shutdown:</strong> + * @code + * core->ReleaseResource(context); + * @endcode + */ +struct PPB_Graphics3D_1_0 { + /** + * GetAttribMaxValue() retrieves the maximum supported value for the + * given attribute. This function may be used to check if a particular + * attribute value is supported before attempting to create a context. + * + * @param[in] instance The module instance. + * @param[in] attribute The attribute for which maximum value is queried. + * Attributes that can be queried for include: + * - <code>PP_GRAPHICS3DATTRIB_ALPHA_SIZE</code> + * - <code>PP_GRAPHICS3DATTRIB_BLUE_SIZE</code> + * - <code>PP_GRAPHICS3DATTRIB_GREEN_SIZE</code> + * - <code>PP_GRAPHICS3DATTRIB_RED_SIZE</code> + * - <code>PP_GRAPHICS3DATTRIB_DEPTH_SIZE</code> + * - <code>PP_GRAPHICS3DATTRIB_STENCIL_SIZE</code> + * - <code>PP_GRAPHICS3DATTRIB_SAMPLES</code> + * - <code>PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS</code> + * - <code>PP_GRAPHICS3DATTRIB_WIDTH</code> + * - <code>PP_GRAPHICS3DATTRIB_HEIGHT</code> + * @param[out] value The maximum supported value for <code>attribute</code> + * + * @return Returns <code>PP_TRUE</code> on success or the following on error: + * - <code>PP_ERROR_BADRESOURCE</code> if <code>instance</code> is invalid + * - <code>PP_ERROR_BADARGUMENT</code> if <code>attribute</code> is invalid + * or <code>value</code> is 0 + */ + int32_t (*GetAttribMaxValue)(PP_Resource instance, + int32_t attribute, + int32_t* value); + /** + * Create() creates and initializes a 3D rendering context. + * The returned context is off-screen to start with. It must be attached to + * a plugin instance using <code>PPB_Instance::BindGraphics</code> to draw + * on the web page. + * + * @param[in] instance The module instance. + * + * @param[in] share_context The 3D context with which the created context + * would share resources. If <code>share_context</code> is not 0, then all + * shareable data, as defined by the client API (note that for OpenGL and + * OpenGL ES, shareable data excludes texture objects named 0) will be shared + * by <code>share_context<code>, all other contexts <code>share_context</code> + * already shares with, and the newly created context. An arbitrary number of + * <code>PPB_Graphics3D</code> can share data in this fashion. + * + * @param[in] attrib_list specifies a list of attributes for the context. + * It is a list of attribute name-value pairs in which each attribute is + * immediately followed by the corresponding desired value. The list is + * terminated with <code>PP_GRAPHICS3DATTRIB_NONE</code>. + * The <code>attrib_list<code> may be 0 or empty (first attribute is + * <code>PP_GRAPHICS3DATTRIB_NONE</code>). If an attribute is not + * specified in <code>attrib_list</code>, then the default value is used + * (it is said to be specified implicitly). + * Attributes for the context are chosen according to an attribute-specific + * criteria. Attributes can be classified into two categories: + * - AtLeast: The attribute value in the returned context meets or exceeds + * the value specified in <code>attrib_list</code>. + * - Exact: The attribute value in the returned context is equal to + * the value specified in <code>attrib_list</code>. + * + * Attributes that can be specified in <code>attrib_list</code> include: + * - <code>PP_GRAPHICS3DATTRIB_ALPHA_SIZE</code>: + * Category: AtLeast Default: 0. + * - <code>PP_GRAPHICS3DATTRIB_BLUE_SIZE</code>: + * Category: AtLeast Default: 0. + * - <code>PP_GRAPHICS3DATTRIB_GREEN_SIZE</code>: + * Category: AtLeast Default: 0. + * - <code>PP_GRAPHICS3DATTRIB_RED_SIZE</code>: + * Category: AtLeast Default: 0. + * - <code>PP_GRAPHICS3DATTRIB_DEPTH_SIZE</code>: + * Category: AtLeast Default: 0. + * - <code>PP_GRAPHICS3DATTRIB_STENCIL_SIZE</code>: + * Category: AtLeast Default: 0. + * - <code>PP_GRAPHICS3DATTRIB_SAMPLES</code>: + * Category: AtLeast Default: 0. + * - <code>PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS</code>: + * Category: AtLeast Default: 0. + * - <code>PP_GRAPHICS3DATTRIB_WIDTH</code>: + * Category: Exact Default: 0. + * - <code>PP_GRAPHICS3DATTRIB_HEIGHT</code>: + * Category: Exact Default: 0. + * - <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code>: + * Category: Exact Default: Implementation defined. + * + * @return A <code>PP_Resource</code> containing the 3D graphics context if + * successful or 0 if unsuccessful. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_Resource share_context, + const int32_t attrib_list[]); + /** + * IsGraphics3D() determines if the given resource is a valid + * <code>Graphics3D</code> context. + * + * @param[in] resource A <code>Graphics3D</code> context resource. + * + * @return PP_TRUE if the given resource is a valid <code>Graphics3D</code>, + * <code>PP_FALSE</code> if it is an invalid resource or is a resource of + * another type. + */ + PP_Bool (*IsGraphics3D)(PP_Resource resource); + /** + * GetAttribs() retrieves the value for each attribute in + * <code>attrib_list</code>. + * + * @param[in] context The 3D graphics context. + * @param[in,out] attrib_list The list of attributes that are queried. + * <code>attrib_list</code> has the same structure as described for + * <code>PPB_Graphics3D::Create</code>. It is both input and output + * structure for this function. All attributes specified in + * <code>PPB_Graphics3D::Create</code> can be queried for. + * + * @return Returns <code>PP_OK</code> on success or: + * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid + * - <code>PP_ERROR_BADARGUMENT</code> if attrib_list is 0 or any attribute + * in the <code>attrib_list</code> is not a valid attribute. + * + * <strong>Example usage:</strong> To get the values for rgb bits in the + * color buffer, this function must be called as following: + * @code + * int attrib_list[] = {PP_GRAPHICS3DATTRIB_RED_SIZE, 0, + * PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0, + * PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0, + * PP_GRAPHICS3DATTRIB_NONE}; + * GetAttribs(context, attrib_list); + * int red_bits = attrib_list[1]; + * int green_bits = attrib_list[3]; + * int blue_bits = attrib_list[5]; + * @endcode + */ + int32_t (*GetAttribs)(PP_Resource context, int32_t attrib_list[]); + /** + * SetAttribs() sets the values for each attribute in + * <code>attrib_list</code>. + * + * @param[in] context The 3D graphics context. + * @param[in] attrib_list The list of attributes whose values need to be set. + * <code>attrib_list</code> has the same structure as described for + * <code>PPB_Graphics3D::Create</code>. + * Attributes that can be specified are: + * - <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code> + * + * @return Returns <code>PP_OK</code> on success or: + * - <code>PP_ERROR_BADRESOURCE</code> if <code>context</code> is invalid. + * - <code>PP_ERROR_BADARGUMENT</code> if <code>attrib_list</code> is 0 or + * any attribute in the <code>attrib_list</code> is not a valid attribute. + */ + int32_t (*SetAttribs)(PP_Resource context, const int32_t attrib_list[]); + /** + * GetError() returns the current state of the given 3D context. + * + * The recoverable error conditions that have no side effect are + * detected and returned immediately by all functions in this interface. + * In addition the implementation may get into a fatal state while + * processing a command. In this case the application must destroy the + * context and reinitialize client API state and objects to continue + * rendering. + * + * Note that the same error code is also returned in the SwapBuffers callback. + * It is recommended to handle error in the SwapBuffers callback because + * GetError is synchronous. This function may be useful in rare cases where + * drawing a frame is expensive and you want to verify the result of + * ResizeBuffers before attempting to draw a frame. + * + * @param[in] The 3D graphics context. + * @return Returns: + * - <code>PP_OK</code> if no error + * - <code>PP_ERROR_NOMEMORY</code> + * - <code>PP_ERROR_CONTEXT_LOST</code> + */ + int32_t (*GetError)(PP_Resource context); + /** + * ResizeBuffers() resizes the backing surface for context. + * + * If the surface could not be resized due to insufficient resources, + * <code>PP_ERROR_NOMEMORY</code> error is returned on the next + * <code>SwapBuffers</code> callback. + * + * @param[in] context The 3D graphics context. + * @param[in] width The width of the backing surface. + * @param[in] height The height of the backing surface. + * @return Returns <code>PP_OK</code> on success or: + * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid. + * - <code>PP_ERROR_BADARGUMENT</code> if the value specified for + * <code>width</code> or <code>height</code> is less than zero. + */ + int32_t (*ResizeBuffers)(PP_Resource context, int32_t width, int32_t height); + /** + * SwapBuffers() makes the contents of the color buffer available for + * compositing. This function has no effect on off-screen surfaces - ones not + * bound to any plugin instance. The contents of ancillary buffers are always + * undefined after calling <code>SwapBuffers</code>. The contents of the color + * buffer are undefined if the value of the + * <code>PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR</code> attribute of context is not + * <code>PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED</code>. + * + * <code>SwapBuffers</code> runs in asynchronous mode. Specify a callback + * function and the argument for that callback function. The callback function + * will be executed on the calling thread after the color buffer has been + * composited with rest of the html page. While you are waiting for a + * SwapBuffers callback, additional calls to SwapBuffers will fail. + * + * Because the callback is executed (or thread unblocked) only when the + * plugin's current state is actually on the screen, this function provides a + * way to rate limit animations. By waiting until the image is on the screen + * before painting the next frame, you can ensure you're not generating + * updates faster than the screen can be updated. + * + * SwapBuffers performs an implicit flush operation on context. + * If the context gets into an unrecoverable error condition while + * processing a command, the error code will be returned as the argument + * for the callback. The callback may return the following error codes: + * - <code>PP_ERROR_NOMEMORY</code> + * - <code>PP_ERROR_CONTEXT_LOST</code> + * Note that the same error code may also be obtained by calling GetError. + * + * @param[in] context The 3D graphics context. + * @param[in] callback The callback that will executed when + * <code>SwapBuffers</code> completes. + * + * @return Returns PP_OK on success or: + * - <code>PP_ERROR_BADRESOURCE</code> if context is invalid. + * - <code>PP_ERROR_BADARGUMENT</code> if callback is invalid. + * + */ + int32_t (*SwapBuffers)(PP_Resource context, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_Graphics3D_1_0 PPB_Graphics3D; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_GRAPHICS_3D_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_host_resolver.h
Added
@@ -0,0 +1,174 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_host_resolver.idl modified Sat Jun 22 11:11:38 2013. */ + +#ifndef PPAPI_C_PPB_HOST_RESOLVER_H_ +#define PPAPI_C_PPB_HOST_RESOLVER_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/ppb_net_address.h" + +#define PPB_HOSTRESOLVER_INTERFACE_1_0 "PPB_HostResolver;1.0" +#define PPB_HOSTRESOLVER_INTERFACE PPB_HOSTRESOLVER_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_HostResolver</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * <code>PP_HostResolver_Flag</code> is an enumeration of flags which can be + * OR-ed and passed to the host resolver. Currently there is only one flag + * defined. + */ +typedef enum { + /** + * Hint to request the canonical name of the host, which can be retrieved by + * <code>GetCanonicalName()</code>. + */ + PP_HOSTRESOLVER_FLAG_CANONNAME = 1 << 0 +} PP_HostResolver_Flag; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_HostResolver_Flag, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * <code>PP_HostResolver_Hint</code> represents hints for host resolution. + */ +struct PP_HostResolver_Hint { + /** + * Network address family. + */ + PP_NetAddress_Family family; + /** + * Combination of flags from <code>PP_HostResolver_Flag</code>. + */ + int32_t flags; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_HostResolver_Hint, 8); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_HostResolver</code> interface supports host name + * resolution. + * + * Permissions: In order to run <code>Resolve()</code>, apps permission + * <code>socket</code> with subrule <code>resolve-host</code> is required. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +struct PPB_HostResolver_1_0 { + /** + * Creates a host resolver resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * + * @return A <code>PP_Resource</code> corresponding to a host reslover or 0 + * on failure. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is a host resolver. + * + * @param[in] resource A <code>PP_Resource</code> to check. + * + * @return <code>PP_TRUE</code> if the input is a + * <code>PPB_HostResolver</code> resource; <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsHostResolver)(PP_Resource resource); + /** + * Requests resolution of a host name. If the call completes successfully, the + * results can be retrieved by <code>GetCanonicalName()</code>, + * <code>GetNetAddressCount()</code> and <code>GetNetAddress()</code>. + * + * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host + * resolver. + * @param[in] host The host name (or IP address literal) to resolve. + * @param[in] port The port number to be set in the resulting network + * addresses. + * @param[in] hint A <code>PP_HostResolver_Hint</code> structure providing + * hints for host resolution. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have + * required permissions. <code>PP_ERROR_NAME_NOT_RESOLVED</code> will be + * returned if the host name couldn't be resolved. + */ + int32_t (*Resolve)(PP_Resource host_resolver, + const char* host, + uint16_t port, + const struct PP_HostResolver_Hint* hint, + struct PP_CompletionCallback callback); + /** + * Gets the canonical name of the host. + * + * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host + * resolver. + * + * @return A string <code>PP_Var</code> on success, which is an empty string + * if <code>PP_HOSTRESOLVER_FLAG_CANONNAME</code> is not set in the hint flags + * when calling <code>Resolve()</code>; an undefined <code>PP_Var</code> if + * there is a pending <code>Resolve()</code> call or the previous + * <code>Resolve()</code> call failed. + */ + struct PP_Var (*GetCanonicalName)(PP_Resource host_resolver); + /** + * Gets the number of network addresses. + * + * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host + * resolver. + * + * @return The number of available network addresses on success; 0 if there is + * a pending <code>Resolve()</code> call or the previous + * <code>Resolve()</code> call failed. + */ + uint32_t (*GetNetAddressCount)(PP_Resource host_resolver); + /** + * Gets a network address. + * + * @param[in] host_resolver A <code>PP_Resource</code> corresponding to a host + * resolver. + * @param[in] index An index indicating which address to return. + * + * @return A <code>PPB_NetAddress</code> resource on success; 0 if there is a + * pending <code>Resolve()</code> call or the previous <code>Resolve()</code> + * call failed, or the specified index is out of range. + */ + PP_Resource (*GetNetAddress)(PP_Resource host_resolver, uint32_t index); +}; + +typedef struct PPB_HostResolver_1_0 PPB_HostResolver; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_HOST_RESOLVER_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_image_data.h
Added
@@ -0,0 +1,208 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_image_data.idl modified Tue Nov 13 08:48:25 2012. */ + +#ifndef PPAPI_C_PPB_IMAGE_DATA_H_ +#define PPAPI_C_PPB_IMAGE_DATA_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_IMAGEDATA_INTERFACE_1_0 "PPB_ImageData;1.0" +#define PPB_IMAGEDATA_INTERFACE PPB_IMAGEDATA_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_ImageData</code> struct for determining how + * a browser handles image data. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * <code>PP_ImageDataFormat</code> is an enumeration of the different types of + * image data formats. + * + * The third part of each enumeration value describes the memory layout from + * the lowest address to the highest. For example, BGRA means the B component + * is stored in the lowest address, no matter what endianness the platform is + * using. + * + * The PREMUL suffix implies pre-multiplied alpha is used. In this mode, the + * red, green and blue color components of the pixel data supplied to an image + * data should be pre-multiplied by their alpha value. For example: starting + * with floating point color components, here is how to convert them to 8-bit + * premultiplied components for image data: + * + * ...components of a pixel, floats ranging from 0 to 1... + * <code>float red = 1.0f;</code> + * <code>float green = 0.50f;</code> + * <code>float blue = 0.0f;</code> + * <code>float alpha = 0.75f;</code> + * ...components for image data are 8-bit values ranging from 0 to 255... + * <code>uint8_t image_data_red_premul = (uint8_t)(red * alpha * 255.0f); + * </code> + * <code>uint8_t image_data_green_premul = (uint8_t)(green * alpha * 255.0f); + * </code> + * <code>uint8_t image_data_blue_premul = (uint8_t)(blue * alpha * 255.0f); + * </code> + * <code>uint8_t image_data_alpha_premul = (uint8_t)(alpha * 255.0f);</code> + * + * <strong>Note:</strong> The resulting pre-multiplied red, green and blue + * components should not be greater than the alpha value. + */ +typedef enum { + PP_IMAGEDATAFORMAT_BGRA_PREMUL, + PP_IMAGEDATAFORMAT_RGBA_PREMUL +} PP_ImageDataFormat; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ImageDataFormat, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * The <code>PP_ImageDataDesc</code> structure represents a description of + * image data. + */ +struct PP_ImageDataDesc { + /** + * This value represents one of the image data types in the + * <code>PP_ImageDataFormat</code> enum. + */ + PP_ImageDataFormat format; + /** This value represents the size of the bitmap in pixels. */ + struct PP_Size size; + /** + * This value represents the row width in bytes. This may be different than + * width * 4 since there may be padding at the end of the lines. + */ + int32_t stride; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_ImageDataDesc, 16); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_ImageData</code> interface contains pointers to several + * functions for determining the browser's treatment of image data. + */ +struct PPB_ImageData_1_0 { + /** + * GetNativeImageDataFormat() returns the browser's preferred format for + * image data. The browser uses this format internally for painting. Other + * formats may require internal conversions to paint or may have additional + * restrictions depending on the function. + * + * @return A <code>PP_ImageDataFormat</code> containing the preferred format. + */ + PP_ImageDataFormat (*GetNativeImageDataFormat)(void); + /** + * IsImageDataFormatSupported() determines if the given image data format is + * supported by the browser. Note: <code>PP_IMAGEDATAFORMAT_BGRA_PREMUL</code> + * and <code>PP_IMAGEDATAFORMAT_RGBA_PREMUL</code> formats are always + * supported. Other image formats do not make this guarantee, and should be + * checked first with IsImageDataFormatSupported() before using. + * + * @param[in] format The image data format. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * image data format is supported by the browser. + */ + PP_Bool (*IsImageDataFormatSupported)(PP_ImageDataFormat format); + /** + * Create() allocates an image data resource with the given format and size. + * + * For security reasons, if uninitialized, the bitmap will not contain random + * memory, but may contain data from a previous image produced by the same + * module if the bitmap was cached and re-used. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] format The desired image data format. + * @param[in] size A pointer to a <code>PP_Size</code> containing the image + * size. + * @param[in] init_to_zero A <code>PP_Bool</code> to determine transparency + * at creation. + * Set the <code>init_to_zero</code> flag if you want the bitmap initialized + * to transparent during the creation process. If this flag is not set, the + * current contents of the bitmap will be undefined, and the module should + * be sure to set all the pixels. + * + * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on + * failure. Failure means the instance, image size, or format was invalid. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_ImageDataFormat format, + const struct PP_Size* size, + PP_Bool init_to_zero); + /** + * IsImageData() determines if a given resource is image data. + * + * @param[in] image_data A <code>PP_Resource</code> corresponding to image + * data. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is an image data or <code>PP_FALSE</code> if the resource is + * invalid or some type other than image data. + */ + PP_Bool (*IsImageData)(PP_Resource image_data); + /** + * Describe() computes the description of the + * image data. + * + * @param[in] image_data A <code>PP_Resource</code> corresponding to image + * data. + * @param[in,out] desc A pointer to a <code>PP_ImageDataDesc</code> + * containing the description. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> on success or + * <code>PP_FALSE</code> if the resource is not an image data. On + * <code>PP_FALSE</code>, the <code>desc</code> structure will be filled + * with 0. + */ + PP_Bool (*Describe)(PP_Resource image_data, struct PP_ImageDataDesc* desc); + /** + * Map() maps an image data into the module address space. + * + * @param[in] image_data A <code>PP_Resource</code> corresponding to image + * data. + * + * @return A pointer to the beginning of the data. + */ + void* (*Map)(PP_Resource image_data); + /** + * Unmap is a pointer to a function that unmaps an image data from the module + * address space. + * + * @param[in] image_data A <code>PP_Resource</code> corresponding to image + * data. + */ + void (*Unmap)(PP_Resource image_data); +}; + +typedef struct PPB_ImageData_1_0 PPB_ImageData; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_IMAGE_DATA_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_input_event.h
Added
@@ -0,0 +1,1042 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_input_event.idl modified Thu Sep 1 12:40:05 2016. */ + +#ifndef PPAPI_C_PPB_INPUT_EVENT_H_ +#define PPAPI_C_PPB_INPUT_EVENT_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" +#include "ppapi/c/pp_touch_point.h" +#include "ppapi/c/pp_var.h" + +#define PPB_INPUT_EVENT_INTERFACE_1_0 "PPB_InputEvent;1.0" +#define PPB_INPUT_EVENT_INTERFACE PPB_INPUT_EVENT_INTERFACE_1_0 + +#define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_0 "PPB_MouseInputEvent;1.0" +#define PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1 "PPB_MouseInputEvent;1.1" +#define PPB_MOUSE_INPUT_EVENT_INTERFACE PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1 + +#define PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 "PPB_WheelInputEvent;1.0" +#define PPB_WHEEL_INPUT_EVENT_INTERFACE PPB_WHEEL_INPUT_EVENT_INTERFACE_1_0 + +#define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0 "PPB_KeyboardInputEvent;1.0" +#define PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_2 "PPB_KeyboardInputEvent;1.2" +#define PPB_KEYBOARD_INPUT_EVENT_INTERFACE \ + PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_2 + +#define PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0 "PPB_TouchInputEvent;1.0" +#define PPB_TOUCH_INPUT_EVENT_INTERFACE PPB_TOUCH_INPUT_EVENT_INTERFACE_1_0 + +#define PPB_IME_INPUT_EVENT_INTERFACE_1_0 "PPB_IMEInputEvent;1.0" +#define PPB_IME_INPUT_EVENT_INTERFACE PPB_IME_INPUT_EVENT_INTERFACE_1_0 + +/** + * @file + * This file defines the Input Event interfaces. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains the types of input events. + */ +typedef enum { + PP_INPUTEVENT_TYPE_UNDEFINED = -1, + /** + * Notification that a mouse button was pressed. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSEDOWN = 0, + /** + * Notification that a mouse button was released. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSEUP = 1, + /** + * Notification that a mouse button was moved when it is over the instance + * or dragged out of it. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSEMOVE = 2, + /** + * Notification that the mouse entered the instance's bounds. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSEENTER = 3, + /** + * Notification that a mouse left the instance's bounds. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSELEAVE = 4, + /** + * Notification that the scroll wheel was used. + * + * Register for this event using the PP_INPUTEVENT_CLASS_WHEEL class. + */ + PP_INPUTEVENT_TYPE_WHEEL = 5, + /** + * Notification that a key transitioned from "up" to "down". + * + * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. + */ + PP_INPUTEVENT_TYPE_RAWKEYDOWN = 6, + /** + * Notification that a key was pressed. This does not necessarily correspond + * to a character depending on the key and language. Use the + * PP_INPUTEVENT_TYPE_CHAR for character input. + * + * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. + */ + PP_INPUTEVENT_TYPE_KEYDOWN = 7, + /** + * Notification that a key was released. + * + * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. + */ + PP_INPUTEVENT_TYPE_KEYUP = 8, + /** + * Notification that a character was typed. Use this for text input. Key + * down events may generate 0, 1, or more than one character event depending + * on the key, locale, and operating system. + * + * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. + */ + PP_INPUTEVENT_TYPE_CHAR = 9, + /** + * Notification that a context menu should be shown. + * + * This message will be sent when the user right-clicks or performs another + * OS-specific mouse command that should open a context menu. When this event + * is delivered depends on the system, on some systems (Mac) it will + * delivered after the mouse down event, and on others (Windows) it will be + * delivered after the mouse up event. + * + * You will always get the normal mouse events. For example, you may see + * MOUSEDOWN,CONTEXTMENU,MOUSEUP or MOUSEDOWN,MOUSEUP,CONTEXTMENU. + * + * The return value from the event handler determines if the context menu + * event will be passed to the page when you are using filtered input events + * (via RequestFilteringInputEvents()). In non-filtering mode the event will + * never be propagated and no context menu will be displayed. If you are + * handling mouse events in filtering mode, you may want to return true from + * this event even if you do not support a context menu to suppress the + * default one. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_CONTEXTMENU = 10, + /** + * Notification that an input method composition process has just started. + * + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. + */ + PP_INPUTEVENT_TYPE_IME_COMPOSITION_START = 11, + /** + * Notification that the input method composition string is updated. + * + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. + */ + PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE = 12, + /** + * Notification that an input method composition process has completed. + * + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. + */ + PP_INPUTEVENT_TYPE_IME_COMPOSITION_END = 13, + /** + * Notification that an input method committed a string. + * + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. + */ + PP_INPUTEVENT_TYPE_IME_TEXT = 14, + /** + * Notification that a finger was placed on a touch-enabled device. + * + * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. + */ + PP_INPUTEVENT_TYPE_TOUCHSTART = 15, + /** + * Notification that a finger was moved on a touch-enabled device. + * + * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. + */ + PP_INPUTEVENT_TYPE_TOUCHMOVE = 16, + /** + * Notification that a finger was released on a touch-enabled device. + * + * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. + */ + PP_INPUTEVENT_TYPE_TOUCHEND = 17, + /** + * Notification that a touch event was canceled. + * + * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. + */ + PP_INPUTEVENT_TYPE_TOUCHCANCEL = 18 +} PP_InputEvent_Type; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4); + +/** + * This enumeration contains event modifier constants. Each modifier is one + * bit. Retrieve the modifiers from an input event using the GetEventModifiers + * function on PPB_InputEvent. + */ +typedef enum { + PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0, + PP_INPUTEVENT_MODIFIER_CONTROLKEY = 1 << 1, + PP_INPUTEVENT_MODIFIER_ALTKEY = 1 << 2, + PP_INPUTEVENT_MODIFIER_METAKEY = 1 << 3, + PP_INPUTEVENT_MODIFIER_ISKEYPAD = 1 << 4, + PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT = 1 << 5, + PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN = 1 << 6, + PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN = 1 << 7, + PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN = 1 << 8, + PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY = 1 << 9, + PP_INPUTEVENT_MODIFIER_NUMLOCKKEY = 1 << 10, + PP_INPUTEVENT_MODIFIER_ISLEFT = 1 << 11, + PP_INPUTEVENT_MODIFIER_ISRIGHT = 1 << 12, + PP_INPUTEVENT_MODIFIER_ISPEN = 1 << 13, + PP_INPUTEVENT_MODIFIER_ISERASER = 1 << 14 +} PP_InputEvent_Modifier; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Modifier, 4); + +/** + * This enumeration contains constants representing each mouse button. To get + * the mouse button for a mouse down or up event, use GetMouseButton on + * PPB_InputEvent. + */ +typedef enum { + PP_INPUTEVENT_MOUSEBUTTON_NONE = -1, + PP_INPUTEVENT_MOUSEBUTTON_LEFT = 0, + PP_INPUTEVENT_MOUSEBUTTON_MIDDLE = 1, + PP_INPUTEVENT_MOUSEBUTTON_RIGHT = 2 +} PP_InputEvent_MouseButton; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_MouseButton, 4); + +typedef enum { + /** + * Request mouse input events. + * + * Normally you will request mouse events by calling RequestInputEvents(). + * The only use case for filtered events (via RequestFilteringInputEvents()) + * is for instances that have irregular outlines and you want to perform hit + * testing, which is very uncommon. Requesting non-filtered mouse events will + * lead to higher performance. + */ + PP_INPUTEVENT_CLASS_MOUSE = 1 << 0, + /** + * Requests keyboard events. Often you will want to request filtered mode + * (via RequestFilteringInputEvents) for keyboard events so you can pass on + * events (by returning false) that you don't handle. For example, if you + * don't request filtered mode and the user pressed "Page Down" when your + * instance has focus, the page won't scroll which will be a poor experience. + * + * A small number of tab and window management commands like Alt-F4 are never + * sent to the page. You can not request these keyboard commands since it + * would allow pages to trap users on a page. + */ + PP_INPUTEVENT_CLASS_KEYBOARD = 1 << 1, + /** + * Identifies scroll wheel input event. Wheel events must be requested in + * filtering mode via RequestFilteringInputEvents(). This is because many + * wheel commands should be forwarded to the page. + * + * Most instances will not need this event. Consuming wheel events by + * returning true from your filtered event handler will prevent the user from + * scrolling the page when the mouse is over the instance which can be very + * annoying. + * + * If you handle wheel events (for example, you have a document viewer which + * the user can scroll), the recommended behavior is to return false only if + * the wheel event actually causes your document to scroll. When the user + * reaches the end of the document, return false to indicating that the event + * was not handled. This will then forward the event to the containing page + * for scrolling, producing the nested scrolling behavior users expect from + * frames in a page. + */ + PP_INPUTEVENT_CLASS_WHEEL = 1 << 2, + /** + * Identifies touch input events. + * + * Request touch events only if you intend to handle them. If the browser + * knows you do not need to handle touch events, it can handle them at a + * higher level and achieve higher performance. If the plugin does not + * register for touch-events, then it will receive synthetic mouse events that + * are generated from the touch events (e.g. mouse-down for touch-start, + * mouse-move for touch-move (with left-button down), and mouse-up for + * touch-end. If the plugin does register for touch events, then the synthetic + * mouse events are not created. + */ + PP_INPUTEVENT_CLASS_TOUCH = 1 << 3, + /** + * Identifies IME composition input events. + * + * Request this input event class if you allow on-the-spot IME input. + */ + PP_INPUTEVENT_CLASS_IME = 1 << 4 +} PP_InputEvent_Class; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Class, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_InputEvent</code> interface contains pointers to several + * functions related to generic input events on the browser. + */ +struct PPB_InputEvent_1_0 { + /** + * RequestInputEvent() requests that input events corresponding to the given + * input events are delivered to the instance. + * + * It's recommended that you use RequestFilteringInputEvents() for keyboard + * events instead of this function so that you don't interfere with normal + * browser accelerators. + * + * By default, no input events are delivered. Call this function with the + * classes of events you are interested in to have them be delivered to + * the instance. Calling this function will override any previous setting for + * each specified class of input events (for example, if you previously + * called RequestFilteringInputEvents(), this function will set those events + * to non-filtering mode). + * + * Input events may have high overhead, so you should only request input + * events that your plugin will actually handle. For example, the browser may + * do optimizations for scroll or touch events that can be processed + * substantially faster if it knows there are no non-default receivers for + * that message. Requesting that such messages be delivered, even if they are + * processed very quickly, may have a noticeable effect on the performance of + * the page. + * + * Note that synthetic mouse events will be generated from touch events if + * (and only if) you do not request touch events. + * + * When requesting input events through this function, the events will be + * delivered and <i>not</i> bubbled to the default handlers. + * + * <strong>Example:</strong> + * @code + * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE); + * RequestFilteringInputEvents(instance, + * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); + * @endcode + * + * @param instance The <code>PP_Instance</code> of the instance requesting + * the given events. + * + * @param event_classes A combination of flags from + * <code>PP_InputEvent_Class</code> that identifies the classes of events the + * instance is requesting. The flags are combined by logically ORing their + * values. + * + * @return <code>PP_OK</code> if the operation succeeded, + * <code>PP_ERROR_BADARGUMENT</code> if instance is invalid, or + * <code>PP_ERROR_NOTSUPPORTED</code> if one of the event class bits were + * illegal. In the case of an invalid bit, all valid bits will be applied + * and only the illegal bits will be ignored. The most common cause of a + * <code>PP_ERROR_NOTSUPPORTED</code> return value is requesting keyboard + * events, these must use RequestFilteringInputEvents(). + */ + int32_t (*RequestInputEvents)(PP_Instance instance, uint32_t event_classes); + /** + * RequestFilteringInputEvents() requests that input events corresponding to + * the given input events are delivered to the instance for filtering. + * + * By default, no input events are delivered. In most cases you would + * register to receive events by calling RequestInputEvents(). In some cases, + * however, you may wish to filter events such that they can be bubbled up + * to the default handlers. In this case, register for those classes of + * events using this function instead of RequestInputEvents(). + * + * Filtering input events requires significantly more overhead than just + * delivering them to the instance. As such, you should only request + * filtering in those cases where it's absolutely necessary. The reason is + * that it requires the browser to stop and block for the instance to handle + * the input event, rather than sending the input event asynchronously. This + * can have significant overhead. + * + * <strong>Example:</strong> + * @code + * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE); + * RequestFilteringInputEvents(instance, + * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); + * @endcode + * + * @return <code>PP_OK</code> if the operation succeeded, + * <code>PP_ERROR_BADARGUMENT</code> if instance is invalid, or + * <code>PP_ERROR_NOTSUPPORTED</code> if one of the event class bits were + * illegal. In the case of an invalid bit, all valid bits will be applied + * and only the illegal bits will be ignored. + */ + int32_t (*RequestFilteringInputEvents)(PP_Instance instance, + uint32_t event_classes); + /** + * ClearInputEventRequest() requests that input events corresponding to the + * given input classes no longer be delivered to the instance. + * + * By default, no input events are delivered. If you have previously + * requested input events via RequestInputEvents() or + * RequestFilteringInputEvents(), this function will unregister handling + * for the given instance. This will allow greater browser performance for + * those events. + * + * Note that you may still get some input events after clearing the flag if + * they were dispatched before the request was cleared. For example, if + * there are 3 mouse move events waiting to be delivered, and you clear the + * mouse event class during the processing of the first one, you'll still + * receive the next two. You just won't get more events generated. + * + * @param instance The <code>PP_Instance</code> of the instance requesting + * to no longer receive the given events. + * + * @param event_classes A combination of flags from + * <code>PP_InputEvent_Class</code> that identify the classes of events the + * instance is no longer interested in. + */ + void (*ClearInputEventRequest)(PP_Instance instance, uint32_t event_classes); + /** + * IsInputEvent() returns true if the given resource is a valid input event + * resource. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a generic + * resource. + * + * @return <code>PP_TRUE</code> if the given resource is a valid input event + * resource. + */ + PP_Bool (*IsInputEvent)(PP_Resource resource); + /** + * GetType() returns the type of input event for the given input event + * resource. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to an input + * event. + * + * @return A <code>PP_InputEvent_Type</code> if its a valid input event or + * <code>PP_INPUTEVENT_TYPE_UNDEFINED</code> if the resource is invalid. + */ + PP_InputEvent_Type (*GetType)(PP_Resource event); + /** + * GetTimeStamp() Returns the time that the event was generated. This will be + * before the current time since processing and dispatching the event has + * some overhead. Use this value to compare the times the user generated two + * events without being sensitive to variable processing time. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to the event. + * + * @return The return value is in time ticks, which is a monotonically + * increasing clock not related to the wall clock time. It will not change + * if the user changes their clock or daylight savings time starts, so can + * be reliably used to compare events. This means, however, that you can't + * correlate event times to a particular time of day on the system clock. + */ + PP_TimeTicks (*GetTimeStamp)(PP_Resource event); + /** + * GetModifiers() returns a bitfield indicating which modifiers were down + * at the time of the event. This is a combination of the flags in the + * <code>PP_InputEvent_Modifier</code> enum. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to an input + * event. + * + * @return The modifiers associated with the event, or 0 if the given + * resource is not a valid event resource. + */ + uint32_t (*GetModifiers)(PP_Resource event); +}; + +typedef struct PPB_InputEvent_1_0 PPB_InputEvent; + +/** + * The <code>PPB_MouseInputEvent</code> interface contains pointers to several + * functions related to mouse input events. + */ +struct PPB_MouseInputEvent_1_1 { + /** + * Create() creates a mouse input event with the given parameters. Normally + * you will get a mouse event passed through the + * <code>HandleInputEvent</code> and will not need to create them, but some + * applications may want to create their own for internal use. The type must + * be one of the mouse event types. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of + * input event. + * + * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * <code>PP_InputEvent_Modifier</code> flags. + * + * @param[in] mouse_button The button that changed for mouse down or up + * events. This value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for + * mouse move, enter, and leave events. + * + * @param[in] mouse_position A <code>Point</code> containing the x and y + * position of the mouse when the event occurred. + * + * @param[in] mouse_movement The change in position of the mouse. + * + * @return A <code>PP_Resource</code> containing the new mouse input event. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + uint32_t modifiers, + PP_InputEvent_MouseButton mouse_button, + const struct PP_Point* mouse_position, + int32_t click_count, + const struct PP_Point* mouse_movement); + /** + * IsMouseInputEvent() determines if a resource is a mouse event. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to an event. + * + * @return <code>PP_TRUE</code> if the given resource is a valid mouse input + * event, otherwise <code>PP_FALSE</code>. + */ + PP_Bool (*IsMouseInputEvent)(PP_Resource resource); + /** + * GetButton() returns the mouse button that generated a mouse down or up + * event. + * + * @param[in] mouse_event A <code>PP_Resource</code> corresponding to a + * mouse event. + * + * @return The mouse button associated with mouse down and up events. This + * value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for mouse move, + * enter, and leave events, and for all non-mouse events. + */ + PP_InputEvent_MouseButton (*GetButton)(PP_Resource mouse_event); + /** + * GetPosition() returns the pixel location of a mouse input event. When + * the mouse is locked, it returns the last known mouse position just as + * mouse lock was entered. + * + * @param[in] mouse_event A <code>PP_Resource</code> corresponding to a + * mouse event. + * + * @return The point associated with the mouse event, relative to the upper- + * left of the instance receiving the event. These values can be negative for + * mouse drags. The return value will be (0, 0) for non-mouse events. + */ + struct PP_Point (*GetPosition)(PP_Resource mouse_event); + int32_t (*GetClickCount)(PP_Resource mouse_event); + /** + * Returns the change in position of the mouse. When the mouse is locked, + * although the mouse position doesn't actually change, this function + * still provides movement information, which indicates what the change in + * position would be had the mouse not been locked. + * + * @param[in] mouse_event A <code>PP_Resource</code> corresponding to a + * mouse event. + * + * @return The change in position of the mouse, relative to the previous + * position. + */ + struct PP_Point (*GetMovement)(PP_Resource mouse_event); +}; + +typedef struct PPB_MouseInputEvent_1_1 PPB_MouseInputEvent; + +struct PPB_MouseInputEvent_1_0 { + PP_Resource (*Create)(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + uint32_t modifiers, + PP_InputEvent_MouseButton mouse_button, + const struct PP_Point* mouse_position, + int32_t click_count); + PP_Bool (*IsMouseInputEvent)(PP_Resource resource); + PP_InputEvent_MouseButton (*GetButton)(PP_Resource mouse_event); + struct PP_Point (*GetPosition)(PP_Resource mouse_event); + int32_t (*GetClickCount)(PP_Resource mouse_event); +}; + +/** + * The <code>PPB_WheelIputEvent</code> interface contains pointers to several + * functions related to wheel input events. + */ +struct PPB_WheelInputEvent_1_0 { + /** + * Create() creates a wheel input event with the given parameters. Normally + * you will get a wheel event passed through the + * <code>HandleInputEvent</code> and will not need to create them, but some + * applications may want to create their own for internal use. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * <code>PP_InputEvent_Modifier</code> flags. + * + * @param[in] wheel_delta The scroll wheel's horizontal and vertical scroll + * amounts. + * + * @param[in] wheel_ticks The number of "clicks" of the scroll wheel that + * have produced the event. + * + * @param[in] scroll_by_page When true, the user is requesting to scroll + * by pages. When false, the user is requesting to scroll by lines. + * + * @return A <code>PP_Resource</code> containing the new wheel input event. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_TimeTicks time_stamp, + uint32_t modifiers, + const struct PP_FloatPoint* wheel_delta, + const struct PP_FloatPoint* wheel_ticks, + PP_Bool scroll_by_page); + /** + * IsWheelInputEvent() determines if a resource is a wheel event. + * + * @param[in] wheel_event A <code>PP_Resource</code> corresponding to an + * event. + * + * @return <code>PP_TRUE</code> if the given resource is a valid wheel input + * event. + */ + PP_Bool (*IsWheelInputEvent)(PP_Resource resource); + /** + * GetDelta() returns the amount vertically and horizontally the user has + * requested to scroll by with their mouse wheel. A scroll down or to the + * right (where the content moves up or left) is represented as positive + * values, and a scroll up or to the left (where the content moves down or + * right) is represented as negative values. + * + * This amount is system dependent and will take into account the user's + * preferred scroll sensitivity and potentially also nonlinear acceleration + * based on the speed of the scrolling. + * + * Devices will be of varying resolution. Some mice with large detents will + * only generate integer scroll amounts. But fractional values are also + * possible, for example, on some trackpads and newer mice that don't have + * "clicks". + * + * @param[in] wheel_event A <code>PP_Resource</code> corresponding to a wheel + * event. + * + * @return The vertical and horizontal scroll values. The units are either in + * pixels (when scroll_by_page is false) or pages (when scroll_by_page is + * true). For example, y = -3 means scroll up 3 pixels when scroll_by_page + * is false, and scroll up 3 pages when scroll_by_page is true. + */ + struct PP_FloatPoint (*GetDelta)(PP_Resource wheel_event); + /** + * GetTicks() returns the number of "clicks" of the scroll wheel + * that have produced the event. The value may have system-specific + * acceleration applied to it, depending on the device. The positive and + * negative meanings are the same as for GetDelta(). + * + * If you are scrolling, you probably want to use the delta values. These + * tick events can be useful if you aren't doing actual scrolling and don't + * want or pixel values. An example may be cycling between different items in + * a game. + * + * @param[in] wheel_event A <code>PP_Resource</code> corresponding to a wheel + * event. + * + * @return The number of "clicks" of the scroll wheel. You may receive + * fractional values for the wheel ticks if the mouse wheel is high + * resolution or doesn't have "clicks". If your program wants discrete + * events (as in the "picking items" example) you should accumulate + * fractional click values from multiple messages until the total value + * reaches positive or negative one. This should represent a similar amount + * of scrolling as for a mouse that has a discrete mouse wheel. + */ + struct PP_FloatPoint (*GetTicks)(PP_Resource wheel_event); + /** + * GetScrollByPage() indicates if the scroll delta x/y indicates pages or + * lines to scroll by. + * + * @param[in] wheel_event A <code>PP_Resource</code> corresponding to a wheel + * event. + * + * @return <code>PP_TRUE</code> if the event is a wheel event and the user is + * scrolling by pages. <code>PP_FALSE</code> if not or if the resource is not + * a wheel event. + */ + PP_Bool (*GetScrollByPage)(PP_Resource wheel_event); +}; + +typedef struct PPB_WheelInputEvent_1_0 PPB_WheelInputEvent; + +/** + * The <code>PPB_KeyboardInputEvent</code> interface contains pointers to + * several functions related to keyboard input events. + */ +struct PPB_KeyboardInputEvent_1_2 { + /** + * Creates a keyboard input event with the given parameters. Normally you + * will get a keyboard event passed through the HandleInputEvent and will not + * need to create them, but some applications may want to create their own + * for internal use. The type must be one of the keyboard event types. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of + * input event. + * + * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * <code>PP_InputEvent_Modifier</code> flags. + * + * @param[in] key_code This value reflects the DOM KeyboardEvent + * <code>keyCode</code> field, which is the Windows-style Virtual Key + * code of the key. + * + * @param[in] character_text This value represents the typed character as a + * UTF-8 string. + * + * @param[in] code This value represents the DOM3 |code| string that + * corresponds to the physical key being pressed. + * + * @return A <code>PP_Resource</code> containing the new keyboard input + * event. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + uint32_t modifiers, + uint32_t key_code, + struct PP_Var character_text, + struct PP_Var code); + /** + * IsKeyboardInputEvent() determines if a resource is a keyboard event. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to an event. + * + * @return <code>PP_TRUE</code> if the given resource is a valid input event. + */ + PP_Bool (*IsKeyboardInputEvent)(PP_Resource resource); + /** + * GetKeyCode() returns the DOM keyCode field for the keyboard event. + * Chrome populates this with the Windows-style Virtual Key code of the key. + * + * @param[in] key_event A <code>PP_Resource</code> corresponding to a + * keyboard event. + * + * @return The DOM keyCode field for the keyboard event. + */ + uint32_t (*GetKeyCode)(PP_Resource key_event); + /** + * GetCharacterText() returns the typed character as a UTF-8 string for the + * given character event. + * + * @param[in] character_event A <code>PP_Resource</code> corresponding to a + * keyboard event. + * + * @return A string var representing a single typed character for character + * input events. For non-character input events the return value will be an + * undefined var. + */ + struct PP_Var (*GetCharacterText)(PP_Resource character_event); + /** + * GetCode() returns the DOM |code| field for this keyboard event, as + * defined in the DOM3 Events spec: + * http://www.w3.org/TR/DOM-Level-3-Events/ + * + * @param[in] key_event The key event for which to return the key code. + * + * @return The string that contains the DOM |code| for the keyboard event. + */ + struct PP_Var (*GetCode)(PP_Resource key_event); +}; + +typedef struct PPB_KeyboardInputEvent_1_2 PPB_KeyboardInputEvent; + +struct PPB_KeyboardInputEvent_1_0 { + PP_Resource (*Create)(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + uint32_t modifiers, + uint32_t key_code, + struct PP_Var character_text); + PP_Bool (*IsKeyboardInputEvent)(PP_Resource resource); + uint32_t (*GetKeyCode)(PP_Resource key_event); + struct PP_Var (*GetCharacterText)(PP_Resource character_event); +}; +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * The list of all TouchPoints which are currently down. + */ + PP_TOUCHLIST_TYPE_TOUCHES = 0, + /** + * The list of all TouchPoints whose state has changed since the last + * TouchInputEvent. + */ + PP_TOUCHLIST_TYPE_CHANGEDTOUCHES = 1, + /** + * The list of all TouchPoints which are targeting this plugin. This is a + * subset of Touches. + */ + PP_TOUCHLIST_TYPE_TARGETTOUCHES = 2 +} PP_TouchListType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TouchListType, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_TouchInputEvent</code> interface contains pointers to several + * functions related to touch events. + */ +struct PPB_TouchInputEvent_1_0 { + /** + * Creates a touch input event with the given parameters. Normally you + * will get a touch event passed through the HandleInputEvent and will not + * need to create them, but some applications may want to create their own + * for internal use. The type must be one of the touch event types. + * This newly created touch input event does not have any touch point in any + * of the touch-point lists. <code>AddTouchPoint</code> should be called to + * add the touch-points. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of + * input event. + * + * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * <code>PP_InputEvent_Modifier</code> flags. + * + * @return A <code>PP_Resource</code> containing the new touch input event. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + uint32_t modifiers); + /** + * Adds a touch point to the touch event in the specified touch-list. + * + * @param[in] touch_event A <code>PP_Resource</code> corresponding to a touch + * event. + * + * @param[in] list The list to add the touch point to. + * + * @param[in] point The point to add to the list. + */ + void (*AddTouchPoint)(PP_Resource touch_event, + PP_TouchListType list, + const struct PP_TouchPoint* point); + /** + * IsTouchInputEvent() determines if a resource is a touch event. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to an event. + * + * @return <code>PP_TRUE</code> if the given resource is a valid touch input + * event, otherwise <code>PP_FALSE</code>. + */ + PP_Bool (*IsTouchInputEvent)(PP_Resource resource); + /** + * Returns the number of touch-points in the specified list. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a touch + * event. + * + * @param[in] list The list. + * + * @return The number of touch-points in the specified list. + */ + uint32_t (*GetTouchCount)(PP_Resource resource, PP_TouchListType list); + /** + * Returns the touch-point at the specified index from the specified list. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a touch + * event. + * + * @param[in] list The list. + * + * @param[in] index The index. + * + * @return A <code>PP_TouchPoint</code> representing the touch-point. + */ + struct PP_TouchPoint (*GetTouchByIndex)(PP_Resource resource, + PP_TouchListType list, + uint32_t index); + /** + * Returns the touch-point with the specified touch-id in the specified list. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a touch + * event. + * + * @param[in] list The list. + * + * @param[in] touch_id The id of the touch-point. + * + * @return A <code>PP_TouchPoint</code> representing the touch-point. + */ + struct PP_TouchPoint (*GetTouchById)(PP_Resource resource, + PP_TouchListType list, + uint32_t touch_id); +}; + +typedef struct PPB_TouchInputEvent_1_0 PPB_TouchInputEvent; + +struct PPB_IMEInputEvent_1_0 { + /** + * Create() creates an IME input event with the given parameters. Normally + * you will get an IME event passed through the <code>HandleInputEvent</code> + * and will not need to create them, but some applications may want to create + * their own for internal use. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A <code>PP_InputEvent_Type</code> identifying the type of + * input event. The type must be one of the IME event types. + * + * @param[in] time_stamp A <code>PP_TimeTicks</code> indicating the time + * when the event occurred. + * + * @param[in] text The string returned by <code>GetText</code>. + * + * @param[in] segment_number The number returned by + * <code>GetSegmentNumber</code>. + * + * @param[in] segment_offsets The array of numbers returned by + * <code>GetSegmentOffset</code>. If <code>segment_number</code> is zero, + * the number of elements of the array should be zero. If + * <code>segment_number</code> is non-zero, the length of the array must be + * <code>segment_number</code> + 1. + * + * @param[in] target_segment The number returned by + * <code>GetTargetSegment</code>. + * + * @param[in] selection_start The start index returned by + * <code>GetSelection</code>. + * + * @param[in] selection_end The end index returned by + * <code>GetSelection</code>. + * + * @return A <code>PP_Resource</code> containing the new IME input event. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + struct PP_Var text, + uint32_t segment_number, + const uint32_t segment_offsets[], + int32_t target_segment, + uint32_t selection_start, + uint32_t selection_end); + /** + * IsIMEInputEvent() determines if a resource is an IME event. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to an event. + * + * @return <code>PP_TRUE</code> if the given resource is a valid input event. + */ + PP_Bool (*IsIMEInputEvent)(PP_Resource resource); + /** + * GetText() returns the composition text as a UTF-8 string for the given IME + * event. + * + * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME + * event. + * + * @return A string var representing the composition text. For non-IME input + * events the return value will be an undefined var. + */ + struct PP_Var (*GetText)(PP_Resource ime_event); + /** + * GetSegmentNumber() returns the number of segments in the composition text. + * + * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME + * event. + * + * @return The number of segments. For events other than COMPOSITION_UPDATE, + * returns 0. + */ + uint32_t (*GetSegmentNumber)(PP_Resource ime_event); + /** + * GetSegmentOffset() returns the position of the index-th segmentation point + * in the composition text. The position is given by a byte-offset (not a + * character-offset) of the string returned by GetText(). It always satisfies + * 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1) + * < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()). + * Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range + * of the i-th segment, and hence GetSegmentNumber() can be a valid argument + * to this function instead of an off-by-1 error. + * + * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME + * event. + * + * @param[in] index An integer indicating a segment. + * + * @return The byte-offset of the segmentation point. If the event is not + * COMPOSITION_UPDATE or index is out of range, returns 0. + */ + uint32_t (*GetSegmentOffset)(PP_Resource ime_event, uint32_t index); + /** + * GetTargetSegment() returns the index of the current target segment of + * composition. + * + * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME + * event. + * + * @return An integer indicating the index of the target segment. When there + * is no active target segment, or the event is not COMPOSITION_UPDATE, + * returns -1. + */ + int32_t (*GetTargetSegment)(PP_Resource ime_event); + /** + * GetSelection() returns the range selected by caret in the composition text. + * + * @param[in] ime_event A <code>PP_Resource</code> corresponding to an IME + * event. + * + * @param[out] start The start position of the current selection. + * + * @param[out] end The end position of the current selection. + */ + void (*GetSelection)(PP_Resource ime_event, uint32_t* start, uint32_t* end); +}; + +typedef struct PPB_IMEInputEvent_1_0 PPB_IMEInputEvent; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_INPUT_EVENT_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_instance.h
Added
@@ -0,0 +1,86 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_instance.idl modified Fri Dec 07 12:57:46 2012. */ + +#ifndef PPAPI_C_PPB_INSTANCE_H_ +#define PPAPI_C_PPB_INSTANCE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_INSTANCE_INTERFACE_1_0 "PPB_Instance;1.0" +#define PPB_INSTANCE_INTERFACE PPB_INSTANCE_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_Instance</code> interface implemented by the + * browser and containing pointers to functions related to + * the module instance on a web page. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Instance interface contains pointers to functions + * related to the module instance on a web page. + */ +struct PPB_Instance_1_0 { + /** + * BindGraphics() binds the given graphics as the current display surface. + * The contents of this device is what will be displayed in the instance's + * area on the web page. The device must be a 2D or a 3D device. + * + * You can pass a <code>NULL</code> resource as the device parameter to + * unbind all devices from the given instance. The instance will then appear + * transparent. Re-binding the same device will return <code>PP_TRUE</code> + * and will do nothing. + * + * Any previously-bound device will be released. It is an error to bind + * a device when it is already bound to another instance. If you want + * to move a device between instances, first unbind it from the old one, and + * then rebind it to the new one. + * + * Binding a device will invalidate that portion of the web page to flush the + * contents of the new device to the screen. + * + * @param[in] instance A PP_Instance identifying one instance of a module. + * @param[in] device A PP_Resource corresponding to a graphics device. + * + * @return <code>PP_Bool</code> containing <code>PP_TRUE</code> if bind was + * successful or <code>PP_FALSE</code> if the device was not the correct + * type. On success, a reference to the device will be held by the + * instance, so the caller can release its reference if it chooses. + */ + PP_Bool (*BindGraphics)(PP_Instance instance, PP_Resource device); + /** + * IsFullFrame() determines if the instance is full-frame. Such an instance + * represents the entire document in a frame rather than an embedded + * resource. This can happen if the user does a top-level navigation or the + * page specifies an iframe to a resource with a MIME type registered by the + * module. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * + * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the + * instance is full-frame. + */ + PP_Bool (*IsFullFrame)(PP_Instance instance); +}; + +typedef struct PPB_Instance_1_0 PPB_Instance; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_INSTANCE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_media_stream_audio_track.h
Added
@@ -0,0 +1,215 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_media_stream_audio_track.idl modified Wed May 28 09:36:15 2014. */ + +#ifndef PPAPI_C_PPB_MEDIA_STREAM_AUDIO_TRACK_H_ +#define PPAPI_C_PPB_MEDIA_STREAM_AUDIO_TRACK_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_MEDIASTREAMAUDIOTRACK_INTERFACE_0_1 "PPB_MediaStreamAudioTrack;0.1" +#define PPB_MEDIASTREAMAUDIOTRACK_INTERFACE \ + PPB_MEDIASTREAMAUDIOTRACK_INTERFACE_0_1 + +/** + * @file + * Defines the <code>PPB_MediaStreamAudioTrack</code> interface. Used for + * receiving audio samples from a MediaStream audio track in the browser. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains audio track attributes which are used by + * <code>Configure()</code>. + */ +typedef enum { + /** + * Attribute list terminator. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE = 0, + /** + * The maximum number of buffers to hold audio samples. + * Note: this is only used as advisory; the browser may allocate more or fewer + * based on available resources. How many buffers depends on usage - + * request at least 2 to make sure latency doesn't cause lost samples. If + * the plugin expects to hold on to more than one buffer at a time (e.g. to do + * multi-buffer processing), it should request that many more. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERS = 1, + /** + * The sample rate of audio data in buffers. The attribute value is a + * <code>PP_AudioBuffer_SampleRate</code>. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_RATE = 2, + /** + * The sample size of audio data in buffers in bytes. The attribute value is a + * <code>PP_AudioBuffer_SampleSize</code>. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_SIZE = 3, + /** + * The number of channels in audio buffers. + * + * Supported values: 1, 2 + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_CHANNELS = 4, + /** + * The duration of an audio buffer in milliseconds. + * + * Valid range: 10 to 10000 + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_DURATION = 5 +} PP_MediaStreamAudioTrack_Attrib; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_MediaStreamAudioTrack_0_1 { + /** + * Determines if a resource is a MediaStream audio track resource. + * + * @param[in] resource The <code>PP_Resource</code> to test. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a Mediastream audio track resource or <code>PP_FALSE</code> + * otherwise. + */ + PP_Bool (*IsMediaStreamAudioTrack)(PP_Resource resource); + /** + * Configures underlying buffers for incoming audio samples. + * If the application doesn't want to drop samples, then the + * <code>PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERS</code> should be + * chosen such that inter-buffer processing time variability won't overrun all + * the input buffers. If all buffers are filled, then samples will be + * dropped. The application can detect this by examining the timestamp on + * returned buffers. If <code>Configure()</code> is not called, default + * settings will be used. Calls to Configure while the plugin holds + * buffers will fail. + * Example usage from plugin code: + * @code + * int32_t attribs[] = { + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERS, 4, + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_DURATION, 10, + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE}; + * track_if->Configure(track, attribs, callback); + * @endcode + * + * @param[in] audio_track A <code>PP_Resource</code> corresponding to an audio + * resource. + * @param[in] attrib_list A list of attribute name-value pairs in which each + * attribute is immediately followed by the corresponding desired value. + * The list is terminated by + * <code>PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE</code>. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of <code>Configure()</code>. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*Configure)(PP_Resource audio_track, + const int32_t attrib_list[], + struct PP_CompletionCallback callback); + /** + * Gets attribute value for a given attribute name. + * + * @param[in] audio_track A <code>PP_Resource</code> corresponding to an audio + * resource. + * @param[in] attrib A <code>PP_MediaStreamAudioTrack_Attrib</code> for + * querying. + * @param[out] value A int32_t for storing the attribute value on success. + * Otherwise, the value will not be changed. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*GetAttrib)(PP_Resource audio_track, + PP_MediaStreamAudioTrack_Attrib attrib, + int32_t* value); + /** + * Returns the track ID of the underlying MediaStream audio track. + * + * @param[in] audio_track The <code>PP_Resource</code> to check. + * + * @return A <code>PP_Var</code> containing the MediaStream track ID as + * a string. + */ + struct PP_Var (*GetId)(PP_Resource audio_track); + /** + * Checks whether the underlying MediaStream track has ended. + * Calls to GetBuffer while the track has ended are safe to make and will + * complete, but will fail. + * + * @param[in] audio_track The <code>PP_Resource</code> to check. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * MediaStream track has ended or <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*HasEnded)(PP_Resource audio_track); + /** + * Gets the next audio buffer from the MediaStream track. + * If internal processing is slower than the incoming buffer rate, new buffers + * will be dropped from the incoming stream. Once all buffers are full, + * audio samples will be dropped until <code>RecycleBuffer()</code> is called + * to free a slot for another buffer. + * If there are no audio data in the input buffer, + * <code>PP_OK_COMPLETIONPENDING</code> will be returned immediately and the + * <code>callback</code> will be called, when a new buffer of audio samples + * is received or an error happens. + * + * @param[in] audio_track A <code>PP_Resource</code> corresponding to an audio + * resource. + * @param[out] buffer A <code>PP_Resource</code> corresponding to + * an AudioBuffer resource. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of GetBuffer(). + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*GetBuffer)(PP_Resource audio_track, + PP_Resource* buffer, + struct PP_CompletionCallback callback); + /** + * Recycles a buffer returned by <code>GetBuffer()</code>, so the track can + * reuse the buffer. And the buffer will become invalid. The caller should + * release all references it holds to <code>buffer</code> and not use it + * anymore. + * + * @param[in] audio_track A <code>PP_Resource</code> corresponding to an audio + * resource. + * @param[in] buffer A <code>PP_Resource</code> corresponding to + * an AudioBuffer resource returned by <code>GetBuffer()</code>. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*RecycleBuffer)(PP_Resource audio_track, PP_Resource buffer); + /** + * Closes the MediaStream audio track and disconnects it from the audio + * source. After calling <code>Close()</code>, no new buffers will be + * received. + * + * @param[in] audio_track A <code>PP_Resource</code> corresponding to a + * MediaStream audio track resource. + */ + void (*Close)(PP_Resource audio_track); +}; + +typedef struct PPB_MediaStreamAudioTrack_0_1 PPB_MediaStreamAudioTrack; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_MEDIA_STREAM_AUDIO_TRACK_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_media_stream_video_track.h
Added
@@ -0,0 +1,275 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_media_stream_video_track.idl modified Mon Apr 7 15:25:56 2014. */ + +#ifndef PPAPI_C_PPB_MEDIA_STREAM_VIDEO_TRACK_H_ +#define PPAPI_C_PPB_MEDIA_STREAM_VIDEO_TRACK_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_MEDIASTREAMVIDEOTRACK_INTERFACE_0_1 "PPB_MediaStreamVideoTrack;0.1" +#define PPB_MEDIASTREAMVIDEOTRACK_INTERFACE_1_0 \ + "PPB_MediaStreamVideoTrack;1.0" /* dev */ +#define PPB_MEDIASTREAMVIDEOTRACK_INTERFACE \ + PPB_MEDIASTREAMVIDEOTRACK_INTERFACE_0_1 + +/** + * @file + * Defines the <code>PPB_MediaStreamVideoTrack</code> interface. Used for + * receiving video frames from a MediaStream video track in the browser. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains video track attributes which are used by + * <code>Configure()</code>. + */ +typedef enum { + /** + * Attribute list terminator. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE = 0, + /** + * The maximum number of frames to hold in the input buffer. + * Note: this is only used as advisory; the browser may allocate more or fewer + * based on available resources. How many frames to buffer depends on usage - + * request at least 2 to make sure latency doesn't cause lost frames. If + * the plugin expects to hold on to more than one frame at a time (e.g. to do + * multi-frame processing), it should request that many more. + * If this attribute is not specified or value 0 is specified for this + * attribute, the default value will be used. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES = 1, + /** + * The width of video frames in pixels. It should be a multiple of 4. + * If the specified size is different from the video source (webcam), + * frames will be scaled to specified size. + * If this attribute is not specified or value 0 is specified, the original + * frame size of the video track will be used. + * + * Maximum value: 4096 (4K resolution). + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_WIDTH = 2, + /** + * The height of video frames in pixels. It should be a multiple of 4. + * If the specified size is different from the video source (webcam), + * frames will be scaled to specified size. + * If this attribute is not specified or value 0 is specified, the original + * frame size of the video track will be used. + * + * Maximum value: 4096 (4K resolution). + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_HEIGHT = 3, + /** + * The format of video frames. The attribute value is + * a <code>PP_VideoFrame_Format</code>. If the specified format is different + * from the video source (webcam), frames will be converted to specified + * format. + * If this attribute is not specified or value + * <code>PP_VIDEOFRAME_FORMAT_UNKNOWN</code> is specified, the orignal frame + * format of the video track will be used. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_FORMAT = 4 +} PP_MediaStreamVideoTrack_Attrib; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_MediaStreamVideoTrack_1_0 { /* dev */ + /** + * Creates a PPB_MediaStreamVideoTrack resource for video output. Call this + * when you will be creating frames and putting them to the track. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * + * @return A <code>PP_Resource</code> corresponding to a + * PPB_MediaStreamVideoTrack resource if successful, 0 if failed. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a resource is a MediaStream video track resource. + * + * @param[in] resource The <code>PP_Resource</code> to test. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a Mediastream video track resource or <code>PP_FALSE</code> + * otherwise. + */ + PP_Bool (*IsMediaStreamVideoTrack)(PP_Resource resource); + /** + * Configures underlying frame buffers for incoming frames. + * If the application doesn't want to drop frames, then the + * <code>PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES</code> should be + * chosen such that inter-frame processing time variability won't overrun the + * input buffer. If the buffer is overfilled, then frames will be dropped. + * The application can detect this by examining the timestamp on returned + * frames. If some attributes are not specified, default values will be used + * for those unspecified attributes. If <code>Configure()</code> is not + * called, default settings will be used. + * Example usage from plugin code: + * @code + * int32_t attribs[] = { + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES, 4, + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE}; + * track_if->Configure(track, attribs, callback); + * @endcode + * + * @param[in] video_track A <code>PP_Resource</code> corresponding to a video + * resource. + * @param[in] attrib_list A list of attribute name-value pairs in which each + * attribute is immediately followed by the corresponding desired value. + * The list is terminated by + * <code>PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE</code>. + * @param[in] callback <code>PP_CompletionCallback</code> to be called upon + * completion of <code>Configure()</code>. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns <code>PP_ERROR_INPROGRESS</code> if there is a pending call of + * <code>Configure()</code> or <code>GetFrame()</code>, or the plugin + * holds some frames which are not recycled with <code>RecycleFrame()</code>. + * If an error is returned, all attributes and the underlying buffer will not + * be changed. + */ + int32_t (*Configure)(PP_Resource video_track, + const int32_t attrib_list[], + struct PP_CompletionCallback callback); + /** + * Gets attribute value for a given attribute name. + * + * @param[in] video_track A <code>PP_Resource</code> corresponding to a video + * resource. + * @param[in] attrib A <code>PP_MediaStreamVideoTrack_Attrib</code> for + * querying. + * @param[out] value A int32_t for storing the attribute value on success. + * Otherwise, the value will not be changed. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*GetAttrib)(PP_Resource video_track, + PP_MediaStreamVideoTrack_Attrib attrib, + int32_t* value); + /** + * Returns the track ID of the underlying MediaStream video track. + * + * @param[in] video_track The <code>PP_Resource</code> to check. + * + * @return A <code>PP_Var</code> containing the MediaStream track ID as + * a string. + */ + struct PP_Var (*GetId)(PP_Resource video_track); + /** + * Checks whether the underlying MediaStream track has ended. + * Calls to GetFrame while the track has ended are safe to make and will + * complete, but will fail. + * + * @param[in] video_track The <code>PP_Resource</code> to check. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * MediaStream track has ended or <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*HasEnded)(PP_Resource video_track); + /** + * Gets the next video frame from the MediaStream track. + * If internal processing is slower than the incoming frame rate, new frames + * will be dropped from the incoming stream. Once the input buffer is full, + * frames will be dropped until <code>RecycleFrame()</code> is called to free + * a spot for another frame to be buffered. + * If there are no frames in the input buffer, + * <code>PP_OK_COMPLETIONPENDING</code> will be returned immediately and the + * <code>callback</code> will be called when a new frame is received or an + * error happens. + * + * @param[in] video_track A <code>PP_Resource</code> corresponding to a video + * resource. + * @param[out] frame A <code>PP_Resource</code> corresponding to a VideoFrame + * resource. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of GetFrame(). + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_NOMEMORY if <code>max_buffered_frames</code> frames buffer + * was not allocated successfully. + */ + int32_t (*GetFrame)(PP_Resource video_track, + PP_Resource* frame, + struct PP_CompletionCallback callback); + /** + * Recycles a frame returned by <code>GetFrame()</code>, so the track can + * reuse the underlying buffer of this frame. And the frame will become + * invalid. The caller should release all references it holds to + * <code>frame</code> and not use it anymore. + * + * @param[in] video_track A <code>PP_Resource</code> corresponding to a video + * resource. + * @param[in] frame A <code>PP_Resource</code> corresponding to a VideoFrame + * resource returned by <code>GetFrame()</code>. + * + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + */ + int32_t (*RecycleFrame)(PP_Resource video_track, PP_Resource frame); + /** + * Closes the MediaStream video track and disconnects it from video source. + * After calling <code>Close()</code>, no new frames will be received. + * + * @param[in] video_track A <code>PP_Resource</code> corresponding to a + * MediaStream video track resource. + */ + void (*Close)(PP_Resource video_track); + /** + * Gets a free frame for output. The frame is allocated by + * <code>Configure()</code>. The caller should fill it with frame data, and + * then use |PutFrame()| to send the frame back. + */ + int32_t (*GetEmptyFrame)(PP_Resource video_track, + PP_Resource* frame, + struct PP_CompletionCallback callback); + /** + * Sends a frame returned by |GetEmptyFrame()| to the output track. + * After this function, the |frame| should not be used anymore and the + * caller should release the reference that it holds. + */ + int32_t (*PutFrame)(PP_Resource video_track, PP_Resource frame); +}; + +struct PPB_MediaStreamVideoTrack_0_1 { + PP_Bool (*IsMediaStreamVideoTrack)(PP_Resource resource); + int32_t (*Configure)(PP_Resource video_track, + const int32_t attrib_list[], + struct PP_CompletionCallback callback); + int32_t (*GetAttrib)(PP_Resource video_track, + PP_MediaStreamVideoTrack_Attrib attrib, + int32_t* value); + struct PP_Var (*GetId)(PP_Resource video_track); + PP_Bool (*HasEnded)(PP_Resource video_track); + int32_t (*GetFrame)(PP_Resource video_track, + PP_Resource* frame, + struct PP_CompletionCallback callback); + int32_t (*RecycleFrame)(PP_Resource video_track, PP_Resource frame); + void (*Close)(PP_Resource video_track); +}; + +typedef struct PPB_MediaStreamVideoTrack_0_1 PPB_MediaStreamVideoTrack; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_MEDIA_STREAM_VIDEO_TRACK_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_message_loop.h
Added
@@ -0,0 +1,291 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_message_loop.idl modified Thu May 9 14:59:57 2013. */ + +#ifndef PPAPI_C_PPB_MESSAGE_LOOP_H_ +#define PPAPI_C_PPB_MESSAGE_LOOP_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_MESSAGELOOP_INTERFACE_1_0 "PPB_MessageLoop;1.0" +#define PPB_MESSAGELOOP_INTERFACE PPB_MESSAGELOOP_INTERFACE_1_0 + +/** + * @file + * Defines the PPB_MessageLoop interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * A message loop allows PPAPI calls to be issued on a thread. You may not + * issue any API calls on a thread without creating a message loop. It also + * allows you to post work to the message loop for a thread. + * + * To process work posted to the message loop, as well as completion callbacks + * for asynchronous operations, you must run the message loop via Run(). + * + * Note the system manages the lifetime of the instance (and all associated + * resources). If the instance is deleted from the page, background threads may + * suddenly see their PP_Resource handles become invalid. In this case, calls + * will fail with PP_ERROR_BADRESOURCE. If you need to access data associated + * with your instance, you will probably want to create some kind of threadsafe + * proxy object that can handle asynchronous destruction of the instance object. + * + * Typical usage: + * On the main thread: + * - Create the thread yourself (using pthreads). + * - Create the message loop resource. + * - Pass the message loop resource to your thread's main function. + * - Call PostWork() on the message loop to run functions on the thread. + * + * From the background thread's main function: + * - Call AttachToCurrentThread() with the message loop resource. + * - Call Run() with the message loop resource. + * + * Your callbacks should look like this: + * @code + * void DoMyWork(void* user_data, int32_t status) { + * if (status != PP_OK) { + * Cleanup(); // e.g. free user_data. + * return; + * } + * ... do your work... + * } + * @endcode + * For a C++ example, see ppapi/utility/threading/simple_thread.h + * + * (You can also create the message loop resource on the background thread, + * but then the main thread will have no reference to it should you want to + * call PostWork()). + * + * + * THREAD HANDLING + * + * The main thread has an implicitly created message loop. The main thread is + * the thread where PPP_InitializeModule and PPP_Instance functions are called. + * You can retrieve a reference to this message loop by calling + * GetForMainThread() or, if your code is on the main thread, GetCurrent() will + * also work. + * + * Some special threads created by the system can not have message loops. In + * particular, the background thread created for audio processing has this + * requirement because it's intended to be highly responsive to keep up with + * the realtime requirements of audio processing. You can not make PPAPI calls + * from these threads. + * + * Once you associate a message loop with a thread, you don't have to keep a + * reference to it. The system will hold a reference to the message loop for as + * long as the thread is running. The current message loop can be retrieved + * using the GetCurrent() function. + * + * It is legal to create threads in your plugin without message loops, but + * PPAPI calls will fail unless explicitly noted in the documentation. + * + * You can create a message loop object on a thread and never actually run the + * message loop. This will allow you to call blocking PPAPI calls (via + * PP_BlockUntilComplete()). If you make any asynchronous calls, the callbacks + * from those calls will be queued in the message loop and never run. The same + * thing will happen if work is scheduled after the message loop exits and + * the message loop is not run again. + * + * + * DESTRUCTION AND ERROR HANDLING + * + * Often, your application will associate memory with completion callbacks. For + * example, the C++ CompletionCallbackFactory has a small amount of + * heap-allocated memory for each callback. This memory will be leaked if the + * callback is never run. To avoid this memory leak, you need to be careful + * about error handling and shutdown. + * + * There are a number of cases where posted callbacks will never be run: + * + * - You tear down the thread (via pthreads) without "destroying" the message + * loop (via PostQuit with should_destroy = PP_TRUE). In this case, any + * tasks in the message queue will be lost. + * + * - You create a message loop, post callbacks to it, and never run it. + * + * - You quit the message loop via PostQuit with should_destroy set to + * PP_FALSE. In this case, the system will assume the message loop will be + * run again later and keep your tasks. + * + * To do proper shutdown, call PostQuit with should_destroy = PP_TRUE. This + * will prohibit future work from being posted, and will allow the message loop + * to run until all pending tasks are run. + * + * If you post a callback to a message loop that's been destroyed, or to an + * invalid message loop, PostWork will return an error and will not run the + * callback. This is true even for callbacks with the "required" flag set, + * since the system may not even know what thread to issue the error callback + * on. + * + * Therefore, you should check for errors from PostWork and destroy any + * associated memory to avoid leaks. If you're using the C++ + * CompletionCallbackFactory, use the following pattern: + * @code + * pp::CompletionCallback callback = factory_.NewOptionalCallback(...); + * int32_t result = message_loop.PostWork(callback); + * if (result != PP_OK) + * callback.Run(result); + * @endcode + * This will run the callback with an error value, and assumes that the + * implementation of your callback checks the "result" argument and returns + * immediately on error. + */ +struct PPB_MessageLoop_1_0 { + /** + * Creates a message loop resource. + * + * This may be called from any thread. After your thread starts but before + * issuing any other PPAPI calls on it, you must associate it with a message + * loop by calling AttachToCurrentThread. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Returns a resource identifying the message loop for the main thread. The + * main thread always has a message loop created by the system. + */ + PP_Resource (*GetForMainThread)(void); + /** + * Returns a reference to the PPB_MessageLoop object attached to the current + * thread. If there is no attached message loop, the return value will be 0. + */ + PP_Resource (*GetCurrent)(void); + /** + * Sets the given message loop resource as being the associated message loop + * for the currently running thread. + * + * You must call this function exactly once on a thread before making any + * PPAPI calls. A message loop can only be attached to one thread, and the + * message loop can not be changed later. The message loop will be attached + * as long as the thread is running or until you quit with should_destroy + * set to PP_TRUE. + * + * If this function fails, attempting to run the message loop will fail. + * Note that you can still post work to the message loop: it will get queued + * up should the message loop eventually be successfully attached and run. + * + * @return + * - PP_OK: The message loop was successfully attached to the thread and is + * ready to use. + * - PP_ERROR_BADRESOURCE: The given message loop resource is invalid. + * - PP_ERROR_INPROGRESS: The current thread already has a message loop + * attached. This will always be the case for the main thread, which has + * an implicit system-created message loop attached. + * - PP_ERROR_WRONG_THREAD: The current thread type can not have a message + * loop attached to it. See the interface level discussion about these + * special threads, which include realtime audio threads. + */ + int32_t (*AttachToCurrentThread)(PP_Resource message_loop); + /** + * Runs the thread message loop. Running the message loop is required for you + * to get issued completion callbacks on the thread. + * + * The message loop identified by the argument must have been previously + * successfully attached to the current thread. + * + * You may not run nested message loops. Since the main thread has an + * implicit message loop that the system runs, you may not call Run on the + * main thread. + * + * @return + * - PP_OK: The message loop was successfully run. Note that on + * success, the message loop will only exit when you call PostQuit(). + * - PP_ERROR_BADRESOURCE: The given message loop resource is invalid. + * - PP_ERROR_WRONG_THREAD: You are attempting to run a message loop that + * has not been successfully attached to the current thread. Call + * AttachToCurrentThread(). + * - PP_ERROR_INPROGRESS: You are attempting to call Run in a nested + * fashion (Run is already on the stack). This will occur if you attempt + * to call run on the main thread's message loop (see above). + */ + int32_t (*Run)(PP_Resource message_loop); + /** + * Schedules work to run on the given message loop. This may be called from + * any thread. Posted work will be executed in the order it was posted when + * the message loop is Run(). + * + * @param message_loop The message loop resource. + * + * @param callback The completion callback to execute from the message loop. + * + * @param delay_ms The number of milliseconds to delay execution of the given + * completion callback. Passing 0 means it will get queued normally and + * executed in order. + * + * + * The completion callback will be called with PP_OK as the "result" parameter + * if it is run normally. It is good practice to check for PP_OK and return + * early otherwise. + * + * The "required" flag on the completion callback is ignored. If there is an + * error posting your callback, the error will be returned from PostWork and + * the callback will never be run (because there is no appropriate place to + * run your callback with an error without causing unexpected threading + * problems). If you associate memory with the completion callback (for + * example, you're using the C++ CompletionCallbackFactory), you will need to + * free this or manually run the callback. See "Destruction and error + * handling" above. + * + * + * You can call this function before the message loop has started and the + * work will get queued until the message loop is run. You can also post + * work after the message loop has exited as long as should_destroy was + * PP_FALSE. It will be queued until the next invocation of Run(). + * + * @return + * - PP_OK: The work was posted to the message loop's queue. As described + * above, this does not mean that the work has been or will be executed + * (if you never run the message loop after posting). + * - PP_ERROR_BADRESOURCE: The given message loop resource is invalid. + * - PP_ERROR_BADARGUMENT: The function pointer for the completion callback + * is null (this will be the case if you pass PP_BlockUntilComplete()). + * - PP_ERROR_FAILED: The message loop has been destroyed. + */ + int32_t (*PostWork)(PP_Resource message_loop, + struct PP_CompletionCallback callback, + int64_t delay_ms); + /** + * Posts a quit message to the given message loop's work queue. Work posted + * before that point will be processed before quitting. + * + * This may be called on the message loop registered for the current thread, + * or it may be called on the message loop registered for another thread. It + * is an error to attempt to PostQuit() the main thread loop. + * + * @param should_destroy Marks the message loop as being in a destroyed state + * and prevents further posting of messages. + * + * If you quit a message loop without setting should_destroy, it will still + * be attached to the thread and you can still run it again by calling Run() + * again. If you destroy it, it will be detached from the current thread. + * + * @return + * - PP_OK: The request to quit was successfully posted. + * - PP_ERROR_BADRESOURCE: The message loop was invalid. + * - PP_ERROR_WRONG_THREAD: You are attempting to quit the main thread. + * The main thread's message loop is managed by the system and can't be + * quit. + */ + int32_t (*PostQuit)(PP_Resource message_loop, PP_Bool should_destroy); +}; + +typedef struct PPB_MessageLoop_1_0 PPB_MessageLoop; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_MESSAGE_LOOP_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_messaging.h
Added
@@ -0,0 +1,170 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_messaging.idl modified Wed Sep 24 10:48:37 2014. */ + +#ifndef PPAPI_C_PPB_MESSAGING_H_ +#define PPAPI_C_PPB_MESSAGING_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/ppp_message_handler.h" + +#define PPB_MESSAGING_INTERFACE_1_0 "PPB_Messaging;1.0" +#define PPB_MESSAGING_INTERFACE_1_2 "PPB_Messaging;1.2" +#define PPB_MESSAGING_INTERFACE PPB_MESSAGING_INTERFACE_1_2 + +/** + * @file + * This file defines the <code>PPB_Messaging</code> interface implemented + * by the browser for sending messages to DOM elements associated with a + * specific module instance. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_Messaging</code> interface is implemented by the browser + * and is related to sending messages to JavaScript message event listeners on + * the DOM element associated with specific module instance. + */ +struct PPB_Messaging_1_2 { + /** + * PostMessage() asynchronously invokes any listeners for message events on + * the DOM element for the given module instance. A call to PostMessage() + * will not block while the message is processed. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] message A <code>PP_Var</code> containing the data to be sent to + * JavaScript. + * <code>message</code> can be any <code>PP_Var</code> type except + * <code>PP_VARTYPE_OBJECT</code>. Array/Dictionary types are supported from + * Chrome M29 onward. All var types are copied when passing them to + * JavaScript. + * + * When passing array or dictionary <code>PP_Var</code>s, the entire reference + * graph will be converted and transferred. If the reference graph has cycles, + * the message will not be sent and an error will be logged to the console. + * + * Listeners for message events in JavaScript code will receive an object + * conforming to the HTML 5 <code>MessageEvent</code> interface. + * Specifically, the value of message will be contained as a property called + * data in the received <code>MessageEvent</code>. + * + * This messaging system is similar to the system used for listening for + * messages from Web Workers. Refer to + * <code>http://www.whatwg.org/specs/web-workers/current-work/</code> for + * further information. + * + * <strong>Example:</strong> + * + * @code + * + * <body> + * <object id="plugin" + * type="application/x-ppapi-postMessage-example"/> + * <script type="text/javascript"> + * var plugin = document.getElementById('plugin'); + * plugin.addEventListener("message", + * function(message) { alert(message.data); }, + * false); + * </script> + * </body> + * + * @endcode + * + * The module instance then invokes PostMessage() as follows: + * + * @code + * + * char hello_world[] = "Hello world!"; + * PP_Var hello_var = ppb_var_interface->VarFromUtf8(instance, + * hello_world, + * sizeof(hello_world)); + * ppb_messaging_interface->PostMessage(instance, hello_var); // Copies var. + * ppb_var_interface->Release(hello_var); + * + * @endcode + * + * The browser will pop-up an alert saying "Hello world!" + */ + void (*PostMessage)(PP_Instance instance, struct PP_Var message); + /** + * Registers a handler for receiving messages from JavaScript. If a handler + * is registered this way, it will replace PPP_Messaging, and all messages + * sent from JavaScript via postMessage and postMessageAndAwaitResponse will + * be dispatched to <code>handler</code>. + * + * The function calls will be dispatched via <code>message_loop</code>. This + * means that the functions will be invoked on the thread to which + * <code>message_loop</code> is attached, when <code>message_loop</code> is + * run. It is illegal to pass the main thread message loop; + * RegisterMessageHandler will return PP_ERROR_WRONG_THREAD in that case. + * If you quit <code>message_loop</code> before calling Unregister(), + * the browser will not be able to call functions in the plugin's message + * handler any more. That could mean missing some messages or could cause a + * leak if you depend on Destroy() to free hander data. So you should, + * whenever possible, Unregister() the handler prior to quitting its event + * loop. + * + * Attempting to register a message handler when one is already registered + * will cause the current MessageHandler to be unregistered and replaced. In + * that case, no messages will be sent to the "default" message handler + * (PPP_Messaging). Messages will stop arriving at the prior message handler + * and will begin to be dispatched at the new message handler. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] user_data A pointer the plugin may choose to use when handling + * calls to functions within PPP_MessageHandler. The browser will pass this + * same pointer when invoking functions within PPP_MessageHandler. + * @param[in] handler The plugin-provided set of functions for handling + * messages. + * @param[in] message_loop Represents the message loop on which + * PPP_MessageHandler functions should be invoked. + * @return PP_OK on success, or an error from pp_errors.h. + */ + int32_t (*RegisterMessageHandler)( + PP_Instance instance, + void* user_data, + const struct PPP_MessageHandler_0_2* handler, + PP_Resource message_loop); + /** + * Unregisters the current message handler for <code>instance</code> if one + * is registered. After this call, the message handler (if one was + * registered) will have "Destroy" called on it and will receive no further + * messages after that point. After that point, all messages sent from + * JavaScript using postMessage() will be dispatched to PPP_Messaging (if + * the plugin supports PPP_MESSAGING_INTERFACE). Attempts to call + * postMessageAndAwaitResponse() from JavaScript will fail. + * + * Attempting to unregister a message handler when none is registered has no + * effect. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + */ + void (*UnregisterMessageHandler)(PP_Instance instance); +}; + +typedef struct PPB_Messaging_1_2 PPB_Messaging; + +struct PPB_Messaging_1_0 { + void (*PostMessage)(PP_Instance instance, struct PP_Var message); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_MESSAGING_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_mouse_cursor.h
Added
@@ -0,0 +1,138 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_mouse_cursor.idl modified Thu Mar 28 10:11:32 2013. */ + +#ifndef PPAPI_C_PPB_MOUSE_CURSOR_H_ +#define PPAPI_C_PPB_MOUSE_CURSOR_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_MOUSECURSOR_INTERFACE_1_0 "PPB_MouseCursor;1.0" +#define PPB_MOUSECURSOR_INTERFACE PPB_MOUSECURSOR_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_MouseCursor</code> interface for setting + * the mouse cursor. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * The <code>PP_MouseCursor_Type</code> enumeration lists the available stock + * cursor types. + */ +enum PP_MouseCursor_Type { + PP_MOUSECURSOR_TYPE_CUSTOM = -1, + PP_MOUSECURSOR_TYPE_POINTER = 0, + PP_MOUSECURSOR_TYPE_CROSS = 1, + PP_MOUSECURSOR_TYPE_HAND = 2, + PP_MOUSECURSOR_TYPE_IBEAM = 3, + PP_MOUSECURSOR_TYPE_WAIT = 4, + PP_MOUSECURSOR_TYPE_HELP = 5, + PP_MOUSECURSOR_TYPE_EASTRESIZE = 6, + PP_MOUSECURSOR_TYPE_NORTHRESIZE = 7, + PP_MOUSECURSOR_TYPE_NORTHEASTRESIZE = 8, + PP_MOUSECURSOR_TYPE_NORTHWESTRESIZE = 9, + PP_MOUSECURSOR_TYPE_SOUTHRESIZE = 10, + PP_MOUSECURSOR_TYPE_SOUTHEASTRESIZE = 11, + PP_MOUSECURSOR_TYPE_SOUTHWESTRESIZE = 12, + PP_MOUSECURSOR_TYPE_WESTRESIZE = 13, + PP_MOUSECURSOR_TYPE_NORTHSOUTHRESIZE = 14, + PP_MOUSECURSOR_TYPE_EASTWESTRESIZE = 15, + PP_MOUSECURSOR_TYPE_NORTHEASTSOUTHWESTRESIZE = 16, + PP_MOUSECURSOR_TYPE_NORTHWESTSOUTHEASTRESIZE = 17, + PP_MOUSECURSOR_TYPE_COLUMNRESIZE = 18, + PP_MOUSECURSOR_TYPE_ROWRESIZE = 19, + PP_MOUSECURSOR_TYPE_MIDDLEPANNING = 20, + PP_MOUSECURSOR_TYPE_EASTPANNING = 21, + PP_MOUSECURSOR_TYPE_NORTHPANNING = 22, + PP_MOUSECURSOR_TYPE_NORTHEASTPANNING = 23, + PP_MOUSECURSOR_TYPE_NORTHWESTPANNING = 24, + PP_MOUSECURSOR_TYPE_SOUTHPANNING = 25, + PP_MOUSECURSOR_TYPE_SOUTHEASTPANNING = 26, + PP_MOUSECURSOR_TYPE_SOUTHWESTPANNING = 27, + PP_MOUSECURSOR_TYPE_WESTPANNING = 28, + PP_MOUSECURSOR_TYPE_MOVE = 29, + PP_MOUSECURSOR_TYPE_VERTICALTEXT = 30, + PP_MOUSECURSOR_TYPE_CELL = 31, + PP_MOUSECURSOR_TYPE_CONTEXTMENU = 32, + PP_MOUSECURSOR_TYPE_ALIAS = 33, + PP_MOUSECURSOR_TYPE_PROGRESS = 34, + PP_MOUSECURSOR_TYPE_NODROP = 35, + PP_MOUSECURSOR_TYPE_COPY = 36, + PP_MOUSECURSOR_TYPE_NONE = 37, + PP_MOUSECURSOR_TYPE_NOTALLOWED = 38, + PP_MOUSECURSOR_TYPE_ZOOMIN = 39, + PP_MOUSECURSOR_TYPE_ZOOMOUT = 40, + PP_MOUSECURSOR_TYPE_GRAB = 41, + PP_MOUSECURSOR_TYPE_GRABBING = 42 +}; +PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_MouseCursor_Type, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_MouseCursor</code> allows setting the mouse cursor. + */ +struct PPB_MouseCursor_1_0 { + /** + * Sets the given mouse cursor. The mouse cursor will be in effect whenever + * the mouse is over the given instance until it is set again by another + * call. Note that you can hide the mouse cursor by setting it to the + * <code>PP_MOUSECURSOR_TYPE_NONE</code> type. + * + * This function allows setting both system defined mouse cursors and + * custom cursors. To set a system-defined cursor, pass the type you want + * and set the custom image to 0 and the hot spot to NULL. To set a custom + * cursor, set the type to <code>PP_MOUSECURSOR_TYPE_CUSTOM</code> and + * specify your image and hot spot. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * that the mouse cursor will affect. + * + * @param[in] type A <code>PP_MouseCursor_Type</code> identifying the type of + * mouse cursor to show. + * + * @param[in] image A <code>PPB_ImageData</code> resource identifying the + * custom image to set when the type is + * <code>PP_MOUSECURSOR_TYPE_CUSTOM</code>. The image must be less than 32 + * pixels in each direction and must be of the system's native image format. + * When you are specifying a predefined cursor, this parameter must be 0. + * + * @param[in] hot_spot When setting a custom cursor, this identifies the + * pixel position within the given image of the "hot spot" of the cursor. + * When specifying a stock cursor, this parameter is ignored. + * + * @return PP_TRUE on success, or PP_FALSE if the instance or cursor type + * is invalid, or if the image is too large. + */ + PP_Bool (*SetCursor)(PP_Instance instance, + enum PP_MouseCursor_Type type, + PP_Resource image, + const struct PP_Point* hot_spot); +}; + +typedef struct PPB_MouseCursor_1_0 PPB_MouseCursor; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_MOUSE_CURSOR_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_mouse_lock.h
Added
@@ -0,0 +1,82 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_mouse_lock.idl modified Mon Dec 17 16:09:50 2012. */ + +#ifndef PPAPI_C_PPB_MOUSE_LOCK_H_ +#define PPAPI_C_PPB_MOUSE_LOCK_H_ + +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_MOUSELOCK_INTERFACE_1_0 "PPB_MouseLock;1.0" +#define PPB_MOUSELOCK_INTERFACE PPB_MOUSELOCK_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_MouseLock</code> interface for + * locking the target of mouse events to a specific module instance. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_MouseLock</code> interface is implemented by the browser. + * This interface provides a way of locking the target of mouse events to a + * single module instance and removing the cursor from view. This mode is + * useful for certain classes of applications, especially first-person + * perspective 3D applications and 3D modeling software. + */ +struct PPB_MouseLock_1_0 { + /** + * LockMouse() requests the mouse to be locked. + * + * While the mouse is locked, the cursor is implicitly hidden from the user. + * Any movement of the mouse will generate a + * <code>PP_INPUTEVENT_TYPE_MOUSEMOVE</code> event. The + * <code>GetPosition()</code> function in the <code>PPB_MouseInputEvent</code> + * interface reports the last known mouse position just as mouse lock was + * entered. The <code>GetMovement()</code> function provides relative movement + * information indicating what the change in position of the mouse would be + * had it not been locked. + * + * The browser may revoke the mouse lock for reasons including (but not + * limited to) the user pressing the ESC key, the user activating another + * program using a reserved keystroke (e.g. ALT+TAB), or some other system + * event. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*LockMouse)(PP_Instance instance, + struct PP_CompletionCallback callback); + /** + * UnlockMouse() causes the mouse to be unlocked, allowing it to track user + * movement again. This is an asynchronous operation. The module instance + * will be notified using the <code>PPP_MouseLock</code> interface when it + * has lost the mouse lock. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + */ + void (*UnlockMouse)(PP_Instance instance); +}; + +typedef struct PPB_MouseLock_1_0 PPB_MouseLock; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_MOUSE_LOCK_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_net_address.h
Added
@@ -0,0 +1,203 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_net_address.idl modified Sat Jun 22 10:14:31 2013. */ + +#ifndef PPAPI_C_PPB_NET_ADDRESS_H_ +#define PPAPI_C_PPB_NET_ADDRESS_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_NETADDRESS_INTERFACE_1_0 "PPB_NetAddress;1.0" +#define PPB_NETADDRESS_INTERFACE PPB_NETADDRESS_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_NetAddress</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * Network address family types. + */ +typedef enum { + /** + * The address family is unspecified. + */ + PP_NETADDRESS_FAMILY_UNSPECIFIED = 0, + /** + * The Internet Protocol version 4 (IPv4) address family. + */ + PP_NETADDRESS_FAMILY_IPV4 = 1, + /** + * The Internet Protocol version 6 (IPv6) address family. + */ + PP_NETADDRESS_FAMILY_IPV6 = 2 +} PP_NetAddress_Family; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetAddress_Family, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * All members are expressed in network byte order. + */ +struct PP_NetAddress_IPv4 { + /** + * Port number. + */ + uint16_t port; + /** + * IPv4 address. + */ + uint8_t addr[4]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv4, 6); + +/** + * All members are expressed in network byte order. + */ +struct PP_NetAddress_IPv6 { + /** + * Port number. + */ + uint16_t port; + /** + * IPv6 address. + */ + uint8_t addr[16]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv6, 18); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_NetAddress</code> interface provides operations on network + * addresses. + */ +struct PPB_NetAddress_1_0 { + /** + * Creates a <code>PPB_NetAddress</code> resource with the specified IPv4 + * address. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * @param[in] ipv4_addr An IPv4 address. + * + * @return A <code>PP_Resource</code> representing the same address as + * <code>ipv4_addr</code> or 0 on failure. + */ + PP_Resource (*CreateFromIPv4Address)( + PP_Instance instance, + const struct PP_NetAddress_IPv4* ipv4_addr); + /** + * Creates a <code>PPB_NetAddress</code> resource with the specified IPv6 + * address. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * @param[in] ipv6_addr An IPv6 address. + * + * @return A <code>PP_Resource</code> representing the same address as + * <code>ipv6_addr</code> or 0 on failure. + */ + PP_Resource (*CreateFromIPv6Address)( + PP_Instance instance, + const struct PP_NetAddress_IPv6* ipv6_addr); + /** + * Determines if a given resource is a network address. + * + * @param[in] resource A <code>PP_Resource</code> to check. + * + * @return <code>PP_TRUE</code> if the input is a <code>PPB_NetAddress</code> + * resource; <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsNetAddress)(PP_Resource resource); + /** + * Gets the address family. + * + * @param[in] addr A <code>PP_Resource</code> corresponding to a network + * address. + * + * @return The address family on success; + * <code>PP_NETADDRESS_FAMILY_UNSPECIFIED</code> on failure. + */ + PP_NetAddress_Family (*GetFamily)(PP_Resource addr); + /** + * Returns a human-readable description of the network address. The + * description is in the form of host [ ":" port ] and conforms to + * http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses + * (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). + * + * @param[in] addr A <code>PP_Resource</code> corresponding to a network + * address. + * @param[in] include_port Whether to include the port number in the + * description. + * + * @return A string <code>PP_Var</code> on success; an undefined + * <code>PP_Var</code> on failure. + */ + struct PP_Var (*DescribeAsString)(PP_Resource addr, PP_Bool include_port); + /** + * Fills a <code>PP_NetAddress_IPv4</code> structure if the network address is + * of <code>PP_NETADDRESS_FAMILY_IPV4</code> address family. + * Note that passing a network address of + * <code>PP_NETADDRESS_FAMILY_IPV6</code> address family will fail even if the + * address is an IPv4-mapped IPv6 address. + * + * @param[in] addr A <code>PP_Resource</code> corresponding to a network + * address. + * @param[out] ipv4_addr A <code>PP_NetAddress_IPv4</code> structure to store + * the result. + * + * @return A <code>PP_Bool</code> value indicating whether the operation + * succeeded. + */ + PP_Bool (*DescribeAsIPv4Address)(PP_Resource addr, + struct PP_NetAddress_IPv4* ipv4_addr); + /** + * Fills a <code>PP_NetAddress_IPv6</code> structure if the network address is + * of <code>PP_NETADDRESS_FAMILY_IPV6</code> address family. + * Note that passing a network address of + * <code>PP_NETADDRESS_FAMILY_IPV4</code> address family will fail - this + * method doesn't map it to an IPv6 address. + * + * @param[in] addr A <code>PP_Resource</code> corresponding to a network + * address. + * @param[out] ipv6_addr A <code>PP_NetAddress_IPv6</code> structure to store + * the result. + * + * @return A <code>PP_Bool</code> value indicating whether the operation + * succeeded. + */ + PP_Bool (*DescribeAsIPv6Address)(PP_Resource addr, + struct PP_NetAddress_IPv6* ipv6_addr); +}; + +typedef struct PPB_NetAddress_1_0 PPB_NetAddress; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_NET_ADDRESS_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_network_list.h
Added
@@ -0,0 +1,183 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_network_list.idl modified Mon Sep 9 11:16:26 2013. */ + +#ifndef PPAPI_C_PPB_NETWORK_LIST_H_ +#define PPAPI_C_PPB_NETWORK_LIST_H_ + +#include "ppapi/c/pp_array_output.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_NETWORKLIST_INTERFACE_1_0 "PPB_NetworkList;1.0" +#define PPB_NETWORKLIST_INTERFACE PPB_NETWORKLIST_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_NetworkList</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * Type of a network interface. + */ +typedef enum { + /** + * Type of the network interface is not known. + */ + PP_NETWORKLIST_TYPE_UNKNOWN = 0, + /** + * Wired Ethernet network. + */ + PP_NETWORKLIST_TYPE_ETHERNET = 1, + /** + * Wireless Wi-Fi network. + */ + PP_NETWORKLIST_TYPE_WIFI = 2, + /** + * Cellular network (e.g. LTE). + */ + PP_NETWORKLIST_TYPE_CELLULAR = 3 +} PP_NetworkList_Type; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkList_Type, 4); + +/** + * State of a network interface. + */ +typedef enum { + /** + * Network interface is down. + */ + PP_NETWORKLIST_STATE_DOWN = 0, + /** + * Network interface is up. + */ + PP_NETWORKLIST_STATE_UP = 1 +} PP_NetworkList_State; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkList_State, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_NetworkList</code> is used to represent a list of + * network interfaces and their configuration. The content of the list + * is immutable. The current networks configuration can be received + * using the <code>PPB_NetworkMonitor</code> interface. + */ +struct PPB_NetworkList_1_0 { + /** + * Determines if the specified <code>resource</code> is a + * <code>NetworkList</code> object. + * + * @param[in] resource A <code>PP_Resource</code> resource. + * + * @return Returns <code>PP_TRUE</code> if <code>resource</code> is + * a <code>PPB_NetworkList</code>, <code>PP_FALSE</code> + * otherwise. + */ + PP_Bool (*IsNetworkList)(PP_Resource resource); + /** + * Gets number of interfaces in the list. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * network list. + * + * @return Returns number of available network interfaces or 0 if + * the list has never been updated. + */ + uint32_t (*GetCount)(PP_Resource resource); + /** + * Gets name of a network interface. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns name for the network interface with the specified + * <code>index</code>. + */ + struct PP_Var (*GetName)(PP_Resource resource, uint32_t index); + /** + * Gets type of a network interface. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns type of the network interface with the specified + * <code>index</code>. + */ + PP_NetworkList_Type (*GetType)(PP_Resource resource, uint32_t index); + /** + * Gets state of a network interface. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns current state of the network interface with the + * specified <code>index</code>. + */ + PP_NetworkList_State (*GetState)(PP_Resource resource, uint32_t index); + /** + * Gets list of IP addresses for a network interface. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * network list. + * @param[in] index Index of the network interface. + * @param[in] output An output array which will receive + * <code>PPB_NetAddress</code> resources on success. Please note that the + * ref count of those resources has already been increased by 1 for the + * caller. + * + * @return An error code from <code>pp_errors.h</code>. + */ + int32_t (*GetIpAddresses)(PP_Resource resource, + uint32_t index, + struct PP_ArrayOutput output); + /** + * Gets display name of a network interface. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns display name for the network interface with the + * specified <code>index</code>. + */ + struct PP_Var (*GetDisplayName)(PP_Resource resource, uint32_t index); + /** + * Gets MTU (Maximum Transmission Unit) of a network interface. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns MTU for the network interface with the specified + * <code>index</code> or 0 if MTU is unknown. + */ + uint32_t (*GetMTU)(PP_Resource resource, uint32_t index); +}; + +typedef struct PPB_NetworkList_1_0 PPB_NetworkList; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_NETWORK_LIST_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_network_monitor.h
Added
@@ -0,0 +1,89 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_network_monitor.idl modified Thu Sep 19 16:42:34 2013. */ + +#ifndef PPAPI_C_PPB_NETWORK_MONITOR_H_ +#define PPAPI_C_PPB_NETWORK_MONITOR_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_NETWORKMONITOR_INTERFACE_1_0 "PPB_NetworkMonitor;1.0" +#define PPB_NETWORKMONITOR_INTERFACE PPB_NETWORKMONITOR_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_NetworkMonitor</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_NetworkMonitor</code> allows to get network interfaces + * configuration and monitor network configuration changes. + * + * Permissions: Apps permission <code>socket</code> with subrule + * <code>network-state</code> is required for <code>UpdateNetworkList()</code>. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +struct PPB_NetworkMonitor_1_0 { + /** + * Creates a Network Monitor resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * + * @return A <code>PP_Resource</code> corresponding to a network monitor or 0 + * on failure. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Gets current network configuration. When called for the first time, + * completes as soon as the current network configuration is received from + * the browser. Each consequent call will wait for network list changes, + * returning a new <code>PPB_NetworkList</code> resource every time. + * + * @param[in] network_monitor A <code>PP_Resource</code> corresponding to a + * network monitor. + * @param[out] network_list The <code>PPB_NetworkList<code> resource with the + * current state of network interfaces. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have + * required permissions. + */ + int32_t (*UpdateNetworkList)(PP_Resource network_monitor, + PP_Resource* network_list, + struct PP_CompletionCallback callback); + /** + * Determines if the specified <code>resource</code> is a + * <code>NetworkMonitor</code> object. + * + * @param[in] resource A <code>PP_Resource</code> resource. + * + * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a + * <code>PPB_NetworkMonitor</code>, <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsNetworkMonitor)(PP_Resource resource); +}; + +typedef struct PPB_NetworkMonitor_1_0 PPB_NetworkMonitor; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_NETWORK_MONITOR_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_network_proxy.h
Added
@@ -0,0 +1,75 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_network_proxy.idl modified Fri Jun 21 09:37:20 2013. */ + +#ifndef PPAPI_C_PPB_NETWORK_PROXY_H_ +#define PPAPI_C_PPB_NETWORK_PROXY_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_NETWORKPROXY_INTERFACE_1_0 "PPB_NetworkProxy;1.0" +#define PPB_NETWORKPROXY_INTERFACE PPB_NETWORKPROXY_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_NetworkProxy</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * This interface provides a way to determine the appropriate proxy settings + * for a given URL. + * + * Permissions: Apps permission <code>socket</code> with subrule + * <code>resolve-proxy</code> is required for using this API. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +struct PPB_NetworkProxy_1_0 { + /** + * Retrieves the proxy that will be used for the given URL. The result will + * be a string in PAC format. For more details about PAC format, please see + * http://en.wikipedia.org/wiki/Proxy_auto-config + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * + * @param[in] url A string <code>PP_Var</code> containing a URL. + * + * @param[out] proxy_string A <code>PP_Var</code> that GetProxyForURL will + * set upon successful completion. If the call fails, <code>proxy_string + * </code> will be unchanged. Otherwise, it will be set to a string <code> + * PP_Var</code> containing the appropriate PAC string for <code>url</code>. + * If set, <code>proxy_string</code> will have a reference count of 1 which + * the plugin must manage. + * + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*GetProxyForURL)(PP_Instance instance, + struct PP_Var url, + struct PP_Var* proxy_string, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_NetworkProxy_1_0 PPB_NetworkProxy; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_NETWORK_PROXY_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_opengles2.h
Added
@@ -0,0 +1,1195 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +/* From ppb_opengles2.idl modified Fri Sep 5 14:52:51 2014. */ + +#ifndef PPAPI_C_PPB_OPENGLES2_H_ +#define PPAPI_C_PPB_OPENGLES2_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_OPENGLES2_INTERFACE_1_0 "PPB_OpenGLES2;1.0" +#define PPB_OPENGLES2_INTERFACE PPB_OPENGLES2_INTERFACE_1_0 + +#define PPB_OPENGLES2_INSTANCEDARRAYS_INTERFACE_1_0 \ + "PPB_OpenGLES2InstancedArrays;1.0" +#define PPB_OPENGLES2_INSTANCEDARRAYS_INTERFACE \ + PPB_OPENGLES2_INSTANCEDARRAYS_INTERFACE_1_0 + +#define PPB_OPENGLES2_FRAMEBUFFERBLIT_INTERFACE_1_0 \ + "PPB_OpenGLES2FramebufferBlit;1.0" +#define PPB_OPENGLES2_FRAMEBUFFERBLIT_INTERFACE \ + PPB_OPENGLES2_FRAMEBUFFERBLIT_INTERFACE_1_0 + +#define PPB_OPENGLES2_FRAMEBUFFERMULTISAMPLE_INTERFACE_1_0 \ + "PPB_OpenGLES2FramebufferMultisample;1.0" +#define PPB_OPENGLES2_FRAMEBUFFERMULTISAMPLE_INTERFACE \ + PPB_OPENGLES2_FRAMEBUFFERMULTISAMPLE_INTERFACE_1_0 + +#define PPB_OPENGLES2_CHROMIUMENABLEFEATURE_INTERFACE_1_0 \ + "PPB_OpenGLES2ChromiumEnableFeature;1.0" +#define PPB_OPENGLES2_CHROMIUMENABLEFEATURE_INTERFACE \ + PPB_OPENGLES2_CHROMIUMENABLEFEATURE_INTERFACE_1_0 + +#define PPB_OPENGLES2_CHROMIUMMAPSUB_INTERFACE_1_0 \ + "PPB_OpenGLES2ChromiumMapSub;1.0" +#define PPB_OPENGLES2_CHROMIUMMAPSUB_INTERFACE \ + PPB_OPENGLES2_CHROMIUMMAPSUB_INTERFACE_1_0 + +#define PPB_OPENGLES2_QUERY_INTERFACE_1_0 "PPB_OpenGLES2Query;1.0" +#define PPB_OPENGLES2_QUERY_INTERFACE PPB_OPENGLES2_QUERY_INTERFACE_1_0 + +#define PPB_OPENGLES2_VERTEXARRAYOBJECT_INTERFACE_1_0 \ + "PPB_OpenGLES2VertexArrayObject;1.0" +#define PPB_OPENGLES2_VERTEXARRAYOBJECT_INTERFACE \ + PPB_OPENGLES2_VERTEXARRAYOBJECT_INTERFACE_1_0 + +/** + * @file + * This file is auto-generated from + * gpu/command_buffer/build_gles2_cmd_buffer.py + * It's formatted by clang-format using chromium coding style: + * clang-format -i -style=chromium filename + * DO NOT EDIT! */ + + +#include "ppapi/c/pp_resource.h" + +#ifndef __gl2_h_ +typedef void GLvoid; +typedef int GLsizei; +typedef unsigned short GLushort; +typedef short GLshort; +typedef unsigned char GLubyte; +typedef unsigned int GLenum; +typedef int GLint; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef float GLfloat; +typedef float GLclampf; +typedef signed char GLbyte; +typedef unsigned int GLuint; +typedef int GLfixed; +typedef int GLclampx; +#ifdef _WIN64 +typedef long long int GLintptr; +typedef long long int GLsizeiptr; +#else +typedef long int GLintptr; +typedef long int GLsizeiptr; +#endif // _WIN64 +#endif // __gl2_h_ + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_OpenGLES2_1_0 { + void (*ActiveTexture)(PP_Resource context, GLenum texture); + void (*AttachShader)(PP_Resource context, GLuint program, GLuint shader); + void (*BindAttribLocation)(PP_Resource context, + GLuint program, + GLuint index, + const char* name); + void (*BindBuffer)(PP_Resource context, GLenum target, GLuint buffer); + void (*BindFramebuffer)(PP_Resource context, + GLenum target, + GLuint framebuffer); + void (*BindRenderbuffer)(PP_Resource context, + GLenum target, + GLuint renderbuffer); + void (*BindTexture)(PP_Resource context, GLenum target, GLuint texture); + void (*BlendColor)(PP_Resource context, + GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha); + void (*BlendEquation)(PP_Resource context, GLenum mode); + void (*BlendEquationSeparate)(PP_Resource context, + GLenum modeRGB, + GLenum modeAlpha); + void (*BlendFunc)(PP_Resource context, GLenum sfactor, GLenum dfactor); + void (*BlendFuncSeparate)(PP_Resource context, + GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha); + void (*BufferData)(PP_Resource context, + GLenum target, + GLsizeiptr size, + const void* data, + GLenum usage); + void (*BufferSubData)(PP_Resource context, + GLenum target, + GLintptr offset, + GLsizeiptr size, + const void* data); + GLenum (*CheckFramebufferStatus)(PP_Resource context, GLenum target); + void (*Clear)(PP_Resource context, GLbitfield mask); + void (*ClearColor)(PP_Resource context, + GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha); + void (*ClearDepthf)(PP_Resource context, GLclampf depth); + void (*ClearStencil)(PP_Resource context, GLint s); + void (*ColorMask)(PP_Resource context, + GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha); + void (*CompileShader)(PP_Resource context, GLuint shader); + void (*CompressedTexImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const void* data); + void (*CompressedTexSubImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const void* data); + void (*CopyTexImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border); + void (*CopyTexSubImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height); + GLuint (*CreateProgram)(PP_Resource context); + GLuint (*CreateShader)(PP_Resource context, GLenum type); + void (*CullFace)(PP_Resource context, GLenum mode); + void (*DeleteBuffers)(PP_Resource context, GLsizei n, const GLuint* buffers); + void (*DeleteFramebuffers)(PP_Resource context, + GLsizei n, + const GLuint* framebuffers); + void (*DeleteProgram)(PP_Resource context, GLuint program); + void (*DeleteRenderbuffers)(PP_Resource context, + GLsizei n, + const GLuint* renderbuffers); + void (*DeleteShader)(PP_Resource context, GLuint shader); + void (*DeleteTextures)(PP_Resource context, + GLsizei n, + const GLuint* textures); + void (*DepthFunc)(PP_Resource context, GLenum func); + void (*DepthMask)(PP_Resource context, GLboolean flag); + void (*DepthRangef)(PP_Resource context, GLclampf zNear, GLclampf zFar); + void (*DetachShader)(PP_Resource context, GLuint program, GLuint shader); + void (*Disable)(PP_Resource context, GLenum cap); + void (*DisableVertexAttribArray)(PP_Resource context, GLuint index); + void (*DrawArrays)(PP_Resource context, + GLenum mode, + GLint first, + GLsizei count); + void (*DrawElements)(PP_Resource context, + GLenum mode, + GLsizei count, + GLenum type, + const void* indices); + void (*Enable)(PP_Resource context, GLenum cap); + void (*EnableVertexAttribArray)(PP_Resource context, GLuint index); + void (*Finish)(PP_Resource context); + void (*Flush)(PP_Resource context); + void (*FramebufferRenderbuffer)(PP_Resource context, + GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer); + void (*FramebufferTexture2D)(PP_Resource context, + GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level); + void (*FrontFace)(PP_Resource context, GLenum mode); + void (*GenBuffers)(PP_Resource context, GLsizei n, GLuint* buffers); + void (*GenerateMipmap)(PP_Resource context, GLenum target); + void (*GenFramebuffers)(PP_Resource context, GLsizei n, GLuint* framebuffers); + void (*GenRenderbuffers)(PP_Resource context, + GLsizei n, + GLuint* renderbuffers); + void (*GenTextures)(PP_Resource context, GLsizei n, GLuint* textures); + void (*GetActiveAttrib)(PP_Resource context, + GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name); + void (*GetActiveUniform)(PP_Resource context, + GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name); + void (*GetAttachedShaders)(PP_Resource context, + GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders); + GLint (*GetAttribLocation)(PP_Resource context, + GLuint program, + const char* name); + void (*GetBooleanv)(PP_Resource context, GLenum pname, GLboolean* params); + void (*GetBufferParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + GLenum (*GetError)(PP_Resource context); + void (*GetFloatv)(PP_Resource context, GLenum pname, GLfloat* params); + void (*GetFramebufferAttachmentParameteriv)(PP_Resource context, + GLenum target, + GLenum attachment, + GLenum pname, + GLint* params); + void (*GetIntegerv)(PP_Resource context, GLenum pname, GLint* params); + void (*GetProgramiv)(PP_Resource context, + GLuint program, + GLenum pname, + GLint* params); + void (*GetProgramInfoLog)(PP_Resource context, + GLuint program, + GLsizei bufsize, + GLsizei* length, + char* infolog); + void (*GetRenderbufferParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + void (*GetShaderiv)(PP_Resource context, + GLuint shader, + GLenum pname, + GLint* params); + void (*GetShaderInfoLog)(PP_Resource context, + GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* infolog); + void (*GetShaderPrecisionFormat)(PP_Resource context, + GLenum shadertype, + GLenum precisiontype, + GLint* range, + GLint* precision); + void (*GetShaderSource)(PP_Resource context, + GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source); + const GLubyte* (*GetString)(PP_Resource context, GLenum name); + void (*GetTexParameterfv)(PP_Resource context, + GLenum target, + GLenum pname, + GLfloat* params); + void (*GetTexParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + void (*GetUniformfv)(PP_Resource context, + GLuint program, + GLint location, + GLfloat* params); + void (*GetUniformiv)(PP_Resource context, + GLuint program, + GLint location, + GLint* params); + GLint (*GetUniformLocation)(PP_Resource context, + GLuint program, + const char* name); + void (*GetVertexAttribfv)(PP_Resource context, + GLuint index, + GLenum pname, + GLfloat* params); + void (*GetVertexAttribiv)(PP_Resource context, + GLuint index, + GLenum pname, + GLint* params); + void (*GetVertexAttribPointerv)(PP_Resource context, + GLuint index, + GLenum pname, + void** pointer); + void (*Hint)(PP_Resource context, GLenum target, GLenum mode); + GLboolean (*IsBuffer)(PP_Resource context, GLuint buffer); + GLboolean (*IsEnabled)(PP_Resource context, GLenum cap); + GLboolean (*IsFramebuffer)(PP_Resource context, GLuint framebuffer); + GLboolean (*IsProgram)(PP_Resource context, GLuint program); + GLboolean (*IsRenderbuffer)(PP_Resource context, GLuint renderbuffer); + GLboolean (*IsShader)(PP_Resource context, GLuint shader); + GLboolean (*IsTexture)(PP_Resource context, GLuint texture); + void (*LineWidth)(PP_Resource context, GLfloat width); + void (*LinkProgram)(PP_Resource context, GLuint program); + void (*PixelStorei)(PP_Resource context, GLenum pname, GLint param); + void (*PolygonOffset)(PP_Resource context, GLfloat factor, GLfloat units); + void (*ReadPixels)(PP_Resource context, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void* pixels); + void (*ReleaseShaderCompiler)(PP_Resource context); + void (*RenderbufferStorage)(PP_Resource context, + GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height); + void (*SampleCoverage)(PP_Resource context, GLclampf value, GLboolean invert); + void (*Scissor)(PP_Resource context, + GLint x, + GLint y, + GLsizei width, + GLsizei height); + void (*ShaderBinary)(PP_Resource context, + GLsizei n, + const GLuint* shaders, + GLenum binaryformat, + const void* binary, + GLsizei length); + void (*ShaderSource)(PP_Resource context, + GLuint shader, + GLsizei count, + const char** str, + const GLint* length); + void (*StencilFunc)(PP_Resource context, GLenum func, GLint ref, GLuint mask); + void (*StencilFuncSeparate)(PP_Resource context, + GLenum face, + GLenum func, + GLint ref, + GLuint mask); + void (*StencilMask)(PP_Resource context, GLuint mask); + void (*StencilMaskSeparate)(PP_Resource context, GLenum face, GLuint mask); + void (*StencilOp)(PP_Resource context, + GLenum fail, + GLenum zfail, + GLenum zpass); + void (*StencilOpSeparate)(PP_Resource context, + GLenum face, + GLenum fail, + GLenum zfail, + GLenum zpass); + void (*TexImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels); + void (*TexParameterf)(PP_Resource context, + GLenum target, + GLenum pname, + GLfloat param); + void (*TexParameterfv)(PP_Resource context, + GLenum target, + GLenum pname, + const GLfloat* params); + void (*TexParameteri)(PP_Resource context, + GLenum target, + GLenum pname, + GLint param); + void (*TexParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + const GLint* params); + void (*TexSubImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* pixels); + void (*Uniform1f)(PP_Resource context, GLint location, GLfloat x); + void (*Uniform1fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform1i)(PP_Resource context, GLint location, GLint x); + void (*Uniform1iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*Uniform2f)(PP_Resource context, GLint location, GLfloat x, GLfloat y); + void (*Uniform2fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform2i)(PP_Resource context, GLint location, GLint x, GLint y); + void (*Uniform2iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*Uniform3f)(PP_Resource context, + GLint location, + GLfloat x, + GLfloat y, + GLfloat z); + void (*Uniform3fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform3i)(PP_Resource context, + GLint location, + GLint x, + GLint y, + GLint z); + void (*Uniform3iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*Uniform4f)(PP_Resource context, + GLint location, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w); + void (*Uniform4fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform4i)(PP_Resource context, + GLint location, + GLint x, + GLint y, + GLint z, + GLint w); + void (*Uniform4iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*UniformMatrix2fv)(PP_Resource context, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value); + void (*UniformMatrix3fv)(PP_Resource context, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value); + void (*UniformMatrix4fv)(PP_Resource context, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value); + void (*UseProgram)(PP_Resource context, GLuint program); + void (*ValidateProgram)(PP_Resource context, GLuint program); + void (*VertexAttrib1f)(PP_Resource context, GLuint indx, GLfloat x); + void (*VertexAttrib1fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttrib2f)(PP_Resource context, + GLuint indx, + GLfloat x, + GLfloat y); + void (*VertexAttrib2fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttrib3f)(PP_Resource context, + GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z); + void (*VertexAttrib3fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttrib4f)(PP_Resource context, + GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w); + void (*VertexAttrib4fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttribPointer)(PP_Resource context, + GLuint indx, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + const void* ptr); + void (*Viewport)(PP_Resource context, + GLint x, + GLint y, + GLsizei width, + GLsizei height); +}; + +struct PPB_OpenGLES2 { + void (*ActiveTexture)(PP_Resource context, GLenum texture); + void (*AttachShader)(PP_Resource context, GLuint program, GLuint shader); + void (*BindAttribLocation)(PP_Resource context, + GLuint program, + GLuint index, + const char* name); + void (*BindBuffer)(PP_Resource context, GLenum target, GLuint buffer); + void (*BindFramebuffer)(PP_Resource context, + GLenum target, + GLuint framebuffer); + void (*BindRenderbuffer)(PP_Resource context, + GLenum target, + GLuint renderbuffer); + void (*BindTexture)(PP_Resource context, GLenum target, GLuint texture); + void (*BlendColor)(PP_Resource context, + GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha); + void (*BlendEquation)(PP_Resource context, GLenum mode); + void (*BlendEquationSeparate)(PP_Resource context, + GLenum modeRGB, + GLenum modeAlpha); + void (*BlendFunc)(PP_Resource context, GLenum sfactor, GLenum dfactor); + void (*BlendFuncSeparate)(PP_Resource context, + GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha); + void (*BufferData)(PP_Resource context, + GLenum target, + GLsizeiptr size, + const void* data, + GLenum usage); + void (*BufferSubData)(PP_Resource context, + GLenum target, + GLintptr offset, + GLsizeiptr size, + const void* data); + GLenum (*CheckFramebufferStatus)(PP_Resource context, GLenum target); + void (*Clear)(PP_Resource context, GLbitfield mask); + void (*ClearColor)(PP_Resource context, + GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha); + void (*ClearDepthf)(PP_Resource context, GLclampf depth); + void (*ClearStencil)(PP_Resource context, GLint s); + void (*ColorMask)(PP_Resource context, + GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha); + void (*CompileShader)(PP_Resource context, GLuint shader); + void (*CompressedTexImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const void* data); + void (*CompressedTexSubImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const void* data); + void (*CopyTexImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border); + void (*CopyTexSubImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height); + GLuint (*CreateProgram)(PP_Resource context); + GLuint (*CreateShader)(PP_Resource context, GLenum type); + void (*CullFace)(PP_Resource context, GLenum mode); + void (*DeleteBuffers)(PP_Resource context, GLsizei n, const GLuint* buffers); + void (*DeleteFramebuffers)(PP_Resource context, + GLsizei n, + const GLuint* framebuffers); + void (*DeleteProgram)(PP_Resource context, GLuint program); + void (*DeleteRenderbuffers)(PP_Resource context, + GLsizei n, + const GLuint* renderbuffers); + void (*DeleteShader)(PP_Resource context, GLuint shader); + void (*DeleteTextures)(PP_Resource context, + GLsizei n, + const GLuint* textures); + void (*DepthFunc)(PP_Resource context, GLenum func); + void (*DepthMask)(PP_Resource context, GLboolean flag); + void (*DepthRangef)(PP_Resource context, GLclampf zNear, GLclampf zFar); + void (*DetachShader)(PP_Resource context, GLuint program, GLuint shader); + void (*Disable)(PP_Resource context, GLenum cap); + void (*DisableVertexAttribArray)(PP_Resource context, GLuint index); + void (*DrawArrays)(PP_Resource context, + GLenum mode, + GLint first, + GLsizei count); + void (*DrawElements)(PP_Resource context, + GLenum mode, + GLsizei count, + GLenum type, + const void* indices); + void (*Enable)(PP_Resource context, GLenum cap); + void (*EnableVertexAttribArray)(PP_Resource context, GLuint index); + void (*Finish)(PP_Resource context); + void (*Flush)(PP_Resource context); + void (*FramebufferRenderbuffer)(PP_Resource context, + GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer); + void (*FramebufferTexture2D)(PP_Resource context, + GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level); + void (*FrontFace)(PP_Resource context, GLenum mode); + void (*GenBuffers)(PP_Resource context, GLsizei n, GLuint* buffers); + void (*GenerateMipmap)(PP_Resource context, GLenum target); + void (*GenFramebuffers)(PP_Resource context, GLsizei n, GLuint* framebuffers); + void (*GenRenderbuffers)(PP_Resource context, + GLsizei n, + GLuint* renderbuffers); + void (*GenTextures)(PP_Resource context, GLsizei n, GLuint* textures); + void (*GetActiveAttrib)(PP_Resource context, + GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name); + void (*GetActiveUniform)(PP_Resource context, + GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name); + void (*GetAttachedShaders)(PP_Resource context, + GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders); + GLint (*GetAttribLocation)(PP_Resource context, + GLuint program, + const char* name); + void (*GetBooleanv)(PP_Resource context, GLenum pname, GLboolean* params); + void (*GetBufferParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + GLenum (*GetError)(PP_Resource context); + void (*GetFloatv)(PP_Resource context, GLenum pname, GLfloat* params); + void (*GetFramebufferAttachmentParameteriv)(PP_Resource context, + GLenum target, + GLenum attachment, + GLenum pname, + GLint* params); + void (*GetIntegerv)(PP_Resource context, GLenum pname, GLint* params); + void (*GetProgramiv)(PP_Resource context, + GLuint program, + GLenum pname, + GLint* params); + void (*GetProgramInfoLog)(PP_Resource context, + GLuint program, + GLsizei bufsize, + GLsizei* length, + char* infolog); + void (*GetRenderbufferParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + void (*GetShaderiv)(PP_Resource context, + GLuint shader, + GLenum pname, + GLint* params); + void (*GetShaderInfoLog)(PP_Resource context, + GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* infolog); + void (*GetShaderPrecisionFormat)(PP_Resource context, + GLenum shadertype, + GLenum precisiontype, + GLint* range, + GLint* precision); + void (*GetShaderSource)(PP_Resource context, + GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source); + const GLubyte* (*GetString)(PP_Resource context, GLenum name); + void (*GetTexParameterfv)(PP_Resource context, + GLenum target, + GLenum pname, + GLfloat* params); + void (*GetTexParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + void (*GetUniformfv)(PP_Resource context, + GLuint program, + GLint location, + GLfloat* params); + void (*GetUniformiv)(PP_Resource context, + GLuint program, + GLint location, + GLint* params); + GLint (*GetUniformLocation)(PP_Resource context, + GLuint program, + const char* name); + void (*GetVertexAttribfv)(PP_Resource context, + GLuint index, + GLenum pname, + GLfloat* params); + void (*GetVertexAttribiv)(PP_Resource context, + GLuint index, + GLenum pname, + GLint* params); + void (*GetVertexAttribPointerv)(PP_Resource context, + GLuint index, + GLenum pname, + void** pointer); + void (*Hint)(PP_Resource context, GLenum target, GLenum mode); + GLboolean (*IsBuffer)(PP_Resource context, GLuint buffer); + GLboolean (*IsEnabled)(PP_Resource context, GLenum cap); + GLboolean (*IsFramebuffer)(PP_Resource context, GLuint framebuffer); + GLboolean (*IsProgram)(PP_Resource context, GLuint program); + GLboolean (*IsRenderbuffer)(PP_Resource context, GLuint renderbuffer); + GLboolean (*IsShader)(PP_Resource context, GLuint shader); + GLboolean (*IsTexture)(PP_Resource context, GLuint texture); + void (*LineWidth)(PP_Resource context, GLfloat width); + void (*LinkProgram)(PP_Resource context, GLuint program); + void (*PixelStorei)(PP_Resource context, GLenum pname, GLint param); + void (*PolygonOffset)(PP_Resource context, GLfloat factor, GLfloat units); + void (*ReadPixels)(PP_Resource context, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void* pixels); + void (*ReleaseShaderCompiler)(PP_Resource context); + void (*RenderbufferStorage)(PP_Resource context, + GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height); + void (*SampleCoverage)(PP_Resource context, GLclampf value, GLboolean invert); + void (*Scissor)(PP_Resource context, + GLint x, + GLint y, + GLsizei width, + GLsizei height); + void (*ShaderBinary)(PP_Resource context, + GLsizei n, + const GLuint* shaders, + GLenum binaryformat, + const void* binary, + GLsizei length); + void (*ShaderSource)(PP_Resource context, + GLuint shader, + GLsizei count, + const char** str, + const GLint* length); + void (*StencilFunc)(PP_Resource context, GLenum func, GLint ref, GLuint mask); + void (*StencilFuncSeparate)(PP_Resource context, + GLenum face, + GLenum func, + GLint ref, + GLuint mask); + void (*StencilMask)(PP_Resource context, GLuint mask); + void (*StencilMaskSeparate)(PP_Resource context, GLenum face, GLuint mask); + void (*StencilOp)(PP_Resource context, + GLenum fail, + GLenum zfail, + GLenum zpass); + void (*StencilOpSeparate)(PP_Resource context, + GLenum face, + GLenum fail, + GLenum zfail, + GLenum zpass); + void (*TexImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels); + void (*TexParameterf)(PP_Resource context, + GLenum target, + GLenum pname, + GLfloat param); + void (*TexParameterfv)(PP_Resource context, + GLenum target, + GLenum pname, + const GLfloat* params); + void (*TexParameteri)(PP_Resource context, + GLenum target, + GLenum pname, + GLint param); + void (*TexParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + const GLint* params); + void (*TexSubImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* pixels); + void (*Uniform1f)(PP_Resource context, GLint location, GLfloat x); + void (*Uniform1fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform1i)(PP_Resource context, GLint location, GLint x); + void (*Uniform1iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*Uniform2f)(PP_Resource context, GLint location, GLfloat x, GLfloat y); + void (*Uniform2fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform2i)(PP_Resource context, GLint location, GLint x, GLint y); + void (*Uniform2iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*Uniform3f)(PP_Resource context, + GLint location, + GLfloat x, + GLfloat y, + GLfloat z); + void (*Uniform3fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform3i)(PP_Resource context, + GLint location, + GLint x, + GLint y, + GLint z); + void (*Uniform3iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*Uniform4f)(PP_Resource context, + GLint location, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w); + void (*Uniform4fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform4i)(PP_Resource context, + GLint location, + GLint x, + GLint y, + GLint z, + GLint w); + void (*Uniform4iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*UniformMatrix2fv)(PP_Resource context, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value); + void (*UniformMatrix3fv)(PP_Resource context, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value); + void (*UniformMatrix4fv)(PP_Resource context, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value); + void (*UseProgram)(PP_Resource context, GLuint program); + void (*ValidateProgram)(PP_Resource context, GLuint program); + void (*VertexAttrib1f)(PP_Resource context, GLuint indx, GLfloat x); + void (*VertexAttrib1fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttrib2f)(PP_Resource context, + GLuint indx, + GLfloat x, + GLfloat y); + void (*VertexAttrib2fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttrib3f)(PP_Resource context, + GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z); + void (*VertexAttrib3fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttrib4f)(PP_Resource context, + GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w); + void (*VertexAttrib4fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttribPointer)(PP_Resource context, + GLuint indx, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + const void* ptr); + void (*Viewport)(PP_Resource context, + GLint x, + GLint y, + GLsizei width, + GLsizei height); +}; + +struct PPB_OpenGLES2InstancedArrays_1_0 { + void (*DrawArraysInstancedANGLE)(PP_Resource context, + GLenum mode, + GLint first, + GLsizei count, + GLsizei primcount); + void (*DrawElementsInstancedANGLE)(PP_Resource context, + GLenum mode, + GLsizei count, + GLenum type, + const void* indices, + GLsizei primcount); + void (*VertexAttribDivisorANGLE)(PP_Resource context, + GLuint index, + GLuint divisor); +}; + +struct PPB_OpenGLES2InstancedArrays { + void (*DrawArraysInstancedANGLE)(PP_Resource context, + GLenum mode, + GLint first, + GLsizei count, + GLsizei primcount); + void (*DrawElementsInstancedANGLE)(PP_Resource context, + GLenum mode, + GLsizei count, + GLenum type, + const void* indices, + GLsizei primcount); + void (*VertexAttribDivisorANGLE)(PP_Resource context, + GLuint index, + GLuint divisor); +}; + +struct PPB_OpenGLES2FramebufferBlit_1_0 { + void (*BlitFramebufferEXT)(PP_Resource context, + GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter); +}; + +struct PPB_OpenGLES2FramebufferBlit { + void (*BlitFramebufferEXT)(PP_Resource context, + GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter); +}; + +struct PPB_OpenGLES2FramebufferMultisample_1_0 { + void (*RenderbufferStorageMultisampleEXT)(PP_Resource context, + GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height); +}; + +struct PPB_OpenGLES2FramebufferMultisample { + void (*RenderbufferStorageMultisampleEXT)(PP_Resource context, + GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height); +}; + +struct PPB_OpenGLES2ChromiumEnableFeature_1_0 { + GLboolean (*EnableFeatureCHROMIUM)(PP_Resource context, const char* feature); +}; + +struct PPB_OpenGLES2ChromiumEnableFeature { + GLboolean (*EnableFeatureCHROMIUM)(PP_Resource context, const char* feature); +}; + +struct PPB_OpenGLES2ChromiumMapSub_1_0 { + void* (*MapBufferSubDataCHROMIUM)(PP_Resource context, + GLuint target, + GLintptr offset, + GLsizeiptr size, + GLenum access); + void (*UnmapBufferSubDataCHROMIUM)(PP_Resource context, const void* mem); + void* (*MapTexSubImage2DCHROMIUM)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLenum access); + void (*UnmapTexSubImage2DCHROMIUM)(PP_Resource context, const void* mem); +}; + +struct PPB_OpenGLES2ChromiumMapSub { + void* (*MapBufferSubDataCHROMIUM)(PP_Resource context, + GLuint target, + GLintptr offset, + GLsizeiptr size, + GLenum access); + void (*UnmapBufferSubDataCHROMIUM)(PP_Resource context, const void* mem); + void* (*MapTexSubImage2DCHROMIUM)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLenum access); + void (*UnmapTexSubImage2DCHROMIUM)(PP_Resource context, const void* mem); +}; + +struct PPB_OpenGLES2Query_1_0 { + void (*GenQueriesEXT)(PP_Resource context, GLsizei n, GLuint* queries); + void (*DeleteQueriesEXT)(PP_Resource context, + GLsizei n, + const GLuint* queries); + GLboolean (*IsQueryEXT)(PP_Resource context, GLuint id); + void (*BeginQueryEXT)(PP_Resource context, GLenum target, GLuint id); + void (*EndQueryEXT)(PP_Resource context, GLenum target); + void (*GetQueryivEXT)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + void (*GetQueryObjectuivEXT)(PP_Resource context, + GLuint id, + GLenum pname, + GLuint* params); +}; + +struct PPB_OpenGLES2Query { + void (*GenQueriesEXT)(PP_Resource context, GLsizei n, GLuint* queries); + void (*DeleteQueriesEXT)(PP_Resource context, + GLsizei n, + const GLuint* queries); + GLboolean (*IsQueryEXT)(PP_Resource context, GLuint id); + void (*BeginQueryEXT)(PP_Resource context, GLenum target, GLuint id); + void (*EndQueryEXT)(PP_Resource context, GLenum target); + void (*GetQueryivEXT)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + void (*GetQueryObjectuivEXT)(PP_Resource context, + GLuint id, + GLenum pname, + GLuint* params); +}; + +struct PPB_OpenGLES2VertexArrayObject_1_0 { + void (*GenVertexArraysOES)(PP_Resource context, GLsizei n, GLuint* arrays); + void (*DeleteVertexArraysOES)(PP_Resource context, + GLsizei n, + const GLuint* arrays); + GLboolean (*IsVertexArrayOES)(PP_Resource context, GLuint array); + void (*BindVertexArrayOES)(PP_Resource context, GLuint array); +}; + +struct PPB_OpenGLES2VertexArrayObject { + void (*GenVertexArraysOES)(PP_Resource context, GLsizei n, GLuint* arrays); + void (*DeleteVertexArraysOES)(PP_Resource context, + GLsizei n, + const GLuint* arrays); + GLboolean (*IsVertexArrayOES)(PP_Resource context, GLuint array); + void (*BindVertexArrayOES)(PP_Resource context, GLuint array); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_OPENGLES2_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_tcp_socket.h
Added
@@ -0,0 +1,344 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_tcp_socket.idl modified Mon Dec 8 16:50:44 2014. */ + +#ifndef PPAPI_C_PPB_TCP_SOCKET_H_ +#define PPAPI_C_PPB_TCP_SOCKET_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_TCPSOCKET_INTERFACE_1_0 "PPB_TCPSocket;1.0" +#define PPB_TCPSOCKET_INTERFACE_1_1 "PPB_TCPSocket;1.1" +#define PPB_TCPSOCKET_INTERFACE_1_2 "PPB_TCPSocket;1.2" +#define PPB_TCPSOCKET_INTERFACE PPB_TCPSOCKET_INTERFACE_1_2 + +/** + * @file + * This file defines the <code>PPB_TCPSocket</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * Option names used by <code>SetOption()</code>. + */ +typedef enum { + /** + * Disables coalescing of small writes to make TCP segments, and instead + * delivers data immediately. Value's type is <code>PP_VARTYPE_BOOL</code>. + * On version 1.1 or earlier, this option can only be set after a successful + * <code>Connect()</code> call. On version 1.2 or later, there is no such + * limitation. + */ + PP_TCPSOCKET_OPTION_NO_DELAY = 0, + /** + * Specifies the total per-socket buffer space reserved for sends. Value's + * type should be <code>PP_VARTYPE_INT32</code>. + * On version 1.1 or earlier, this option can only be set after a successful + * <code>Connect()</code> call. On version 1.2 or later, there is no such + * limitation. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if <code>SetOption()</code> succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE = 1, + /** + * Specifies the total per-socket buffer space reserved for receives. Value's + * type should be <code>PP_VARTYPE_INT32</code>. + * On version 1.1 or earlier, this option can only be set after a successful + * <code>Connect()</code> call. On version 1.2 or later, there is no such + * limitation. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if <code>SetOption()</code> succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2 +} PP_TCPSocket_Option; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocket_Option, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_TCPSocket</code> interface provides TCP socket operations. + * + * Permissions: Apps permission <code>socket</code> with subrule + * <code>tcp-connect</code> is required for <code>Connect()</code>; subrule + * <code>tcp-listen</code> is required for <code>Listen()</code>. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +struct PPB_TCPSocket_1_2 { + /** + * Creates a TCP socket resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * + * @return A <code>PP_Resource</code> corresponding to a TCP socket or 0 + * on failure. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is a TCP socket. + * + * @param[in] resource A <code>PP_Resource</code> to check. + * + * @return <code>PP_TRUE</code> if the input is a + * <code>PPB_TCPSocket</code> resource; <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsTCPSocket)(PP_Resource resource); + /** + * Binds the socket to the given address. The socket must not be bound. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * @param[in] addr A <code>PPB_NetAddress</code> resource. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>, + * including (but not limited to): + * - <code>PP_ERROR_ADDRESS_IN_USE</code>: the address is already in use. + * - <code>PP_ERROR_ADDRESS_INVALID</code>: the address is invalid. + */ + int32_t (*Bind)(PP_Resource tcp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + /** + * Connects the socket to the given address. The socket must not be listening. + * Binding the socket beforehand is optional. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * @param[in] addr A <code>PPB_NetAddress</code> resource. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>, + * including (but not limited to): + * - <code>PP_ERROR_NOACCESS</code>: the caller doesn't have required + * permissions. + * - <code>PP_ERROR_ADDRESS_UNREACHABLE</code>: <code>addr</code> is + * unreachable. + * - <code>PP_ERROR_CONNECTION_REFUSED</code>: the connection attempt was + * refused. + * - <code>PP_ERROR_CONNECTION_FAILED</code>: the connection attempt failed. + * - <code>PP_ERROR_CONNECTION_TIMEDOUT</code>: the connection attempt timed + * out. + * + * Since version 1.1, if the socket is listening/connected or has a pending + * listen/connect request, <code>Connect()</code> will fail without starting a + * connection attempt; otherwise, any failure during the connection attempt + * will cause the socket to be closed. + */ + int32_t (*Connect)(PP_Resource tcp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + /** + * Gets the local address of the socket, if it is bound. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * + * @return A <code>PPB_NetAddress</code> resource on success or 0 on failure. + */ + PP_Resource (*GetLocalAddress)(PP_Resource tcp_socket); + /** + * Gets the remote address of the socket, if it is connected. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * + * @return A <code>PPB_NetAddress</code> resource on success or 0 on failure. + */ + PP_Resource (*GetRemoteAddress)(PP_Resource tcp_socket); + /** + * Reads data from the socket. The socket must be connected. It may perform a + * partial read. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * @param[out] buffer The buffer to store the received data on success. It + * must be at least as large as <code>bytes_to_read</code>. + * @param[in] bytes_to_read The number of bytes to read. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been read, 0 means that end-of-file was reached; otherwise, an error code + * from <code>pp_errors.h</code>. + */ + int32_t (*Read)(PP_Resource tcp_socket, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + /** + * Writes data to the socket. The socket must be connected. It may perform a + * partial write. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * @param[in] buffer The buffer containing the data to write. + * @param[in] bytes_to_write The number of bytes to write. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been written; otherwise, an error code from <code>pp_errors.h</code>. + */ + int32_t (*Write)(PP_Resource tcp_socket, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + /** + * Starts listening. The socket must be bound and not connected. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * @param[in] backlog A hint to determine the maximum length to which the + * queue of pending connections may grow. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>, + * including (but not limited to): + * - <code>PP_ERROR_NOACCESS</code>: the caller doesn't have required + * permissions. + * - <code>PP_ERROR_ADDRESS_IN_USE</code>: Another socket is already listening + * on the same port. + */ + int32_t (*Listen)(PP_Resource tcp_socket, + int32_t backlog, + struct PP_CompletionCallback callback); + /** + * Accepts a connection. The socket must be listening. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * @param[out] accepted_tcp_socket Stores the accepted TCP socket on success. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>, + * including (but not limited to): + * - <code>PP_ERROR_CONNECTION_ABORTED</code>: A connection has been aborted. + */ + int32_t (*Accept)(PP_Resource tcp_socket, + PP_Resource* accepted_tcp_socket, + struct PP_CompletionCallback callback); + /** + * Cancels all pending operations and closes the socket. Any pending callbacks + * will still run, reporting <code>PP_ERROR_ABORTED</code> if pending IO was + * interrupted. After a call to this method, no output buffer pointers passed + * into previous <code>Read()</code> or <code>Accept()</code> calls will be + * accessed. It is not valid to call <code>Connect()</code> or + * <code>Listen()</code> again. + * + * The socket is implicitly closed if it is destroyed, so you are not required + * to call this method. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + */ + void (*Close)(PP_Resource tcp_socket); + /** + * Sets a socket option on the TCP socket. + * Please see the <code>PP_TCPSocket_Option</code> description for option + * names, value types and allowed values. + * + * @param[in] tcp_socket A <code>PP_Resource</code> corresponding to a TCP + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*SetOption)(PP_Resource tcp_socket, + PP_TCPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_TCPSocket_1_2 PPB_TCPSocket; + +struct PPB_TCPSocket_1_0 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsTCPSocket)(PP_Resource resource); + int32_t (*Connect)(PP_Resource tcp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + PP_Resource (*GetLocalAddress)(PP_Resource tcp_socket); + PP_Resource (*GetRemoteAddress)(PP_Resource tcp_socket); + int32_t (*Read)(PP_Resource tcp_socket, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + int32_t (*Write)(PP_Resource tcp_socket, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + void (*Close)(PP_Resource tcp_socket); + int32_t (*SetOption)(PP_Resource tcp_socket, + PP_TCPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; + +struct PPB_TCPSocket_1_1 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsTCPSocket)(PP_Resource resource); + int32_t (*Bind)(PP_Resource tcp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + int32_t (*Connect)(PP_Resource tcp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + PP_Resource (*GetLocalAddress)(PP_Resource tcp_socket); + PP_Resource (*GetRemoteAddress)(PP_Resource tcp_socket); + int32_t (*Read)(PP_Resource tcp_socket, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + int32_t (*Write)(PP_Resource tcp_socket, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + int32_t (*Listen)(PP_Resource tcp_socket, + int32_t backlog, + struct PP_CompletionCallback callback); + int32_t (*Accept)(PP_Resource tcp_socket, + PP_Resource* accepted_tcp_socket, + struct PP_CompletionCallback callback); + void (*Close)(PP_Resource tcp_socket); + int32_t (*SetOption)(PP_Resource tcp_socket, + PP_TCPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_TCP_SOCKET_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_text_input_controller.h
Added
@@ -0,0 +1,125 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_text_input_controller.idl modified Thu Aug 1 09:30:48 2013. */ + +#ifndef PPAPI_C_PPB_TEXT_INPUT_CONTROLLER_H_ +#define PPAPI_C_PPB_TEXT_INPUT_CONTROLLER_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_TEXTINPUTCONTROLLER_INTERFACE_1_0 "PPB_TextInputController;1.0" +#define PPB_TEXTINPUTCONTROLLER_INTERFACE PPB_TEXTINPUTCONTROLLER_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_TextInputController</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * PP_TextInput_Type is used to indicate the status of a plugin in regard to + * text input. + */ +typedef enum { + /** + * Input caret is not in an editable mode, no input method shall be used. + */ + PP_TEXTINPUT_TYPE_NONE = 0, + /** + * Input caret is in a normal editable mode, any input method can be used. + */ + PP_TEXTINPUT_TYPE_TEXT = 1, + /** + * Input caret is in a password box, an input method may be used only if + * it's suitable for password input. + */ + PP_TEXTINPUT_TYPE_PASSWORD = 2, + PP_TEXTINPUT_TYPE_SEARCH = 3, + PP_TEXTINPUT_TYPE_EMAIL = 4, + PP_TEXTINPUT_TYPE_NUMBER = 5, + PP_TEXTINPUT_TYPE_TELEPHONE = 6, + PP_TEXTINPUT_TYPE_URL = 7 +} PP_TextInput_Type; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TextInput_Type, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * <code>PPB_TextInputController</code> provides a set of functions for giving + * hints to the browser about the text input status of plugins, and functions + * for controlling input method editors (IMEs). + */ +struct PPB_TextInputController_1_0 { + /** + * Informs the browser about the current text input mode of the plugin. + * Typical use of this information in the browser is to properly + * display/suppress tools for supporting text inputs (such as virtual + * keyboards in touch screen based devices, or input method editors often + * used for composing East Asian characters). + */ + void (*SetTextInputType)(PP_Instance instance, PP_TextInput_Type type); + /** + * Informs the browser about the coordinates of the text input caret area. + * Typical use of this information in the browser is to layout IME windows + * etc. + */ + void (*UpdateCaretPosition)(PP_Instance instance, + const struct PP_Rect* caret); + /** + * Cancels the current composition in IME. + */ + void (*CancelCompositionText)(PP_Instance instance); + /** + * Informs the browser about the current text selection and surrounding + * text. <code>text</code> is a UTF-8 string that contains the current range + * of text selection in the plugin. <code>caret</code> is the byte-index of + * the caret position within <code>text</code>. <code>anchor</code> is the + * byte-index of the anchor position (i.e., if a range of text is selected, + * it is the other edge of selection different from <code>caret</code>. If + * there are no selection, <code>anchor</code> is equal to <code>caret</code>. + * + * Typical use of this information in the browser is to enable "reconversion" + * features of IME that puts back the already committed text into the + * pre-commit composition state. Another use is to improve the precision + * of suggestion of IME by taking the context into account (e.g., if the caret + * looks to be on the beginning of a sentence, suggest capital letters in a + * virtual keyboard). + * + * When the focus is not on text, call this function setting <code>text</code> + * to an empty string and <code>caret</code> and <code>anchor</code> to zero. + * Also, the plugin should send the empty text when it does not want to reveal + * the selection to IME (e.g., when the surrounding text is containing + * password text). + */ + void (*UpdateSurroundingText)(PP_Instance instance, + struct PP_Var text, + uint32_t caret, + uint32_t anchor); +}; + +typedef struct PPB_TextInputController_1_0 PPB_TextInputController; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_TEXT_INPUT_CONTROLLER_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_udp_socket.h
Added
@@ -0,0 +1,326 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_udp_socket.idl modified Tue Mar 17 11:47:56 2015. */ + +#ifndef PPAPI_C_PPB_UDP_SOCKET_H_ +#define PPAPI_C_PPB_UDP_SOCKET_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_UDPSOCKET_INTERFACE_1_0 "PPB_UDPSocket;1.0" +#define PPB_UDPSOCKET_INTERFACE_1_1 "PPB_UDPSocket;1.1" +#define PPB_UDPSOCKET_INTERFACE_1_2 "PPB_UDPSocket;1.2" +#define PPB_UDPSOCKET_INTERFACE PPB_UDPSOCKET_INTERFACE_1_2 + +/** + * @file + * This file defines the <code>PPB_UDPSocket</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * Option names used by <code>SetOption()</code>. + */ +typedef enum { + /** + * Allows the socket to share the local address to which it will be bound with + * other processes. Value's type should be <code>PP_VARTYPE_BOOL</code>. + * This option can only be set before calling <code>Bind()</code>. + */ + PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, + /** + * Allows sending and receiving packets to and from broadcast addresses. + * Value's type should be <code>PP_VARTYPE_BOOL</code>. + * On version 1.0, this option can only be set before calling + * <code>Bind()</code>. On version 1.1 or later, there is no such limitation. + */ + PP_UDPSOCKET_OPTION_BROADCAST = 1, + /** + * Specifies the total per-socket buffer space reserved for sends. Value's + * type should be <code>PP_VARTYPE_INT32</code>. + * On version 1.0, this option can only be set after a successful + * <code>Bind()</code> call. On version 1.1 or later, there is no such + * limitation. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if <code>SetOption()</code> succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, + /** + * Specifies the total per-socket buffer space reserved for receives. Value's + * type should be <code>PP_VARTYPE_INT32</code>. + * On version 1.0, this option can only be set after a successful + * <code>Bind()</code> call. On version 1.1 or later, there is no such + * limitation. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if <code>SetOption()</code> succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3, + /** + * Specifies whether the packets sent from the host to the multicast group + * should be looped back to the host or not. Value's type should be + * <code>PP_VARTYPE_BOOL</code>. + * This option can only be set before calling <code>Bind()</code>. + * + * This is only supported in version 1.2 of the API (Chrome 43) and later. + */ + PP_UDPSOCKET_OPTION_MULTICAST_LOOP = 4, + /** + * Specifies the time-to-live for packets sent to the multicast group. The + * value should be within 0 to 255 range. The default value is 1 and means + * that packets will not be routed beyond the local network. Value's type + * should be <code>PP_VARTYPE_INT32</code>. + * This option can only be set before calling <code>Bind()</code>. + * + * This is only supported in version 1.2 of the API (Chrome 43) and later. + */ + PP_UDPSOCKET_OPTION_MULTICAST_TTL = 5 +} PP_UDPSocket_Option; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_UDPSocket_Option, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_UDPSocket</code> interface provides UDP socket operations. + * + * Permissions: Apps permission <code>socket</code> with subrule + * <code>udp-bind</code> is required for <code>Bind()</code>; subrule + * <code>udp-send-to</code> is required for <code>SendTo()</code>. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +struct PPB_UDPSocket_1_2 { + /** + * Creates a UDP socket resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * + * @return A <code>PP_Resource</code> corresponding to a UDP socket or 0 + * on failure. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is a UDP socket. + * + * @param[in] resource A <code>PP_Resource</code> to check. + * + * @return <code>PP_TRUE</code> if the input is a <code>PPB_UDPSocket</code> + * resource; <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsUDPSocket)(PP_Resource resource); + /** + * Binds the socket to the given address. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[in] addr A <code>PPB_NetAddress</code> resource. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have + * required permissions. <code>PP_ERROR_ADDRESS_IN_USE</code> will be returned + * if the address is already in use. + */ + int32_t (*Bind)(PP_Resource udp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + /** + * Gets the address that the socket is bound to. The socket must be bound. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * + * @return A <code>PPB_NetAddress</code> resource on success or 0 on failure. + */ + PP_Resource (*GetBoundAddress)(PP_Resource udp_socket); + /** + * Receives data from the socket and stores the source address. The socket + * must be bound. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[out] buffer The buffer to store the received data on success. It + * must be at least as large as <code>num_bytes</code>. + * @param[in] num_bytes The number of bytes to receive. + * @param[out] addr A <code>PPB_NetAddress</code> resource to store the source + * address on success. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been received; otherwise, an error code from <code>pp_errors.h</code>. + */ + int32_t (*RecvFrom)(PP_Resource udp_socket, + char* buffer, + int32_t num_bytes, + PP_Resource* addr, + struct PP_CompletionCallback callback); + /** + * Sends data to a specific destination. The socket must be bound. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[in] buffer The buffer containing the data to send. + * @param[in] num_bytes The number of bytes to send. + * @param[in] addr A <code>PPB_NetAddress</code> resource holding the + * destination address. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been sent; otherwise, an error code from <code>pp_errors.h</code>. + * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have + * required permissions. + * <code>PP_ERROR_INPROGRESS</code> will be returned if the socket is busy + * sending. The caller should wait until a pending send completes before + * retrying. + */ + int32_t (*SendTo)(PP_Resource udp_socket, + const char* buffer, + int32_t num_bytes, + PP_Resource addr, + struct PP_CompletionCallback callback); + /** + * Cancels all pending reads and writes, and closes the socket. Any pending + * callbacks will still run, reporting <code>PP_ERROR_ABORTED</code> if + * pending IO was interrupted. After a call to this method, no output + * parameters passed into previous <code>RecvFrom()</code> calls will be + * accessed. It is not valid to call <code>Bind()</code> again. + * + * The socket is implicitly closed if it is destroyed, so you are not + * required to call this method. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + */ + void (*Close)(PP_Resource udp_socket); + /** + * Sets a socket option on the UDP socket. + * Please see the <code>PP_UDPSocket_Option</code> description for option + * names, value types and allowed values. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*SetOption)(PP_Resource udp_socket, + PP_UDPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); + /** + * Joins the multicast group with address specified by <code>group</code> + * parameter, which is expected to be a <code>PPB_NetAddress</code> object. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[in] group A <code>PP_Resource</code> corresponding to the network + * address of the multicast group. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*JoinGroup)(PP_Resource udp_socket, + PP_Resource group, + struct PP_CompletionCallback callback); + /** + * Leaves the multicast group with address specified by <code>group</code> + * parameter, which is expected to be a <code>PPB_NetAddress</code> object. + * + * @param[in] udp_socket A <code>PP_Resource</code> corresponding to a UDP + * socket. + * @param[in] group A <code>PP_Resource</code> corresponding to the network + * address of the multicast group. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*LeaveGroup)(PP_Resource udp_socket, + PP_Resource group, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_UDPSocket_1_2 PPB_UDPSocket; + +struct PPB_UDPSocket_1_0 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsUDPSocket)(PP_Resource resource); + int32_t (*Bind)(PP_Resource udp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + PP_Resource (*GetBoundAddress)(PP_Resource udp_socket); + int32_t (*RecvFrom)(PP_Resource udp_socket, + char* buffer, + int32_t num_bytes, + PP_Resource* addr, + struct PP_CompletionCallback callback); + int32_t (*SendTo)(PP_Resource udp_socket, + const char* buffer, + int32_t num_bytes, + PP_Resource addr, + struct PP_CompletionCallback callback); + void (*Close)(PP_Resource udp_socket); + int32_t (*SetOption)(PP_Resource udp_socket, + PP_UDPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; + +struct PPB_UDPSocket_1_1 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsUDPSocket)(PP_Resource resource); + int32_t (*Bind)(PP_Resource udp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + PP_Resource (*GetBoundAddress)(PP_Resource udp_socket); + int32_t (*RecvFrom)(PP_Resource udp_socket, + char* buffer, + int32_t num_bytes, + PP_Resource* addr, + struct PP_CompletionCallback callback); + int32_t (*SendTo)(PP_Resource udp_socket, + const char* buffer, + int32_t num_bytes, + PP_Resource addr, + struct PP_CompletionCallback callback); + void (*Close)(PP_Resource udp_socket); + int32_t (*SetOption)(PP_Resource udp_socket, + PP_UDPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_UDP_SOCKET_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_url_loader.h
Added
@@ -0,0 +1,226 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_url_loader.idl modified Thu Mar 28 10:07:37 2013. */ + +#ifndef PPAPI_C_PPB_URL_LOADER_H_ +#define PPAPI_C_PPB_URL_LOADER_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_URLLOADER_INTERFACE_1_0 "PPB_URLLoader;1.0" +#define PPB_URLLOADER_INTERFACE PPB_URLLOADER_INTERFACE_1_0 + +/** + * @file + * This file defines the <strong>PPB_URLLoader</strong> interface for loading + * URLs. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <strong>PPB_URLLoader</strong> interface contains pointers to functions + * for loading URLs. The typical steps for loading a URL are: + * + * -# Call Create() to create a URLLoader object. + * -# Create a <code>URLRequestInfo</code> object and set properties on it. + * Refer to <code>PPB_URLRequestInfo</code> for further information. + * -# Call Open() with the <code>URLRequestInfo</code> as an argument. + * -# When Open() completes, call GetResponseInfo() to examine the response + * headers. Refer to <code>PPB_URLResponseInfo</code> for further information. + * -# Call ReadResponseBody() to stream the data for the response. + * + * Alternatively, if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on + * the <code>URLRequestInfo</code> in step #2: + * - Call FinishStreamingToFile(), after examining the response headers + * (step #4), to wait for the downloaded file to be complete. + * - Then, access the downloaded file using the GetBodyAsFileRef() function of + * the <code>URLResponseInfo</code> returned in step #4. + */ +struct PPB_URLLoader_1_0 { + /** + * Create() creates a new <code>URLLoader</code> object. The + * <code>URLLoader</code> is associated with a particular instance, so that + * any UI dialogs that need to be shown to the user can be positioned + * relative to the window containing the instance. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * + * @return A <code>PP_Resource</code> corresponding to a URLLoader if + * successful, 0 if the instance is invalid. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsURLLoader() determines if a resource is an <code>URLLoader</code>. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>URLLoader</code>. + * + * @return <code>PP_TRUE</code> if the resource is a <code>URLLoader</code>, + * <code>PP_FALSE</code> if the resource is invalid or some type other + * than <code>URLLoader</code>. + */ + PP_Bool (*IsURLLoader)(PP_Resource resource); + /** + * Open() begins loading the <code>URLRequestInfo</code>. The operation + * completes when response headers are received or when an error occurs. Use + * GetResponseInfo() to access the response headers. + * + * @param[in] loader A <code>PP_Resource</code> corresponding to a + * <code>URLLoader</code>. + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>URLRequestInfo</code>. + * @param[in] callback A <code>PP_CompletionCallback</code> to run on + * asynchronous completion of Open(). This callback will run when response + * headers for the url are received or error occurred. This callback + * will only run if Open() returns <code>PP_OK_COMPLETIONPENDING</code>. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*Open)(PP_Resource loader, + PP_Resource request_info, + struct PP_CompletionCallback callback); + /** + * FollowRedirect() can be invoked to follow a redirect after Open() + * completed on receiving redirect headers. + * + * @param[in] loader A <code>PP_Resource</code> corresponding to a + * <code>URLLoader</code>. + * @param[in] callback A <code>PP_CompletionCallback</code> to run on + * asynchronous completion of FollowRedirect(). This callback will run when + * response headers for the redirect url are received or error occurred. This + * callback will only run if FollowRedirect() returns + * <code>PP_OK_COMPLETIONPENDING</code>. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*FollowRedirect)(PP_Resource loader, + struct PP_CompletionCallback callback); + /** + * GetUploadProgress() returns the current upload progress (which is + * meaningful after Open() has been called). Progress only refers to the + * request body and does not include the headers. + * + * This data is only available if the <code>URLRequestInfo</code> passed + * to Open() had the <code>PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS</code> + * property set to PP_TRUE. + * + * @param[in] loader A <code>PP_Resource</code> corresponding to a + * <code>URLLoader</code>. + * @param[in] bytes_sent The number of bytes sent thus far. + * @param[in] total_bytes_to_be_sent The total number of bytes to be sent. + * + * @return <code>PP_TRUE</code> if the upload progress is available, + * <code>PP_FALSE</code> if it is not available. + */ + PP_Bool (*GetUploadProgress)(PP_Resource loader, + int64_t* bytes_sent, + int64_t* total_bytes_to_be_sent); + /** + * GetDownloadProgress() returns the current download progress, which is + * meaningful after Open() has been called. Progress only refers to the + * response body and does not include the headers. + * + * This data is only available if the <code>URLRequestInfo</code> passed to + * Open() had the <code>PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS</code> + * property set to <code>PP_TRUE</code>. + * + * @param[in] loader A <code>PP_Resource</code> corresponding to a + * <code>URLLoader</code>. + * @param[in] bytes_received The number of bytes received thus far. + * @param[in] total_bytes_to_be_received The total number of bytes to be + * received. The total bytes to be received may be unknown, in which case + * <code>total_bytes_to_be_received</code> will be set to -1. + * + * @return <code>PP_TRUE</code> if the download progress is available, + * <code>PP_FALSE</code> if it is not available. + */ + PP_Bool (*GetDownloadProgress)(PP_Resource loader, + int64_t* bytes_received, + int64_t* total_bytes_to_be_received); + /** + * GetResponseInfo() returns the current <code>URLResponseInfo</code> object. + * + * @param[in] instance A <code>PP_Resource</code> corresponding to a + * <code>URLLoader</code>. + * + * @return A <code>PP_Resource</code> corresponding to the + * <code>URLResponseInfo</code> if successful, 0 if the loader is not a valid + * resource or if Open() has not been called. + */ + PP_Resource (*GetResponseInfo)(PP_Resource loader); + /** + * ReadResponseBody() is used to read the response body. The size of the + * buffer must be large enough to hold the specified number of bytes to read. + * This function might perform a partial read. + * + * @param[in] loader A <code>PP_Resource</code> corresponding to a + * <code>URLLoader</code>. + * @param[in,out] buffer A pointer to the buffer for the response body. + * @param[in] bytes_to_read The number of bytes to read. + * @param[in] callback A <code>PP_CompletionCallback</code> to run on + * asynchronous completion. The callback will run if the bytes (full or + * partial) are read or an error occurs asynchronously. This callback will + * run only if this function returns <code>PP_OK_COMPLETIONPENDING</code>. + * + * @return An int32_t containing the number of bytes read or an error code + * from <code>pp_errors.h</code>. + */ + int32_t (*ReadResponseBody)(PP_Resource loader, + void* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + /** + * FinishStreamingToFile() is used to wait for the response body to be + * completely downloaded to the file provided by the GetBodyAsFileRef() + * in the current <code>URLResponseInfo</code>. This function is only used if + * <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on the + * <code>URLRequestInfo</code> passed to Open(). + * + * @param[in] loader A <code>PP_Resource</code> corresponding to a + * <code>URLLoader</code>. + * @param[in] callback A <code>PP_CompletionCallback</code> to run on + * asynchronous completion. This callback will run when body is downloaded + * or an error occurs after FinishStreamingToFile() returns + * <code>PP_OK_COMPLETIONPENDING</code>. + * + * @return An int32_t containing the number of bytes read or an error code + * from <code>pp_errors.h</code>. + */ + int32_t (*FinishStreamingToFile)(PP_Resource loader, + struct PP_CompletionCallback callback); + /** + * Close is a pointer to a function used to cancel any pending IO and close + * the <code>URLLoader</code> object. Any pending callbacks will still run, + * reporting <code>PP_ERROR_ABORTED</code> if pending IO was interrupted. + * It is NOT valid to call Open() again after a call to this function. + * + * <strong>Note:</strong> If the <code>URLLoader</code> object is destroyed + * while it is still open, then it will be implicitly closed so you are not + * required to call Close(). + * + * @param[in] loader A <code>PP_Resource</code> corresponding to a + * <code>URLLoader</code>. + */ + void (*Close)(PP_Resource loader); +}; + +typedef struct PPB_URLLoader_1_0 PPB_URLLoader; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_URL_LOADER_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_url_request_info.h
Added
@@ -0,0 +1,268 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_url_request_info.idl modified Thu Mar 28 10:19:35 2013. */ + +#ifndef PPAPI_C_PPB_URL_REQUEST_INFO_H_ +#define PPAPI_C_PPB_URL_REQUEST_INFO_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" +#include "ppapi/c/pp_var.h" + +#define PPB_URLREQUESTINFO_INTERFACE_1_0 "PPB_URLRequestInfo;1.0" +#define PPB_URLREQUESTINFO_INTERFACE PPB_URLREQUESTINFO_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_URLRequestInfo</code> API for creating and + * manipulating URL requests. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains properties that can be set on a URL request. + */ +typedef enum { + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_URLREQUESTPROPERTY_URL = 0, + /** + * This corresponds to a string (<code>PP_VARTYPE_STRING</code>); either + * POST or GET. Refer to the + * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html">HTTP + * Methods</a> documentation for further information. + * + */ + PP_URLREQUESTPROPERTY_METHOD = 1, + /** + * This corresponds to a string (<code>PP_VARTYPE_STRING</code>); \n + * delimited. Refer to the + * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html"Header + * Field Definitions</a> documentation for further information. + */ + PP_URLREQUESTPROPERTY_HEADERS = 2, + /** + * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>; + * default=<code>PP_FALSE</code>). + * Set this value to <code>PP_TRUE</code> if you want to download the data + * to a file. Use PPB_URLLoader.FinishStreamingToFile() to complete the + * download. + */ + PP_URLREQUESTPROPERTY_STREAMTOFILE = 3, + /** + * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>; + * default=<code>PP_TRUE</code>). + * Set this value to <code>PP_FALSE</code> if you want to use + * PPB_URLLoader.FollowRedirects() to follow the redirects only after + * examining redirect headers. + */ + PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS = 4, + /** + * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>; + * default=<code>PP_FALSE</code>). + * Set this value to <code>PP_TRUE</code> if you want to be able to poll the + * download progress using PPB_URLLoader.GetDownloadProgress(). + */ + PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS = 5, + /** + * This corresponds to a <code>PP_Bool</code> + * (default=<code>PP_FALSE</code>). Set this value to <code>PP_TRUE</code> if + * you want to be able to poll the upload progress using + * PPB_URLLoader.GetUploadProgress(). + */ + PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS = 6, + /** + * This corresponds to a string (<code>PP_VARTYPE_STRING)</code> or may be + * undefined (<code>PP_VARTYPE_UNDEFINED</code>; default). + * Set it to a string to set a custom referrer (if empty, the referrer header + * will be omitted), or to undefined to use the default referrer. Only loaders + * with universal access (only available on trusted implementations) will + * accept <code>URLRequestInfo</code> objects that try to set a custom + * referrer; if given to a loader without universal access, + * <code>PP_ERROR_NOACCESS</code> will result. + */ + PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL = 7, + /** + * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>; + * default=<code>PP_FALSE</code>). Whether cross-origin requests are allowed. + * Cross-origin requests are made using the CORS (Cross-Origin Resource + * Sharing) algorithm to check whether the request should be allowed. For the + * complete CORS algorithm, refer to + * the <a href="http://www.w3.org/TR/access-control">Cross-Origin Resource + * Sharing</a> documentation. + */ + PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS = 8, + /** + * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>; + * default=<code>PP_FALSE</code>). + * Whether HTTP credentials are sent with cross-origin requests. If false, + * no credentials are sent with the request and cookies are ignored in the + * response. If the request is not cross-origin, this property is ignored. + */ + PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS = 9, + /** + * This corresponds to a string (<code>PP_VARTYPE_STRING</code>) or may be + * undefined (<code>PP_VARTYPE_UNDEFINED</code>; default). + * Set it to a string to set a custom content-transfer-encoding header (if + * empty, that header will be omitted), or to undefined to use the default + * (if any). Only loaders with universal access (only available on trusted + * implementations) will accept <code>URLRequestInfo</code> objects that try + * to set a custom content transfer encoding; if given to a loader without + * universal access, <code>PP_ERROR_NOACCESS</code> will result. + */ + PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING = 10, + /** + * This corresponds to an integer (<code>PP_VARTYPE_INT32</code>); default + * is not defined and is set by the browser, possibly depending on system + * capabilities. Set it to an integer to set an upper threshold for the + * prefetched buffer of an asynchronous load. When exceeded, the browser will + * defer loading until + * <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD</code> is hit, + * at which time it will begin prefetching again. When setting this property, + * <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD</code> must also + * be set. Behavior is undefined if the former is <= the latter. + */ + PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD = 11, + /** + * This corresponds to an integer (<code>PP_VARTYPE_INT32</code>); default is + * not defined and is set by the browser to a value appropriate for the + * default <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD</code>. + * Set it to an integer to set a lower threshold for the prefetched buffer + * of an asynchronous load. When reached, the browser will resume loading if + * If <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD</code> had + * previously been reached. + * When setting this property, + * <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD</code> must also + * be set. Behavior is undefined if the former is >= the latter. + */ + PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD = 12, + /** + * This corresponds to a string (<code>PP_VARTYPE_STRING</code>) or may be + * undefined (<code>PP_VARTYPE_UNDEFINED</code>; default). Set it to a string + * to set a custom user-agent header (if empty, that header will be omitted), + * or to undefined to use the default. Only loaders with universal access + * (only available on trusted implementations) will accept + * <code>URLRequestInfo</code> objects that try to set a custom user agent; if + * given to a loader without universal access, <code>PP_ERROR_NOACCESS</code> + * will result. + */ + PP_URLREQUESTPROPERTY_CUSTOMUSERAGENT = 13 +} PP_URLRequestProperty; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLRequestProperty, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_URLRequestInfo</code> interface is used to create + * and handle URL requests. This API is used in conjunction with + * <code>PPB_URLLoader</code>. Refer to <code>PPB_URLLoader</code> for further + * information. + */ +struct PPB_URLRequestInfo_1_0 { + /** + * Create() creates a new <code>URLRequestInfo</code> object. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * + * @return A <code>PP_Resource</code> identifying the + * <code>URLRequestInfo</code> if successful, 0 if the instance is invalid. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsURLRequestInfo() determines if a resource is a + * <code>URLRequestInfo</code>. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>URLRequestInfo</code>. + * + * @return <code>PP_TRUE</code> if the resource is a + * <code>URLRequestInfo</code>, <code>PP_FALSE</code> if the resource is + * invalid or some type other than <code>URLRequestInfo</code>. + */ + PP_Bool (*IsURLRequestInfo)(PP_Resource resource); + /** + * SetProperty() sets a request property. The value of the property must be + * the correct type according to the property being set. + * + * @param[in] request A <code>PP_Resource</code> corresponding to a + * <code>URLRequestInfo</code>. + * @param[in] property A <code>PP_URLRequestProperty</code> identifying the + * property to set. + * @param[in] value A <code>PP_Var</code> containing the property value. + * + * @return <code>PP_TRUE</code> if successful, <code>PP_FALSE</code> if any + * of the parameters are invalid. + */ + PP_Bool (*SetProperty)(PP_Resource request, + PP_URLRequestProperty property, + struct PP_Var value); + /** + * AppendDataToBody() appends data to the request body. A Content-Length + * request header will be automatically generated. + * + * @param[in] request A <code>PP_Resource</code> corresponding to a + * <code>URLRequestInfo</code>. + * @param[in] data A pointer to a buffer holding the data. + * @param[in] len The length, in bytes, of the data. + * + * @return <code>PP_TRUE</code> if successful, <code>PP_FALSE</code> if any + * of the parameters are invalid. + * + * + */ + PP_Bool (*AppendDataToBody)(PP_Resource request, + const void* data, + uint32_t len); + /** + * AppendFileToBody() appends a file, to be uploaded, to the request body. + * A content-length request header will be automatically generated. + * + * @param[in] request A <code>PP_Resource</code> corresponding to a + * <code>URLRequestInfo</code>. + * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file + * reference. + * @param[in] start_offset An optional starting point offset within the + * file. + * @param[in] number_of_bytes An optional number of bytes of the file to + * be included. If <code>number_of_bytes</code> is -1, then the sub-range + * to upload extends to the end of the file. + * @param[in] expected_last_modified_time An optional (non-zero) last + * modified time stamp used to validate that the file was not modified since + * the given time before it was uploaded. The upload will fail with an error + * code of <code>PP_ERROR_FILECHANGED</code> if the file has been modified + * since the given time. If <code>expected_last_modified_time</code> is 0, + * then no validation is performed. + * + * @return <code>PP_TRUE</code> if successful, <code>PP_FALSE</code> if any + * of the parameters are invalid. + */ + PP_Bool (*AppendFileToBody)(PP_Resource request, + PP_Resource file_ref, + int64_t start_offset, + int64_t number_of_bytes, + PP_Time expected_last_modified_time); +}; + +typedef struct PPB_URLRequestInfo_1_0 PPB_URLRequestInfo; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_URL_REQUEST_INFO_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_url_response_info.h
Added
@@ -0,0 +1,149 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_url_response_info.idl modified Mon Nov 14 10:36:01 2011. */ + +#ifndef PPAPI_C_PPB_URL_RESPONSE_INFO_H_ +#define PPAPI_C_PPB_URL_RESPONSE_INFO_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_URLRESPONSEINFO_INTERFACE_1_0 "PPB_URLResponseInfo;1.0" +#define PPB_URLRESPONSEINFO_INTERFACE PPB_URLRESPONSEINFO_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_URLResponseInfo</code> API for examining URL + * responses. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains properties set on a URL response. + */ +typedef enum { + /** + * This corresponds to a string (PP_VARTYPE_STRING); an absolute URL formed by + * resolving the relative request URL with the absolute document URL. Refer + * to the + * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2"> + * HTTP Request URI</a> and + * <a href="http://www.w3.org/TR/html4/struct/links.html#h-12.4.1"> + * HTML Resolving Relative URIs</a> documentation for further information. + */ + PP_URLRESPONSEPROPERTY_URL = 0, + /** + * This corresponds to a string (PP_VARTYPE_STRING); the absolute URL returned + * in the response header's 'Location' field if this is a redirect response, + * an empty string otherwise. Refer to the + * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3"> + * HTTP Status Codes - Redirection</a> documentation for further information. + */ + PP_URLRESPONSEPROPERTY_REDIRECTURL = 1, + /** + * This corresponds to a string (PP_VARTYPE_STRING); the HTTP method to be + * used in a new request if this is a redirect response, an empty string + * otherwise. Refer to the + * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3"> + * HTTP Status Codes - Redirection</a> documentation for further information. + */ + PP_URLRESPONSEPROPERTY_REDIRECTMETHOD = 2, + /** + * This corresponds to an int32 (PP_VARETYPE_INT32); the status code from the + * response, e.g., 200 if the request was successful. Refer to the + * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1"> + * HTTP Status Code and Reason Phrase</a> documentation for further + * information. + */ + PP_URLRESPONSEPROPERTY_STATUSCODE = 3, + /** + * This corresponds to a string (PP_VARTYPE_STRING); the status line + * from the response. Refer to the + * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1"> + * HTTP Response Status Line</a> documentation for further information. + */ + PP_URLRESPONSEPROPERTY_STATUSLINE = 4, + /** + * This corresponds to a string(PP_VARTYPE_STRING), a \n-delimited list of + * header field/value pairs of the form "field: value", returned by the + * server. Refer to the + * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14"> + * HTTP Header Field Definitions</a> documentation for further information. + */ + PP_URLRESPONSEPROPERTY_HEADERS = 5 +} PP_URLResponseProperty; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLResponseProperty, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_URLResponseInfo interface contains APIs for + * examining URL responses. Refer to <code>PPB_URLLoader</code> for further + * information. + */ +struct PPB_URLResponseInfo_1_0 { + /** + * IsURLResponseInfo() determines if a response is a + * <code>URLResponseInfo</code>. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>URLResponseInfo</code>. + * + * @return <code>PP_TRUE</code> if the resource is a + * <code>URLResponseInfo</code>, <code>PP_FALSE</code> if the resource is + * invalid or some type other than <code>URLResponseInfo</code>. + */ + PP_Bool (*IsURLResponseInfo)(PP_Resource resource); + /** + * GetProperty() gets a response property. + * + * @param[in] request A <code>PP_Resource</code> corresponding to a + * <code>URLResponseInfo</code>. + * @param[in] property A <code>PP_URLResponseProperty</code> identifying + * the type of property in the response. + * + * @return A <code>PP_Var</code> containing the response property value if + * successful, <code>PP_VARTYPE_VOID</code> if an input parameter is invalid. + */ + struct PP_Var (*GetProperty)(PP_Resource response, + PP_URLResponseProperty property); + /** + * GetBodyAsFileRef() returns a FileRef pointing to the file containing the + * response body. This is only valid if + * <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on the + * <code>URLRequestInfo</code> used to produce this response. This file + * remains valid until the <code>URLLoader</code> associated with this + * <code>URLResponseInfo</code> is closed or destroyed. + * + * @param[in] request A <code>PP_Resource</code> corresponding to a + * <code>URLResponseInfo</code>. + * + * @return A <code>PP_Resource</code> corresponding to a <code>FileRef</code> + * if successful, 0 if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was + * not requested or if the <code>URLLoader</code> has not been opened yet. + */ + PP_Resource (*GetBodyAsFileRef)(PP_Resource response); +}; + +typedef struct PPB_URLResponseInfo_1_0 PPB_URLResponseInfo; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_URL_RESPONSE_INFO_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_var.h
Added
@@ -0,0 +1,148 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_var.idl modified Thu Apr 10 14:54:41 2014. */ + +#ifndef PPAPI_C_PPB_VAR_H_ +#define PPAPI_C_PPB_VAR_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_VAR_INTERFACE_1_0 "PPB_Var;1.0" +#define PPB_VAR_INTERFACE_1_1 "PPB_Var;1.1" +#define PPB_VAR_INTERFACE_1_2 "PPB_Var;1.2" +#define PPB_VAR_INTERFACE PPB_VAR_INTERFACE_1_2 + +/** + * @file + * This file defines the <code>PPB_Var</code> struct. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPB_Var API + */ +struct PPB_Var_1_2 { + /** + * AddRef() adds a reference to the given var. If this is not a refcounted + * object, this function will do nothing so you can always call it no matter + * what the type. + * + * @param[in] var A <code>PP_Var</code> that will have a reference added. + */ + void (*AddRef)(struct PP_Var var); + /** + * Release() removes a reference to given var, deleting it if the internal + * reference count becomes 0. If the <code>PP_Var</code> is of type + * <code>PP_VARTYPE_RESOURCE</code>, + * it will implicitly release a reference count on the + * <code>PP_Resource</code> (equivalent to PPB_Core::ReleaseResource()). + * + * If the given var is not a refcounted object, this function will do nothing + * so you can always call it no matter what the type. + * + * @param[in] var A <code>PP_Var</code> that will have a reference removed. + */ + void (*Release)(struct PP_Var var); + /** + * VarFromUtf8() creates a string var from a string. The string must be + * encoded in valid UTF-8 and is NOT NULL-terminated, the length must be + * specified in <code>len</code>. It is an error if the string is not + * valid UTF-8. + * + * If the length is 0, the <code>*data</code> pointer will not be dereferenced + * and may be <code>NULL</code>. Note, however if length is 0, the + * "NULL-ness" will not be preserved, as VarToUtf8() will never return + * <code>NULL</code> on success, even for empty strings. + * + * The resulting object will be a refcounted string object. It will be + * AddRef'ed for the caller. When the caller is done with it, it should be + * Released. + * + * On error (basically out of memory to allocate the string, or input that + * is not valid UTF-8), this function will return a Null var. + * + * @param[in] data A string + * @param[in] len The length of the string. + * + * @return A <code>PP_Var</code> structure containing a reference counted + * string object. + */ + struct PP_Var (*VarFromUtf8)(const char* data, uint32_t len); + /** + * VarToUtf8() converts a string-type var to a char* encoded in UTF-8. This + * string is NOT NULL-terminated. The length will be placed in + * <code>*len</code>. If the string is valid but empty the return value will + * be non-NULL, but <code>*len</code> will still be 0. + * + * If the var is not a string, this function will return NULL and + * <code>*len</code> will be 0. + * + * The returned buffer will be valid as long as the underlying var is alive. + * If the instance frees its reference, the string will be freed and the + * pointer will be to arbitrary memory. + * + * @param[in] var A PP_Var struct containing a string-type var. + * @param[in,out] len A pointer to the length of the string-type var. + * + * @return A char* encoded in UTF-8. + */ + const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); + /** + * Converts a resource-type var to a <code>PP_Resource</code>. + * + * @param[in] var A <code>PP_Var</code> struct containing a resource-type var. + * + * @return A <code>PP_Resource</code> retrieved from the var, or 0 if the var + * is not a resource. The reference count of the resource is incremented on + * behalf of the caller. + */ + PP_Resource (*VarToResource)(struct PP_Var var); + /** + * Creates a new <code>PP_Var</code> from a given resource. Implicitly adds a + * reference count on the <code>PP_Resource</code> (equivalent to + * PPB_Core::AddRefResource(resource)). + * + * @param[in] resource A <code>PP_Resource</code> to be wrapped in a var. + * + * @return A <code>PP_Var</code> created for this resource, with type + * <code>PP_VARTYPE_RESOURCE</code>. The reference count of the var is set to + * 1 on behalf of the caller. + */ + struct PP_Var (*VarFromResource)(PP_Resource resource); +}; + +typedef struct PPB_Var_1_2 PPB_Var; + +struct PPB_Var_1_0 { + void (*AddRef)(struct PP_Var var); + void (*Release)(struct PP_Var var); + struct PP_Var (*VarFromUtf8)(PP_Module module, + const char* data, + uint32_t len); + const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); +}; + +struct PPB_Var_1_1 { + void (*AddRef)(struct PP_Var var); + void (*Release)(struct PP_Var var); + struct PP_Var (*VarFromUtf8)(const char* data, uint32_t len); + const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_VAR_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_var_array.h
Added
@@ -0,0 +1,95 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_var_array.idl modified Sun Jun 16 15:37:27 2013. */ + +#ifndef PPAPI_C_PPB_VAR_ARRAY_H_ +#define PPAPI_C_PPB_VAR_ARRAY_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_VAR_ARRAY_INTERFACE_1_0 "PPB_VarArray;1.0" +#define PPB_VAR_ARRAY_INTERFACE PPB_VAR_ARRAY_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_VarArray</code> struct providing + * a way to interact with array vars. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_VarArray_1_0 { + /** + * Creates an array var, i.e., a <code>PP_Var</code> with type set to + * <code>PP_VARTYPE_ARRAY</code>. The array length is set to 0. + * + * @return An empty array var, whose reference count is set to 1 on behalf of + * the caller. + */ + struct PP_Var (*Create)(void); + /** + * Gets an element from the array. + * + * @param[in] array An array var. + * @param[in] index An index indicating which element to return. + * + * @return The element at the specified position. The reference count of the + * element returned is incremented on behalf of the caller. If + * <code>index</code> is larger than or equal to the array length, an + * undefined var is returned. + */ + struct PP_Var (*Get)(struct PP_Var array, uint32_t index); + /** + * Sets the value of an element in the array. + * + * @param[in] array An array var. + * @param[in] index An index indicating which element to modify. If + * <code>index</code> is larger than or equal to the array length, the length + * is updated to be <code>index</code> + 1. Any position in the array that + * hasn't been set before is set to undefined, i.e., <code>PP_Var</code> of + * type <code>PP_VARTYPE_UNDEFINED</code>. + * @param[in] value The value to set. The array holds a reference to it on + * success. + * + * @return A <code>PP_Bool</code> indicating whether the operation succeeds. + */ + PP_Bool (*Set)(struct PP_Var array, uint32_t index, struct PP_Var value); + /** + * Gets the array length. + * + * @param[in] array An array var. + * + * @return The array length. + */ + uint32_t (*GetLength)(struct PP_Var array); + /** + * Sets the array length. + * + * @param[in] array An array var. + * @param[in] length The new array length. If <code>length</code> is smaller + * than its current value, the array is truncated to the new length; any + * elements that no longer fit are removed and the references to them will be + * released. If <code>length</code> is larger than its current value, + * undefined vars are appended to increase the array to the specified length. + * + * @return A <code>PP_Bool</code> indicating whether the operation succeeds. + */ + PP_Bool (*SetLength)(struct PP_Var array, uint32_t length); +}; + +typedef struct PPB_VarArray_1_0 PPB_VarArray; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_VAR_ARRAY_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_var_array_buffer.h
Added
@@ -0,0 +1,119 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_var_array_buffer.idl modified Thu Feb 28 09:24:06 2013. */ + +#ifndef PPAPI_C_PPB_VAR_ARRAY_BUFFER_H_ +#define PPAPI_C_PPB_VAR_ARRAY_BUFFER_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_VAR_ARRAY_BUFFER_INTERFACE_1_0 "PPB_VarArrayBuffer;1.0" +#define PPB_VAR_ARRAY_BUFFER_INTERFACE PPB_VAR_ARRAY_BUFFER_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_VarArrayBuffer</code> struct providing + * a way to interact with JavaScript ArrayBuffers. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_VarArrayBuffer</code> interface provides a way to interact + * with JavaScript ArrayBuffers, which represent a contiguous sequence of + * bytes. Use <code>PPB_Var</code> to manage the reference count for a + * <code>VarArrayBuffer</code>. Note that these Vars are not part of the + * embedding page's DOM, and can only be shared with JavaScript using the + * <code>PostMessage</code> and <code>HandleMessage</code> functions of + * <code>pp::Instance</code>. + */ +struct PPB_VarArrayBuffer_1_0 { + /** + * Create() creates a zero-initialized <code>VarArrayBuffer</code>. + * + * @param[in] size_in_bytes The size of the <code>ArrayBuffer</code> to + * be created. + * + * @return A <code>PP_Var</code> representing a <code>VarArrayBuffer</code> + * of the requested size and with a reference count of 1. + */ + struct PP_Var (*Create)(uint32_t size_in_bytes); + /** + * ByteLength() retrieves the length of the <code>VarArrayBuffer</code> in + * bytes. On success, <code>byte_length</code> is set to the length of the + * given <code>ArrayBuffer</code> var. On failure, <code>byte_length</code> + * is unchanged (this could happen, for instance, if the given + * <code>PP_Var</code> is not of type <code>PP_VARTYPE_ARRAY_BUFFER</code>). + * Note that ByteLength() will successfully retrieve the size of an + * <code>ArrayBuffer</code> even if the <code>ArrayBuffer</code> is not + * currently mapped. + * + * @param[in] array The <code>ArrayBuffer</code> whose length should be + * returned. + * + * @param[out] byte_length A variable which is set to the length of the given + * <code>ArrayBuffer</code> on success. + * + * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure. + */ + PP_Bool (*ByteLength)(struct PP_Var array, uint32_t* byte_length); + /** + * Map() maps the <code>ArrayBuffer</code> in to the module's address space + * and returns a pointer to the beginning of the buffer for the given + * <code>ArrayBuffer PP_Var</code>. ArrayBuffers are copied when transmitted, + * so changes to the underlying memory are not automatically available to + * the embedding page. + * + * Note that calling Map() can be a relatively expensive operation. Use care + * when calling it in performance-critical code. For example, you should call + * it only once when looping over an <code>ArrayBuffer</code>. + * + * <strong>Example:</strong> + * + * @code + * char* data = (char*)(array_buffer_if.Map(array_buffer_var)); + * uint32_t byte_length = 0; + * PP_Bool ok = array_buffer_if.ByteLength(array_buffer_var, &byte_length); + * if (!ok) + * return DoSomethingBecauseMyVarIsNotAnArrayBuffer(); + * for (uint32_t i = 0; i < byte_length; ++i) + * data[i] = 'A'; + * @endcode + * + * @param[in] array The <code>ArrayBuffer</code> whose internal buffer should + * be returned. + * + * @return A pointer to the internal buffer for this + * <code>ArrayBuffer</code>. Returns <code>NULL</code> + * if the given <code>PP_Var</code> is not of type + * <code>PP_VARTYPE_ARRAY_BUFFER</code>. + */ + void* (*Map)(struct PP_Var array); + /** + * Unmap() unmaps the given <code>ArrayBuffer</code> var from the module + * address space. Use this if you want to save memory but might want to call + * Map() to map the buffer again later. The <code>PP_Var</code> remains valid + * and should still be released using <code>PPB_Var</code> when you are done + * with the <code>ArrayBuffer</code>. + * + * @param[in] array The <code>ArrayBuffer</code> to be released. + */ + void (*Unmap)(struct PP_Var array); +}; + +typedef struct PPB_VarArrayBuffer_1_0 PPB_VarArrayBuffer; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_VAR_ARRAY_BUFFER_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_var_dictionary.h
Added
@@ -0,0 +1,107 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_var_dictionary.idl modified Sat Jun 8 23:03:54 2013. */ + +#ifndef PPAPI_C_PPB_VAR_DICTIONARY_H_ +#define PPAPI_C_PPB_VAR_DICTIONARY_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_VAR_DICTIONARY_INTERFACE_1_0 "PPB_VarDictionary;1.0" +#define PPB_VAR_DICTIONARY_INTERFACE PPB_VAR_DICTIONARY_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_VarDictionary</code> struct providing + * a way to interact with dictionary vars. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * A dictionary var contains key-value pairs with unique keys. The keys are + * strings while the values can be arbitrary vars. Key comparison is always + * done by value instead of by reference. + */ +struct PPB_VarDictionary_1_0 { + /** + * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to + * <code>PP_VARTYPE_DICTIONARY</code>. + * + * @return An empty dictionary var, whose reference count is set to 1 on + * behalf of the caller. + */ + struct PP_Var (*Create)(void); + /** + * Gets the value associated with the specified key. + * + * @param[in] dict A dictionary var. + * @param[in] key A string var. + * + * @return The value that is associated with <code>key</code>. The reference + * count of the element returned is incremented on behalf of the caller. If + * <code>key</code> is not a string var, or it doesn't exist in + * <code>dict</code>, an undefined var is returned. + */ + struct PP_Var (*Get)(struct PP_Var dict, struct PP_Var key); + /** + * Sets the value associated with the specified key. + * + * @param[in] dict A dictionary var. + * @param[in] key A string var. If this key hasn't existed in + * <code>dict</code>, it is added and associated with <code>value</code>; + * otherwise, the previous value is replaced with <code>value</code>. + * @param[in] value The value to set. The dictionary holds a reference to it + * on success. + * + * @return A <code>PP_Bool</code> indicating whether the operation succeeds. + */ + PP_Bool (*Set)(struct PP_Var dict, struct PP_Var key, struct PP_Var value); + /** + * Deletes the specified key and its associated value, if the key exists. The + * reference to the element will be released. + * + * @param[in] dict A dictionary var. + * @param[in] key A string var. + */ + void (*Delete)(struct PP_Var dict, struct PP_Var key); + /** + * Checks whether a key exists. + * + * @param[in] dict A dictionary var. + * @param[in] key A string var. + * + * @return A <code>PP_Bool</code> indicating whether the key exists. + */ + PP_Bool (*HasKey)(struct PP_Var dict, struct PP_Var key); + /** + * Gets all the keys in a dictionary. Please note that for each key that you + * set into the dictionary, a string var with the same contents is returned; + * but it may not be the same string var (i.e., <code>value.as_id</code> may + * be different). + * + * @param[in] dict A dictionary var. + * + * @return An array var which contains all the keys of <code>dict</code>. Its + * reference count is incremented on behalf of the caller. The elements are + * string vars. Returns a null var if failed. + */ + struct PP_Var (*GetKeys)(struct PP_Var dict); +}; + +typedef struct PPB_VarDictionary_1_0 PPB_VarDictionary; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_VAR_DICTIONARY_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_video_decoder.h
Added
@@ -0,0 +1,311 @@ +/* Copyright (c) 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_video_decoder.idl modified Mon Sep 28 15:23:30 2015. */ + +#ifndef PPAPI_C_PPB_VIDEO_DECODER_H_ +#define PPAPI_C_PPB_VIDEO_DECODER_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_codecs.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_VIDEODECODER_INTERFACE_0_1 "PPB_VideoDecoder;0.1" +#define PPB_VIDEODECODER_INTERFACE_0_2 "PPB_VideoDecoder;0.2" +#define PPB_VIDEODECODER_INTERFACE_1_0 "PPB_VideoDecoder;1.0" +#define PPB_VIDEODECODER_INTERFACE_1_1 "PPB_VideoDecoder;1.1" +#define PPB_VIDEODECODER_INTERFACE PPB_VIDEODECODER_INTERFACE_1_1 + +/** + * @file + * This file defines the <code>PPB_VideoDecoder</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Video decoder interface. + * + * Typical usage: + * - Call Create() to create a new video decoder resource. + * - Call Initialize() to initialize it with a 3d graphics context and the + * desired codec profile. + * - Call Decode() continuously (waiting for each previous call to complete) to + * push bitstream buffers to the decoder. + * - Call GetPicture() continuously (waiting for each previous call to complete) + * to pull decoded pictures from the decoder. + * - Call Flush() to signal end of stream to the decoder and perform shutdown + * when it completes. + * - Call Reset() to quickly stop the decoder (e.g. to implement Seek) and wait + * for the callback before restarting decoding at another point. + * - To destroy the decoder, the plugin should release all of its references to + * it. Any pending callbacks will abort before the decoder is destroyed. + * + * Available video codecs vary by platform. + * All: theora, vorbis, vp8. + * Chrome and ChromeOS: aac, h264. + * ChromeOS: mpeg4. + */ +struct PPB_VideoDecoder_1_1 { + /** + * Creates a new video decoder resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * with the video decoder. + * + * @return A <code>PP_Resource</code> corresponding to a video decoder if + * successful or 0 otherwise. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if the given resource is a video decoder. + * + * @param[in] resource A <code>PP_Resource</code> identifying a resource. + * + * @return <code>PP_TRUE</code> if the resource is a + * <code>PPB_VideoDecoder</code>, <code>PP_FALSE</code> if the resource is + * invalid or some other type. + */ + PP_Bool (*IsVideoDecoder)(PP_Resource resource); + /** + * Initializes a video decoder resource. This should be called after Create() + * and before any other functions. + * + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video + * decoder. + * @param[in] graphics3d_context A <code>PPB_Graphics3D</code> resource to use + * during decoding. + * @param[in] profile A <code>PP_VideoProfile</code> specifying the video + * codec profile. + * @param[in] acceleration A <code>PP_HardwareAcceleration</code> specifying + * whether to use a hardware accelerated or a software implementation. + * @param[in] min_picture_count A count of pictures the plugin would like to + * have in flight. This is effectively the number of times the plugin can + * call GetPicture() and get a decoded frame without calling + * RecyclePicture(). The decoder has its own internal minimum count, and will + * take the larger of its internal and this value. A client that doesn't care + * can therefore just pass in zero for this argument. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the + * requested profile is not supported. In this case, the client may call + * Initialize() again with different parameters to find a good configuration. + * Returns PP_ERROR_BADARGUMENT if the requested minimum picture count is + * unreasonably large. + */ + int32_t (*Initialize)(PP_Resource video_decoder, + PP_Resource graphics3d_context, + PP_VideoProfile profile, + PP_HardwareAcceleration acceleration, + uint32_t min_picture_count, + struct PP_CompletionCallback callback); + /** + * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's + * |buffer|. The plugin should wait until the decoder signals completion by + * returning PP_OK or by running |callback| before calling Decode() again. + * + * In general, each bitstream buffer should contain a demuxed bitstream frame + * for the selected video codec. For example, H264 decoders expect to receive + * one AnnexB NAL unit, including the 4 byte start code prefix, while VP8 + * decoders expect to receive a bitstream frame without the IVF frame header. + * + * If the call to Decode() eventually results in a picture, the |decode_id| + * parameter is copied into the returned picture. The plugin can use this to + * associate decoded pictures with Decode() calls (e.g. to assign timestamps + * or frame numbers to pictures.) This value is opaque to the API so the + * plugin is free to pass any value. + * + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video + * decoder. + * @param[in] decode_id An optional value, chosen by the plugin, that can be + * used to associate calls to Decode() with decoded pictures returned by + * GetPicture(). + * @param[in] size Buffer size in bytes. + * @param[in] buffer Starting address of buffer. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Flush() + * or Reset() call is pending. + * Returns PP_ERROR_INPROGRESS if there is another Decode() call pending. + * Returns PP_ERROR_NOMEMORY if a bitstream buffer can't be created. + * Returns PP_ERROR_ABORTED when Reset() is called while Decode() is pending. + */ + int32_t (*Decode)(PP_Resource video_decoder, + uint32_t decode_id, + uint32_t size, + const void* buffer, + struct PP_CompletionCallback callback); + /** + * Gets the next picture from the decoder. The picture is valid after the + * decoder signals completion by returning PP_OK or running |callback|. The + * plugin can call GetPicture() again after the decoder signals completion. + * When the plugin is finished using the picture, it should return it to the + * system by calling RecyclePicture(). + * + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video + * decoder. + * @param[out] picture A <code>PP_VideoPicture</code> to hold the decoded + * picture. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Reset() + * call is pending. + * Returns PP_ERROR_INPROGRESS if there is another GetPicture() call pending. + * Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() + * completes while GetPicture() is pending. + */ + int32_t (*GetPicture)(PP_Resource video_decoder, + struct PP_VideoPicture* picture, + struct PP_CompletionCallback callback); + /** + * Recycles a picture that the plugin has received from the decoder. + * The plugin should call this as soon as it has finished using the texture so + * the decoder can decode more pictures. + * + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video + * decoder. + * @param[in] picture A <code>PP_VideoPicture</code> to return to + * the decoder. + */ + void (*RecyclePicture)(PP_Resource video_decoder, + const struct PP_VideoPicture* picture); + /** + * Flushes the decoder. The plugin should call Flush() when it reaches the + * end of its video stream in order to stop cleanly. The decoder will run any + * pending Decode() call to completion. The plugin should make no further + * calls to the decoder other than GetPicture() and RecyclePicture() until + * the decoder signals completion by running |callback|. Just before + * completion, any pending GetPicture() call will complete by running its + * callback with result PP_ERROR_ABORTED to signal that no more pictures are + * available. Any pictures held by the plugin remain valid during and after + * the flush and should be recycled back to the decoder. + * + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video + * decoder. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_FAILED if the decoder isn't initialized. + */ + int32_t (*Flush)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); + /** + * Resets the decoder as quickly as possible. The plugin can call Reset() to + * skip to another position in the video stream. After Reset() returns, any + * pending calls to Decode() and GetPicture()) abort, causing their callbacks + * to run with PP_ERROR_ABORTED. The plugin should not make further calls to + * the decoder other than RecyclePicture() until the decoder signals + * completion by running |callback|. Any pictures held by the plugin remain + * valid during and after the reset and should be recycled back to the + * decoder. + * + * @param[in] video_decoder A <code>PP_Resource</code> identifying the video + * decoder. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_FAILED if the decoder isn't initialized. + */ + int32_t (*Reset)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_VideoDecoder_1_1 PPB_VideoDecoder; + +struct PPB_VideoDecoder_0_1 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsVideoDecoder)(PP_Resource resource); + int32_t (*Initialize)(PP_Resource video_decoder, + PP_Resource graphics3d_context, + PP_VideoProfile profile, + PP_Bool allow_software_fallback, + struct PP_CompletionCallback callback); + int32_t (*Decode)(PP_Resource video_decoder, + uint32_t decode_id, + uint32_t size, + const void* buffer, + struct PP_CompletionCallback callback); + int32_t (*GetPicture)(PP_Resource video_decoder, + struct PP_VideoPicture_0_1* picture, + struct PP_CompletionCallback callback); + void (*RecyclePicture)(PP_Resource video_decoder, + const struct PP_VideoPicture* picture); + int32_t (*Flush)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); + int32_t (*Reset)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); +}; + +struct PPB_VideoDecoder_0_2 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsVideoDecoder)(PP_Resource resource); + int32_t (*Initialize)(PP_Resource video_decoder, + PP_Resource graphics3d_context, + PP_VideoProfile profile, + PP_HardwareAcceleration acceleration, + struct PP_CompletionCallback callback); + int32_t (*Decode)(PP_Resource video_decoder, + uint32_t decode_id, + uint32_t size, + const void* buffer, + struct PP_CompletionCallback callback); + int32_t (*GetPicture)(PP_Resource video_decoder, + struct PP_VideoPicture_0_1* picture, + struct PP_CompletionCallback callback); + void (*RecyclePicture)(PP_Resource video_decoder, + const struct PP_VideoPicture* picture); + int32_t (*Flush)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); + int32_t (*Reset)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); +}; + +struct PPB_VideoDecoder_1_0 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsVideoDecoder)(PP_Resource resource); + int32_t (*Initialize)(PP_Resource video_decoder, + PP_Resource graphics3d_context, + PP_VideoProfile profile, + PP_HardwareAcceleration acceleration, + struct PP_CompletionCallback callback); + int32_t (*Decode)(PP_Resource video_decoder, + uint32_t decode_id, + uint32_t size, + const void* buffer, + struct PP_CompletionCallback callback); + int32_t (*GetPicture)(PP_Resource video_decoder, + struct PP_VideoPicture* picture, + struct PP_CompletionCallback callback); + void (*RecyclePicture)(PP_Resource video_decoder, + const struct PP_VideoPicture* picture); + int32_t (*Flush)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); + int32_t (*Reset)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_VIDEO_DECODER_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_video_encoder.h
Added
@@ -0,0 +1,282 @@ +/* Copyright 2015 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_video_encoder.idl modified Wed Jul 15 11:34:20 2015. */ + +#ifndef PPAPI_C_PPB_VIDEO_ENCODER_H_ +#define PPAPI_C_PPB_VIDEO_ENCODER_H_ + +#include "ppapi/c/pp_array_output.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_codecs.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/ppb_video_frame.h" + +#define PPB_VIDEOENCODER_INTERFACE_0_1 "PPB_VideoEncoder;0.1" /* dev */ +#define PPB_VIDEOENCODER_INTERFACE_0_2 "PPB_VideoEncoder;0.2" +#define PPB_VIDEOENCODER_INTERFACE PPB_VIDEOENCODER_INTERFACE_0_2 + +/** + * @file + * This file defines the <code>PPB_VideoEncoder</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Video encoder interface. + * + * Typical usage: + * - Call Create() to create a new video encoder resource. + * - Call GetSupportedFormats() to determine which codecs and profiles are + * available. + * - Call Initialize() to initialize the encoder for a supported profile. + * - Call GetVideoFrame() to get a blank frame and fill it in, or get a video + * frame from another resource, e.g. <code>PPB_MediaStreamVideoTrack</code>. + * - Call Encode() to push the video frame to the encoder. If an external frame + * is pushed, wait for completion to recycle the frame. + * - Call GetBitstreamBuffer() continuously (waiting for each previous call to + * complete) to pull encoded pictures from the encoder. + * - Call RecycleBitstreamBuffer() after consuming the data in the bitstream + * buffer. + * - To destroy the encoder, the plugin should release all of its references to + * it. Any pending callbacks will abort before the encoder is destroyed. + * + * Available video codecs vary by platform. + * All: vp8 (software). + * ChromeOS, depending on your device: h264 (hardware), vp8 (hardware) + */ +struct PPB_VideoEncoder_0_2 { + /** + * Creates a new video encoder resource. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * with the video encoder. + * + * @return A <code>PP_Resource</code> corresponding to a video encoder if + * successful or 0 otherwise. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if the given resource is a video encoder. + * + * @param[in] resource A <code>PP_Resource</code> identifying a resource. + * + * @return <code>PP_TRUE</code> if the resource is a + * <code>PPB_VideoEncoder</code>, <code>PP_FALSE</code> if the resource is + * invalid or some other type. + */ + PP_Bool (*IsVideoEncoder)(PP_Resource resource); + /** + * Gets an array of supported video encoder profiles. + * These can be used to choose a profile before calling Initialize(). + * + * @param[in] video_encoder A <code>PP_Resource</code> identifying the video + * encoder. + * @param[in] output A <code>PP_ArrayOutput</code> to receive the supported + * <code>PP_VideoProfileDescription</code> structs. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return If >= 0, the number of supported profiles returned, otherwise an + * error code from <code>pp_errors.h</code>. + */ + int32_t (*GetSupportedProfiles)(PP_Resource video_encoder, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + /** + * Initializes a video encoder resource. The plugin should call Initialize() + * successfully before calling any of the functions below. + * + * @param[in] video_encoder A <code>PP_Resource</code> identifying the video + * encoder. + * @param[in] input_format The <code>PP_VideoFrame_Format</code> of the + * frames which will be encoded. + * @param[in] input_visible_size A <code>PP_Size</code> specifying the + * dimensions of the visible part of the input frames. + * @param[in] output_profile A <code>PP_VideoProfile</code> specifying the + * codec profile of the encoded output stream. + * @param[in] acceleration A <code>PP_HardwareAcceleration</code> specifying + * whether to use a hardware accelerated or a software implementation. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_NOTSUPPORTED if video encoding is not available, or the + * requested codec profile is not supported. + */ + int32_t (*Initialize)(PP_Resource video_encoder, + PP_VideoFrame_Format input_format, + const struct PP_Size* input_visible_size, + PP_VideoProfile output_profile, + uint32_t initial_bitrate, + PP_HardwareAcceleration acceleration, + struct PP_CompletionCallback callback); + /** + * Gets the number of input video frames that the encoder may hold while + * encoding. If the plugin is providing the video frames, it should have at + * least this many available. + * + * @param[in] video_encoder A <code>PP_Resource</code> identifying the video + * encoder. + * @return An int32_t containing the number of frames required, or an error + * code from <code>pp_errors.h</code>. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*GetFramesRequired)(PP_Resource video_encoder); + /** + * Gets the coded size of the video frames required by the encoder. Coded + * size is the logical size of the input frames, in pixels. The encoder may + * have hardware alignment requirements that make this different from + * |input_visible_size|, as requested in the call to Initialize(). + * + * @param[in] video_encoder A <code>PP_Resource</code> identifying the video + * encoder. + * @param[in] coded_size A <code>PP_Size</code> to hold the coded size. + * @return An int32_t containing a result code from <code>pp_errors.h</code>. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*GetFrameCodedSize)(PP_Resource video_encoder, + struct PP_Size* coded_size); + /** + * Gets a blank video frame which can be filled with video data and passed + * to the encoder. + * + * @param[in] video_encoder A <code>PP_Resource</code> identifying the video + * encoder. + * @param[out] video_frame A blank <code>PPB_VideoFrame</code> resource. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*GetVideoFrame)(PP_Resource video_encoder, + PP_Resource* video_frame, + struct PP_CompletionCallback callback); + /** + * Encodes a video frame. + * + * @param[in] video_encoder A <code>PP_Resource</code> identifying the video + * encoder. + * @param[in] video_frame The <code>PPB_VideoFrame</code> to be encoded. + * @param[in] force_keyframe A <code>PP_Bool> specifying whether the encoder + * should emit a key frame for this video frame. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. Plugins that pass <code>PPB_VideoFrame</code> resources owned + * by other resources should wait for completion before reusing them. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*Encode)(PP_Resource video_encoder, + PP_Resource video_frame, + PP_Bool force_keyframe, + struct PP_CompletionCallback callback); + /** + * Gets the next encoded bitstream buffer from the encoder. + * + * @param[in] video_encoder A <code>PP_Resource</code> identifying the video + * encoder. + * @param[out] bitstream_buffer A <code>PP_BitstreamBuffer</code> containing + * encoded video data. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. The plugin can call GetBitstreamBuffer from the callback in + * order to continuously "pull" bitstream buffers from the encoder. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + * Returns PP_ERROR_INPROGRESS if a prior call to GetBitstreamBuffer() has + * not completed. + */ + int32_t (*GetBitstreamBuffer)(PP_Resource video_encoder, + struct PP_BitstreamBuffer* bitstream_buffer, + struct PP_CompletionCallback callback); + /** + * Recycles a bitstream buffer back to the encoder. + * + * @param[in] video_encoder A <code>PP_Resource</code> identifying the video + * encoder. + * @param[in] bitstream_buffer A <code>PP_BitstreamBuffer</code> that is no + * longer needed by the plugin. + */ + void (*RecycleBitstreamBuffer)( + PP_Resource video_encoder, + const struct PP_BitstreamBuffer* bitstream_buffer); + /** + * Requests a change to encoding parameters. This is only a request, + * fulfilled on a best-effort basis. + * + * @param[in] video_encoder A <code>PP_Resource</code> identifying the video + * encoder. + * @param[in] bitrate The requested new bitrate, in bits per second. + * @param[in] framerate The requested new framerate, in frames per second. + */ + void (*RequestEncodingParametersChange)(PP_Resource video_encoder, + uint32_t bitrate, + uint32_t framerate); + /** + * Closes the video encoder, and cancels any pending encodes. Any pending + * callbacks will still run, reporting <code>PP_ERROR_ABORTED</code> . It is + * not valid to call any encoder functions after a call to this method. + * <strong>Note:</strong> Destroying the video encoder closes it implicitly, + * so you are not required to call Close(). + * + * @param[in] video_encoder A <code>PP_Resource</code> identifying the video + * encoder. + */ + void (*Close)(PP_Resource video_encoder); +}; + +typedef struct PPB_VideoEncoder_0_2 PPB_VideoEncoder; + +struct PPB_VideoEncoder_0_1 { /* dev */ + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsVideoEncoder)(PP_Resource resource); + int32_t (*GetSupportedProfiles)(PP_Resource video_encoder, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + int32_t (*Initialize)(PP_Resource video_encoder, + PP_VideoFrame_Format input_format, + const struct PP_Size* input_visible_size, + PP_VideoProfile output_profile, + uint32_t initial_bitrate, + PP_HardwareAcceleration acceleration, + struct PP_CompletionCallback callback); + int32_t (*GetFramesRequired)(PP_Resource video_encoder); + int32_t (*GetFrameCodedSize)(PP_Resource video_encoder, + struct PP_Size* coded_size); + int32_t (*GetVideoFrame)(PP_Resource video_encoder, + PP_Resource* video_frame, + struct PP_CompletionCallback callback); + int32_t (*Encode)(PP_Resource video_encoder, + PP_Resource video_frame, + PP_Bool force_keyframe, + struct PP_CompletionCallback callback); + int32_t (*GetBitstreamBuffer)(PP_Resource video_encoder, + struct PP_BitstreamBuffer* bitstream_buffer, + struct PP_CompletionCallback callback); + void (*RecycleBitstreamBuffer)( + PP_Resource video_encoder, + const struct PP_BitstreamBuffer* bitstream_buffer); + void (*RequestEncodingParametersChange)(PP_Resource video_encoder, + uint32_t bitrate, + uint32_t framerate); + void (*Close)(PP_Resource video_encoder); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_VIDEO_ENCODER_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_video_frame.h
Added
@@ -0,0 +1,139 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_video_frame.idl modified Tue Mar 25 18:28:57 2014. */ + +#ifndef PPAPI_C_PPB_VIDEO_FRAME_H_ +#define PPAPI_C_PPB_VIDEO_FRAME_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" + +#define PPB_VIDEOFRAME_INTERFACE_0_1 "PPB_VideoFrame;0.1" +#define PPB_VIDEOFRAME_INTERFACE PPB_VIDEOFRAME_INTERFACE_0_1 + +/** + * @file + * Defines the <code>PPB_VideoFrame</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * Unknown format value. + */ + PP_VIDEOFRAME_FORMAT_UNKNOWN = 0, + /** + * 12bpp YVU planar 1x1 Y, 2x2 VU samples. + */ + PP_VIDEOFRAME_FORMAT_YV12 = 1, + /** + * 12bpp YUV planar 1x1 Y, 2x2 UV samples. + */ + PP_VIDEOFRAME_FORMAT_I420 = 2, + /** + * 32bpp BGRA. + */ + PP_VIDEOFRAME_FORMAT_BGRA = 3, + /** + * The last format. + */ + PP_VIDEOFRAME_FORMAT_LAST = PP_VIDEOFRAME_FORMAT_BGRA +} PP_VideoFrame_Format; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_VideoFrame_0_1 { + /** + * Determines if a resource is a VideoFrame resource. + * + * @param[in] resource The <code>PP_Resource</code> to test. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given + * resource is a VideoFrame resource or <code>PP_FALSE</code> otherwise. + */ + PP_Bool (*IsVideoFrame)(PP_Resource resource); + /** + * Gets the timestamp of the video frame. + * + * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame + * resource. + * + * @return A <code>PP_TimeDelta</code> containing the timestamp of the video + * frame. Given in seconds since the start of the containing video stream. + */ + PP_TimeDelta (*GetTimestamp)(PP_Resource frame); + /** + * Sets the timestamp of the video frame. Given in seconds since the + * start of the containing video stream. + * + * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame + * resource. + * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp + * of the video frame. Given in seconds since the start of the containing + * video stream. + */ + void (*SetTimestamp)(PP_Resource frame, PP_TimeDelta timestamp); + /** + * Gets the format of the video frame. + * + * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame + * resource. + * + * @return A <code>PP_VideoFrame_Format</code> containing the format of the + * video frame. + */ + PP_VideoFrame_Format (*GetFormat)(PP_Resource frame); + /** + * Gets the size of the video frame. + * + * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame + * resource. + * @param[out] size A <code>PP_Size</code>. + * + * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> on success or + * <code>PP_FALSE</code> on failure. + */ + PP_Bool (*GetSize)(PP_Resource frame, struct PP_Size* size); + /** + * Gets the data buffer for video frame pixels. + * + * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame + * resource. + * + * @return A pointer to the beginning of the data buffer. + */ + void* (*GetDataBuffer)(PP_Resource frame); + /** + * Gets the size of data buffer. + * + * @param[in] frame A <code>PP_Resource</code> corresponding to a video frame + * resource. + * + * @return The size of the data buffer. + */ + uint32_t (*GetDataBufferSize)(PP_Resource frame); +}; + +typedef struct PPB_VideoFrame_0_1 PPB_VideoFrame; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_VIDEO_FRAME_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_view.h
Added
@@ -0,0 +1,243 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_view.idl modified Fri Sep 5 11:32:22 2014. */ + +#ifndef PPAPI_C_PPB_VIEW_H_ +#define PPAPI_C_PPB_VIEW_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_VIEW_INTERFACE_1_0 "PPB_View;1.0" +#define PPB_VIEW_INTERFACE_1_1 "PPB_View;1.1" +#define PPB_VIEW_INTERFACE_1_2 "PPB_View;1.2" +#define PPB_VIEW_INTERFACE PPB_VIEW_INTERFACE_1_2 + +/** + * @file + * This file defines the <code>PPB_View</code> struct representing the state + * of the view of an instance. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * <code>PPB_View</code> represents the state of the view of an instance. + * You will receive new view information using + * <code>PPP_Instance.DidChangeView</code>. + */ +struct PPB_View_1_2 { + /** + * IsView() determines if the given resource is a valid + * <code>PPB_View</code> resource. Note that <code>PPB_ViewChanged</code> + * resources derive from <code>PPB_View</code> and will return true here + * as well. + * + * @param resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_View</code> resource. + * + * @return <code>PP_TRUE</code> if the given resource supports + * <code>PPB_View</code> or <code>PP_FALSE</code> if it is an invalid + * resource or is a resource of another type. + */ + PP_Bool (*IsView)(PP_Resource resource); + /** + * GetRect() retrieves the rectangle of the module instance associated + * with a view changed notification relative to the upper-left of the browser + * viewport. This position changes when the page is scrolled. + * + * The returned rectangle may not be inside the visible portion of the + * viewport if the module instance is scrolled off the page. Therefore, the + * position may be negative or larger than the size of the page. The size will + * always reflect the size of the module were it to be scrolled entirely into + * view. + * + * In general, most modules will not need to worry about the position of the + * module instance in the viewport, and only need to use the size. + * + * @param resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_View</code> resource. + * + * @param rect A <code>PP_Rect</code> receiving the rectangle on success. + * + * @return Returns <code>PP_TRUE</code> if the resource was valid and the + * viewport rectangle was filled in, <code>PP_FALSE</code> if not. + */ + PP_Bool (*GetRect)(PP_Resource resource, struct PP_Rect* rect); + /** + * IsFullscreen() returns whether the instance is currently + * displaying in fullscreen mode. + * + * @param resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_View</code> resource. + * + * @return <code>PP_TRUE</code> if the instance is in full screen mode, + * or <code>PP_FALSE</code> if it's not or the resource is invalid. + */ + PP_Bool (*IsFullscreen)(PP_Resource resource); + /** + * IsVisible() determines whether the module instance might be visible to + * the user. For example, the Chrome window could be minimized or another + * window could be over it. In both of these cases, the module instance + * would not be visible to the user, but IsVisible() will return true. + * + * Use the result to speed up or stop updates for invisible module + * instances. + * + * This function performs the duties of GetRect() (determining whether the + * module instance is scrolled into view and the clip rectangle is nonempty) + * and IsPageVisible() (whether the page is visible to the user). + * + * @param resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_View</code> resource. + * + * @return <code>PP_TRUE</code> if the instance might be visible to the + * user, <code>PP_FALSE</code> if it is definitely not visible. + */ + PP_Bool (*IsVisible)(PP_Resource resource); + /** + * IsPageVisible() determines if the page that contains the module instance + * is visible. The most common cause of invisible pages is that + * the page is in a background tab in the browser. + * + * Most applications should use IsVisible() instead of this function since + * the module instance could be scrolled off of a visible page, and this + * function will still return true. However, depending on how your module + * interacts with the page, there may be certain updates that you may want to + * perform when the page is visible even if your specific module instance is + * not visible. + * + * @param resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_View</code> resource. + * + * @return <code>PP_TRUE</code> if the instance is plausibly visible to the + * user, <code>PP_FALSE</code> if it is definitely not visible. + */ + PP_Bool (*IsPageVisible)(PP_Resource resource); + /** + * GetClipRect() returns the clip rectangle relative to the upper-left corner + * of the module instance. This rectangle indicates the portions of the module + * instance that are scrolled into view. + * + * If the module instance is scrolled off the view, the return value will be + * (0, 0, 0, 0). This clip rectangle does <i>not</i> take into account page + * visibility. Therefore, if the module instance is scrolled into view, but + * the page itself is on a tab that is not visible, the return rectangle will + * contain the visible rectangle as though the page were visible. Refer to + * IsPageVisible() and IsVisible() if you want to account for page + * visibility. + * + * Most applications will not need to worry about the clip rectangle. The + * recommended behavior is to do full updates if the module instance is + * visible, as determined by IsVisible(), and do no updates if it is not + * visible. + * + * However, if the cost for computing pixels is very high for your + * application, or the pages you're targeting frequently have very large + * module instances with small visible portions, you may wish to optimize + * further. In this case, the clip rectangle will tell you which parts of + * the module to update. + * + * Note that painting of the page and sending of view changed updates + * happens asynchronously. This means when the user scrolls, for example, + * it is likely that the previous backing store of the module instance will + * be used for the first paint, and will be updated later when your + * application generates new content with the new clip. This may cause + * flickering at the boundaries when scrolling. If you do choose to do + * partial updates, you may want to think about what color the invisible + * portions of your backing store contain (be it transparent or some + * background color) or to paint a certain region outside the clip to reduce + * the visual distraction when this happens. + * + * @param resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_View</code> resource. + * + * @param clip Output argument receiving the clip rect on success. + * + * @return Returns <code>PP_TRUE</code> if the resource was valid and the + * clip rect was filled in, <code>PP_FALSE</code> if not. + */ + PP_Bool (*GetClipRect)(PP_Resource resource, struct PP_Rect* clip); + /** + * GetDeviceScale returns the scale factor between device pixels and Density + * Independent Pixels (DIPs, also known as logical pixels or UI pixels on + * some platforms). This allows the developer to render their contents at + * device resolution, even as coordinates / sizes are given in DIPs through + * the API. + * + * Note that the coordinate system for Pepper APIs is DIPs. Also note that + * one DIP might not equal one CSS pixel - when page scale/zoom is in effect. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_View</code> resource. + * + * @return A <code>float</code> value representing the number of device pixels + * per DIP. If the resource is invalid, the value will be 0.0. + */ + float (*GetDeviceScale)(PP_Resource resource); + /** + * GetCSSScale returns the scale factor between DIPs and CSS pixels. This + * allows proper scaling between DIPs - as sent via the Pepper API - and CSS + * pixel coordinates used for Web content. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_View</code> resource. + * + * @return css_scale A <code>float</code> value representing the number of + * DIPs per CSS pixel. If the resource is invalid, the value will be 0.0. + */ + float (*GetCSSScale)(PP_Resource resource); + /** + * GetScrollOffset returns the scroll offset of the window containing the + * plugin. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_View</code> resource. + * + * @param[out] offset A <code>PP_Point</code> which will be set to the value + * of the scroll offset in CSS pixels. + * + * @return Returns <code>PP_TRUE</code> if the resource was valid and the + * offset was filled in, <code>PP_FALSE</code> if not. + */ + PP_Bool (*GetScrollOffset)(PP_Resource resource, struct PP_Point* offset); +}; + +typedef struct PPB_View_1_2 PPB_View; + +struct PPB_View_1_0 { + PP_Bool (*IsView)(PP_Resource resource); + PP_Bool (*GetRect)(PP_Resource resource, struct PP_Rect* rect); + PP_Bool (*IsFullscreen)(PP_Resource resource); + PP_Bool (*IsVisible)(PP_Resource resource); + PP_Bool (*IsPageVisible)(PP_Resource resource); + PP_Bool (*GetClipRect)(PP_Resource resource, struct PP_Rect* clip); +}; + +struct PPB_View_1_1 { + PP_Bool (*IsView)(PP_Resource resource); + PP_Bool (*GetRect)(PP_Resource resource, struct PP_Rect* rect); + PP_Bool (*IsFullscreen)(PP_Resource resource); + PP_Bool (*IsVisible)(PP_Resource resource); + PP_Bool (*IsPageVisible)(PP_Resource resource); + PP_Bool (*GetClipRect)(PP_Resource resource, struct PP_Rect* clip); + float (*GetDeviceScale)(PP_Resource resource); + float (*GetCSSScale)(PP_Resource resource); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_VIEW_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_vpn_provider.h
Added
@@ -0,0 +1,175 @@ +/* Copyright 2016 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_vpn_provider.idl modified Fri May 6 20:42:01 2016. */ + +#ifndef PPAPI_C_PPB_VPN_PROVIDER_H_ +#define PPAPI_C_PPB_VPN_PROVIDER_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_VPNPROVIDER_INTERFACE_0_1 "PPB_VpnProvider;0.1" /* dev */ +/** + * @file + * This file defines the <code>PPB_VpnProvider</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Use the <code>PPB_VpnProvider</code> interface to implement a VPN client. + * Important: This API is available only on Chrome OS. + * + * This interface enhances the <code>chrome.vpnProvider</code> JavaScript API by + * providing a high performance path for packet handling. + * + * Permissions: Apps permission <code>vpnProvider</code> is required for + * <code>PPB_VpnProvider.Bind()</code>. + * + * Typical usage: + * - Create a <code>PPB_VpnProvider</code> instance. + * - Register the callback for <code>PPB_VpnProvider.ReceivePacket()</code>. + * - In the extension follow the usual workflow for configuring a VPN connection + * via the <code>chrome.vpnProvider</code> API until the step for notifying + * the connection state as "connected". + * - Bind to the previously created connection using + * <code>PPB_VpnProvider.Bind()</code>. + * - Notify the connection state as "connected" from JavaScript using + * <code>chrome.vpnProvider.notifyConnectionStateChanged</code>. + * - When the steps above are completed without errors, a virtual tunnel is + * created to the network stack of Chrome OS. IP packets can be sent through + * the tunnel using <code>PPB_VpnProvider.SendPacket()</code> and any packets + * originating on the Chrome OS device will be received using the callback + * registered for <code>PPB_VpnProvider.ReceivePacket()</code>. + * - When the user disconnects from the VPN configuration or there is an error + * the extension will be notfied via + * <code>chrome.vpnProvider.onPlatformMessage</code>. + */ +struct PPB_VpnProvider_0_1 { /* dev */ + /** + * Create() creates a VpnProvider instance. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * with the VpnProvider. + * + * @return A <code>PP_Resource</code> corresponding to a VpnProvider if + * successful. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsVpnProvider() determines if the provided <code>resource</code> is a + * VpnProvider instance. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * VpnProvider. + * + * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a + * <code>PPB_VpnProvider</code>, <code>PP_FALSE</code> if the + * <code>resource</code> is invalid or some type other than + * <code>PPB_VpnProvider</code>. + */ + PP_Bool (*IsVpnProvider)(PP_Resource resource); + /** + * Bind() binds to an existing configuration created from JavaScript by + * <code>chrome.vpnProvider.createConfig</code>. All packets will be routed + * via <code>SendPacket</code> and <code>ReceivePacket</code>. The user should + * register the callback for <code>ReceivePacket</code> before calling + * <code>Bind()</code>. + * + * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a + * VpnProvider. + * + * @param[in] configuration_id A <code>PP_VARTYPE_STRING</code> representing + * the configuration id from the callback of + * <code>chrome.vpnProvider.createConfig</code>. + * + * @param[in] configuration_name A <code>PP_VARTYPE_STRING</code> representing + * the configuration name as defined by the user when calling + * <code>chrome.vpnProvider.createConfig</code>. + * + * @param[in] callback A <code>PP_CompletionCallback</code> called on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to + * <code>Bind()</code> has not completed. + * Returns <code>PP_ERROR_BADARGUMENT</code> if either + * <code>configuration_id</code> or <code>configuration_name</code> are not of + * type <code>PP_VARTYPE_STRING</code>. + * Returns <code>PP_ERROR_NOACCESS</code> if the caller does the have the + * required "vpnProvider" permission. + * Returns <code>PP_ERROR_FAILED</code> if <code>connection_id</code> and + * <code>connection_name</code> could not be matched with the existing + * connection, or if the plugin originates from a different extension than the + * one that created the connection. + */ + int32_t (*Bind)(PP_Resource vpn_provider, + struct PP_Var configuration_id, + struct PP_Var configuration_name, + struct PP_CompletionCallback callback); + /** + * SendPacket() sends an IP packet through the tunnel created for the VPN + * session. This will succeed only when the VPN session is owned by the + * module and the connection is bound. + * + * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a + * VpnProvider. + * + * @param[in] packet A <code>PP_VARTYPE_ARRAY_BUFFER</code> corresponding to + * an IP packet to be sent to the platform. + * + * @param[in] callback A <code>PP_CompletionCallback</code> called on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns <code>PP_ERROR_FAILED</code> if the connection is not bound. + * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to + * <code>SendPacket()</code> has not completed. + * Returns <code>PP_ERROR_BADARGUMENT</code> if <code>packet</code> is not of + * type <code>PP_VARTYPE_ARRAY_BUFFER</code>. + */ + int32_t (*SendPacket)(PP_Resource vpn_provider, + struct PP_Var packet, + struct PP_CompletionCallback callback); + /** + * ReceivePacket() receives an IP packet from the tunnel for the VPN session. + * This function only returns a single packet. This function must be called at + * least N times to receive N packets, no matter the size of each packet. The + * callback should be registered before calling <code>Bind()</code>. + * + * @param[in] vpn_provider A <code>PP_Resource</code> corresponding to a + * VpnProvider. + * + * @param[out] packet The received packet is copied to provided + * <code>packet</code>. The <code>packet</code> must remain valid until + * ReceivePacket() completes. Its received <code>PP_VarType</code> will be + * <code>PP_VARTYPE_ARRAY_BUFFER</code>. + * + * @param[in] callback A <code>PP_CompletionCallback</code> called on + * completion. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to + * <code>ReceivePacket()</code> has not completed. + */ + int32_t (*ReceivePacket)(PP_Resource vpn_provider, + struct PP_Var* packet, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_VPN_PROVIDER_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppb_websocket.h
Added
@@ -0,0 +1,443 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppb_websocket.idl modified Thu May 31 15:47:38 2012. */ + +#ifndef PPAPI_C_PPB_WEBSOCKET_H_ +#define PPAPI_C_PPB_WEBSOCKET_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_WEBSOCKET_INTERFACE_1_0 "PPB_WebSocket;1.0" +#define PPB_WEBSOCKET_INTERFACE PPB_WEBSOCKET_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPB_WebSocket</code> interface providing + * bi-directional, full-duplex, communications over a single TCP socket. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains the types representing the WebSocket ready state + * and these states are based on the JavaScript WebSocket API specification. + * GetReadyState() returns one of these states. + */ +typedef enum { + /** + * Ready state is queried on an invalid resource. + */ + PP_WEBSOCKETREADYSTATE_INVALID = -1, + /** + * Ready state that the connection has not yet been established. + */ + PP_WEBSOCKETREADYSTATE_CONNECTING = 0, + /** + * Ready state that the WebSocket connection is established and communication + * is possible. + */ + PP_WEBSOCKETREADYSTATE_OPEN = 1, + /** + * Ready state that the connection is going through the closing handshake. + */ + PP_WEBSOCKETREADYSTATE_CLOSING = 2, + /** + * Ready state that the connection has been closed or could not be opened. + */ + PP_WEBSOCKETREADYSTATE_CLOSED = 3 +} PP_WebSocketReadyState; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_WebSocketReadyState, 4); + +/** + * This enumeration contains status codes. These codes are used in Close() and + * GetCloseCode(). Refer to RFC 6455, The WebSocket Protocol, for further + * information. + * <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> and codes in the range + * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to + * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and + * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to + * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are valid for Close(). + */ +typedef enum { + /** + * Indicates to request closing connection without status code and reason. + * + * (Note that the code 1005 is forbidden to send in actual close frames by + * the RFC. PP_WebSocket reuses this code internally and the code will never + * appear in the actual close frames.) + */ + PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED = 1005, + /** + * Status codes in the range 0-999 are not used. + */ + /** + * Indicates a normal closure. + */ + PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE = 1000, + /** + * Indicates that an endpoint is "going away", such as a server going down. + */ + PP_WEBSOCKETSTATUSCODE_GOING_AWAY = 1001, + /** + * Indicates that an endpoint is terminating the connection due to a protocol + * error. + */ + PP_WEBSOCKETSTATUSCODE_PROTOCOL_ERROR = 1002, + /** + * Indicates that an endpoint is terminating the connection because it has + * received a type of data it cannot accept. + */ + PP_WEBSOCKETSTATUSCODE_UNSUPPORTED_DATA = 1003, + /** + * Status code 1004 is reserved. + */ + /** + * Pseudo code to indicate that receiving close frame doesn't contain any + * status code. + */ + PP_WEBSOCKETSTATUSCODE_NO_STATUS_RECEIVED = 1005, + /** + * Pseudo code to indicate that connection was closed abnormally, e.g., + * without closing handshake. + */ + PP_WEBSOCKETSTATUSCODE_ABNORMAL_CLOSURE = 1006, + /** + * Indicates that an endpoint is terminating the connection because it has + * received data within a message that was not consistent with the type of + * the message (e.g., non-UTF-8 data within a text message). + */ + PP_WEBSOCKETSTATUSCODE_INVALID_FRAME_PAYLOAD_DATA = 1007, + /** + * Indicates that an endpoint is terminating the connection because it has + * received a message that violates its policy. + */ + PP_WEBSOCKETSTATUSCODE_POLICY_VIOLATION = 1008, + /** + * Indicates that an endpoint is terminating the connection because it has + * received a message that is too big for it to process. + */ + PP_WEBSOCKETSTATUSCODE_MESSAGE_TOO_BIG = 1009, + /** + * Indicates that an endpoint (client) is terminating the connection because + * it has expected the server to negotiate one or more extension, but the + * server didn't return them in the response message of the WebSocket + * handshake. + */ + PP_WEBSOCKETSTATUSCODE_MANDATORY_EXTENSION = 1010, + /** + * Indicates that a server is terminating the connection because it + * encountered an unexpected condition. + */ + PP_WEBSOCKETSTATUSCODE_INTERNAL_SERVER_ERROR = 1011, + /** + * Status codes in the range 1012-1014 are reserved. + */ + /** + * Pseudo code to indicate that the connection was closed due to a failure to + * perform a TLS handshake. + */ + PP_WEBSOCKETSTATUSCODE_TLS_HANDSHAKE = 1015, + /** + * Status codes in the range 1016-2999 are reserved. + */ + /** + * Status codes in the range 3000-3999 are reserved for use by libraries, + * frameworks, and applications. These codes are registered directly with + * IANA. + */ + PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN = 3000, + PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX = 3999, + /** + * Status codes in the range 4000-4999 are reserved for private use. + * Application can use these codes for application specific purposes freely. + */ + PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN = 4000, + PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX = 4999 +} PP_WebSocketCloseCode; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_WebSocketCloseCode, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_WebSocket</code> interface provides bi-directional, + * full-duplex, communications over a single TCP socket. + */ +struct PPB_WebSocket_1_0 { + /** + * Create() creates a WebSocket instance. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * with the WebSocket. + * + * @return A <code>PP_Resource</code> corresponding to a WebSocket if + * successful. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsWebSocket() determines if the provided <code>resource</code> is a + * WebSocket instance. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * WebSocket. + * + * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a + * <code>PPB_WebSocket</code>, <code>PP_FALSE</code> if the + * <code>resource</code> is invalid or some type other than + * <code>PPB_WebSocket</code>. + */ + PP_Bool (*IsWebSocket)(PP_Resource resource); + /** + * Connect() connects to the specified WebSocket server. You can call this + * function once for a <code>web_socket</code>. + * + * @param[in] web_socket A <code>PP_Resource</code> corresponding to a + * WebSocket. + * + * @param[in] url A <code>PP_Var</code> representing a WebSocket server URL. + * The <code>PP_VarType</code> must be <code>PP_VARTYPE_STRING</code>. + * + * @param[in] protocols A pointer to an array of <code>PP_Var</code> + * specifying sub-protocols. Each <code>PP_Var</code> represents one + * sub-protocol and its <code>PP_VarType</code> must be + * <code>PP_VARTYPE_STRING</code>. This argument can be null only if + * <code>protocol_count</code> is 0. + * + * @param[in] protocol_count The number of sub-protocols in + * <code>protocols</code>. + * + * @param[in] callback A <code>PP_CompletionCallback</code> called + * when a connection is established or an error occurs in establishing + * connection. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns <code>PP_ERROR_BADARGUMENT</code> if the specified + * <code>url</code>, or <code>protocols</code> contain an invalid string as + * defined in the WebSocket API specification. + * <code>PP_ERROR_BADARGUMENT</code> corresponds to a SyntaxError in the + * WebSocket API specification. + * Returns <code>PP_ERROR_NOACCESS</code> if the protocol specified in the + * <code>url</code> is not a secure protocol, but the origin of the caller + * has a secure scheme. Also returns <code>PP_ERROR_NOACCESS</code> if the + * port specified in the <code>url</code> is a port that the user agent + * is configured to block access to because it is a well-known port like + * SMTP. <code>PP_ERROR_NOACCESS</code> corresponds to a SecurityError of the + * specification. + * Returns <code>PP_ERROR_INPROGRESS</code> if this is not the first call to + * Connect(). + */ + int32_t (*Connect)(PP_Resource web_socket, + struct PP_Var url, + const struct PP_Var protocols[], + uint32_t protocol_count, + struct PP_CompletionCallback callback); + /** + * Close() closes the specified WebSocket connection by specifying + * <code>code</code> and <code>reason</code>. + * + * @param[in] web_socket A <code>PP_Resource</code> corresponding to a + * WebSocket. + * + * @param[in] code The WebSocket close code. This is ignored if it is + * <code>PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED</code>. + * <code>PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE</code> must be used for the + * usual case. To indicate some specific error cases, codes in the range + * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN</code> to + * <code>PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX</code>, and in the range + * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN</code> to + * <code>PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX</code> are available. + * + * @param[in] reason A <code>PP_Var</code> representing the WebSocket + * close reason. This is ignored if it is <code>PP_VARTYPE_UNDEFINED</code>. + * Otherwise, its <code>PP_VarType</code> must be + * <code>PP_VARTYPE_STRING</code>. + * + * @param[in] callback A <code>PP_CompletionCallback</code> called + * when the connection is closed or an error occurs in closing the + * connection. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns <code>PP_ERROR_BADARGUMENT</code> if <code>reason</code> contains + * an invalid character as a UTF-8 string, or is longer than 123 bytes. + * <code>PP_ERROR_BADARGUMENT</code> corresponds to a JavaScript SyntaxError + * in the WebSocket API specification. + * Returns <code>PP_ERROR_NOACCESS</code> if the code is not an integer + * equal to 1000 or in the range 3000 to 4999. <code>PP_ERROR_NOACCESS</code> + * corresponds to an InvalidAccessError in the WebSocket API specification. + * Returns <code>PP_ERROR_INPROGRESS</code> if a previous call to Close() is + * not finished. + */ + int32_t (*Close)(PP_Resource web_socket, + uint16_t code, + struct PP_Var reason, + struct PP_CompletionCallback callback); + /** + * ReceiveMessage() receives a message from the WebSocket server. + * This interface only returns a single message. That is, this interface must + * be called at least N times to receive N messages, no matter the size of + * each message. + * + * @param[in] web_socket A <code>PP_Resource</code> corresponding to a + * WebSocket. + * + * @param[out] message The received message is copied to provided + * <code>message</code>. The <code>message</code> must remain valid until + * ReceiveMessage() completes. Its received <code>PP_VarType</code> will be + * <code>PP_VARTYPE_STRING</code> or <code>PP_VARTYPE_ARRAY_BUFFER</code>. + * + * @param[in] callback A <code>PP_CompletionCallback</code> called + * when ReceiveMessage() completes. This callback is ignored if + * ReceiveMessage() completes synchronously and returns <code>PP_OK</code>. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * If an error is detected or connection is closed, ReceiveMessage() returns + * <code>PP_ERROR_FAILED</code> after all buffered messages are received. + * Until buffered message become empty, ReceiveMessage() continues to return + * <code>PP_OK</code> as if connection is still established without errors. + */ + int32_t (*ReceiveMessage)(PP_Resource web_socket, + struct PP_Var* message, + struct PP_CompletionCallback callback); + /** + * SendMessage() sends a message to the WebSocket server. + * + * @param[in] web_socket A <code>PP_Resource</code> corresponding to a + * WebSocket. + * + * @param[in] message A message to send. The message is copied to an internal + * buffer, so the caller can free <code>message</code> safely after returning + * from the function. Its sent <code>PP_VarType</code> must be + * <code>PP_VARTYPE_STRING</code> or <code>PP_VARTYPE_ARRAY_BUFFER</code>. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + * Returns <code>PP_ERROR_FAILED</code> if the ReadyState is + * <code>PP_WEBSOCKETREADYSTATE_CONNECTING</code>. + * <code>PP_ERROR_FAILED</code> corresponds to a JavaScript + * InvalidStateError in the WebSocket API specification. + * Returns <code>PP_ERROR_BADARGUMENT</code> if the provided + * <code>message</code> contains an invalid character as a UTF-8 string. + * <code>PP_ERROR_BADARGUMENT</code> corresponds to a JavaScript + * SyntaxError in the WebSocket API specification. + * Otherwise, returns <code>PP_OK</code>, which doesn't necessarily mean + * that the server received the message. + */ + int32_t (*SendMessage)(PP_Resource web_socket, struct PP_Var message); + /** + * GetBufferedAmount() returns the number of bytes of text and binary + * messages that have been queued for the WebSocket connection to send, but + * have not been transmitted to the network yet. + * + * @param[in] web_socket A <code>PP_Resource</code> corresponding to a + * WebSocket. + * + * @return Returns the number of bytes. + */ + uint64_t (*GetBufferedAmount)(PP_Resource web_socket); + /** + * GetCloseCode() returns the connection close code for the WebSocket + * connection. + * + * @param[in] web_socket A <code>PP_Resource</code> corresponding to a + * WebSocket. + * + * @return Returns 0 if called before the close code is set. + */ + uint16_t (*GetCloseCode)(PP_Resource web_socket); + /** + * GetCloseReason() returns the connection close reason for the WebSocket + * connection. + * + * @param[in] web_socket A <code>PP_Resource</code> corresponding to a + * WebSocket. + * + * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the + * close reason is set, the return value contains an empty string. Returns a + * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. + */ + struct PP_Var (*GetCloseReason)(PP_Resource web_socket); + /** + * GetCloseWasClean() returns if the connection was closed cleanly for the + * specified WebSocket connection. + * + * @param[in] web_socket A <code>PP_Resource</code> corresponding to a + * WebSocket. + * + * @return Returns <code>PP_FALSE</code> if called before the connection is + * closed, called on an invalid resource, or closed for abnormal reasons. + * Otherwise, returns <code>PP_TRUE</code> if the connection was closed + * cleanly. + */ + PP_Bool (*GetCloseWasClean)(PP_Resource web_socket); + /** + * GetExtensions() returns the extensions selected by the server for the + * specified WebSocket connection. + * + * @param[in] web_socket A <code>PP_Resource</code> corresponding to a + * WebSocket. + * + * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the + * connection is established, the var's data is an empty string. Returns a + * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. + */ + struct PP_Var (*GetExtensions)(PP_Resource web_socket); + /** + * GetProtocol() returns the sub-protocol chosen by the server for the + * specified WebSocket connection. + * + * @param[in] web_socket A <code>PP_Resource</code> corresponding to a + * WebSocket. + * + * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the + * connection is established, the var contains the empty string. Returns a + * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. + */ + struct PP_Var (*GetProtocol)(PP_Resource web_socket); + /** + * GetReadyState() returns the ready state of the specified WebSocket + * connection. + * + * @param[in] web_socket A <code>PP_Resource</code> corresponding to a + * WebSocket. + * + * @return Returns <code>PP_WEBSOCKETREADYSTATE_INVALID</code> if called + * before Connect() is called, or if this function is called on an + * invalid resource. + */ + PP_WebSocketReadyState (*GetReadyState)(PP_Resource web_socket); + /** + * GetURL() returns the URL associated with specified WebSocket connection. + * + * @param[in] web_socket A <code>PP_Resource</code> corresponding to a + * WebSocket. + * + * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the + * connection is established, the var contains the empty string. Returns a + * <code>PP_VARTYPE_UNDEFINED</code> if this function is called on an + * invalid resource. + */ + struct PP_Var (*GetURL)(PP_Resource web_socket); +}; + +typedef struct PPB_WebSocket_1_0 PPB_WebSocket; +/** + * @} + */ + +#endif /* PPAPI_C_PPB_WEBSOCKET_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppp.h
Added
@@ -0,0 +1,159 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppp.idl modified Mon Feb 11 15:48:41 2013. */ + +#ifndef PPAPI_C_PPP_H_ +#define PPAPI_C_PPP_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/ppb.h" + +/** + * @file + * This file defines three functions that your module must + * implement to interact with the browser. + */ + + + +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/ppb.h" + +#if __GNUC__ >= 4 +#define PP_EXPORT __attribute__ ((visibility("default"))) +#elif defined(_MSC_VER) +#define PP_EXPORT __declspec(dllexport) +#endif + +/* {PENDING: undefine PP_EXPORT?} */ + +/* We don't want name mangling for these external functions. We only need + * 'extern "C"' if we're compiling with a C++ compiler. + */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PPP_InitializeModule() is the entry point for a module and is called by the + * browser when your module loads. Your code must implement this function. + * + * Failure indicates to the browser that this module can not be used. In this + * case, the module will be unloaded and ShutdownModule will NOT be called. + * + * @param[in] module A handle to your module. Generally you should store this + * value since it will be required for other API calls. + * @param[in] get_browser_interface A pointer to the function that you can + * use to query for browser interfaces. Generally you should store this value + * for future use. + * + * @return <code>PP_OK</code> on success. Any other value on failure. + */ +PP_EXPORT int32_t PPP_InitializeModule(PP_Module module, + PPB_GetInterface get_browser_interface); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PPP_ShutdownModule() is <strong>sometimes</strong> called before the module + * is unloaded. It is not recommended that you implement this function. + * + * There is no practical use of this function for third party modules. Its + * existence is because of some internal use cases inside Chrome. + * + * Since your module runs in a separate process, there's no need to free + * allocated memory. There is also no need to free any resources since all of + * resources associated with an instance will be force-freed when that instance + * is deleted. + * + * <strong>Note:</strong> This function will always be skipped on untrusted + * (Native Client) implementations. This function may be skipped on trusted + * implementations in certain circumstances when Chrome does "fast shutdown" + * of a web page. + */ +PP_EXPORT void PPP_ShutdownModule(void); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PPP_GetInterface() is called by the browser to query the module for + * interfaces it supports. + * + * Your module must implement the <code>PPP_Instance</code> interface or it + * will be unloaded. Other interfaces are optional. + * + * This function is called from within browser code whenever an interface is + * needed. This means your plugin could be reentered via this function if you + * make a browser call and it needs an interface. Furthermore, you should not + * make any other browser calls from within your implementation to avoid + * reentering the browser. + * + * As a result, your implementation of this should merely provide a lookup + * from the requested name to an interface pointer, via something like a big + * if/else block or a map, and not do any other work. + * + * @param[in] interface_name A pointer to a "PPP" (plugin) interface name. + * Interface names are null-terminated ASCII strings. + * + * @return A pointer for the interface or <code>NULL</code> if the interface is + * not supported. + */ +PP_EXPORT const void* PPP_GetInterface(const char* interface_name); +/** + * @} + */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/** + * @addtogroup Typedefs + * @{ + */ +/** + * Defines the type of the <code>PPP_InitializeModule</code> function. + */ +typedef int32_t (*PP_InitializeModule_Func)( + PP_Module module, + PPB_GetInterface get_browser_interface); + +/** + * Defines the type of the <code>PPP_ShutdownModule</code> function. + */ +typedef void (*PP_ShutdownModule_Func)(void); + +/** + * Defines the type of the <code>PPP_ShutdownModule</code> function. + */ +typedef const void* (*PP_GetInterface_Func)(const char* interface_name); +/** + * @} + */ + +#endif /* PPAPI_C_PPP_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppp_graphics_3d.h
Added
@@ -0,0 +1,46 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppp_graphics_3d.idl modified Wed Mar 21 17:35:39 2012. */ + +#ifndef PPAPI_C_PPP_GRAPHICS_3D_H_ +#define PPAPI_C_PPP_GRAPHICS_3D_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPP_GRAPHICS_3D_INTERFACE_1_0 "PPP_Graphics_3D;1.0" +#define PPP_GRAPHICS_3D_INTERFACE PPP_GRAPHICS_3D_INTERFACE_1_0 + +/** + * @file + * Defines the <code>PPP_Graphics3D</code> struct representing a 3D graphics + * context within the browser. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * <code>PPP_Graphics3D</code> defines the notification interface for a 3D + * graphics context. + */ +struct PPP_Graphics3D_1_0 { + /** + * Called when the OpenGL ES window is invalidated and needs to be repainted. + */ + void (*Graphics3DContextLost)(PP_Instance instance); +}; + +typedef struct PPP_Graphics3D_1_0 PPP_Graphics3D; +/** + * @} + */ + +#endif /* PPAPI_C_PPP_GRAPHICS_3D_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppp_input_event.h
Added
@@ -0,0 +1,84 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppp_input_event.idl modified Tue Apr 8 15:19:45 2014. */ + +#ifndef PPAPI_C_PPP_INPUT_EVENT_H_ +#define PPAPI_C_PPP_INPUT_EVENT_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPP_INPUT_EVENT_INTERFACE_0_1 "PPP_InputEvent;0.1" +#define PPP_INPUT_EVENT_INTERFACE PPP_INPUT_EVENT_INTERFACE_0_1 + +/** + * @file + * This file defines the API for receiving input events from the browser. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPP_InputEvent_0_1 { + /** + * Function for receiving input events from the browser. + * + * In order to receive input events, you must register for them by calling + * PPB_InputEvent.RequestInputEvents() or RequestFilteringInputEvents(). By + * default, no events are delivered. + * + * If the event was handled, it will not be forwarded to the default handlers + * in the web page. If it was not handled, it may be dispatched to a default + * handler. So it is important that an instance respond accurately with + * whether event propagation should continue. + * + * Event propagation also controls focus. If you handle an event like a mouse + * event, typically the instance will be given focus. Returning false from + * a filtered event handler or not registering for an event type means that + * the click will be given to a lower part of the page and your instance will + * not receive focus. This allows an instance to be partially transparent, + * where clicks on the transparent areas will behave like clicks to the + * underlying page. + * + * In general, you should try to keep input event handling short. Especially + * for filtered input events, the browser or page may be blocked waiting for + * you to respond. + * + * The caller of this function will maintain a reference to the input event + * resource during this call. Unless you take a reference to the resource + * to hold it for later, you don't need to release it. + * + * <strong>Note:</strong> If you're not receiving input events, make sure you + * register for the event classes you want by calling RequestInputEvents or + * RequestFilteringInputEvents. If you're still not receiving keyboard input + * events, make sure you're returning true (or using a non-filtered event + * handler) for mouse events. Otherwise, the instance will not receive focus + * and keyboard events will not be sent. + * + * \see PPB_InputEvent.RequestInputEvents and + * PPB_InputEvent.RequestFilteringInputEvents + * + * @return PP_TRUE if the event was handled, PP_FALSE if not. If you have + * registered to filter this class of events by calling + * RequestFilteringInputEvents, and you return PP_FALSE, the event will + * be forwarded to the page (and eventually the browser) for the default + * handling. For non-filtered events, the return value will be ignored. + */ + PP_Bool (*HandleInputEvent)(PP_Instance instance, PP_Resource input_event); +}; + +typedef struct PPP_InputEvent_0_1 PPP_InputEvent; +/** + * @} + */ + +#endif /* PPAPI_C_PPP_INPUT_EVENT_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppp_instance.h
Added
@@ -0,0 +1,197 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppp_instance.idl modified Thu Apr 25 13:07:47 2013. */ + +#ifndef PPAPI_C_PPP_INSTANCE_H_ +#define PPAPI_C_PPP_INSTANCE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" + +#define PPP_INSTANCE_INTERFACE_1_0 "PPP_Instance;1.0" +#define PPP_INSTANCE_INTERFACE_1_1 "PPP_Instance;1.1" +#define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_1_1 + +/** + * @file + * This file defines the <code>PPP_Instance</code> structure - a series of + * pointers to methods that you must implement in your module. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPP_Instance</code> interface contains pointers to a series of + * functions that you must implement in your module. These functions can be + * trivial (simply return the default return value) unless you want your module + * to handle events such as change of focus or input events (keyboard/mouse) + * events. + */ +struct PPP_Instance_1_1 { + /** + * DidCreate() is a creation handler that is called when a new instance is + * created. This function is called for each instantiation on the page, + * corresponding to one \<embed\> tag on the page. + * + * Generally you would handle this call by initializing the information + * your module associates with an instance and creating a mapping from the + * given <code>PP_Instance</code> handle to this data. The + * <code>PP_Instance</code> handle will be used in subsequent calls to + * identify which instance the call pertains to. + * + * It's possible for more than one instance to be created in a single module. + * This means that you may get more than one <code>OnCreate</code> without an + * <code>OnDestroy</code> in between, and should be prepared to maintain + * multiple states associated with each instance. + * + * If this function reports a failure (by returning <code>PP_FALSE</code>), + * the instance will be deleted. + * + * @param[in] instance A new <code>PP_Instance</code> identifying one + * instance of a module. This is an opaque handle. + * + * @param[in] argc The number of arguments contained in <code>argn</code> + * and <code>argv</code>. + * + * @param[in] argn An array of argument names. These argument names are + * supplied in the \<embed\> tag, for example: + * <code>\<embed id="nacl_module" dimensions="2"\></code> will produce two + * argument names: "id" and "dimensions." + * + * @param[in] argv An array of argument values. These are the values of the + * arguments listed in the \<embed\> tag, for example + * <code>\<embed id="nacl_module" dimensions="2"\></code> will produce two + * argument values: "nacl_module" and "2". The indices of these values match + * the indices of the corresponding names in <code>argn</code>. + * + * @return <code>PP_TRUE</code> on success or <code>PP_FALSE</code> on + * failure. + */ + PP_Bool (*DidCreate)(PP_Instance instance, + uint32_t argc, + const char* argn[], + const char* argv[]); + /** + * DidDestroy() is an instance destruction handler. This function is called + * in many cases (see below) when a module instance is destroyed. It will be + * called even if DidCreate() returned failure. + * + * Generally you will handle this call by deallocating the tracking + * information and the <code>PP_Instance</code> mapping you created in the + * DidCreate() call. You can also free resources associated with this + * instance but this isn't required; all resources associated with the deleted + * instance will be automatically freed when this function returns. + * + * The instance identifier will still be valid during this call, so the module + * can perform cleanup-related tasks. Once this function returns, the + * <code>PP_Instance</code> handle will be invalid. This means that you can't + * do any asynchronous operations like network requests, file writes or + * messaging from this function since they will be immediately canceled. + * + * <strong>Note:</strong> This function will always be skipped on untrusted + * (Native Client) implementations. This function may be skipped on trusted + * implementations in certain circumstances when Chrome does "fast shutdown" + * of a web page. Fast shutdown will happen in some cases when all module + * instances are being deleted, and no cleanup functions will be called. + * The module will just be unloaded and the process terminated. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + */ + void (*DidDestroy)(PP_Instance instance); + /** + * <code>DidChangeView() is called when the position, size, or other view + * attributes of the instance has changed. + */ + void (*DidChangeView)(PP_Instance instance, PP_Resource view); + /** + * DidChangeFocus() is called when an instance has gained or lost focus. + * Having focus means that keyboard events will be sent to the instance. + * An instance's default condition is that it will not have focus. + * + * The focus flag takes into account both browser tab and window focus as + * well as focus of the plugin element on the page. In order to be deemed + * to have focus, the browser window must be topmost, the tab must be + * selected in the window, and the instance must be the focused element on + * the page. + * + * <strong>Note:</strong>Clicks on instances will give focus only if you + * handle the click event. Return <code>true</code> from + * <code>HandleInputEvent</code> in <code>PPP_InputEvent</code> (or use + * unfiltered events) to signal that the click event was handled. Otherwise, + * the browser will bubble the event and give focus to the element on the page + * that actually did end up consuming it. If you're not getting focus, check + * to make sure you're either requesting them via + * <code>RequestInputEvents()<code> (which implicitly marks all input events + * as consumed) or via <code>RequestFilteringInputEvents()</code> and + * returning true from your event handler. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * receiving the input event. + * + * @param[in] has_focus Indicates the new focused state of the instance. + */ + void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); + /** + * HandleDocumentLoad() is called after initialize for a full-frame + * instance that was instantiated based on the MIME type of a DOMWindow + * navigation. This situation only applies to modules that are pre-registered + * to handle certain MIME types. If you haven't specifically registered to + * handle a MIME type or aren't positive this applies to you, your + * implementation of this function can just return <code>PP_FALSE</code>. + * + * The given <code>url_loader</code> corresponds to a + * <code>PPB_URLLoader</code> instance that is already opened. Its response + * headers may be queried using <code>PPB_URLLoader::GetResponseInfo</code>. + * The reference count for the URL loader is not incremented automatically on + * behalf of the module. You need to increment the reference count yourself + * if you are going to keep a reference to it. + * + * This method returns <code>PP_FALSE</code> if the module cannot handle the + * data. In response to this method, the module should call + * ReadResponseBody() to read the incoming data. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * that should do the load. + * + * @param[in] url_loader An open <code>PPB_URLLoader</code> instance. + * + * @return <code>PP_TRUE</code> if the data was handled, + * <code>PP_FALSE</code> otherwise. If you return false, the load will be + * canceled for you. + */ + PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); +}; + +typedef struct PPP_Instance_1_1 PPP_Instance; + +struct PPP_Instance_1_0 { + PP_Bool (*DidCreate)(PP_Instance instance, + uint32_t argc, + const char* argn[], + const char* argv[]); + void (*DidDestroy)(PP_Instance instance); + void (*DidChangeView)(PP_Instance instance, + const struct PP_Rect* position, + const struct PP_Rect* clip); + void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); + PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PPP_INSTANCE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppp_message_handler.h
Added
@@ -0,0 +1,96 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppp_message_handler.idl modified Wed Sep 24 10:48:49 2014. */ + +#ifndef PPAPI_C_PPP_MESSAGE_HANDLER_H_ +#define PPAPI_C_PPP_MESSAGE_HANDLER_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +/** + * @file + * This file defines the <code>PPP_MessageHandler</code> interface that plugins + * can implement and register using PPB_Messaging::RegisterMessageHandler in + * order to handle messages sent from JavaScript via postMessage() or + * postMessageAndAwaitResponse(). + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPP_MessageHandler</code> interface is implemented by the plugin + * if the plugin wants to receive messages from a thread other than the main + * Pepper thread, or if the plugin wants to handle blocking messages which + * JavaScript may send via postMessageAndAwaitResponse(). + * + * This interface struct should not be returned by PPP_GetInterface; instead it + * must be passed as a parameter to PPB_Messaging::RegisterMessageHandler. + */ +struct PPP_MessageHandler_0_2 { + /** + * Invoked as a result of JavaScript invoking postMessage() on the plugin's + * DOM element. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler(). + * @param[in] message A copy of the parameter that JavaScript provided to + * postMessage(). + */ + void (*HandleMessage)(PP_Instance instance, + void* user_data, + const struct PP_Var* message); + /** + * Invoked as a result of JavaScript invoking postMessageAndAwaitResponse() + * on the plugin's DOM element. + * + * NOTE: JavaScript execution is blocked during the duration of this call. + * Hence, the plugin should respond as quickly as possible. For this reason, + * blocking completion callbacks are disallowed while handling a blocking + * message. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler(). + * @param[in] message is a copy of the parameter that JavaScript provided + * to postMessageAndAwaitResponse(). + * @param[out] response will be copied to a JavaScript object which is + * returned as the result of postMessageAndAwaitResponse() to the invoking + * + */ + void (*HandleBlockingMessage)(PP_Instance instance, + void* user_data, + const struct PP_Var* message, + struct PP_Var* response); + /** + * Invoked when the handler object is no longer needed. After this, no more + * calls will be made which pass this same value for <code>instance</code> + * and <code>user_data</code>. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler. + */ + void (*Destroy)(PP_Instance instance, void* user_data); +}; + +typedef struct PPP_MessageHandler_0_2 PPP_MessageHandler; +/** + * @} + */ + +#endif /* PPAPI_C_PPP_MESSAGE_HANDLER_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppp_messaging.h
Added
@@ -0,0 +1,87 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppp_messaging.idl modified Wed Jun 5 10:32:43 2013. */ + +#ifndef PPAPI_C_PPP_MESSAGING_H_ +#define PPAPI_C_PPP_MESSAGING_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPP_MESSAGING_INTERFACE_1_0 "PPP_Messaging;1.0" +#define PPP_MESSAGING_INTERFACE PPP_MESSAGING_INTERFACE_1_0 + +/** + * @file + * This file defines the PPP_Messaging interface containing pointers to + * functions that you must implement to handle postMessage messages + * on the associated DOM element. + * + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPP_Messaging</code> interface contains pointers to functions + * that you must implement to handle postMessage events on the associated + * DOM element. + */ +struct PPP_Messaging_1_0 { + /** + * HandleMessage() is a function that the browser calls when PostMessage() + * is invoked on the DOM element for the module instance in JavaScript. Note + * that PostMessage() in the JavaScript interface is asynchronous, meaning + * JavaScript execution will not be blocked while HandleMessage() is + * processing the message. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + * @param[in] message A <code>PP_Var</code> which has been converted from a + * JavaScript value. JavaScript array/object types are supported from Chrome + * M29 onward. All JavaScript values are copied when passing them to the + * plugin. + * + * When converting JavaScript arrays, any object properties whose name + * is not an array index are ignored. When passing arrays and objects, the + * entire reference graph will be converted and transferred. If the reference + * graph has cycles, the message will not be sent and an error will be logged + * to the console. + * + * The following JavaScript code invokes <code>HandleMessage</code>, passing + * the module instance on which it was invoked, with <code>message</code> + * being a string <code>PP_Var</code> containing "Hello world!" + * + * <strong>Example:</strong> + * + * @code + * + * <body> + * <object id="plugin" + * type="application/x-ppapi-postMessage-example"/> + * <script type="text/javascript"> + * document.getElementById('plugin').postMessage("Hello world!"); + * </script> + * </body> + * + * @endcode + * + */ + void (*HandleMessage)(PP_Instance instance, struct PP_Var message); +}; + +typedef struct PPP_Messaging_1_0 PPP_Messaging; +/** + * @} + */ + +#endif /* PPAPI_C_PPP_MESSAGING_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/ppp_mouse_lock.h
Added
@@ -0,0 +1,51 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From ppp_mouse_lock.idl modified Wed Dec 21 19:08:34 2011. */ + +#ifndef PPAPI_C_PPP_MOUSE_LOCK_H_ +#define PPAPI_C_PPP_MOUSE_LOCK_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +#define PPP_MOUSELOCK_INTERFACE_1_0 "PPP_MouseLock;1.0" +#define PPP_MOUSELOCK_INTERFACE PPP_MOUSELOCK_INTERFACE_1_0 + +/** + * @file + * This file defines the <code>PPP_MouseLock</code> interface containing a + * function that you must implement to receive mouse lock events from the + * browser. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPP_MouseLock</code> interface contains a function that you must + * implement to receive mouse lock events from the browser. + */ +struct PPP_MouseLock_1_0 { + /** + * MouseLockLost() is called when the instance loses the mouse lock, such as + * when the user presses the ESC key. + * + * @param[in] instance A <code>PP_Instance</code> identifying one instance + * of a module. + */ + void (*MouseLockLost)(PP_Instance instance); +}; + +typedef struct PPP_MouseLock_1_0 PPP_MouseLock; +/** + * @} + */ + +#endif /* PPAPI_C_PPP_MOUSE_LOCK_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private
Added
+(directory)
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/pp_file_handle.h
Added
@@ -0,0 +1,31 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/pp_file_handle.idl modified Fri Jul 27 17:01:41 2012. */ + +#ifndef PPAPI_C_PRIVATE_PP_FILE_HANDLE_H_ +#define PPAPI_C_PRIVATE_PP_FILE_HANDLE_H_ + +#include "ppapi/c/pp_macros.h" + +/** + * @file + * This file provides support for native OS file handles. + */ + + + +#ifdef _WIN32 +#include<windows.h> +typedef HANDLE PP_FileHandle; +static const PP_FileHandle PP_kInvalidFileHandle = NULL; + +#else +typedef int PP_FileHandle; +static const PP_FileHandle PP_kInvalidFileHandle = -1; +#endif + +#endif /* PPAPI_C_PRIVATE_PP_FILE_HANDLE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_ext_crx_file_system_private.h
Added
@@ -0,0 +1,60 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_ext_crx_file_system_private.idl, + * modified Fri Nov 1 12:23:59 2013. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_EXT_CRX_FILE_SYSTEM_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_EXT_CRX_FILE_SYSTEM_PRIVATE_H_ + +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_EXT_CRXFILESYSTEM_PRIVATE_INTERFACE_0_1 \ + "PPB_Ext_CrxFileSystem_Private;0.1" +#define PPB_EXT_CRXFILESYSTEM_PRIVATE_INTERFACE \ + PPB_EXT_CRXFILESYSTEM_PRIVATE_INTERFACE_0_1 + +/** + * @file + * This file contains the <code>PPB_Ext_CrxFileSystem_Private</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/* <code>PPB_Ext_CrxFileSystem_Private</code> interface */ +struct PPB_Ext_CrxFileSystem_Private_0_1 { + /** + * Open() opens the CRX file system for the current extension. It will fail + * when called from non-extension context. + * + * @param[in] crxfs A <code>PP_Resource</code> corresponding to a + * CrxFileSystem. + * @param[out] file_system An output <code>PP_Resource</code> corresponding + * to a PPB_FileSystem. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*Open)(PP_Instance instance, + PP_Resource* file_system, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_Ext_CrxFileSystem_Private_0_1 PPB_Ext_CrxFileSystem_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_EXT_CRX_FILE_SYSTEM_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_file_io_private.h
Added
@@ -0,0 +1,49 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_file_io_private.idl modified Wed Mar 27 14:43:25 2013. */ + +#ifndef PPAPI_C_PRIVATE_PPB_FILE_IO_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_FILE_IO_PRIVATE_H_ + +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_FILEIO_PRIVATE_INTERFACE_0_1 "PPB_FileIO_Private;0.1" +#define PPB_FILEIO_PRIVATE_INTERFACE PPB_FILEIO_PRIVATE_INTERFACE_0_1 + +/** + * @file + */ + + +#include "ppapi/c/private/pp_file_handle.h" + +/** + * @addtogroup Interfaces + * @{ + */ +/* PPB_FileIO_Private interface */ +struct PPB_FileIO_Private_0_1 { + /** + * Returns a file handle corresponding to the given FileIO + * object. The FileIO object must have been opened with a + * successful call to FileIO::Open. The caller gets the ownership + * of the returned file handle and must close it. + */ + int32_t (*RequestOSFileHandle)(PP_Resource file_io, + PP_FileHandle* handle, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_FileIO_Private_0_1 PPB_FileIO_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_FILE_IO_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_file_ref_private.h
Added
@@ -0,0 +1,48 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_file_ref_private.idl modified Fri Dec 16 17:34:59 2011. */ + +#ifndef PPAPI_C_PRIVATE_PPB_FILE_REF_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_FILE_REF_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_FILEREFPRIVATE_INTERFACE_0_1 "PPB_FileRefPrivate;0.1" +#define PPB_FILEREFPRIVATE_INTERFACE PPB_FILEREFPRIVATE_INTERFACE_0_1 + +/** + * @file + * This file contains the <code>PPB_FileRefPrivate</code> interface. */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/* PPB_FileRefPrivate interface */ +struct PPB_FileRefPrivate_0_1 { + /** + * GetAbsolutePath() returns the absolute path of the file. + * + * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file + * reference. + * + * @return A <code>PP_Var</code> containing the absolute path of the file. + */ + struct PP_Var (*GetAbsolutePath)(PP_Resource file_ref); +}; + +typedef struct PPB_FileRefPrivate_0_1 PPB_FileRefPrivate; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_FILE_REF_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_host_resolver_private.h
Added
@@ -0,0 +1,118 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_host_resolver_private.idl, + * modified Mon Jun 24 09:49:40 2013. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_HOST_RESOLVER_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_HOST_RESOLVER_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/private/ppb_net_address_private.h" + +#define PPB_HOSTRESOLVER_PRIVATE_INTERFACE_0_1 "PPB_HostResolver_Private;0.1" +#define PPB_HOSTRESOLVER_PRIVATE_INTERFACE \ + PPB_HOSTRESOLVER_PRIVATE_INTERFACE_0_1 + +/** + * @file + * This file defines the <code>PPB_HostResolver_Private</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * The <code>PP_HostResolver_Flags</code> is an enumeration of the + * different types of flags, that can be OR-ed and passed to host + * resolver. + */ +typedef enum { + /** + * AI_CANONNAME + */ + PP_HOST_RESOLVER_PRIVATE_FLAGS_CANONNAME = 1 << 0, + /** + * Hint to the resolver that only loopback addresses are configured. + */ + PP_HOST_RESOLVER_PRIVATE_FLAGS_LOOPBACK_ONLY = 1 << 1 +} PP_HostResolver_Private_Flags; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_HostResolver_Private_Flags, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct PP_HostResolver_Private_Hint { + PP_NetAddressFamily_Private family; + int32_t flags; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_HostResolver_Private_Hint, 8); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_HostResolver_Private_0_1 { + /** + * Allocates a Host Resolver resource. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is a Host Resolver. + */ + PP_Bool (*IsHostResolver)(PP_Resource resource); + /** + * Creates a new request to Host Resolver. |callback| is invoked + * when request is processed and a list of network addresses is + * obtained. These addresses can be be used in Connect, Bind or + * Listen calls to connect to a given |host| and |port|. + */ + int32_t (*Resolve)(PP_Resource host_resolver, + const char* host, + uint16_t port, + const struct PP_HostResolver_Private_Hint* hint, + struct PP_CompletionCallback callback); + /** + * Returns canonical name of host. + */ + struct PP_Var (*GetCanonicalName)(PP_Resource host_resolver); + /** + * Returns number of network addresses obtained after Resolve call. + */ + uint32_t (*GetSize)(PP_Resource host_resolver); + /** + * Stores in the |addr| |index|-th network address. |addr| can't be + * NULL. Returns PP_TRUE if success or PP_FALSE if the given + * resource is not a Host Resolver or |index| exceeds number of + * available addresses. + */ + PP_Bool (*GetNetAddress)(PP_Resource host_resolver, + uint32_t index, + struct PP_NetAddress_Private* addr); +}; + +typedef struct PPB_HostResolver_Private_0_1 PPB_HostResolver_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_HOST_RESOLVER_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_isolated_file_system_private.h
Added
@@ -0,0 +1,86 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_isolated_file_system_private.idl, + * modified Fri Nov 8 02:21:15 2013. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_ISOLATED_FILE_SYSTEM_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_ISOLATED_FILE_SYSTEM_PRIVATE_H_ + +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_2 \ + "PPB_IsolatedFileSystem_Private;0.2" +#define PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE \ + PPB_ISOLATEDFILESYSTEM_PRIVATE_INTERFACE_0_2 + +/** + * @file + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * The <code>PP_IsolatedFileSystemType_Private</code> values indicate the type + * of isolated file systems. + */ +typedef enum { + /** Type for invalid file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID = 0, + /** Type for CRX file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX = 1, + /** Type for PluginPrivate file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE = 2 +} PP_IsolatedFileSystemType_Private; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_IsolatedFileSystemType_Private, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/* <code>PPB_IsolatedFileSystem_Private</code> interface */ +struct PPB_IsolatedFileSystem_Private_0_2 { + /** + * Open() opens a file system corresponding the given file system type. + * + * When opening the CRX file system, this should be called from an extension + * context, otherwise it will fail. + * + * @param[in] instance A <code>PP_Instance</code> identifying the instance + * with the file system. + * @param[in] type A file system type as defined by + * <code>PP_IsolatedFileSystemType_Private</code> enum. + * @param[out] file_system An output <code>PP_Resource</code> corresponding + * to a PPB_FileSystem. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion of Open. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*Open)(PP_Instance instance, + PP_IsolatedFileSystemType_Private type, + PP_Resource* file_system, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_IsolatedFileSystem_Private_0_2 + PPB_IsolatedFileSystem_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_ISOLATED_FILE_SYSTEM_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_net_address_private.h
Added
@@ -0,0 +1,187 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_net_address_private.idl, + * modified Mon Jun 24 09:52:39 2013. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_NET_ADDRESS_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_NET_ADDRESS_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_NETADDRESS_PRIVATE_INTERFACE_0_1 "PPB_NetAddress_Private;0.1" +#define PPB_NETADDRESS_PRIVATE_INTERFACE_1_0 "PPB_NetAddress_Private;1.0" +#define PPB_NETADDRESS_PRIVATE_INTERFACE_1_1 "PPB_NetAddress_Private;1.1" +#define PPB_NETADDRESS_PRIVATE_INTERFACE PPB_NETADDRESS_PRIVATE_INTERFACE_1_1 + +/** + * @file + * This file defines the <code>PPB_NetAddress_Private</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * The address family is unspecified. + */ + PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED = 0, + /** + * The Internet Protocol version 4 (IPv4) address family. + */ + PP_NETADDRESSFAMILY_PRIVATE_IPV4 = 1, + /** + * The Internet Protocol version 6 (IPv6) address family. + */ + PP_NETADDRESSFAMILY_PRIVATE_IPV6 = 2 +} PP_NetAddressFamily_Private; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetAddressFamily_Private, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * This is an opaque type holding a network address. Plugins must + * never access members of this struct directly. + */ +struct PP_NetAddress_Private { + uint32_t size; + int8_t data[128]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_Private, 132); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_NetAddress_Private</code> interface provides operations on + * network addresses. + */ +struct PPB_NetAddress_Private_1_1 { + /** + * Returns PP_TRUE if the two addresses are equal (host and port). + */ + PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1, + const struct PP_NetAddress_Private* addr2); + /** + * Returns PP_TRUE if the two addresses refer to the same host. + */ + PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1, + const struct PP_NetAddress_Private* addr2); + /** + * Returns a human-readable description of the network address, optionally + * including the port (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"), + * or an undefined var on failure. + */ + struct PP_Var (*Describe)(PP_Module module, + const struct PP_NetAddress_Private* addr, + PP_Bool include_port); + /** + * Replaces the port in the given source address. Returns PP_TRUE on success. + */ + PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr, + uint16_t port, + struct PP_NetAddress_Private* addr_out); + /** + * Gets the "any" address (for IPv4 or IPv6); for use with UDP Bind. + */ + void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr); + /** + * Gets the address family. + */ + PP_NetAddressFamily_Private (*GetFamily)( + const struct PP_NetAddress_Private* addr); + /** + * Gets the port. The port is returned in host byte order. + */ + uint16_t (*GetPort)(const struct PP_NetAddress_Private* addr); + /** + * Gets the address. The output, address, must be large enough for the + * current socket family. The output will be the binary representation of an + * address for the current socket family. For IPv4 and IPv6 the address is in + * network byte order. PP_TRUE is returned if the address was successfully + * retrieved. + */ + PP_Bool (*GetAddress)(const struct PP_NetAddress_Private* addr, + void* address, + uint16_t address_size); + /** + * Returns ScopeID for IPv6 addresses or 0 for IPv4. + */ + uint32_t (*GetScopeID)(const struct PP_NetAddress_Private* addr); + /** + * Creates NetAddress with the specified IPv4 address and port + * number. + */ + void (*CreateFromIPv4Address)(const uint8_t ip[4], + uint16_t port, + struct PP_NetAddress_Private* addr_out); + /** + * Creates NetAddress with the specified IPv6 address, scope_id and + * port number. + */ + void (*CreateFromIPv6Address)(const uint8_t ip[16], + uint32_t scope_id, + uint16_t port, + struct PP_NetAddress_Private* addr_out); +}; + +typedef struct PPB_NetAddress_Private_1_1 PPB_NetAddress_Private; + +struct PPB_NetAddress_Private_0_1 { + PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1, + const struct PP_NetAddress_Private* addr2); + PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1, + const struct PP_NetAddress_Private* addr2); + struct PP_Var (*Describe)(PP_Module module, + const struct PP_NetAddress_Private* addr, + PP_Bool include_port); + PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr, + uint16_t port, + struct PP_NetAddress_Private* addr_out); + void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr); +}; + +struct PPB_NetAddress_Private_1_0 { + PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1, + const struct PP_NetAddress_Private* addr2); + PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1, + const struct PP_NetAddress_Private* addr2); + struct PP_Var (*Describe)(PP_Module module, + const struct PP_NetAddress_Private* addr, + PP_Bool include_port); + PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr, + uint16_t port, + struct PP_NetAddress_Private* addr_out); + void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr); + PP_NetAddressFamily_Private (*GetFamily)( + const struct PP_NetAddress_Private* addr); + uint16_t (*GetPort)(const struct PP_NetAddress_Private* addr); + PP_Bool (*GetAddress)(const struct PP_NetAddress_Private* addr, + void* address, + uint16_t address_size); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_NET_ADDRESS_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_output_protection_private.h
Added
@@ -0,0 +1,172 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_output_protection_private.idl, + * modified Tue Oct 8 13:22:13 2013. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE_0_1 \ + "PPB_OutputProtection_Private;0.1" +#define PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE \ + PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE_0_1 + +/** + * @file + * This file defines the API for output protection. Currently, it only supports + * Chrome OS. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * Content protection methods applied on video output link. + */ +typedef enum { + PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE = 0, + PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP = 1 << 0 +} PP_OutputProtectionMethod_Private; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_OutputProtectionMethod_Private, 4); + +/** + * Video output link types. + */ +typedef enum { + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NONE = 0, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_UNKNOWN = 1 << 0, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_INTERNAL = 1 << 1, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA = 1 << 2, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI = 1 << 3, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI = 1 << 4, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT = 1 << 5, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK = 1 << 6 +} PP_OutputProtectionLinkType_Private; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_OutputProtectionLinkType_Private, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_OutputProtection_Private</code> interface allows controlling + * output protection. + * + * <strong>Example:</strong> + * + * @code + * op = output_protection->Create(instance); + * output_protection->QueryStatus(op, &link_mask, &protection_mask, + * done_callback); + * @endcode + * + * In this example, the plugin wants to enforce HDCP for HDMI link. + * @code + * if (link_mask & PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI) { + * output_protection->EnableProtection( + * op, PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP, done_callback); + * } + * @endcode + * + * After EnableProtection() completes, the plugin has to query protection + * status periodically to make sure the protection is enabled and remains + * enabled. + */ +struct PPB_OutputProtection_Private_0_1 { + /** + * Create() creates a new <code>PPB_OutputProtection_Private</code> object. + * + * @pram[in] instance A <code>PP_Instance</code> identifying one instance of + * a module. + * + * @return A <code>PP_Resource</code> corresponding to a + * <code>PPB_OutputProtection_Private</code> if successful, 0 if creation + * failed. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsOutputProtection() determines if the provided resource is a + * <code>PPB_OutputProtection_Private</code>. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_OutputProtection_Private</code>. + * + * @return <code>PP_TRUE</code> if the resource is a + * <code>PPB_OutputProtection_Private</code>, <code>PP_FALSE</code> if the + * resource is invalid or some type other than + * <code>PPB_OutputProtection_Private</code>. + */ + PP_Bool (*IsOutputProtection)(PP_Resource resource); + /** + * Query link status and protection status. + * Clients have to query status periodically in order to detect changes. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_OutputProtection_Private</code>. + * @param[out] link_mask The type of connected output links, which is a + * bit-mask of the <code>PP_OutputProtectionLinkType_Private</code> values. + * @param[out] protection_mask Enabled protection methods, which is a + * bit-mask of the <code>PP_OutputProtectionMethod_Private</code> values. + * @param[in] callback A <code>PP_CompletionCallback</code> to run on + * asynchronous completion of QueryStatus(). This callback will only run if + * QueryStatus() returns <code>PP_OK_COMPLETIONPENDING</code>. + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*QueryStatus)(PP_Resource resource, + uint32_t* link_mask, + uint32_t* protection_mask, + struct PP_CompletionCallback callback); + /** + * Set desired protection methods. + * + * When the desired protection method(s) have been applied to all applicable + * output links, the relevant bit(s) of the protection_mask returned by + * QueryStatus() will be set. Otherwise, the relevant bit(s) of + * protection_mask will not be set; there is no separate error code or + * callback. + * + * Protections will be disabled if no longer desired by all instances. + * + * @param[in] resource A <code>PP_Resource</code> corresponding to a + * <code>PPB_OutputProtection_Private</code>. + * @param[in] desired_protection_mask The desired protection methods, which + * is a bit-mask of the <code>PP_OutputProtectionMethod_Private</code> + * values. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called with + * <code>PP_OK</code> when the protection request has been made. This may be + * before the protection have actually been applied. Call QueryStatus to get + * protection status. If it failed to make the protection request, the + * callback is called with <code>PP_ERROR_FAILED</code> and there is no need + * to call QueryStatus(). + * + * @return An int32_t containing an error code from <code>pp_errors.h</code>. + */ + int32_t (*EnableProtection)(PP_Resource resource, + uint32_t desired_protection_mask, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_OutputProtection_Private_0_1 PPB_OutputProtection_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_OUTPUT_PROTECTION_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_tcp_server_socket_private.h
Added
@@ -0,0 +1,109 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_tcp_server_socket_private.idl, + * modified Mon May 20 12:45:38 2013. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_TCP_SERVER_SOCKET_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_TCP_SERVER_SOCKET_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/private/ppb_net_address_private.h" + +#define PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE_0_1 \ + "PPB_TCPServerSocket_Private;0.1" +#define PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE_0_2 \ + "PPB_TCPServerSocket_Private;0.2" +#define PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE \ + PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE_0_2 + +/** + * @file + * This file defines the <code>PPB_TCPServerSocket_Private</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_TCPServerSocket_Private</code> interface provides TCP + * server socket operations. + */ +struct PPB_TCPServerSocket_Private_0_2 { + /** + * Allocates a TCP server socket resource. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is TCP server socket. + */ + PP_Bool (*IsTCPServerSocket)(PP_Resource resource); + /** + * Binds |tcp_server_socket| to the address given by |addr| and + * starts listening. The |backlog| argument defines the maximum + * length to which the queue of pending connections may + * grow. |callback| is invoked when |tcp_server_socket| is ready to + * accept incoming connections or in the case of failure. Returns + * PP_ERROR_NOSPACE if socket can't be initialized, or + * PP_ERROR_FAILED in the case of Listen failure. Otherwise, returns + * PP_OK. + */ + int32_t (*Listen)(PP_Resource tcp_server_socket, + const struct PP_NetAddress_Private* addr, + int32_t backlog, + struct PP_CompletionCallback callback); + /** + * Accepts single connection, creates instance of + * PPB_TCPSocket_Private and stores reference to it in + * |tcp_socket|. |callback| is invoked when connection is accepted + * or in the case of failure. This method can be called only after + * successful Listen call on |tcp_server_socket|. + */ + int32_t (*Accept)(PP_Resource tcp_server_socket, + PP_Resource* tcp_socket, + struct PP_CompletionCallback callback); + /** + * Returns the current address to which the socket is bound, in the + * buffer pointed to by |addr|. This method can be called only after + * successful Listen() call and before StopListening() call. + */ + int32_t (*GetLocalAddress)(PP_Resource tcp_server_socket, + struct PP_NetAddress_Private* addr); + /** + * Cancels all pending callbacks reporting PP_ERROR_ABORTED and + * closes the socket. Note: this method is implicitly called when + * server socket is destroyed. + */ + void (*StopListening)(PP_Resource tcp_server_socket); +}; + +typedef struct PPB_TCPServerSocket_Private_0_2 PPB_TCPServerSocket_Private; + +struct PPB_TCPServerSocket_Private_0_1 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsTCPServerSocket)(PP_Resource resource); + int32_t (*Listen)(PP_Resource tcp_server_socket, + const struct PP_NetAddress_Private* addr, + int32_t backlog, + struct PP_CompletionCallback callback); + int32_t (*Accept)(PP_Resource tcp_server_socket, + PP_Resource* tcp_socket, + struct PP_CompletionCallback callback); + void (*StopListening)(PP_Resource tcp_server_socket); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_TCP_SERVER_SOCKET_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_tcp_socket_private.h
Added
@@ -0,0 +1,241 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_tcp_socket_private.idl modified Mon Jun 24 09:53:12 2013. */ + +#ifndef PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/private/ppb_net_address_private.h" + +#define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_3 "PPB_TCPSocket_Private;0.3" +#define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4 "PPB_TCPSocket_Private;0.4" +#define PPB_TCPSOCKET_PRIVATE_INTERFACE_0_5 "PPB_TCPSocket_Private;0.5" +#define PPB_TCPSOCKET_PRIVATE_INTERFACE PPB_TCPSOCKET_PRIVATE_INTERFACE_0_5 + +/** + * @file + * This file defines the <code>PPB_TCPSocket_Private</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /* Special value used for testing. Guaranteed to fail SetOption(). */ + PP_TCPSOCKETOPTION_PRIVATE_INVALID = 0, + /* Disable coalescing of small writes to make TCP segments, and instead + * deliver data immediately. For SSL sockets, this option must be set before + * SSLHandshake() is called. Value type is PP_VARTYPE_BOOL. */ + PP_TCPSOCKETOPTION_PRIVATE_NO_DELAY = 1 +} PP_TCPSocketOption_Private; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocketOption_Private, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_TCPSocket_Private</code> interface provides TCP socket + * operations. + */ +struct PPB_TCPSocket_Private_0_5 { + /** + * Allocates a TCP socket resource. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is TCP socket. + */ + PP_Bool (*IsTCPSocket)(PP_Resource resource); + /** + * Connects to a TCP port given as a host-port pair. + * When a proxy server is used, |host| and |port| refer to the proxy server + * instead of the destination server. + */ + int32_t (*Connect)(PP_Resource tcp_socket, + const char* host, + uint16_t port, + struct PP_CompletionCallback callback); + /** + * Same as Connect(), but connecting to the address given by |addr|. A typical + * use-case would be for reconnections. + */ + int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + /** + * Gets the local address of the socket, if it has been connected. + * Returns PP_TRUE on success. + */ + PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, + struct PP_NetAddress_Private* local_addr); + /** + * Gets the remote address of the socket, if it has been connected. + * Returns PP_TRUE on success. + */ + PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, + struct PP_NetAddress_Private* remote_addr); + /** + * Does SSL handshake and moves to sending and receiving encrypted data. The + * socket must have been successfully connected. |server_name| will be + * compared with the name(s) in the server's certificate during the SSL + * handshake. |server_port| is only used to identify an SSL server in the SSL + * session cache. + * When a proxy server is used, |server_name| and |server_port| refer to the + * destination server. + * If the socket is not connected, or there are pending read/write requests, + * SSLHandshake() will fail without starting a handshake. Otherwise, any + * failure during the handshake process will cause the socket to be + * disconnected. + */ + int32_t (*SSLHandshake)(PP_Resource tcp_socket, + const char* server_name, + uint16_t server_port, + struct PP_CompletionCallback callback); + /** + * Returns the server's <code>PPB_X509Certificate_Private</code> for a socket + * connection if an SSL connection has been established using + * <code>SSLHandshake</code>. If no SSL connection has been established, a + * null resource is returned. + */ + PP_Resource (*GetServerCertificate)(PP_Resource tcp_socket); + /** + * NOTE: This function is not implemented and will return + * <code>PP_FALSE</code>. + * Adds a trusted/untrusted chain building certificate to be used for this + * connection. The <code>certificate</code> must be a + * <code>PPB_X509Certificate_Private<code>. <code>PP_TRUE</code> is returned + * upon success. + */ + PP_Bool (*AddChainBuildingCertificate)(PP_Resource tcp_socket, + PP_Resource certificate, + PP_Bool is_trusted); + /** + * Reads data from the socket. The size of |buffer| must be at least as large + * as |bytes_to_read|. May perform a partial read. Returns the number of bytes + * read or an error code. If the return value is 0, then it indicates that + * end-of-file was reached. + * This method won't return more than 1 megabyte, so if |bytes_to_read| + * exceeds 1 megabyte, it will always perform a partial read. + * Multiple outstanding read requests are not supported. + */ + int32_t (*Read)(PP_Resource tcp_socket, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + /** + * Writes data to the socket. May perform a partial write. Returns the number + * of bytes written or an error code. + * This method won't write more than 1 megabyte, so if |bytes_to_write| + * exceeds 1 megabyte, it will always perform a partial write. + * Multiple outstanding write requests are not supported. + */ + int32_t (*Write)(PP_Resource tcp_socket, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + /** + * Cancels any IO that may be pending, and disconnects the socket. Any pending + * callbacks will still run, reporting PP_Error_Aborted if pending IO was + * interrupted. It is NOT valid to call Connect() again after a call to this + * method. Note: If the socket is destroyed when it is still connected, then + * it will be implicitly disconnected, so you are not required to call this + * method. + */ + void (*Disconnect)(PP_Resource tcp_socket); + /** + * Sets an option on |tcp_socket|. Supported |name| and |value| parameters + * are as described for PP_TCPSocketOption_Private. |callback| will be + * invoked with PP_OK if setting the option succeeds, or an error code + * otherwise. The socket must be connection before SetOption is called. + */ + int32_t (*SetOption)(PP_Resource tcp_socket, + PP_TCPSocketOption_Private name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_TCPSocket_Private_0_5 PPB_TCPSocket_Private; + +struct PPB_TCPSocket_Private_0_3 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsTCPSocket)(PP_Resource resource); + int32_t (*Connect)(PP_Resource tcp_socket, + const char* host, + uint16_t port, + struct PP_CompletionCallback callback); + int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, + struct PP_NetAddress_Private* local_addr); + PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, + struct PP_NetAddress_Private* remote_addr); + int32_t (*SSLHandshake)(PP_Resource tcp_socket, + const char* server_name, + uint16_t server_port, + struct PP_CompletionCallback callback); + int32_t (*Read)(PP_Resource tcp_socket, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + int32_t (*Write)(PP_Resource tcp_socket, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + void (*Disconnect)(PP_Resource tcp_socket); +}; + +struct PPB_TCPSocket_Private_0_4 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsTCPSocket)(PP_Resource resource); + int32_t (*Connect)(PP_Resource tcp_socket, + const char* host, + uint16_t port, + struct PP_CompletionCallback callback); + int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, + struct PP_NetAddress_Private* local_addr); + PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, + struct PP_NetAddress_Private* remote_addr); + int32_t (*SSLHandshake)(PP_Resource tcp_socket, + const char* server_name, + uint16_t server_port, + struct PP_CompletionCallback callback); + PP_Resource (*GetServerCertificate)(PP_Resource tcp_socket); + PP_Bool (*AddChainBuildingCertificate)(PP_Resource tcp_socket, + PP_Resource certificate, + PP_Bool is_trusted); + int32_t (*Read)(PP_Resource tcp_socket, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + int32_t (*Write)(PP_Resource tcp_socket, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + void (*Disconnect)(PP_Resource tcp_socket); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_TCP_SOCKET_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_udp_socket_private.h
Added
@@ -0,0 +1,162 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_udp_socket_private.idl modified Mon Jun 24 09:53:43 2013. */ + +#ifndef PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/private/ppb_net_address_private.h" + +#define PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2 "PPB_UDPSocket_Private;0.2" +#define PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3 "PPB_UDPSocket_Private;0.3" +#define PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4 "PPB_UDPSocket_Private;0.4" +#define PPB_UDPSOCKET_PRIVATE_INTERFACE PPB_UDPSOCKET_PRIVATE_INTERFACE_0_4 + +/** + * @file + * This file defines the <code>PPB_UDPSocket_Private</code> interface. + */ + + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /* Allow the socket to share the local address to which socket will + * be bound with other processes. Value's type should be + * PP_VARTYPE_BOOL. */ + PP_UDPSOCKETFEATURE_PRIVATE_ADDRESS_REUSE = 0, + /* Allow sending and receiving packets sent to and from broadcast + * addresses. Value's type should be PP_VARTYPE_BOOL. */ + PP_UDPSOCKETFEATURE_PRIVATE_BROADCAST = 1, + /* Special value for counting the number of available + * features. Should not be passed to SetSocketFeature(). */ + PP_UDPSOCKETFEATURE_PRIVATE_COUNT = 2 +} PP_UDPSocketFeature_Private; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_UDPSocketFeature_Private, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_UDPSocket_Private_0_4 { + /** + * Creates a UDP socket resource. + */ + PP_Resource (*Create)(PP_Instance instance_id); + /** + * Determines if a given resource is a UDP socket. + */ + PP_Bool (*IsUDPSocket)(PP_Resource resource_id); + /** + * Sets a socket feature to |udp_socket|. Should be called before + * Bind(). Possible values for |name|, |value| and |value|'s type + * are described in PP_UDPSocketFeature_Private description. If no + * error occurs, returns PP_OK. Otherwise, returns + * PP_ERROR_BADRESOURCE (if bad |udp_socket| provided), + * PP_ERROR_BADARGUMENT (if bad name/value/value's type provided) + * or PP_ERROR_FAILED in the case of internal errors. + */ + int32_t (*SetSocketFeature)(PP_Resource udp_socket, + PP_UDPSocketFeature_Private name, + struct PP_Var value); + /* Creates a socket and binds to the address given by |addr|. */ + int32_t (*Bind)(PP_Resource udp_socket, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + /* Returns the address that the socket has bound to. A successful + * call to Bind must be called first. Returns PP_FALSE if Bind + * fails, or if Close has been called. + */ + PP_Bool (*GetBoundAddress)(PP_Resource udp_socket, + struct PP_NetAddress_Private* addr); + /* Performs a non-blocking recvfrom call on socket. + * Bind must be called first. |callback| is invoked when recvfrom + * reads data. You must call GetRecvFromAddress to recover the + * address the data was retrieved from. + */ + int32_t (*RecvFrom)(PP_Resource udp_socket, + char* buffer, + int32_t num_bytes, + struct PP_CompletionCallback callback); + /* Upon successful completion of RecvFrom, the address that the data + * was received from is stored in |addr|. + */ + PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket, + struct PP_NetAddress_Private* addr); + /* Performs a non-blocking sendto call on the socket created and + * bound(has already called Bind). The callback |callback| is + * invoked when sendto completes. + */ + int32_t (*SendTo)(PP_Resource udp_socket, + const char* buffer, + int32_t num_bytes, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + /* Cancels all pending reads and writes, and closes the socket. */ + void (*Close)(PP_Resource udp_socket); +}; + +typedef struct PPB_UDPSocket_Private_0_4 PPB_UDPSocket_Private; + +struct PPB_UDPSocket_Private_0_2 { + PP_Resource (*Create)(PP_Instance instance_id); + PP_Bool (*IsUDPSocket)(PP_Resource resource_id); + int32_t (*Bind)(PP_Resource udp_socket, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + int32_t (*RecvFrom)(PP_Resource udp_socket, + char* buffer, + int32_t num_bytes, + struct PP_CompletionCallback callback); + PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket, + struct PP_NetAddress_Private* addr); + int32_t (*SendTo)(PP_Resource udp_socket, + const char* buffer, + int32_t num_bytes, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + void (*Close)(PP_Resource udp_socket); +}; + +struct PPB_UDPSocket_Private_0_3 { + PP_Resource (*Create)(PP_Instance instance_id); + PP_Bool (*IsUDPSocket)(PP_Resource resource_id); + int32_t (*Bind)(PP_Resource udp_socket, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + PP_Bool (*GetBoundAddress)(PP_Resource udp_socket, + struct PP_NetAddress_Private* addr); + int32_t (*RecvFrom)(PP_Resource udp_socket, + char* buffer, + int32_t num_bytes, + struct PP_CompletionCallback callback); + PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket, + struct PP_NetAddress_Private* addr); + int32_t (*SendTo)(PP_Resource udp_socket, + const char* buffer, + int32_t num_bytes, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + void (*Close)(PP_Resource udp_socket); +}; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_UDP_SOCKET_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_uma_private.h
Added
@@ -0,0 +1,83 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_uma_private.idl modified Fri Mar 14 16:59:33 2014. */ + +#ifndef PPAPI_C_PRIVATE_PPB_UMA_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_UMA_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_UMA_PRIVATE_INTERFACE_0_3 "PPB_UMA_Private;0.3" +#define PPB_UMA_PRIVATE_INTERFACE PPB_UMA_PRIVATE_INTERFACE_0_3 + +/** + * @file + * This file defines the <code>PPB_UMA_Private</code> interface. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Contains functions for plugins to report UMA usage stats. + */ +struct PPB_UMA_Private_0_3 { + /** + * HistogramCustomTimes is a pointer to a function which records a time + * sample given in milliseconds in the histogram given by |name|, possibly + * creating the histogram if it does not exist. + */ + void (*HistogramCustomTimes)(PP_Instance instance, + struct PP_Var name, + int64_t sample, + int64_t min, + int64_t max, + uint32_t bucket_count); + /** + * HistogramCustomCounts is a pointer to a function which records a sample + * in the histogram given by |name|, possibly creating the histogram if it + * does not exist. + */ + void (*HistogramCustomCounts)(PP_Instance instance, + struct PP_Var name, + int32_t sample, + int32_t min, + int32_t max, + uint32_t bucket_count); + /** + * HistogramEnumeration is a pointer to a function which records a sample + * in the histogram given by |name|, possibly creating the histogram if it + * does not exist. The sample represents a value in an enumeration bounded + * by |boundary_value|, that is, sample < boundary_value always. + */ + void (*HistogramEnumeration)(PP_Instance instance, + struct PP_Var name, + int32_t sample, + int32_t boundary_value); + /** + * IsCrashReportingEnabled returns PP_OK to the completion callback to + * indicate that the current user has opted-in to crash reporting, or + * PP_ERROR_* on failure or when a user has not opted-in. This can be used to + * gate other reporting processes such as analytics and crash reporting. + */ + int32_t (*IsCrashReportingEnabled)(PP_Instance instance, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_UMA_Private_0_3 PPB_UMA_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_UMA_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/c/private/ppb_x509_certificate_private.h
Added
@@ -0,0 +1,182 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From private/ppb_x509_certificate_private.idl, + * modified Wed Apr 11 17:11:26 2012. + */ + +#ifndef PPAPI_C_PRIVATE_PPB_X509_CERTIFICATE_PRIVATE_H_ +#define PPAPI_C_PRIVATE_PPB_X509_CERTIFICATE_PRIVATE_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_X509CERTIFICATE_PRIVATE_INTERFACE_0_1 \ + "PPB_X509Certificate_Private;0.1" +#define PPB_X509CERTIFICATE_PRIVATE_INTERFACE \ + PPB_X509CERTIFICATE_PRIVATE_INTERFACE_0_1 + +/** + * @file + * This file defines the <code>PPB_X509Certificate_Private</code> interface for + * an X509 certificate. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration corresponds to fields of an X509 certificate. Refer to + * <a href="http://www.ietf.org/rfc/rfc5280.txt>RFC 5280</a> for further + * documentation about particular fields. + */ +typedef enum { + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_ISSUER_COMMON_NAME = 0, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_ISSUER_LOCALITY_NAME = 1, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_ISSUER_STATE_OR_PROVINCE_NAME = 2, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_ISSUER_COUNTRY_NAME = 3, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_ISSUER_ORGANIZATION_NAME = 4, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_ISSUER_ORGANIZATION_UNIT_NAME = 5, + /** + * Note: This field is unimplemented and will return + * <code>PP_VARTYPE_NULL</code>. + */ + PP_X509CERTIFICATE_PRIVATE_ISSUER_UNIQUE_ID = 6, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_SUBJECT_COMMON_NAME = 7, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_SUBJECT_LOCALITY_NAME = 8, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_SUBJECT_STATE_OR_PROVINCE_NAME = 9, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_SUBJECT_COUNTRY_NAME = 10, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_SUBJECT_ORGANIZATION_NAME = 11, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_SUBJECT_ORGANIZATION_UNIT_NAME = 12, + /** + * Note: This field is unimplemented and will return + * <code>PP_VARTYPE_NULL</code>. + */ + PP_X509CERTIFICATE_PRIVATE_SUBJECT_UNIQUE_ID = 13, + /** + * Note: This field is unimplemented and will return + * <code>PP_VARTYPE_NULL</code>. + */ + PP_X509CERTIFICATE_PRIVATE_VERSION = 14, + /** + * This corresponds to a byte array (<code>PP_VARTYPE_ARRAY_BUFFER</code>). + * The serial number may include a leading 0. + */ + PP_X509CERTIFICATE_PRIVATE_SERIAL_NUMBER = 15, + /** + * Note: This field is unimplemented and will return + * <code>PP_VARTYPE_NULL</code>. + */ + PP_X509CERTIFICATE_PRIVATE_SIGNATURE_ALGORITHM_OID = 16, + /** + * Note: This field is unimplemented and will return + * <code>PP_VARTYPE_NULL</code>. + */ + PP_X509CERTIFICATE_PRIVATE_SIGNATURE_ALGORITHM_PARAMATERS_RAW = 17, + /** + * This corresponds to a double (<code>PP_VARTYPE_DOUBLE</code>) which + * can be cast to a <code>PP_TIME</code>. + */ + PP_X509CERTIFICATE_PRIVATE_VALIDITY_NOT_BEFORE = 18, + /** + * This corresponds to a double (<code>PP_VARTYPE_DOUBLE</code>) which + * can be cast to a <code>PP_TIME</code>. + */ + PP_X509CERTIFICATE_PRIVATE_VALIDITY_NOT_AFTER = 19, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_SUBJECT_PUBLIC_KEY_ALGORITHM_OID = 20, + /** + * Note: This field is unimplemented and will return + * <code>PP_VARTYPE_NULL</code>. + */ + PP_X509CERTIFICATE_PRIVATE_SUBJECT_PUBLIC_KEY = 21, + /** + * This corresponds to a byte array (<code>PP_VARTYPE_ARRAY_BUFFER</code>). + * This is the DER-encoded representation of the certificate. + */ + PP_X509CERTIFICATE_PRIVATE_RAW = 22, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_ISSUER_DISTINGUISHED_NAME = 23, + /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */ + PP_X509CERTIFICATE_PRIVATE_SUBJECT_DISTINGUISHED_NAME = 24 +} PP_X509Certificate_Private_Field; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_X509Certificate_Private_Field, 4); + +/** + * This enumeration defines the different possible values for X5O9 certificate + * versions as returned by: + * <code>GetField(resource, PP_X509CERTIFICATE_PRIVATE_VERSION)</code>. + */ +typedef enum { + PP_X509CERTIFICATE_PRIVATE_V1 = 0, + PP_X509CERTIFICATE_PRIVATE_V2 = 1, + PP_X509CERTIFICATE_PRIVATE_V3 = 2 +} PPB_X509Certificate_Private_Version; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPB_X509Certificate_Private_Version, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The <code>PPB_X509Certificate_Private</code> interface provides access to + * the fields of an X509 certificate. + */ +struct PPB_X509Certificate_Private_0_1 { + /** + * Allocates a <code>PPB_X509Certificate_Private</code> resource. + * <code>Initialize()</code> must be called before using the certificate. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Returns <code>PP_TRUE</code> if a given resource is a + * <code>PPB_X509Certificate_Private</code>. + */ + PP_Bool (*IsX509CertificatePrivate)(PP_Resource resource); + /** + * Initializes a <code>PPB_X509Certificate_Private</code> from the DER-encoded + * representation. |bytes| should represent only a single certificate. + * <code>PP_FALSE</code> is returned if |bytes| is not a valid DER-encoding of + * a certificate. Note: Flash requires this to be synchronous. + */ + PP_Bool (*Initialize)(PP_Resource resource, + const char* bytes, + uint32_t length); + /** + * Get a field of the X509Certificate as a <code>PP_Var</code>. A null + * <code>PP_Var</code> is returned if the field is unavailable. + */ + struct PP_Var (*GetField)(PP_Resource resource, + PP_X509Certificate_Private_Field field); +}; + +typedef struct PPB_X509Certificate_Private_0_1 PPB_X509Certificate_Private; +/** + * @} + */ + +#endif /* PPAPI_C_PRIVATE_PPB_X509_CERTIFICATE_PRIVATE_H_ */ +
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/gles2
Added
+(directory)
View file
lightspark.tar.xz/src/plugin_ppapi/ppapi/gles2/gl2ext_ppapi.h
Added
@@ -0,0 +1,62 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// OpenGL ES 2.0 extensions for PPAPI. + +#ifndef PPAPI_LIB_GL_GLES2_GL2EXT_PPAPI_H_ +#define PPAPI_LIB_GL_GLES2_GL2EXT_PPAPI_H_ + +#include <GLES2/gl2platform.h> + +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/ppb.h" +#include "ppapi/c/ppb_opengles2.h" +#include "ppapi/c/dev/ppb_opengles2ext_dev.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Initializes OpenGL ES 2.0 library. +// Must be called once before making any gl calls. +// GL_FALSE is returned on failure, GL_TRUE otherwise. +GL_APICALL GLboolean GL_APIENTRY glInitializePPAPI( + PPB_GetInterface get_browser_interface); + +// Terminates OpenGL ES 2.0 library. +// GL_FALSE is returned on failure, GL_TRUE otherwise. +GL_APICALL GLboolean GL_APIENTRY glTerminatePPAPI(void); + +// Sets context to be used for rendering in the current thread. +GL_APICALL void GL_APIENTRY glSetCurrentContextPPAPI(PP_Resource context); + +// Gets context being used for rendering in the current thread. +// Returns NULL if a context has not been set yet. +GL_APICALL PP_Resource GL_APIENTRY glGetCurrentContextPPAPI(void); + +// Returns OpenGL ES 2.0 interface. +GL_APICALL const struct PPB_OpenGLES2* GL_APIENTRY glGetInterfacePPAPI(void); +GL_APICALL const struct PPB_OpenGLES2InstancedArrays* GL_APIENTRY + glGetInstancedArraysInterfacePPAPI(void); +GL_APICALL const struct PPB_OpenGLES2FramebufferBlit* GL_APIENTRY + glGetFramebufferBlitInterfacePPAPI(void); +GL_APICALL const struct PPB_OpenGLES2FramebufferMultisample* GL_APIENTRY + glGetFramebufferMultisampleInterfacePPAPI(void); +GL_APICALL const struct PPB_OpenGLES2ChromiumEnableFeature* GL_APIENTRY + glGetChromiumEnableFeatureInterfacePPAPI(void); +GL_APICALL const struct PPB_OpenGLES2ChromiumMapSub* GL_APIENTRY + glGetChromiumMapSubInterfacePPAPI(void); +GL_APICALL const struct PPB_OpenGLES2Query* GL_APIENTRY + glGetQueryInterfacePPAPI(void); +GL_APICALL const struct PPB_OpenGLES2VertexArrayObject* GL_APIENTRY + glGetVertexArrayObjectInterfacePPAPI(void); +GL_APICALL const struct PPB_OpenGLES2DrawBuffers_Dev* GL_APIENTRY + glGetDrawBuffersInterfacePPAPI(void); + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // PPAPI_LIB_GL_GLES2_GL2EXT_PPAPI_H_ +
View file
lightspark.tar.xz/src/scripting/abc.cpp
Changed
@@ -231,6 +231,7 @@ void ScriptLimitsTag::execute(RootMovieClip* root) const { + getVm(root->getSystemState())->stacktrace.reserve(MaxRecursionDepth); getVm(root->getSystemState())->limits.max_recursion = MaxRecursionDepth; getVm(root->getSystemState())->limits.script_timeout = ScriptTimeoutSeconds; }
View file
lightspark.tar.xz/src/scripting/abc.h
Changed
@@ -567,7 +567,7 @@ /* The current recursion level. Each call increases this by one, * each return from a call decreases this. */ uint32_t cur_recursion; - std::list<std::pair<uint32_t,ASObject*> > stacktrace; + std::vector<std::pair<uint32_t,ASObject*> > stacktrace; struct abc_limits { /* maxmium number of recursion allowed. See ScriptLimitsTag */
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp
Changed
@@ -347,7 +347,7 @@ val=mi->synt_method(getSystemState()); assert(val); } - mi->body->hit_count++; + ++mi->body->hit_count; //Prepare arguments uint32_t args_len=mi->numArgs(); @@ -403,7 +403,7 @@ /* Set the current global object, each script in each DoABCTag has its own */ getVm(getSystemState())->currentCallContext = &cc; - if(isBound()) + if(isBound() && obj != closure_this.getPtr()) { /* closure_this can never been overriden */ LOG_CALL(_("Calling with closure ") << this); if(obj)
View file
lightspark.tar.xz/src/swf.cpp
Changed
@@ -729,7 +729,8 @@ if(Config::getConfig()->isRenderingEnabled()) { - sys->renderThread->start(sys->engineData); + if (sys->engineData->needrenderthread) + sys->renderThread->start(sys->engineData); } else { @@ -1028,7 +1029,7 @@ ThreadProfile* SystemState::allocateProfiler(const lightspark::RGB& color) { SpinlockLocker l(profileDataSpinlock); - profilingData.push_back(new ThreadProfile(color,100)); + profilingData.push_back(new ThreadProfile(color,100,engineData)); ThreadProfile* ret=profilingData.back(); return ret; } @@ -1124,8 +1125,8 @@ int width=size.Xmax/20; int height=size.Ymax/20; - GLfloat *vertex_coords = new GLfloat[data.size()*2]; - GLfloat *color_coords = new GLfloat[data.size()*4]; + float *vertex_coords = new float[data.size()*2]; + float *color_coords = new float[data.size()*4]; int32_t start=tickCount-len; if(int32_t(data[0].index-start)>0) @@ -1140,14 +1141,14 @@ color_coords[i*4+2] = color.Blue; color_coords[i*4+3] = 1; } - - glVertexAttribPointer(VERTEX_ATTRIB, 2, GL_FLOAT, GL_FALSE, 0, vertex_coords); - glVertexAttribPointer(COLOR_ATTRIB, 4, GL_FLOAT, GL_FALSE, 0, color_coords); - glEnableVertexAttribArray(VERTEX_ATTRIB); - glEnableVertexAttribArray(COLOR_ATTRIB); - glDrawArrays(GL_LINE_STRIP, 0, data.size()); - glDisableVertexAttribArray(VERTEX_ATTRIB); - glDisableVertexAttribArray(COLOR_ATTRIB); + assert_and_throw(engineData); + engineData->exec_glVertexAttribPointer(VERTEX_ATTRIB, 2, 0, vertex_coords); + engineData->exec_glVertexAttribPointer(COLOR_ATTRIB, 4, 0, color_coords); + engineData->exec_glEnableVertexAttribArray(VERTEX_ATTRIB); + engineData->exec_glEnableVertexAttribArray(COLOR_ATTRIB); + engineData->exec_glDrawArrays_GL_LINE_STRIP(0, data.size()); + engineData->exec_glDisableVertexAttribArray(VERTEX_ATTRIB); + engineData->exec_glDisableVertexAttribArray(COLOR_ATTRIB); cairo_set_source_rgb(cr, float(color.Red)/255, float(color.Green)/255, float(color.Blue)/255);
View file
lightspark.tar.xz/src/swf.h
Changed
@@ -146,8 +146,9 @@ RGB color; int32_t len; uint32_t tickCount; + EngineData* engineData; public: - ThreadProfile(const RGB& c,uint32_t l):color(c),len(l),tickCount(0){} + ThreadProfile(const RGB& c,uint32_t l,EngineData* _engineData):color(c),len(l),tickCount(0),engineData(_engineData){} void accountTime(uint32_t time); void setTag(const std::string& tag); void tick();
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.