1 /*****************************************************************************
2 * rsc_files.h: resources files manipulation functions
3 * This library describes a general format used to store 'resources'. Resources
4 * can be anything, including pictures, audio streams, and so on.
5 *****************************************************************************
6 * Copyright (C) 1999, 2000 VideoLAN
7 * $Id: rsc_files.h,v 1.7 2001/03/21 13:42:33 sam Exp $
9 * Authors: Vincent Seguin <seguin@via.ecp.fr>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
24 *****************************************************************************/
26 /*****************************************************************************
30 *****************************************************************************/
32 /*****************************************************************************
34 *****************************************************************************/
36 /* Maximum length of a resource name (not including the final '\0') - this
37 * constant should not be changed without extreme care */
38 #define RESOURCE_MAX_NAME 32
40 /*****************************************************************************
41 * resource_descriptor_t: resource descriptor
42 *****************************************************************************
43 * This type describe an entry in the resource table.
44 *****************************************************************************/
47 char psz_name[RESOURCE_MAX_NAME + 1]; /* name */
48 u16 i_type; /* type */
49 u64 i_offset; /* data offset */
50 u64 i_size; /* data size */
51 } resource_descriptor_t;
54 #define EMPTY_RESOURCE 0 /* empty place in table */
55 #define PICTURE_RESOURCE 10 /* native video picture */
57 /*****************************************************************************
58 * resource_file_t: resource file descriptor
59 *****************************************************************************
60 * This type describes a resource file and store it's resources table. It can
61 * be used through the *Resource functions, or directly with the i_file field.
62 *****************************************************************************/
65 /* File informations */
66 int i_file; /* file descriptor */
67 int i_type; /* file type */
68 boolean_t b_up_to_date; /* is file up to date ? */
69 boolean_t b_read_only; /* read-only mode */
72 int i_size; /* table size */
73 resource_descriptor_t * p_resource; /* resources table */
76 /* Resources files types */
77 #define VLC_RESOURCE_FILE 0 /* VideoLAN Client resource file */
79 /*****************************************************************************
81 *****************************************************************************/
82 resource_file_t * CreateResourceFile ( char *psz_filename, int i_type, int i_size, int i_mode );
83 resource_file_t * OpenResourceFile ( char *psz_filename, int i_type, int i_flags );
84 int UpdateResourceFile ( resource_file_t *p_file );
85 int CloseResourceFile ( resource_file_t *p_file );
87 int SeekResource ( resource_file_t *p_file, char *psz_name, int i_type );
88 int ReadResource ( resource_file_t *p_file, char *psz_name, int i_type,
89 size_t max_size, byte_t *p_data );
90 int vlc_WriteResource ( resource_file_t *p_file, char *psz_name, int i_type,
91 size_t size, byte_t *p_data );