Even though you can already generate A\+VI files, this library has not reached a final version yet and is still a work in progress. You\textquotesingle{}ve been warned... ;)\hypertarget{index_autotoc_md1}{}\doxysection{S\+Y\+N\+O\+P\+S\+IS}\label{index_autotoc_md1}
{\ttfamily libgwavi} is a fork of {\ttfamily libkohn-\/avi}. It is a tiny C library aimed at creating A\+VI files.

Original credits go to Michael Kohn, who released his library under the L\+G\+PL license. He, however, allowed me to release my forked version under the less restrictive 3-\/clause B\+SD license so... Thanks to him!

Anyway, why the fork you might ask? I used it in an application that needed the library to be reliable. So here is what has already changed from {\ttfamily libkohn-\/avi}\+:


\begin{DoxyItemize}
\item added library documentation
\item removed dead code
\item improved error checking
\item added unit tests
\end{DoxyItemize}\hypertarget{index_autotoc_md2}{}\doxysection{B\+U\+I\+LD}\label{index_autotoc_md2}
This library has no dependencies, you only need the standard C library. To generate {\ttfamily libgwavi.\+so}, just type the following from the root\textquotesingle{}s directory\+: \begin{DoxyVerb}make
\end{DoxyVerb}


To generate the documentation of the library functions, type the following\+: \begin{DoxyVerb}make doc
\end{DoxyVerb}


The code includes a demo application that uses {\ttfamily libgwavi}. You can build it using this command\+: \begin{DoxyVerb}make examples
\end{DoxyVerb}
\hypertarget{index_autotoc_md3}{}\doxysection{H\+O\+W T\+O U\+S\+E IT}\label{index_autotoc_md3}
For a complete example, have a look at the demo application in the examples folder.

If your in a hurry, here is a small explanation on how to use it.

First, you need to include the header file. \begin{DoxyVerb}#include "gwavi.h"
\end{DoxyVerb}


There is basically four main function that you will need to use\+:


\begin{DoxyItemize}
\item {\ttfamily \mbox{\hyperlink{gwavi_8c_a770c50b59f23aacbd3eb01f837715e2d}{gwavi\+\_\+open()}}}
\item {\ttfamily \mbox{\hyperlink{gwavi_8c_a2da2ded4d05d1b188ca933c9e0f45436}{gwavi\+\_\+add\+\_\+frame()}}}
\item {\ttfamily \mbox{\hyperlink{gwavi_8c_a69d79a1c63064fbd315cf4363d4d5ab9}{gwavi\+\_\+add\+\_\+audio()}}}
\item {\ttfamily \mbox{\hyperlink{gwavi_8c_a86a0a631350a3dc8d9768f43accfbbf3}{gwavi\+\_\+close()}}}
\end{DoxyItemize}

Please, note that error checking has been voluntarily omitted int the examples below for the sake of the clarification.

So first, you should declare a {\ttfamily gwavi\+\_\+t} structure and initialize it. You can optionally declare a {\ttfamily gwavi\+\_\+audio\+\_\+t} structure if you need to add an audio channel to your A\+VI file. \begin{DoxyVerb}struct gwavi_t *gwavi;
struct gwavi_audio_t audio;

gwavi = gwavi_open("foo.avi",
                   1920,
                   1080,
                   "MJPG",
                   30,
                   &audio);
\end{DoxyVerb}


Note that the audio channel is optional and that you can pass {\ttfamily N\+U\+LL} as the last argument of {\ttfamily \mbox{\hyperlink{gwavi_8c_a770c50b59f23aacbd3eb01f837715e2d}{gwavi\+\_\+open()}}} if you don\textquotesingle{}t need it.

Then you add your video frames\+: \begin{DoxyVerb}gwavi_add_frame(gwavi, buffer, buffer_length);
\end{DoxyVerb}


You can also add audio with {\ttfamily \mbox{\hyperlink{gwavi_8c_a69d79a1c63064fbd315cf4363d4d5ab9}{gwavi\+\_\+add\+\_\+audio()}}}.

And at the end, you can close the output file and free the allocated memory by calling the {\ttfamily \mbox{\hyperlink{gwavi_8c_a86a0a631350a3dc8d9768f43accfbbf3}{gwavi\+\_\+close()}}} function. \begin{DoxyVerb}gwavi_close(gwavi);
\end{DoxyVerb}
\hypertarget{index_autotoc_md4}{}\doxysection{D\+O\+C\+U\+M\+E\+N\+T\+A\+T\+I\+ON}\label{index_autotoc_md4}
The library documentation can be generated with {\ttfamily make doc} if you have {\ttfamily doxygen} installed. Otherwise, you can just visit \href{http://doc.gw-computing.net/libgwavi}{\texttt{ http\+://doc.\+gw-\/computing.\+net/libgwavi}}. 