]> git.sesse.net Git - vlc/blob - include/rsc_files.h
7d3861dc98e6daf50e274b4e032c8f4c61bc146b
[vlc] / include / rsc_files.h
1 /*****************************************************************************
2  * rsc_files.h: resources files manipulation functions
3  * (c)1999 VideoLAN
4  *****************************************************************************
5  * This library describe a general format used to store 'resources'. Resources
6  * can be anything, including pictures, audio streams, and so on.
7  *****************************************************************************
8  * Requires:
9  *  config.h
10  *  common.h
11  *****************************************************************************/
12
13 /*****************************************************************************
14  * Constants
15  *****************************************************************************/
16
17 /* Maximum length of a resource name (not including the final '\0') - this
18  * constant should not be changed without extreme care */
19 #define RESOURCE_MAX_NAME   32
20
21 /*****************************************************************************
22  * resource_descriptor_t: resource descriptor
23  *****************************************************************************
24  * This type describe an entry in the resource table.
25  *****************************************************************************/
26 typedef struct
27 {
28     char    psz_name[RESOURCE_MAX_NAME + 1];                         /* name */
29     u16     i_type;                                                  /* type */
30     u64     i_offset;                                         /* data offset */
31     u64     i_size;                                             /* data size */
32 } resource_descriptor_t;
33
34 /* Resources types */
35 #define EMPTY_RESOURCE      0                        /* empty place in table */
36 #define PICTURE_RESOURCE    10                       /* native video picture */
37
38 /*****************************************************************************
39  * resource_file_t: resource file descriptor
40  *****************************************************************************
41  * This type describes a resource file and store it's resources table. It can
42  * be used through the *Resource functions, or directly with the i_file field.
43  *****************************************************************************/
44 typedef struct
45 {
46     /* File informations */
47     int                     i_file;                       /* file descriptor */
48     int                     i_type;                             /* file type */
49     boolean_t               b_up_to_date;            /* is file up to date ? */
50     boolean_t               b_read_only;                   /* read-only mode */
51
52     /* Resources table */
53     int                     i_size;                            /* table size */
54     resource_descriptor_t * p_resource;                   /* resources table */
55 } resource_file_t;
56
57 /* Resources files types */
58 #define VLC_RESOURCE_FILE   0               /* VideoLAN Client resource file */
59
60 /*****************************************************************************
61  * Prototypes
62  *****************************************************************************/
63 resource_file_t *   CreateResourceFile  ( char *psz_filename, int i_type, int i_size, int i_mode );
64 resource_file_t *   OpenResourceFile    ( char *psz_filename, int i_type, int i_flags );
65 int                 UpdateResourceFile  ( resource_file_t *p_file );
66 int                 CloseResourceFile   ( resource_file_t *p_file );
67
68 int                 SeekResource        ( resource_file_t *p_file, char *psz_name, int i_type );
69 int                 ReadResource        ( resource_file_t *p_file, char *psz_name, int i_type,
70                                           size_t max_size, byte_t *p_data );
71 int                 WriteResource       ( resource_file_t *p_file, char *psz_name, int i_type,
72                                           size_t size, byte_t *p_data );
73