libgwavi  0.0
libgwavi is a tiny C library aimed at creating AVI files.
 All Files Functions Pages
gwavi.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2011, Michael Kohn
3  * Copyright (c) 2013, Robin Hahling
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * * Redistributions of source code must retain the above copyright notice, this
10  * list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright notice,
13  * this list of conditions and the following disclaimer in the documentation
14  * and/or other materials provided with the distribution.
15  *
16  * * Neither the name of the author nor the names of its contributors may be
17  * used to endorse or promote products derived from this software without
18  * specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef H_GWAVI
34 #define H_GWAVI
35 
36 /* structures */
37 struct gwavi_t;
38 struct gwavi_audio_t;
39 
40 /* Main ibrary functions */
41 struct gwavi_t *gwavi_open(char *filename, unsigned int width,
42  unsigned int height, char *fourcc, unsigned int fps,
43  struct gwavi_audio_t *audio);
44 int gwavi_add_frame(struct gwavi_t *gwavi, unsigned char *buffer, size_t len);
45 int gwavi_add_audio(struct gwavi_t *gwavi, unsigned char *buffer, size_t len);
46 int gwavi_close(struct gwavi_t *gwavi);
47 
48 /*
49  * If needed, these functions can be called before closing the file to
50  * change the framerate, codec, size.
51  * Note: AVI can only have a single frame rate, codec, size for the whole file
52  * so this affects anything recorded before these functions are called.
53  */
54 int gwavi_set_framerate(struct gwavi_t *gwavi, unsigned int fps);
55 int gwavi_set_codec(struct gwavi_t *gwavi, char *fourcc);
56 int gwavi_set_size(struct gwavi_t *gwavi, unsigned int width,
57  unsigned int height);
58 
59 #endif /* ndef H_GWAVI */
60 
int gwavi_set_size(struct gwavi_t *gwavi, unsigned int width, unsigned int height)
This function allows you to reset the video size.
Definition: gwavi.c:490
int gwavi_add_audio(struct gwavi_t *gwavi, unsigned char *buffer, size_t len)
This function allows you to add the audio track to your AVI file.
Definition: gwavi.c:285
int gwavi_add_frame(struct gwavi_t *gwavi, unsigned char *buffer, size_t len)
This function allows you to add an encoded video frame to the AVI file.
Definition: gwavi.c:220
int gwavi_set_framerate(struct gwavi_t *gwavi, unsigned int fps)
This function allows you to reset the framerate.
Definition: gwavi.c:433
struct gwavi_t * gwavi_open(char *filename, unsigned int width, unsigned int height, char *fourcc, unsigned int fps, struct gwavi_audio_t *audio)
This is the first function you should call when using gwavi library.
Definition: gwavi.c:71
int gwavi_close(struct gwavi_t *gwavi)
This function should be called when the program is done adding video and/or audio frames to the AVI f...
Definition: gwavi.c:348
int gwavi_set_codec(struct gwavi_t *gwavi, char *fourcc)
This function allows you to reset the video codec.
Definition: gwavi.c:457