1 /* 2 * GPAC - Multimedia Framework C SDK 3 * 4 * Authors: Jean Le Feuvre 5 * Copyright (c) Telecom ParisTech 2000-2012 6 * All rights reserved 7 * 8 * This file is part of GPAC / Osmozilla NPAPI plugin 9 * 10 * GPAC is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU Lesser General Public License as published by 12 * the Free Software Foundation; either version 2, or (at your option) 13 * any later version. 14 * 15 * GPAC is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public 21 * License along with this library; see the file COPYING. If not, write to 22 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 23 * 24 */ 25 26 #ifndef _OSMO_NPAPI_H_ 27 #define _OSMO_NPAPI_H_ 28 29 30 #ifdef WIN32 31 #include <windows.h> 32 #ifndef __cplusplus 33 typedef BOOL bool; 34 #endif //__cplusplus 35 #endif 36 37 #include "npapi.h" 38 39 /*check this with gecko 1.9.2*/ 40 #if (NP_VERSION_MINOR < 20) 41 #define GECKO_XPCOM 42 #endif 43 44 #ifdef GECKO_XPCOM 45 #include "npupp.h" 46 47 #ifndef uint16_t 48 typedef uint16 uint16_t; 49 #endif 50 51 #ifndef int16_t 52 typedef int16 int16_t; 53 #endif 54 55 #define NPINT32 int32 56 57 #else 58 59 #include "npfunctions.h" 60 61 #define NPINT32 int32_t 62 63 #endif 64 65 #ifdef XP_UNIX 66 #include <stdio.h> 67 #endif //XP_UNIX 68 69 70 #ifndef HIBYTE 71 #define HIBYTE(i) (i >> 8) 72 #endif 73 74 #ifndef LOBYTE 75 #define LOBYTE(i) (i & 0xff) 76 #endif 77 78 /*functions callbacks to browser*/ 79 NPError Osmozilla_GetURL(NPP instance, const char *url, const char *target); 80 void Osmozilla_SetStatus(NPP instance, const char *message); 81 82 83 /* 84 Plugins functions exposed to browser 85 */ 86 NPError NPOsmozilla_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved); 87 NPError NPOsmozilla_Destroy(NPP instance, NPSavedData** save); 88 NPError NPOsmozilla_SetWindow(NPP instance, NPWindow* window); 89 NPError NPOsmozilla_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype); 90 NPError NPOsmozilla_DestroyStream(NPP instance, NPStream* stream, NPError reason); 91 NPINT32 NPOsmozilla_WriteReady(NPP instance, NPStream* stream); 92 NPINT32 NPOsmozilla_Write(NPP instance, NPStream* stream, NPINT32 offset, NPINT32 len, void* buffer); 93 void NPOsmozilla_StreamAsFile(NPP instance, NPStream* stream, const char* fname); 94 void NPOsmozilla_Print(NPP instance, NPPrint* platformPrint); 95 int16_t NPOsmozilla_HandleEvent(NPP instance, void* event); 96 void NPOsmozilla_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData); 97 NPError NPOsmozilla_GetValue(NPP instance, NPPVariable variable, void *result); 98 NPError NPOsmozilla_SetValue(NPP instance, NPNVariable variable, void *value); 99 100 101 /* 102 Functions called by browser 103 */ 104 105 typedef struct __tag_osmozilla Osmozilla; 106 107 /*base functions*/ 108 int Osmozilla_Initialize(Osmozilla *osmo, signed short argc, char* argn[], char* argv[]); 109 void Osmozilla_Shutdown(Osmozilla *osmo); 110 int Osmozilla_SetWindow(Osmozilla *osmozilla, void *os_wnd_handle, void *os_wnd_display, unsigned int width, unsigned int height); 111 void Osmozilla_ConnectTo(Osmozilla *osmozilla, const char *url); 112 void Osmozilla_Print(Osmozilla *osmozilla, unsigned int is_embed, void *os_print_dc, unsigned int target_x, unsigned int target_y, unsigned int target_width, unsigned int target_height); 113 char *Osmozilla_GetVersion(); 114 115 116 /*scripting functions*/ 117 void Osmozilla_Play(Osmozilla *osmo); 118 void Osmozilla_Pause(Osmozilla *osmo); 119 void Osmozilla_Stop(Osmozilla *osmo); 120 void Osmozilla_Update(Osmozilla *osmo, const char *type, const char *commands); 121 void Osmozilla_QualitySwitch(Osmozilla *osmo, int switch_up); 122 void Osmozilla_SetURL(Osmozilla *osmo, const char *url); 123 int Osmozilla_GetDownloadProgress(Osmozilla *osmo); 124 125 126 #ifdef GECKO_XPCOM 127 128 void NPOsmozilla_GetServiceManager(); 129 void NPOsmozilla_ReleaseServiceManager(); 130 void NPOsmozilla_ShutdownScript(Osmozilla *osmo); 131 NPError NPOsmozilla_GetPeer(Osmozilla *osmo, void *value); 132 NPError NPOsmozilla_GetPeerIID(Osmozilla *osmo, void *value); 133 134 #endif //GECKO_XPCOM 135 136 #endif //_NPPLAT_H_ 137