Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
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")); -
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)
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
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
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();
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. + *
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
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
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; +} +
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
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;
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} };
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)(
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. + *
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
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,
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>. + */
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
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.
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);
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.
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
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. + *
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
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; +/** + * @}
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);
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.
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.
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
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); + /**
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.
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
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. + */
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. + *
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,
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
.