2 * riff.h library for RIFF file format i/o
3 * Copyright (C) 2000 - 2002 Arne Schirmacher <arne@schirmacher.de>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 * Revision 1.2 2005/07/25 07:21:39 lilo_booter
25 * + fixes for opendml dv avi
27 * Revision 1.1 2005/04/15 14:28:26 lilo_booter
30 * Revision 1.14 2005/04/01 23:43:10 ddennedy
31 * apply endian fixes from Daniel Kobras
33 * Revision 1.13 2004/10/11 01:37:11 ddennedy
34 * mutex safety locks in RIFF and AVI classes, type 2 AVI optimization, mencoder export script
36 * Revision 1.12 2004/01/06 22:53:42 ddennedy
37 * metadata editing tweaks and bugfixes, new ui elements in preparation for publish functions
39 * Revision 1.11 2003/11/25 23:01:25 ddennedy
40 * cleanup and a few bugfixes
42 * Revision 1.10 2003/10/21 16:34:34 ddennedy
43 * GNOME2 port phase 1: initial checkin
45 * Revision 1.8.4.1 2002/11/25 04:48:31 ddennedy
46 * bugfix to report errors when loading files
48 * Revision 1.8 2002/04/21 06:36:40 ddennedy
49 * kindler avc and 1394 bus reset support in catpure page, honor max file size
51 * Revision 1.7 2002/04/09 06:53:42 ddennedy
52 * cleanup, new libdv 0.9.5, large AVI, dnd storyboard
54 * Revision 1.3 2002/03/25 21:34:25 arne
55 * Support for large (64 bit) files mostly completed
57 * Revision 1.2 2002/03/04 19:22:43 arne
58 * updated to latest Kino avi code
60 * Revision 1.1.1.1 2002/03/03 19:08:08 arne
61 * import of version 1.01
73 #include "endian_types.h"
75 #define QUADWORD int64_le_t
76 #define DWORD int32_le_t
77 #define LONG u_int32_le_t
78 #define WORD int16_le_t
79 #define BYTE u_int8_le_t
80 #define FOURCC u_int32_t // No endian conversion needed.
82 #define RIFF_NO_PARENT (-1)
83 #define RIFF_LISTSIZE (4)
84 #define RIFF_HEADERSIZE (8)
89 FOURCC
make_fourcc( const char * s
);
104 RIFFDirEntry( FOURCC t
, FOURCC n
, int l
, int o
, int p
);
112 RIFFFile( const RIFFFile
& );
114 RIFFFile
& operator=( const RIFFFile
& );
116 virtual bool Open( const char *s
);
117 virtual bool Create( const char *s
);
118 virtual void Close();
119 virtual int AddDirectoryEntry( FOURCC type
, FOURCC name
, off_t length
, int list
);
120 virtual void SetDirectoryEntry( int i
, FOURCC type
, FOURCC name
, off_t length
, off_t offset
, int list
);
121 virtual void SetDirectoryEntry( int i
, RIFFDirEntry
&entry
);
122 virtual void GetDirectoryEntry( int i
, FOURCC
&type
, FOURCC
&name
, off_t
&length
, off_t
&offset
, int &list
) const;
123 virtual RIFFDirEntry
GetDirectoryEntry( int i
) const;
124 virtual off_t
GetFileSize( void ) const;
125 virtual void PrintDirectoryEntry( int i
) const;
126 virtual void PrintDirectoryEntryData( const RIFFDirEntry
&entry
) const;
127 virtual void PrintDirectory( void ) const;
128 virtual int FindDirectoryEntry( FOURCC type
, int n
= 0 ) const;
129 virtual void ParseChunk( int parent
);
130 virtual void ParseList( int parent
);
131 virtual void ParseRIFF( void );
132 virtual void ReadChunk( int chunk_index
, void *data
, off_t data_len
);
133 virtual void WriteChunk( int chunk_index
, const void *data
);
134 virtual void WriteRIFF( void );
138 pthread_mutex_t file_mutex
;
141 vector
<RIFFDirEntry
> directory
;