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
8 * Authors: Vincent Seguin <seguin@via.ecp.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 /*****************************************************************************
29 *****************************************************************************/
31 /*****************************************************************************
33 *****************************************************************************/
35 /* Maximum length of a resource name (not including the final '\0') - this
36 * constant should not be changed without extreme care */
37 #define RESOURCE_MAX_NAME 32
39 /*****************************************************************************
40 * resource_descriptor_t: resource descriptor
41 *****************************************************************************
42 * This type describe an entry in the resource table.
43 *****************************************************************************/
46 char psz_name[RESOURCE_MAX_NAME + 1]; /* name */
47 u16 i_type; /* type */
48 u64 i_offset; /* data offset */
49 u64 i_size; /* data size */
50 } resource_descriptor_t;
53 #define EMPTY_RESOURCE 0 /* empty place in table */
54 #define PICTURE_RESOURCE 10 /* native video picture */
56 /*****************************************************************************
57 * resource_file_t: resource file descriptor
58 *****************************************************************************
59 * This type describes a resource file and store it's resources table. It can
60 * be used through the *Resource functions, or directly with the i_file field.
61 *****************************************************************************/
64 /* File informations */
65 int i_file; /* file descriptor */
66 int i_type; /* file type */
67 boolean_t b_up_to_date; /* is file up to date ? */
68 boolean_t b_read_only; /* read-only mode */
71 int i_size; /* table size */
72 resource_descriptor_t * p_resource; /* resources table */
75 /* Resources files types */
76 #define VLC_RESOURCE_FILE 0 /* VideoLAN Client resource file */
78 /*****************************************************************************
80 *****************************************************************************/
81 resource_file_t * CreateResourceFile ( char *psz_filename, int i_type, int i_size, int i_mode );
82 resource_file_t * OpenResourceFile ( char *psz_filename, int i_type, int i_flags );
83 int UpdateResourceFile ( resource_file_t *p_file );
84 int CloseResourceFile ( resource_file_t *p_file );
86 int SeekResource ( resource_file_t *p_file, char *psz_name, int i_type );
87 int ReadResource ( resource_file_t *p_file, char *psz_name, int i_type,
88 size_t max_size, byte_t *p_data );
89 int vlc_WriteResource ( resource_file_t *p_file, char *psz_name, int i_type,
90 size_t size, byte_t *p_data );