# Plug-in architecture

## Introduction

While the Nexuiz Demo Recorder (NDR) saves you a lot of time, what many video editors still need to do is to transcode/convert/encode/you-name-it the resulting huge avi clip to another (lossless) format. Or, if you are not an editor but just a player who wants to distribute the recorded clip, unless you had Nexuiz encode the clip in the Ogg Theora codec (cl_capturevideo_ogg 1), you might want to encode it in XviD, H.264 or some other lossy codec. For encoding people use all different kinds of tools. Some have a GUI, some don't. Some are available on just one platform, some are cross-platform to some extent. However, since this release the NDR is now able to also encode clips to whatever format you like by the use of encoder plug-ins. For this the NDR has been extended with a plug-in architecture that will look for plug-ins in the “plugins” folder. NDR plug-ins are basically just a bridge between the NDR application and an actual encoder. Examples for actual encoders are VirtualDub for MS Windows, or mencoder for Linux. What a plug-in will do is to assemble a command line that will execute this encoder and hand it the required parameters.

## Extension is easy

In this release the NDR ships with just one plug-in: the VirtualDub plug-in. However, if you are a Java developer it is really easy for you to write your own plug-ins that will be able to handle whatever encoder you want to use. If you are interested, have a look into the src folder at the Sample Plugin. All you need to do is to implement an interface, edit some meta-information files and build a jar file that is being put into the plugins directory of the NDR.

## Plug-in settings

Each plug-in allows the user to interact with it, by offering settings (or “preferences”). There are 2 kinds of settings:

- Global settings, which will be shown in the File → Preferences dialog

- Job/template-specific settings, which will be shown in the dialog you use when creating or editing jobs or templates

## Use plug-ins later on

In order to invoke the functionality of the plug-in you are not required to set up everything at the very beginning (before the clip has actually been recorded). Of course, you can do so, and in this case the job would be recorded and, right after that, be encoded as well. But you can also choose to have jobs recorded first, and then later when you see the need to encode them, edit the job settings (add your plug-in settings there), and then right-click the job and select “just run the xyz plug-in”. Basically this menu item will work on any job with status = done.

Of course you may not move the recorded clip from the destination that you set up, because otherwise the plug-in would not find the file to encode it.

## Error handling

In case something went wrong during the execution of the plug-in itself, you will see a “plug-in error” in the status column of the jobs table. Like for normal “errors”, you can right-click the job and click on “show error message” in order to see the error message of the plug-in. In case you can repair whatever went wrong, do so, then right-click the job and click on “reset job status to done”. Then you can run the plug-in again.

If a plug-in appeared to do its job just fine but you suspect that something went wrong, you might want to have a look at the logs directory in the NDR folder. Depending on whether the one who created the plug-in implemented it, you might see log files which are basically text files containing the output of the encoder itself.