Remove internal unrarlib copy, the new unrarexec code is a strict superset.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25468 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
diego 2007-12-20 10:10:26 +00:00
parent f2281fa06a
commit f9455f34d0
7 changed files with 18 additions and 2985 deletions

View File

@ -136,14 +136,6 @@ Directory: libmpdemux/genres.h
Copyright: 2001 Jason Carter
License: GNU General Public License
Name: unrarlib
Version: 0.4.0 + patches
Homepage: http://www.unrarlib.org/
Directory: unrarlib.[ch]
Copyright: 2000-2002 Christian Scheurer (www.ChristianScheurer.ch)
2000-2002 by Johannes Winkelmann (jw@tks6.net)
License: GNU General Public License / UniquE RAR File Library License
Name: FreeSDP
Version: 0.4.1
Homepage: https://savannah.nongnu.org/projects/freesdp/

View File

@ -34,7 +34,6 @@ SRCS_COMMON = asxparser.c \
subreader.c \
vobsub.c \
SRCS_COMMON-$(UNRARLIB) += unrarlib.c
SRCS_COMMON-$(UNRAR_EXEC) += unrar_exec.c
SRCS_MPLAYER = mplayer.c \

15
configure vendored
View File

@ -255,7 +255,6 @@ Optional features:
--disable-bitmap-font disable bitmap font support [enable]
--disable-freetype disable FreeType 2 font rendering [autodetect]
--disable-fontconfig disable fontconfig font lookup [autodetect]
--disable-unrarlib disable Unique RAR File Library [enabled]
--disable-unrarexec disable using of UnRAR executable [enabled]
--enable-menu enable OSD menu (not DVD menu) [disabled]
--disable-sortsub disable subtitle sorting [enabled]
@ -592,7 +591,6 @@ _sgiaudio=auto
_sunaudio=auto
_alsa=auto
_fastmemcpy=yes
_unrarlib=yes
_unrar_exec=auto
_win32dll=auto
_select=yes
@ -1097,8 +1095,6 @@ for ac_option do
--disable-freetype) _freetype=no ;;
--enable-fontconfig) _fontconfig=yes ;;
--disable-fontconfig) _fontconfig=no ;;
--enable-unrarlib) _unrarlib=yes ;;
--disable-unrarlib) _unrarlib=no ;;
--enable-unrarexec) _unrar_exec=yes ;;
--disable-unrarexec) _unrar_exec=no ;;
--enable-ftp) _ftp=yes ;;
@ -6711,13 +6707,6 @@ else
fi
echores "$_fastmemcpy"
echocheck "UniquE RAR File Library"
if test "$_unrarlib" = yes ; then
_def_unrarlib='#define USE_UNRARLIB 1'
else
_def_unrarlib='#undef USE_UNRARLIB'
fi
echores "$_unrarlib"
echocheck "UnRAR executable"
if test "$_unrar_exec" = auto ; then
@ -7626,7 +7615,6 @@ FAAD = $_faad
SPEEX = $_speex
MUSEPACK = $_musepack
UNRARLIB = $_unrarlib
UNRAR_EXEC = $_unrar_exec
PNG = $_png
JPEG = $_jpeg
@ -8179,9 +8167,6 @@ $_def_nemesi
/* Use 3dnow/mmxext/sse/mmx optimized fast memcpy() [maybe buggy... signal 4]*/
$_def_fastmemcpy
/* Use unrarlib for Vobsubs */
$_def_unrarlib
/* Use UnRAR executable for Vobsubs */
$_def_unrar_exec

View File

@ -24,7 +24,23 @@
#ifndef UNRAR_EXEC_H
#define UNRAR_EXEC_H
#include "unrarlib.h"
struct RAR_archive_entry
{
char *Name;
unsigned long PackSize;
unsigned long UnpSize;
unsigned long FileCRC;
unsigned long FileTime;
unsigned char UnpVer;
unsigned char Method;
unsigned long FileAttr;
};
typedef struct archivelist
{
struct RAR_archive_entry item;
struct archivelist *next;
} ArchiveList_struct;
extern char* unrar_executable;

2729
unrarlib.c

File diff suppressed because it is too large Load Diff

View File

@ -1,204 +0,0 @@
/* ***************************************************************************
**
** This file is part of the UniquE RAR File Library.
**
** Copyright (C) 2000-2002 by Christian Scheurer (www.ChristianScheurer.ch)
** UNIX port copyright (c) 2000-2002 by Johannes Winkelmann (jw@tks6.net)
**
** Modified for use with MPlayer, detailed changelog at
** http://svn.mplayerhq.hu/mplayer/trunk/
** $Id$
**
** The contents of this file are subject to the UniquE RAR File Library
** License (the "unrarlib-license.txt"). You may not use this file except
** in compliance with the License. You may obtain a copy of the License
** at http://www.unrarlib.org/license.html.
** Software distributed under the License is distributed on an "AS IS"
** basis, WITHOUT WARRANTY OF ANY KIND, either express or implied warranty.
**
** Alternatively, the contents of this file may be used under the terms
** of the GNU General Public License Version 2 or later (the "GPL"), in
** which case the provisions of the GPL are applicable instead of those
** above. If you wish to allow use of your version of this file only
** under the terms of the GPL and not to allow others to use your version
** of this file under the terms of the UniquE RAR File Library License,
** indicate your decision by deleting the provisions above and replace
** them with the notice and other provisions required by the GPL. If you
** do not delete the provisions above, a recipient may use your version
** of this file under the terms of the GPL or the UniquE RAR File Library
** License.
**
************************************************************************** */
/* include file for the "UniquE RAR File Library" */
/* (C) 2000-2002 by Christian Scheurer aka. UniquE */
/* multi-OS version (Win32, Linux and SUN) */
#ifndef URARLIB_H
#define URARLIB_H
#ifdef __cplusplus
extern "C"
{
#endif
/* ************************************************************************ */
/* ************************************************************************ */
/* ** ** */
/* ** CONFIGURATION of the UniquE RAR FileLib ** */
/* ** ==> you may change the setting for the lib HERE! ** */
/* ** ** */
/* ************************************************************************ */
/* ************************************************************************ */
/*#define _DEBUG_LOG*/ /* generate debug messages */
#define _DO_CRC32_CHECK /* perform cyclical redundancy */
/* check (CRC32) - disable this */
/* for a little speed-up */
/*#define _USE_ASM*/ /*
* enable assembly extensions
* x86 cpus.
*/
/*#define _USE_MEMORY_TO_MEMORY_DECOMPRESSION*/ /* read file from memory or a */
/* resource instead of reading */
/* from a file. NOTE: you won't */
/* be able to decompress from */
/* file if you enable this */
/* option! */
#ifdef WIN32 /* autodetect Win32 and Linux */
#define _WIN_32 /* Win32 with VisualC */
#define _DEBUG_LOG_FILE "C:\\temp\\debug_unrar.txt" /* log file path */
#else
#define _UNIX /* Linux or Unix with GCC */
#define _DEBUG_LOG_FILE "/tmp/debug_unrar.txt" /* log file path */
/*#define NON_INTEL_BYTE_ORDER*/ /* GCC on motorola systems */
#endif
/* ------------------------------------------------------------------------ */
/* -- global type definitions --------------------------------------------- */
#ifdef NON_INTEL_BYTE_ORDER
#ifdef _USE_ASM
#warning Disabling assembly because NON_INTEL_BYTE_ORDER is set
#undef _USE_ASM
#endif
#endif
#ifdef _WIN_32
typedef unsigned char UBYTE; /* WIN32 definitions */
typedef unsigned short UWORD;
typedef unsigned long UDWORD;
#endif
#ifdef _UNIX /* LINUX/UNIX definitions */
typedef unsigned char UBYTE;
typedef unsigned short UWORD;
typedef unsigned long UDWORD;
#endif
/* This structure is used for listing archive content */
struct RAR20_archive_entry /* These infos about files are */
{ /* stored in RAR v2.0 archives */
char *Name;
UWORD NameSize;
UDWORD PackSize;
UDWORD UnpSize;
UBYTE HostOS; /* MSDOS=0,OS2=1,WIN32=2,UNIX=3 */
UDWORD FileCRC;
UDWORD FileTime;
UBYTE UnpVer;
UBYTE Method;
UDWORD FileAttr;
};
typedef struct archivelist /* used to list archives */
{
struct RAR20_archive_entry item;
struct archivelist *next;
} ArchiveList_struct;
#ifdef _USE_MEMORY_TO_MEMORY_DECOMPRESSION
typedef struct memory_file /* used to decompress files in */
{ /* memory */
void *data; /* pointer to the file data */
unsigned long size; /* total size of the file data */
unsigned long offset; /* offset within "memory-file" */
} MemoryFile;
#endif
/* -- global functions ---------------------------------------------------- */
/* urarlib_get:
* decompresses and decrypt data from a RAR file to a buffer in system memory.
*
* input: *output pointer to an empty char*. This pointer will show
* to the extracted data
* *size shows where to write the size of the decompressed
* file
* (**NOTE: URARLib _does_ memory allocation etc.!**)
* *filename pointer to string containing the file to decompress
* *rarfile pointer to a string with the full name and path of
* the RAR file or pointer to a RAR file in memory if
* memory-to-memory decompression is active.
* *libpassword pointer to a string with the password used to
* en-/decrypt the RAR
* output: int returns TRUE on success or FALSE on error
* (FALSE=0, TRUE=1)
*/
extern int urarlib_get(void *output,
unsigned long *size,
char *filename,
void *rarfile,
char *libpassword);
/* urarlib_list:
* list the content of a RAR archive.
*
* input: *rarfile pointer to a string with the full name and path of
* the RAR file or pointer to a RAR file in memory if
* memory-to-memory decompression is active.
* *list pointer to an ArchiveList_struct that can be
* filled with details about the archive
* to the extracted data
* output: int number of files/directories within archive
*/
extern int urarlib_list(void *rarfile, ArchiveList_struct *list);
/* urarlib_freelist:
* (after the suggestion and code of Duy Nguyen, Sean O'Blarney
* and Johannes Winkelmann who independently wrote a patch)
* free the memory of a ArchiveList_struct created by urarlib_list.
*
* input: *list pointer to an ArchiveList_struct
* output: -
*/
extern void urarlib_freelist(ArchiveList_struct *list);
/* ------------------------------------------------------------------------ */
#ifdef __cplusplus
};
#endif
#endif /* URARLIB_H */

View File

@ -22,8 +22,6 @@
#include "mp_msg.h"
#ifdef USE_UNRAR_EXEC
#include "unrar_exec.h"
#elif defined(USE_UNRARLIB)
#include "unrarlib.h"
#endif
#include "libavutil/common.h"
@ -35,9 +33,8 @@ static int vobsubid = -2;
/**********************************************************************
* RAR stream handling
* The RAR file must have the same basename as the file to open
* See <URL:http://www.unrarlib.org/>
**********************************************************************/
#if defined(USE_UNRARLIB) || defined(USE_UNRAR_EXEC)
#ifdef USE_UNRAR_EXEC
typedef struct {
FILE *file;
unsigned char *data;
@ -90,27 +87,15 @@ rar_open(const char *const filename, const char *const mode)
} else {
p++;
}
#ifdef USE_UNRAR_EXEC
rc = unrar_exec_get(&stream->data, &stream->size, p, rar_filename);
#endif
#ifdef USE_UNRARLIB
if (!rc)
rc = urarlib_get(&stream->data, &stream->size, (char*) p, rar_filename, "");
#endif
if (!rc) {
/* There is no matching filename in the archive. However, sometimes
* the files we are looking for have been given arbitrary names in the archive.
* Let's look for a file with an exact match in the extension only. */
int i, num_files = -1, name_len;
ArchiveList_struct *list, *lp;
#ifdef USE_UNRARLIB
/* the cast in the next line is a hack to overcome a design flaw (IMHO) in unrarlib */
num_files = urarlib_list (rar_filename, (ArchiveList_struct *)&list);
#endif
#ifdef USE_UNRAR_EXEC
if (num_files <= 0)
num_files = unrar_exec_list(rar_filename, &list);
#endif
if (num_files > 0) {
char *demanded_ext;
demanded_ext = strrchr (p, '.');
@ -119,24 +104,13 @@ rar_open(const char *const filename, const char *const mode)
for (i=0, lp=list; i<num_files; i++, lp=lp->next) {
name_len = strlen (lp->item.Name);
if (name_len >= demanded_ext_len && !strcasecmp (lp->item.Name + name_len - demanded_ext_len, demanded_ext)) {
#ifdef USE_UNRAR_EXEC
rc = unrar_exec_get(&stream->data, &stream->size,
lp->item.Name, rar_filename);
if (rc) break;
#endif
#ifdef USE_UNRARLIB
rc = urarlib_get(&stream->data, &stream->size,
lp->item.Name, rar_filename, "");
if (rc) break;
#endif
}
}
}
#ifdef USE_UNRARLIB
urarlib_freelist (list);
#else
unrar_exec_freelist(list);
#endif
}
if (!rc) {
free(rar_filename);