This page was created to give developers a first hand assistance in starting development of Mozilla Firefox plugins on Windows. After the generic development environment setup we present the setup of OggPlay Firefox plugin for Vorbis/Theora OggPlay player plugin. If you have an experience in plugin development and want to test or contribute to the OggPlay plugin development you might want to skip to the next section and go directly to OggPlay player plugin. If you do not have your development plugin environment set up you should start with basic plugin environment configuration.
Setup of basic Mozilla plugin development environment
The documentation on set up of development environment for Mozilla plugins development of Linux/UNIX, Win32 and MacOS is inconsistent and partially incomplete at least. In an attempt to fill in the blanks this section presents basic development environment setup for Win200x/XP.
Basic Mozilla plugin setup for MS Windows Win200x/XP
Although we tested those steps on Windows 2003 Server and Windows XP the configuration should work on the other Window platforms (such as Windows Vista). We also assume that you are using MS Visual Studio 2003 or 2005 altough you should be able to setup the environment using VS6 in a similar way. If you are using other environment/compiler you are on your own.
Before starting setting up your plugin development environment you will need following tools and SDKs:
- Mozilla Firefox (at least in version 1.7 provided you use appropriate Gecko SDK)
- Mozilla Gecko SDK - there are two recent releases of Gecko SDK (1.7 for Firefox 1.0 and 1.8 for Firefox 1.5. and 2.0) available for download on Mozilla Developer Center. Here are direct links to both versions of the SDK:
- Mozilla WinTools - to use xpidl compiler you need also Mozilla WinTools: Direct download
- Microsoft Platform SDK - to compile the plugins you will need to get also Platform SDK from Microsoft Download Center
- SVN client for Windows - there are many Windows clients for SVN, however one of the best is Tortoise SVN available from tigris.org. While your are on it you might want to try AnkhSVN addin for Visual Studio.
Once you unzipped Gecko SDK and installed MS Platform SDK you need to make sure your xpidl compiler is working properly. Unfortunately, the official release of Gecko SDK assumes you have following .dll on your system and in your PATH (provided you are using the newest version of WinTools):
They are included in WinTools package under windows\bin\x86. In order for xpidl to run properly you need to have those .dll files in the same directory as xpidl.exe. Alternatively, if for some reason you do not want to copy those files across you can add the directory where those .dll are located to your system PATH variable. You can do that by navigating to Control Panel->System and then choosing Environment Variables in Advanced tab. There are also other options such as modifing Visual Studio environment by changing vcvarsall.bat script but it is outside of scope of this document.
Once your xpidl you can try your environment and compile the official Mozilla samples. More details presented in the next section.
Testing development environment with sample Mozilla plugin
This is an optional step and unless you failed setting up environment for the OggPlay plugin or you want to build your own plugin you can probably skip this step. But if you want to understand the Mozilla plugin structure it is probably recommended to start with something simple.
Once your xpidl is working properly you can try to compile the official Mozilla samples. You can download them here. The important thing about this archive is that we are interested only the Win32SDK\sdk\samples directory. In particular, attached gecko-sdk is not the most recent one. If you navigate to one of the samples and their windows directory you can open projects' .dsp file. If you are using newer version of Visual Studio than 6.0 it will be converted to the new format. Once you opened sample project you need probably update some of the configuration settings. In Project->Properties menu select C\C++->General and change Additional Include Directories to your Gecko SDK include directory (Note: this is preferably the new Gecko SDK in the archive gecko-sdk-i586-pc-msvc-1.7.zip or gecko-sdk-win32-msvc-220.127.116.11.zip and not the one attached to the samples archive). If you are using Gecko SDK 1.7 or Gecko SDK 1.8 you need to include samples include directory (i.e. ..\..\include) and only main Gecko SDK include (e.g. ..\..\..\gecko-sdk\include).
You also need to point Visual Studio to the xpidl compiler. This is required to compile .idl file in the project. To change the default setting go to Visual Studio Solution Explorer and open Properties setting for the .idl file. Inspect file's Custom Build Step and adjust the directories in relation to the project file (.vcproj for VS200x or .dsp for VS6.0). In particular, you might need to change not only the path to the xpidl compiler but also to the idl directory of your Gecko SDK (e.g. ..\..\..\..\gecko-sdk\xpcom\bin\xpidl -m header -I..\..\..\..\gecko-sdk\xpcom\idl $(InputPath) to ..\..\..\gecko-sdk\bin\xpidl -m header -I..\..\..\gecko-sdk\idl $(InputPath))
Now you should be able to compile the project. Resulting .dll and .xpt files should be copied to the Mozilla Firefox plugins directory (e.g. C:\Program Files\Mozilla Firefox\plugins"). Once you've done that you can restart Mozilla. In general it is a good idea to use following options to during the startup: -P development -console so you can see the plugin output/debug information.
For help with setup of the environment and Visual Studio refere to a guide from Mozilla Developer Center.
Developing OggPlay plugin
Once you have a working Mozilla plugin development environment you can start configuring the environment for OggPlay plugin.
First of all, you need to install SVN client on your development machine. There are many Win32 SVN clients available but this document assumes that you have a client with the capabilities of Tortoise SVN. As mentioned previously at the moment Win32 developement environment for the OggPlay plugin is setup only for VS200x.
To compile and start hacking on Win32 version of OggPlay plugin you need to check out OggplayPluginWin32SDK from svn.annodex.net. (you need to point your svn client to : http://svn.annodex.net/OggplayPluginWin32SDK/trunk). If you are using Tortoise SVN create a new directory in your favourite development location on your hard drive. Then navigate to the location where the new directory has been created. Use left mouse click on the directory where you want to check out the plugin code and development configuration and select SVN Checkout option in the context menu. In the repository URL provide http://svn.annodex.net/OggplayPluginWin32SDK/trunk and checkout the head revision of the plugin sources. Please note, that the checkout can take a while over slow links because the plugin requires a number of libraries such as:
When your checkout is completed navigate to sln/plugin_all_200x' (e.g. plugin_all_2005 for Visual Studio 2005). You should be able to open the plugin_all.sln file.
The development configutation by default assumes that you installed gecko-sdk (with working version of xpidl compiler) in a directory parallel to the directory where you checked out the plugin sources. In paritcular, the directory structure by default should be as follows:
- .\gecko-sdk\bin\ (xpidl.exe)
- .\plugin_sources\sln\plugin_all_200x (plugin_all.sln)
[of course the names of the Gecko SDK (.\gecko-sdk) above and directory storing plugin source files (.\plugin_sources) can be completely arbitral]
If you have Gecko SDK in different location in relation to plugin_all.sln file you will need to go the Properties of liboggplugin project in Visual Studio and find nsILibOggPlugin.idl file in the sources of that project. Next you need to change the directory of the custom compilation step (i.e. left-click on nsILibOggPlugin.idl file, choose Properties expand Custom Build Step and in Command Line option change the relative path to the location of xpidl compiler as well as to Gecko SDK .\idl directory. You can test the setup by compiling just the nsILibOggPlugin.idl file. If the build is sucessfull you can start compiling the plugin. In particular, compiling the default liboggplay project should build all the project in the VS solution and build the plugin in the end. The plugin binaries as well as binaries of other libraries on which plugin depends can be found under .\plugin_sources\sln\plugin_all_200x\debug if your default build configuration was Debug. When the plugin is released the Release build will be compiled to .\plugin_sources\sln\plugin_all_200x\release.
By default a post build step is copying the plugin files (npliboggplugin.dll and npliboggplugin.xpt) to C:\Program Files\Mozilla Firefox\plugins (default Mozilla Firefox location). If you have Mozilla Firefox installed in a different location you need to change the path in liboggplay Post-Built Event configuration (left mouse click on liboggplugin project then Properties then expand Build Events and navigate to Post-Built Event).
Binaries of the OggPlay Mozilla plugin
For people not interested in developing the plugin but willing test it on their own machine are very much encouraged to download the the plugin from:
The installer places the plugin binaries in default system Mozilla directory. This is usually C:\Program Files\Mozilla Firefox\plugins unless your Mozilla Firefox has been installed in different than default location. To test the plugin go to cmmlwiki. If you see the video playing then you successfully installed the plugin. Enjoy!