1 /*
2  * rawvideo.h
3  *
4  * API for reading & writing raw video files (w/ interleaved audio)
5  *
6  * (C) 1997 Randall Hopper
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met: 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer. 2.
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  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
20  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  *
28  */
29 
30 #ifndef __RAWVIDEO_H
31 #define __RAWVIDEO_H
32 
33 #include "tvtypes.h"
34 #include "tvcapture.h"
35 #include "tvaudio.h"
36 
37 #define TV_RAW_MAX_FILES  4
38 
39 typedef TV_IMAGE TV_RAW_IMAGE;
40 typedef TV_SOUND TV_RAW_SOUND;
41 
42 typedef struct {
43     TV_RAW_IMAGE img;
44     TV_RAW_SOUND snd;
45 } TV_RAW_HEADER;
46 
47 typedef struct {
48     TV_INT32 image_bytes;                 /*  Size of image data to follow   */
49     TV_INT32 sound_bytes;                 /*  Size of audio data to follow   */
50     TV_INT32 delay;                       /*  Elapsed delay since last image */
51 } TV_RAW_IMAGE_HEADER;
52 
53 typedef struct TV_RAW_VIDEO_FILE TV_RAW_VIDEO_FILE;
54 
55 
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 TV_UINT32 TVRAWVIDEOCalcImageSize( TV_RAW_IMAGE *img );
62 
63 TV_BOOL TVRAWVIDEOOpen( char               *filenames[],
64                         TV_INT32            num_files,
65                         TV_BOOL             read,
66                         TV_RAW_VIDEO_FILE **rf );
67 
68 TV_BOOL TVRAWVIDEOClose( TV_RAW_VIDEO_FILE **rf );
69 
70 TV_BOOL TVRAWVIDEOHeaderWrite( TV_RAW_VIDEO_FILE *rf,
71                                TV_RAW_IMAGE      *img,
72                                TV_RAW_SOUND      *snd );
73 
74 TV_BOOL TVRAWVIDEOHeaderRead( TV_RAW_VIDEO_FILE *rf,
75                               TV_RAW_IMAGE      *img,
76                               TV_RAW_SOUND      *snd,
77                               TV_BOOL           *eof );
78 
79 TV_BOOL TVRAWVIDEOImageWrite( TV_RAW_VIDEO_FILE   *rf,
80                               TV_RAW_IMAGE_HEADER *head,
81                               TV_RAW_IMAGE        *img,
82                               TV_RAW_SOUND        *snd );
83 
84 TV_BOOL TVRAWVIDEOImageRead( TV_RAW_VIDEO_FILE   *rf,
85                              TV_RAW_IMAGE_HEADER *head,
86                              TV_RAW_IMAGE        *img,
87                              TV_RAW_SOUND        *snd,
88                              TV_BOOL             *eof );
89 
90 #ifdef __cplusplus
91 }  /* Close 'extern "C"' */
92 #endif
93 
94 #endif
95