~ubuntu-dev/mplayer/ubuntu-feisty

« back to all changes in this revision

Viewing changes to unrarlib.h

  • Committer: Reinhard Tartler
  • Date: 2006-07-08 08:45:33 UTC
  • Revision ID: siretart@tauware.de-20060708084533-dbc155bde7122e78
imported mplayer_0.99+1.0pre7try2+cvs20060117

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ***************************************************************************
 
2
 **
 
3
 **  This file is part of the UniquE RAR File Library.
 
4
 **
 
5
 **  Copyright (C) 2000-2002 by Christian Scheurer (www.ChristianScheurer.ch)
 
6
 **  UNIX port copyright (c) 2000-2002 by Johannes Winkelmann (jw@tks6.net)
 
7
 **
 
8
 ** Modified for use with MPlayer, detailed CVS changelog at
 
9
 ** http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
 
10
 ** $Id: unrarlib.h,v 1.4 2005/04/15 18:48:03 diego Exp $
 
11
 **
 
12
 **  The contents of this file are subject to the UniquE RAR File Library
 
13
 **  License (the "unrarlib-license.txt"). You may not use this file except
 
14
 **  in compliance with the License. You may obtain a copy of the License
 
15
 **  at http://www.unrarlib.org/license.html.
 
16
 **  Software distributed under the License is distributed on an "AS IS"
 
17
 **  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied warranty.
 
18
 **
 
19
 **  Alternatively, the contents of this file may be used under the terms
 
20
 **  of the GNU General Public License Version 2 or later (the "GPL"), in
 
21
 **  which case the provisions of the GPL are applicable instead of those
 
22
 **  above. If you wish to allow use of your version of this file only
 
23
 **  under the terms of the GPL and not to allow others to use your version
 
24
 **  of this file under the terms of the UniquE RAR File Library License,
 
25
 **  indicate your decision by deleting the provisions above and replace
 
26
 **  them with the notice and other provisions required by the GPL. If you
 
27
 **  do not delete the provisions above, a recipient may use your version
 
28
 **  of this file under the terms of the GPL or the UniquE RAR File Library
 
29
 **  License.
 
30
 **
 
31
 ************************************************************************** */
 
32
 
 
33
/* include file for the "UniquE RAR File Library"  */
 
34
/* (C) 2000-2002 by Christian Scheurer aka. UniquE */
 
35
/* multi-OS version (Win32, Linux and SUN)         */
 
36
 
 
37
#ifndef __URARLIB_H
 
38
#define __URARLIB_H
 
39
 
 
40
#ifdef __cplusplus
 
41
extern "C"
 
42
{
 
43
#endif
 
44
 
 
45
 
 
46
/* ************************************************************************ */
 
47
/* ************************************************************************ */
 
48
/* **                                                                    ** */
 
49
/* **   CONFIGURATION of the UniquE RAR FileLib                          ** */
 
50
/* **   ==> you may change the setting for the lib HERE!                 ** */
 
51
/* **                                                                    ** */
 
52
/* ************************************************************************ */
 
53
/* ************************************************************************ */
 
54
 
 
55
 
 
56
/*#define _DEBUG_LOG*/                         /* generate debug messages      */
 
57
 
 
58
#define _DO_CRC32_CHECK                     /* perform cyclical redundancy  */
 
59
                                            /* check (CRC32) - disable this */
 
60
                                            /* for a little speed-up        */
 
61
/*#define _USE_ASM*/                            /*
 
62
                                             * enable assembly extensions
 
63
                                             * x86 cpus.
 
64
                                             */
 
65
 
 
66
/*#define _USE_MEMORY_TO_MEMORY_DECOMPRESSION*/ /* read file from memory or a   */
 
67
                                            /* resource instead of reading  */
 
68
                                            /* from a file. NOTE: you won't */
 
69
                                            /*  be able to decompress from  */
 
70
                                            /*  file if you enable this     */
 
71
                                            /*  option!                     */
 
72
 
 
73
 
 
74
#ifdef WIN32                                /* autodetect Win32 and Linux   */
 
75
#define _WIN_32                             /* Win32 with VisualC           */
 
76
#define _DEBUG_LOG_FILE "C:\\temp\\debug_unrar.txt" /* log file path        */
 
77
#else
 
78
#define _UNIX                               /* Linux or Unix with GCC       */
 
79
#define _DEBUG_LOG_FILE "/tmp/debug_unrar.txt" /* log file path             */
 
80
/*#define NON_INTEL_BYTE_ORDER*/               /* GCC on motorola systems    */
 
81
 
 
82
#endif
 
83
 
 
84
/* ------------------------------------------------------------------------ */
 
85
 
 
86
 
 
87
 
 
88
/* -- global type definitions --------------------------------------------- */
 
89
 
 
90
#ifdef NON_INTEL_BYTE_ORDER
 
91
#ifdef _USE_ASM
 
92
#warning Disabling assembly because NON_INTEL_BYTE_ORDER is set
 
93
#undef _USE_ASM
 
94
#endif
 
95
#endif
 
96
 
 
97
#ifdef _WIN_32
 
98
typedef unsigned char    UBYTE;             /* WIN32 definitions            */
 
99
typedef unsigned short   UWORD;
 
100
typedef unsigned long    UDWORD;
 
101
#endif
 
102
 
 
103
#ifdef _UNIX                                /* LINUX/UNIX definitions       */
 
104
typedef unsigned char    UBYTE;
 
105
typedef unsigned short   UWORD;
 
106
typedef unsigned long    UDWORD;
 
107
#endif
 
108
 
 
109
 
 
110
/* This structure is used for listing archive content                       */
 
111
struct RAR20_archive_entry                  /* These infos about files are  */
 
112
{                                           /* stored in RAR v2.0 archives  */
 
113
  char   *Name;
 
114
  UWORD  NameSize;
 
115
  UDWORD PackSize;
 
116
  UDWORD UnpSize;
 
117
  UBYTE  HostOS;                            /* MSDOS=0,OS2=1,WIN32=2,UNIX=3 */
 
118
  UDWORD FileCRC;
 
119
  UDWORD FileTime;
 
120
  UBYTE  UnpVer;
 
121
  UBYTE  Method;
 
122
  UDWORD FileAttr;
 
123
};
 
124
 
 
125
typedef struct  archivelist                 /* used to list archives        */
 
126
{
 
127
  struct RAR20_archive_entry item;
 
128
  struct archivelist         *next;
 
129
} ArchiveList_struct;
 
130
 
 
131
 
 
132
#ifdef _USE_MEMORY_TO_MEMORY_DECOMPRESSION
 
133
typedef struct  memory_file                 /* used to decompress files in  */
 
134
{                                           /* memory                       */
 
135
  void                       *data;         /* pointer to the file data     */
 
136
  unsigned long              size;          /* total size of the file data  */
 
137
  unsigned long              offset;        /* offset within "memory-file"  */
 
138
} MemoryFile;
 
139
#endif
 
140
 
 
141
/* -- global functions ---------------------------------------------------- */
 
142
 
 
143
/* urarlib_get:
 
144
 * decompresses and decrypt data from a RAR file to a buffer in system memory.
 
145
 *
 
146
 *   input: *output         pointer to an empty char*. This pointer will show
 
147
 *                          to the extracted data
 
148
 *          *size           shows where to write the size of the decompressed
 
149
 *                          file
 
150
 *                          (**NOTE: URARLib _does_ memory allocation etc.!**)
 
151
 *          *filename       pointer to string containing the file to decompress
 
152
 *          *rarfile        pointer to a string with the full name and path of
 
153
 *                          the RAR file or pointer to a RAR file in memory if
 
154
 *                          memory-to-memory decompression is active.
 
155
 *          *libpassword    pointer to a string with the password used to
 
156
 *                          en-/decrypt the RAR
 
157
 *   output: int            returns TRUE on success or FALSE on error
 
158
 *                          (FALSE=0, TRUE=1)
 
159
 */
 
160
 
 
161
extern int urarlib_get(void  *output,
 
162
                       unsigned long *size,
 
163
                       char *filename,
 
164
                       void *rarfile,
 
165
                       char *libpassword);
 
166
 
 
167
 
 
168
 
 
169
/* urarlib_list:
 
170
 * list the content of a RAR archive.
 
171
 *
 
172
 *   input: *rarfile        pointer to a string with the full name and path of
 
173
 *                          the RAR file or pointer to a RAR file in memory if
 
174
 *                          memory-to-memory decompression is active.
 
175
 *          *list           pointer to an ArchiveList_struct that can be
 
176
 *                          filled with details about the archive
 
177
 *                          to the extracted data
 
178
 *   output: int            number of files/directories within archive
 
179
 */
 
180
 
 
181
extern int urarlib_list(void *rarfile, ArchiveList_struct *list);
 
182
 
 
183
 
 
184
/* urarlib_freelist:
 
185
 * (after the suggestion and code of Duy Nguyen, Sean O'Blarney
 
186
 * and Johannes Winkelmann who independently wrote a patch)
 
187
 * free the memory of a ArchiveList_struct created by urarlib_list.
 
188
 *
 
189
 *    input: *list          pointer to an ArchiveList_struct
 
190
 *    output: -
 
191
 */
 
192
 
 
193
extern void urarlib_freelist(ArchiveList_struct *list);
 
194
 
 
195
/* ------------------------------------------------------------------------ */
 
196
 
 
197
 
 
198
 
 
199
#ifdef __cplusplus
 
200
};
 
201
#endif
 
202
 
 
203
#endif
 
204