]> git.sesse.net Git - vlc/blob - include/rsc_files.h
* The Gtk+ interface is now built as a Debian package as well. The Gnome
[vlc] / include / rsc_files.h
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  *
8  * Authors: Vincent Seguin <seguin@via.ecp.fr>
9  *
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.
14  * 
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.
19  *
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  *****************************************************************************/
24
25 /*****************************************************************************
26  * Requires:
27  *  config.h
28  *  common.h
29  *****************************************************************************/
30
31 /*****************************************************************************
32  * Constants
33  *****************************************************************************/
34
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
38
39 /*****************************************************************************
40  * resource_descriptor_t: resource descriptor
41  *****************************************************************************
42  * This type describe an entry in the resource table.
43  *****************************************************************************/
44 typedef struct
45 {
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;
51
52 /* Resources types */
53 #define EMPTY_RESOURCE      0                        /* empty place in table */
54 #define PICTURE_RESOURCE    10                       /* native video picture */
55
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  *****************************************************************************/
62 typedef struct
63 {
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 */
69
70     /* Resources table */
71     int                     i_size;                            /* table size */
72     resource_descriptor_t * p_resource;                   /* resources table */
73 } resource_file_t;
74
75 /* Resources files types */
76 #define VLC_RESOURCE_FILE   0               /* VideoLAN Client resource file */
77
78 /*****************************************************************************
79  * Prototypes
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 );
85
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                 WriteResource       ( resource_file_t *p_file, char *psz_name, int i_type,
90                                           size_t size, byte_t *p_data );
91