diff options
27 files changed, 996 insertions, 6037 deletions
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index f50253b72..43803e605 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_dvd.c,v 1.152 2003/04/13 16:02:53 tmattern Exp $ + * $Id: input_dvd.c,v 1.153 2003/04/22 23:30:29 tchamp Exp $ * */ @@ -40,10 +40,14 @@ #include <stdio.h> #include <stdlib.h> #include <stddef.h> + +#ifndef _MSC_VER #include <dirent.h> #include <sys/param.h> #include <sys/types.h> #include <sys/stat.h> +#endif /* _MSC_VER */ + #include <unistd.h> #include <fcntl.h> #include <time.h> @@ -51,11 +55,14 @@ #include <errno.h> #include <dlfcn.h> +#ifndef _MSC_VER #include <sys/mount.h> #include <sys/wait.h> #include <sys/poll.h> #include <sys/ioctl.h> +#endif /* _MSC_VER */ + #if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) #include <sys/dvdio.h> @@ -65,13 +72,23 @@ #elif defined(HAVE_SYS_CDIO_H) #include <sys/cdio.h> #else + +#ifdef WIN32 +#include <io.h> /* read() */ +#else #warning "This might not compile due to missing cdrom ioctls" +#endif /* WIN32 */ + #endif /* DVDNAV includes */ #ifdef HAVE_DVDNAV +#ifndef _MSC_VER # include <dvdnav/dvdnav.h> #else +# include "dvdnav.h" +#endif /* _MSC_VER */ +#else # define DVDNAV_COMPILE # include "dvdnav.h" #endif @@ -125,11 +142,11 @@ # define trace_print(s, args...) /* Nothing */ # endif #else -# ifdef INPUT_DEBUG_TRACE -# define trace_print(s, ...) printf("input_dvd: " __func__ ": " s, __VA_ARGS_); -# else -# define trace_print(s, ...) /* Nothing */ -# endif +# ifndef _MSC_VER +# define trace_print(s, ...) /* Nothing */ +# else +# define trace_print printf +# endif /* _MSC_VER */ #endif /* Array to hold MRLs returned by get_autoplay_list */ @@ -1604,6 +1621,9 @@ static void *init_class (xine_t *xine, void *data) { /* * $Log: input_dvd.c,v $ + * Revision 1.153 2003/04/22 23:30:29 tchamp + * Additional changes for win32/msvc port; This is my first real commit so please be gentle with me; Everything builds except for the win32 ui + * * Revision 1.152 2003/04/13 16:02:53 tmattern * Input plugin api change: * old open() function replaced by : diff --git a/src/input/input_file.c b/src/input/input_file.c index 3356d6b31..612546ddf 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_file.c,v 1.79 2003/04/13 16:02:53 tmattern Exp $ + * $Id: input_file.c,v 1.80 2003/04/22 23:30:35 tchamp Exp $ */ #ifdef HAVE_CONFIG_H @@ -75,6 +75,10 @@ static uint32_t file_plugin_get_capabilities (input_plugin_t *this_gen) { if (this->fh <0) return 0; +#ifdef _MSC_VER + /*return INPUT_CAP_SEEKABLE | INPUT_CAP_GET_DIR;*/ + return INPUT_CAP_SEEKABLE; +#else if (fstat (this->fh, &buf) == 0) { if (S_ISREG(buf.st_mode)) return INPUT_CAP_SEEKABLE; @@ -83,6 +87,7 @@ static uint32_t file_plugin_get_capabilities (input_plugin_t *this_gen) { } else perror ("system call fstat"); return 0; +#endif /* _MSC_VER */ } @@ -231,7 +236,15 @@ static int file_plugin_open (input_plugin_t *this_gen ) { else filename = decode_uri(this->mrl); +#ifdef _MSC_VER + /* + added O_BINARY flag, <CTRL>-Z char + is interperated as EOF on win32. + */ + this->fh = open (filename, O_RDONLY|O_BINARY); +#else this->fh = open (filename, O_RDONLY); +#endif /* _MSC_VER */ if (this->fh == -1) { return 0; diff --git a/src/input/libdvdnav/dvdnav.h b/src/input/libdvdnav/dvdnav.h index fa210ea53..44ef878e1 100644 --- a/src/input/libdvdnav/dvdnav.h +++ b/src/input/libdvdnav/dvdnav.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dvdnav.h,v 1.10 2003/04/07 19:59:09 jcdutton Exp $ + * $Id: dvdnav.h,v 1.11 2003/04/22 23:30:36 tchamp Exp $ * */ @@ -34,11 +34,16 @@ extern "C" { #endif #ifdef HAVE_DVDNAV +#ifndef _MSC_VER # include <dvdnav/dvdnav_events.h> # include <dvdnav/dvd_types.h> #else # include "dvdnav_events.h" # include "dvd_types.h" +#endif /* _MSC_VER */ +#else +# include "dvdnav_events.h" +# include "dvd_types.h" #endif #include "dvd_reader.h" diff --git a/src/input/libdvdread/bswap.h b/src/input/libdvdread/bswap.h index 9c7402957..6eb9e37f2 100644 --- a/src/input/libdvdread/bswap.h +++ b/src/input/libdvdread/bswap.h @@ -65,7 +65,7 @@ * functionality! */ -#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) +#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(_MSC_VER) #define B2N_16(x) \ x = ((((x) & 0xff00) >> 8) | \ (((x) & 0x00ff) << 8)) diff --git a/src/input/libdvdread/dvd_reader.h b/src/input/libdvdread/dvd_reader.h index cc4ba5489..9f609dfd8 100644 --- a/src/input/libdvdread/dvd_reader.h +++ b/src/input/libdvdread/dvd_reader.h @@ -21,6 +21,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#if defined(_MSC_VER) +typedef long ssize_t; +#endif /* _MSC_VER */ + #include <sys/types.h> /** diff --git a/src/liba52/bitstream.h b/src/liba52/bitstream.h index 7d7ea7679..f242c37c4 100644 --- a/src/liba52/bitstream.h +++ b/src/liba52/bitstream.h @@ -21,6 +21,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef WIN32 +#include <unistd.h> +#endif + /* (stolen from the kernel) */ #ifdef WORDS_BIGENDIAN diff --git a/src/video_out/alphablend.h b/src/video_out/alphablend.h index 759b61254..71ecc73cd 100644 --- a/src/video_out/alphablend.h +++ b/src/video_out/alphablend.h @@ -27,12 +27,35 @@ #include "video_out.h" +/* _MSC_VER port changes */ +#undef ATTRIBUTE_PACKED +#undef PRAGMA_PACK_BEGIN +#undef PRAGMA_PACK_END + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define ATTRIBUTE_PACKED __attribute__ ((packed)) +#define PRAGMA_PACK 0 +#endif + +#if !defined(ATTRIBUTE_PACKED) +#define ATTRIBUTE_PACKED +#define PRAGMA_PACK 1 +#endif + +#if PRAGMA_PACK +#pragma pack(8) +#endif + typedef struct { /* CLUT == Color LookUp Table */ uint8_t cb : 8; uint8_t cr : 8; uint8_t y : 8; uint8_t foo : 8; -} __attribute__ ((packed)) clut_t; +} ATTRIBUTE_PACKED clut_t; + +#if PRAGMA_PACK +#pragma pack() +#endif void blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, int img_width, int img_height, diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c index 590574da2..0bca356ba 100755 --- a/src/video_out/video_out_directx.c +++ b/src/video_out/video_out_directx.c @@ -1270,7 +1270,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { static vo_info_t vo_info_win32 = { 7, /* priority */ - XINE_VISUAL_TYPE_WIN32 /* visual type */ + XINE_VISUAL_TYPE_DIRECTX /* visual type */ }; /* diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 11bd7b698..53b0eccba 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.123 2003/04/21 00:25:55 jstembridge Exp $ + * $Id: audio_out.c,v 1.124 2003/04/22 23:30:48 tchamp Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe <andy@alsaplayer.org> @@ -553,7 +553,7 @@ static void audio_filter_equalize (aos_t *this, int index, band, channel; int halflength, length; int out[EQ_CHANNELS], scaledpcm[EQ_CHANNELS]; - long long l; + int64_t l; int num_channels; num_channels = mode_channels (this->input.mode); @@ -575,11 +575,11 @@ static void audio_filter_equalize (aos_t *this, for (band = 0; band < EQ_BANDS; band++) { this->eq_data_history[band][channel].x[this->eq_i] = scaledpcm[channel]; - l = (long long)iir_cf[band].alpha * (long long)(this->eq_data_history[band][channel].x[this->eq_i] - this->eq_data_history[band][channel].x[this->eq_k]) - + (long long)iir_cf[band].gamma * (long long)this->eq_data_history[band][channel].y[this->eq_j] - - (long long)iir_cf[band].beta * (long long)this->eq_data_history[band][channel].y[this->eq_k]; + l = (int64_t)iir_cf[band].alpha * (int64_t)(this->eq_data_history[band][channel].x[this->eq_i] - this->eq_data_history[band][channel].x[this->eq_k]) + + (int64_t)iir_cf[band].gamma * (int64_t)this->eq_data_history[band][channel].y[this->eq_j] + - (int64_t)iir_cf[band].beta * (int64_t)this->eq_data_history[band][channel].y[this->eq_k]; this->eq_data_history[band][channel].y[this->eq_i] = (int)(l >> FP_FRBITS); - l = (long long)this->eq_data_history[band][channel].y[this->eq_i] * (long long)this->eq_gain[band]; + l = (int64_t)this->eq_data_history[band][channel].y[this->eq_i] * (int64_t)this->eq_gain[band]; out[channel] += (int)(l >> FP_FRBITS); } diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index 205f13b2b..7abfa9992 100644 --- a/src/xine-engine/buffer.h +++ b/src/xine-engine/buffer.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: buffer.h,v 1.107 2003/04/16 23:05:27 heinchen Exp $ + * $Id: buffer.h,v 1.108 2003/04/22 23:30:52 tchamp Exp $ * * * contents: @@ -197,6 +197,7 @@ extern "C" { #define BUF_AUDIO_FLAC 0x032C0000 #define BUF_AUDIO_DV 0x032D0000 #define BUF_AUDIO_WMAV 0x032E0000 +#define BUF_AUDIO_DIRECTX 0x032F0000 /* spu buffer types: */ diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c index f144e732b..ff66dfc06 100644 --- a/src/xine-engine/buffer_types.c +++ b/src/xine-engine/buffer_types.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: buffer_types.c,v 1.56 2003/03/23 17:12:30 holstsn Exp $ + * $Id: buffer_types.c,v 1.57 2003/04/22 23:30:53 tchamp Exp $ * * * contents: @@ -833,6 +833,13 @@ static audio_db_t audio_db[] = { BUF_AUDIO_DV, "DV Audio" }, +{ + { + 0 + }, + BUF_AUDIO_DIRECTX, + "Directx Audio" +}, { { 0 }, 0, "last entry" } }; diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index 8cafe9f78..c6dcbf280 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -35,6 +35,10 @@ #include "demuxers/demux.h" #include "buffer.h" +#ifdef WIN32 +#include <winsock.h> +#endif + /* #define LOG */ diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 3e6cb230a..892152872 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -89,14 +89,14 @@ struct osd_font_s { osd_font_t *next; }; -struct osd_ft2context_s { #ifdef HAVE_FT2 +struct osd_ft2context_s { int useme; FT_Library library; FT_Face face; int size; -#endif }; +#endif /* * open a new osd object. this will allocated an empty (all zero) drawing diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 811a53888..5bba920cd 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.243 2003/04/17 19:01:24 miguelfreitas Exp $ + * $Id: xine.c,v 1.244 2003/04/22 23:30:55 tchamp Exp $ * * top-level xine functions * @@ -58,6 +58,11 @@ #include "xineutils.h" #include "compat.h" +#ifdef WIN32 +# include <fcntl.h> +# include <winsock.h> +#endif /* WIN32 */ + /* #define LOG */ @@ -1084,6 +1089,11 @@ void xine_exit (xine_t *this) { if(this->config) this->config->dispose(this->config); +#if defined(WIN32) + WSACleanup(); +#endif + + pthread_mutex_destroy(&this->streams_lock); free (this); @@ -1094,6 +1104,11 @@ xine_t *xine_new (void) { xine_t *this; int i; +#ifdef WIN32 + WSADATA Data; + int i_err; +#endif /* WIN32 */ + this = xine_xmalloc (sizeof (xine_t)); if (!this) { printf ("xine: failed to malloc xine_t\n"); @@ -1120,7 +1135,19 @@ xine_t *xine_new (void) { for (i = 0; i < XINE_LOG_NUM; i++) this->log_buffers[i] = new_scratch_buffer (25); + +#ifdef WIN32 + /* WinSock Library Init. */ + i_err = WSAStartup( MAKEWORD( 1, 1 ), &Data ); + + if( i_err ) + { + fprintf( stderr, "error: can't initiate WinSocks, error %i\n", i_err ); + } + +#endif /* WIN32 */ + /* * streams_lock */ diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 1aa6899a6..33275b05c 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xineutils.h,v 1.48 2003/04/20 21:13:28 guenter Exp $ + * $Id: xineutils.h,v 1.49 2003/04/22 23:30:58 tchamp Exp $ * */ #ifndef XINEUTILS_H @@ -668,7 +668,7 @@ static inline char *_x_strpbrk(const char *s, const char *accept) { #define xine_strpbrk _x_strpbrk #endif -#ifdef HAVE_STRSEP +#if defined HAVE_STRSEP && !defined(_MSC_VER) #define xine_strsep strsep #else static inline char *_x_strsep(char **stringp, const char *delim) { diff --git a/win32/include/dirent.h b/win32/include/dirent.h deleted file mode 100644 index 588048c67..000000000 --- a/win32/include/dirent.h +++ /dev/null @@ -1,32 +0,0 @@ -/*
-
- Declaration of POSIX directory browsing functions and types for Win32.
-
- Kevlin Henney (mailto:kevlin@acm.org), March 1997.
-
- Copyright Kevlin Henney, 1997. All rights reserved.
-
- Permission to use, copy, modify, and distribute this software and its
- documentation for any purpose is hereby granted without fee, provided
- that this copyright and permissions notice appear in all copies and
- derivatives, and that no charge may be made for the software and its
- documentation except to cover cost of distribution.
-
-*/
-
-#ifndef DIRENT_INCLUDED
-#define DIRENT_INCLUDED
-
-typedef struct DIR DIR;
-
-struct dirent
-{
- char *d_name;
-};
-
-DIR *opendir(const char *);
-int closedir(DIR *);
-struct dirent *readdir(DIR *);
-void rewinddir(DIR *);
-
-#endif
diff --git a/win32/include/pthread.h b/win32/include/pthread.h deleted file mode 100644 index 31e2cf918..000000000 --- a/win32/include/pthread.h +++ /dev/null @@ -1,1077 +0,0 @@ -/* This is the POSIX thread API (POSIX 1003).
- *
- * Pthreads-win32 - POSIX Threads Library for Win32
- * Copyright (C) 1998
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA
- */
-
-#if !defined( PTHREAD_H )
-#define PTHREAD_H
-
-#ifdef _UWIN
-# define HAVE_STRUCT_TIMESPEC 1
-# define HAVE_SIGNAL_H 1
-# undef HAVE_CONFIG_H
-# pragma comment(lib, "pthread")
-#endif
-
-/*
- * -------------------------------------------------------------
- *
- *
- * Module: pthread.h
- *
- * Purpose:
- * Provides an implementation of PThreads based upon the
- * standard:
- *
- * POSIX 1003.1c-1995 (POSIX.1c)
- *
- * Parts of the implementation also comply with the
- * Open Group Unix 98 specification in order to enhance
- * code portability between Windows, various commercial
- * Unix implementations, and Linux.
- *
- * Authors:
- * There have been many contributors to this library.
- * The initial implementation was contributed by
- * John Bossom, and several others have provided major
- * sections or revisions of parts of the implementation.
- * Often significant effort has been contributed to
- * find and fix important bugs and other problems to
- * improve the reliability of the library, which sometimes
- * is not reflected in the amount of code which changed as
- * result.
- * As much as possible, the contributors are acknowledged
- * in the ChangeLog file in the source code distribution
- * where their changes are noted in detail.
- *
- * Contributors are listed in the MAINTAINERS file.
- *
- * As usual, all bouquets go to the contributors, and all
- * brickbats go to the project maintainer.
- *
- * Maintainer:
- * The code base for this project is coordinated and
- * eventually pre-tested, packaged, and made available by
- *
- * Ross Johnson <rpj@ise.canberra.edu.au>
- *
- * QA Testers:
- * Ultimately, the library is tested in the real world by
- * a host of competent and demanding scientists and
- * engineers who report bugs and/or provide solutions
- * which are then fixed or incorporated into subsequent
- * versions of the library. Each time a bug is fixed, a
- * test case is written to prove the fix and ensure
- * that later changes to the code don't reintroduce the
- * same error. The number of test cases is slowly growing
- * and therefore so is the code reliability.
- *
- * Compliance:
- * See the file ANNOUNCE for the list of implemented
- * and not-implemented routines and defined options.
- * Of course, these are all defined is this file as well.
- *
- * Web site:
- * The source code and other information about this library
- * are available from
- *
- * http://sources.redhat.com/pthreads-win32/
- *
- * -------------------------------------------------------------
- */
-
-/*
- * -----------------
- * autoconf switches
- * -----------------
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#include <windows.h>
-
-#ifndef NEED_FTIME
-#include <time.h>
-#else /* NEED_FTIME */
-/* use native WIN32 time API */
-#endif /* NEED_FTIME */
-
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif /* HAVE_SIGNAL_H */
-
-#include <setjmp.h>
-
-#ifndef HAVE_STRUCT_TIMESPEC
-struct timespec {
- long tv_sec;
- long tv_nsec;
-};
-#endif /* HAVE_STRUCT_TIMESPEC */
-
-#ifndef SIG_BLOCK
-#define SIG_BLOCK 0
-#endif /* SIG_BLOCK */
-
-#ifndef SIG_UNBLOCK
-#define SIG_UNBLOCK 1
-#endif /* SIG_UNBLOCK */
-
-#ifndef SIG_SETMASK
-#define SIG_SETMASK 2
-#endif /* SIG_SETMASK */
-
-/*
- * note: ETIMEDOUT is correctly defined in winsock.h
- */
-#include <winsock.h>
-
-#ifdef NEED_ERRNO
-# include "need_errno.h"
-#else
-# include <errno.h>
-#endif
-
-#include <sched.h>
-
-/*
- * In case ETIMEDOUT hasn't been defined above somehow.
- */
-#ifndef ETIMEDOUT
-# define ETIMEDOUT 10060 /* This is the value in winsock.h. */
-#endif
-
-/*
- * Several systems don't define ENOTSUP. If not, we use
- * the same value as Solaris.
- */
-#ifndef ENOTSUP
-# define ENOTSUP 48
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-/*
- * -------------------------------------------------------------
- *
- * POSIX 1003.1c-1995 Options
- * ===========================
- *
- * _POSIX_THREADS (set)
- * If set, you can use threads
- *
- * _POSIX_THREAD_ATTR_STACKSIZE (set)
- * If set, you can control the size of a thread's
- * stack
- * pthread_attr_getstacksize
- * pthread_attr_setstacksize
- *
- * _POSIX_THREAD_ATTR_STACKADDR (not set)
- * If set, you can allocate and control a thread's
- * stack. If not supported, the following functions
- * will return ENOSYS, indicating they are not
- * supported:
- * pthread_attr_getstackaddr
- * pthread_attr_setstackaddr
- *
- * _POSIX_THREAD_PRIORITY_SCHEDULING (set)
- * If set, you can use realtime scheduling.
- * Indicates the availability of:
- * pthread_attr_getinheritsched
- * pthread_attr_getschedparam
- * pthread_attr_getschedpolicy
- * pthread_attr_getscope
- * pthread_attr_setinheritsched
- * pthread_attr_setschedparam
- * pthread_attr_setschedpolicy
- * pthread_attr_setscope
- * pthread_getschedparam
- * pthread_setschedparam
- * sched_get_priority_max
- * sched_get_priority_min
- * sched_rr_set_interval
- *
- * _POSIX_THREAD_PRIO_INHERIT (not set)
- * If set, you can create priority inheritance
- * mutexes.
- * pthread_mutexattr_getprotocol +
- * pthread_mutexattr_setprotocol +
- *
- * _POSIX_THREAD_PRIO_PROTECT (not set)
- * If set, you can create priority ceiling mutexes
- * Indicates the availability of:
- * pthread_mutex_getprioceiling
- * pthread_mutex_setprioceiling
- * pthread_mutexattr_getprioceiling
- * pthread_mutexattr_getprotocol +
- * pthread_mutexattr_setprioceiling
- * pthread_mutexattr_setprotocol +
- *
- * _POSIX_THREAD_PROCESS_SHARED (not set)
- * If set, you can create mutexes and condition
- * variables that can be shared with another
- * process.If set, indicates the availability
- * of:
- * pthread_mutexattr_getpshared
- * pthread_mutexattr_setpshared
- * pthread_condattr_getpshared
- * pthread_condattr_setpshared
- *
- * _POSIX_THREAD_SAFE_FUNCTIONS (set)
- * If set you can use the special *_r library
- * functions that provide thread-safe behaviour
- *
- * + These functions provide both 'inherit' and/or
- * 'protect' protocol, based upon these macro
- * settings.
- *
- * POSIX 1003.1c-1995 Limits
- * ===========================
- *
- * PTHREAD_DESTRUCTOR_ITERATIONS
- * Maximum number of attempts to destroy
- * a thread's thread-specific data on
- * termination (must be at least 4)
- *
- * PTHREAD_KEYS_MAX
- * Maximum number of thread-specific data keys
- * available per process (must be at least 128)
- *
- * PTHREAD_STACK_MIN
- * Minimum supported stack size for a thread
- *
- * PTHREAD_THREADS_MAX
- * Maximum number of threads supported per
- * process (must be at least 64).
- *
- *
- * POSIX 1003.1j/D10-1999 Options
- * ==============================
- *
- * _POSIX_READER_WRITER_LOCKS (set)
- * If set, you can use read/write locks
- *
- * _POSIX_SPIN_LOCKS (set)
- * If set, you can use spin locks
- *
- * _POSIX_BARRIERS (set)
- * If set, you can use barriers
- *
- * -------------------------------------------------------------
- */
-
-/*
- * POSIX Options
- */
-#ifndef _POSIX_THREADS
-#define _POSIX_THREADS
-#endif
-
-#ifndef _POSIX_READER_WRITER_LOCKS
-#define _POSIX_READER_WRITER_LOCKS
-#endif
-
-#ifndef _POSIX_SPIN_LOCKS
-#define _POSIX_SPIN_LOCKS
-#endif
-
-#ifndef _POSIX_BARRIERS
-#define _POSIX_BARRIERS
-#endif
-
-#define _POSIX_THREAD_SAFE_FUNCTIONS
-#define _POSIX_THREAD_ATTR_STACKSIZE
-#define _POSIX_THREAD_PRIORITY_SCHEDULING
-
-#if defined( KLUDGE )
-/*
- * The following are not supported
- */
-#define _POSIX_THREAD_ATTR_STACKADDR
-#define _POSIX_THREAD_PRIO_INHERIT
-#define _POSIX_THREAD_PRIO_PROTECT
-#define _POSIX_THREAD_PROCESS_SHARED
-
-#endif /* KLUDGE */
-
-/*
- * POSIX Limits
- *
- * PTHREAD_DESTRUCTOR_ITERATIONS
- * Standard states this must be at least
- * 4.
- *
- * PTHREAD_KEYS_MAX
- * WIN32 permits only 64 TLS keys per process.
- * This limitation could be worked around by
- * simply simulating keys.
- *
- * PTHREADS_STACK_MIN
- * POSIX specifies 0 which is also the value WIN32
- * interprets as allowing the system to
- * set the size to that of the main thread. The
- * maximum stack size in Win32 is 1Meg. WIN32
- * allocates more stack as required up to the 1Meg
- * limit.
- *
- * PTHREAD_THREADS_MAX
- * Not documented by WIN32. Wrote a test program
- * that kept creating threads until it failed
- * revealed this approximate number.
- *
- */
-#define PTHREAD_DESTRUCTOR_ITERATIONS 4
-#define PTHREAD_KEYS_MAX 64
-#define PTHREAD_STACK_MIN 0
-#define PTHREAD_THREADS_MAX 2019
-
-
-#ifdef _UWIN
-# include <sys/types.h>
-#else
-typedef struct pthread_t_ *pthread_t;
-typedef struct pthread_attr_t_ *pthread_attr_t;
-typedef struct pthread_once_t_ pthread_once_t;
-typedef struct pthread_key_t_ *pthread_key_t;
-typedef struct pthread_mutex_t_ *pthread_mutex_t;
-typedef struct pthread_mutexattr_t_ *pthread_mutexattr_t;
-typedef struct pthread_cond_t_ *pthread_cond_t;
-typedef struct pthread_condattr_t_ *pthread_condattr_t;
-#endif
-typedef struct pthread_rwlock_t_ *pthread_rwlock_t;
-typedef struct pthread_rwlockattr_t_ *pthread_rwlockattr_t;
-typedef struct pthread_spinlock_t_ *pthread_spinlock_t;
-typedef struct pthread_barrier_t_ *pthread_barrier_t;
-typedef struct pthread_barrierattr_t_ *pthread_barrierattr_t;
-
-/*
- * ====================
- * ====================
- * POSIX Threads
- * ====================
- * ====================
- */
-
-enum {
-/*
- * pthread_attr_{get,set}detachstate
- */
- PTHREAD_CREATE_JOINABLE = 0, /* Default */
- PTHREAD_CREATE_DETACHED = 1,
-
-/*
- * pthread_attr_{get,set}inheritsched
- */
- PTHREAD_INHERIT_SCHED = 0,
- PTHREAD_EXPLICIT_SCHED = 1, /* Default */
-
-/*
- * pthread_{get,set}scope
- */
- PTHREAD_SCOPE_PROCESS = 0,
- PTHREAD_SCOPE_SYSTEM = 1, /* Default */
-
-/*
- * pthread_setcancelstate paramters
- */
- PTHREAD_CANCEL_ENABLE = 0, /* Default */
- PTHREAD_CANCEL_DISABLE = 1,
-
-/*
- * pthread_setcanceltype parameters
- */
- PTHREAD_CANCEL_ASYNCHRONOUS = 0,
- PTHREAD_CANCEL_DEFERRED = 1, /* Default */
-
-/*
- * pthread_mutexattr_{get,set}pshared
- * pthread_condattr_{get,set}pshared
- */
- PTHREAD_PROCESS_PRIVATE = 0,
- PTHREAD_PROCESS_SHARED = 1,
-
-/*
- * pthread_barrier_wait
- */
- PTHREAD_BARRIER_SERIAL_THREAD = -1
-};
-
-/*
- * ====================
- * ====================
- * Cancelation
- * ====================
- * ====================
- */
-#define PTHREAD_CANCELED ((void *) -1)
-
-
-/*
- * ====================
- * ====================
- * Once Key
- * ====================
- * ====================
- */
-#define PTHREAD_ONCE_INIT { FALSE, -1 }
-
-struct pthread_once_t_
-{
- int done; /* indicates if user function executed */
- long started; /* First thread to increment this value */
- /* to zero executes the user function */
-};
-
-
-/*
- * ====================
- * ====================
- * Object initialisers
- * ====================
- * ====================
- */
-#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) -1)
-
-#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) -1)
-
-#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) -1)
-
-#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t) -1)
-
-enum
-{
- PTHREAD_MUTEX_FAST_NP,
- PTHREAD_MUTEX_RECURSIVE_NP,
- PTHREAD_MUTEX_ERRORCHECK_NP,
- PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP,
- PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
- PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
- PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
-};
-
-
-/* There are three implementations of cancel cleanup.
- * Note that pthread.h is included in both application
- * compilation units and also internally for the library.
- * The code here and within the library aims to work
- * for all reasonable combinations of environments.
- *
- * The three implementations are:
- *
- * WIN32 SEH
- * C
- * C++
- *
- * Please note that exiting a push/pop block via
- * "return", "exit", "break", or "continue" will
- * lead to different behaviour amongst applications
- * depending upon whether the library was built
- * using SEH, C++, or C. For example, a library built
- * with SEH will call the cleanup routine, while both
- * C++ and C built versions will not.
- */
-
-/*
- * define defaults for cleanup code
- */
-#if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C )
-
-#if defined(_MSC_VER)
-#define __CLEANUP_SEH
-#elif defined(__cplusplus)
-#define __CLEANUP_CXX
-#else
-#define __CLEANUP_C
-#endif
-
-#endif
-
-#if defined( __CLEANUP_SEH ) && defined(__GNUC__)
-#error ERROR [__FILE__, line __LINE__]: GNUC does not support SEH.
-#endif
-
-typedef struct ptw32_cleanup_t ptw32_cleanup_t;
-typedef void (__cdecl *ptw32_cleanup_callback_t)(void *);
-
-struct ptw32_cleanup_t
-{
- ptw32_cleanup_callback_t routine;
- void *arg;
- struct ptw32_cleanup_t *prev;
-};
-
-#ifdef __CLEANUP_SEH
- /*
- * WIN32 SEH version of cancel cleanup.
- */
-
-#define pthread_cleanup_push( _rout, _arg ) \
- { \
- ptw32_cleanup_t _cleanup; \
- \
- _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \
- _cleanup.arg = (_arg); \
- __try \
- { \
-
-#define pthread_cleanup_pop( _execute ) \
- } \
- __finally \
- { \
- if( _execute || AbnormalTermination()) \
- { \
- (*(_cleanup.routine))( _cleanup.arg ); \
- } \
- } \
- }
-
-#else /* __CLEANUP_SEH */
-
-#ifdef __CLEANUP_C
-
- /*
- * C implementation of PThreads cancel cleanup
- */
-
-#define pthread_cleanup_push( _rout, _arg ) \
- { \
- ptw32_cleanup_t _cleanup; \
- \
- ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \
-
-#define pthread_cleanup_pop( _execute ) \
- (void) ptw32_pop_cleanup( _execute ); \
- }
-
-#else /* __CLEANUP_C */
-
-#ifdef __CLEANUP_CXX
-
- /*
- * C++ version of cancel cleanup.
- * - John E. Bossom.
- */
-
- class PThreadCleanup {
- /*
- * PThreadCleanup
- *
- * Purpose
- * This class is a C++ helper class that is
- * used to implement pthread_cleanup_push/
- * pthread_cleanup_pop.
- * The destructor of this class automatically
- * pops the pushed cleanup routine regardless
- * of how the code exits the scope
- * (i.e. such as by an exception)
- */
- ptw32_cleanup_callback_t cleanUpRout;
- void * obj;
- int executeIt;
-
- public:
- PThreadCleanup() :
- cleanUpRout( NULL ),
- obj( NULL ),
- executeIt( 0 )
- /*
- * No cleanup performed
- */
- {
- }
-
- PThreadCleanup(
- ptw32_cleanup_callback_t routine,
- void * arg ) :
- cleanUpRout( routine ),
- obj( arg ),
- executeIt( 1 )
- /*
- * Registers a cleanup routine for 'arg'
- */
- {
- }
-
- ~PThreadCleanup()
- {
- if ( executeIt && ((void *) cleanUpRout != NULL) )
- {
- (void) (*cleanUpRout)( obj );
- }
- }
-
- void execute( int exec )
- {
- executeIt = exec;
- }
- };
-
- /*
- * C++ implementation of PThreads cancel cleanup;
- * This implementation takes advantage of a helper
- * class who's destructor automatically calls the
- * cleanup routine if we exit our scope weirdly
- */
-#define pthread_cleanup_push( _rout, _arg ) \
- { \
- PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \
- (void *) (_arg) );
-
-#define pthread_cleanup_pop( _execute ) \
- cleanup.execute( _execute ); \
- }
-
-#else
-
-#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined.
-
-#endif /* __CLEANUP_CXX */
-
-#endif /* __CLEANUP_C */
-
-#endif /* __CLEANUP_SEH */
-
-/*
- * ===============
- * ===============
- * Methods
- * ===============
- * ===============
- */
-
-/*
- * PThread Attribute Functions
- */
-int pthread_attr_init (pthread_attr_t * attr);
-
-int pthread_attr_destroy (pthread_attr_t * attr);
-
-int pthread_attr_getdetachstate (const pthread_attr_t * attr,
- int *detachstate);
-
-int pthread_attr_getstackaddr (const pthread_attr_t * attr,
- void **stackaddr);
-
-int pthread_attr_getstacksize (const pthread_attr_t * attr,
- size_t * stacksize);
-
-int pthread_attr_setdetachstate (pthread_attr_t * attr,
- int detachstate);
-
-int pthread_attr_setstackaddr (pthread_attr_t * attr,
- void *stackaddr);
-
-int pthread_attr_setstacksize (pthread_attr_t * attr,
- size_t stacksize);
-
-int pthread_attr_getschedparam (const pthread_attr_t *attr,
- struct sched_param *param);
-
-int pthread_attr_setschedparam (pthread_attr_t *attr,
- const struct sched_param *param);
-
-int pthread_attr_setschedpolicy (pthread_attr_t *,
- int);
-
-int pthread_attr_getschedpolicy (pthread_attr_t *,
- int *);
-
-int pthread_attr_setinheritsched(pthread_attr_t * attr,
- int inheritsched);
-
-int pthread_attr_getinheritsched(pthread_attr_t * attr,
- int * inheritsched);
-
-int pthread_attr_setscope (pthread_attr_t *,
- int);
-
-int pthread_attr_getscope (const pthread_attr_t *,
- int *);
-
-/*
- * PThread Functions
- */
-int pthread_create (pthread_t * tid,
- const pthread_attr_t * attr,
- void *(*start) (void *),
- void *arg);
-
-int pthread_detach (pthread_t tid);
-
-int pthread_equal (pthread_t t1,
- pthread_t t2);
-
-void pthread_exit (void *value_ptr);
-
-int pthread_join (pthread_t thread,
- void **value_ptr);
-
-pthread_t pthread_self (void);
-
-int pthread_cancel (pthread_t thread);
-
-int pthread_setcancelstate (int state,
- int *oldstate);
-
-int pthread_setcanceltype (int type,
- int *oldtype);
-
-void pthread_testcancel (void);
-
-int pthread_once (pthread_once_t * once_control,
- void (*init_routine) (void));
-
-ptw32_cleanup_t *ptw32_pop_cleanup (int execute);
-
-void ptw32_push_cleanup (ptw32_cleanup_t * cleanup,
- void (*routine) (void *),
- void *arg);
-
-/*
- * Thread Specific Data Functions
- */
-int pthread_key_create (pthread_key_t * key,
- void (*destructor) (void *));
-
-int pthread_key_delete (pthread_key_t key);
-
-int pthread_setspecific (pthread_key_t key,
- const void *value);
-
-void *pthread_getspecific (pthread_key_t key);
-
-
-/*
- * Mutex Attribute Functions
- */
-int pthread_mutexattr_init (pthread_mutexattr_t * attr);
-
-int pthread_mutexattr_destroy (pthread_mutexattr_t * attr);
-
-int pthread_mutexattr_getpshared (const pthread_mutexattr_t
- * attr,
- int *pshared);
-
-int pthread_mutexattr_setpshared (pthread_mutexattr_t * attr,
- int pshared);
-
-int pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind);
-int pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind);
-
-/*
- * Barrier Attribute Functions
- */
-int pthread_barrierattr_init (pthread_barrierattr_t * attr);
-
-int pthread_barrierattr_destroy (pthread_barrierattr_t * attr);
-
-int pthread_barrierattr_getpshared (const pthread_barrierattr_t
- * attr,
- int *pshared);
-
-int pthread_barrierattr_setpshared (pthread_barrierattr_t * attr,
- int pshared);
-
-/*
- * Mutex Functions
- */
-int pthread_mutex_init (pthread_mutex_t * mutex,
- const pthread_mutexattr_t * attr);
-
-int pthread_mutex_destroy (pthread_mutex_t * mutex);
-
-int pthread_mutex_lock (pthread_mutex_t * mutex);
-
-int pthread_mutex_trylock (pthread_mutex_t * mutex);
-
-int pthread_mutex_unlock (pthread_mutex_t * mutex);
-
-/*
- * Spinlock Functions
- */
-int pthread_spin_init (pthread_spinlock_t * lock, int pshared);
-
-int pthread_spin_destroy (pthread_spinlock_t * lock);
-
-int pthread_spin_lock (pthread_spinlock_t * lock);
-
-int pthread_spin_trylock (pthread_spinlock_t * lock);
-
-int pthread_spin_unlock (pthread_spinlock_t * lock);
-
-/*
- * Barrier Functions
- */
-int pthread_barrier_init (pthread_barrier_t * barrier,
- const pthread_barrierattr_t * attr,
- unsigned int count);
-
-int pthread_barrier_destroy (pthread_barrier_t * barrier);
-
-int pthread_barrier_wait (pthread_barrier_t * barrier);
-
-/*
- * Condition Variable Attribute Functions
- */
-int pthread_condattr_init (pthread_condattr_t * attr);
-
-int pthread_condattr_destroy (pthread_condattr_t * attr);
-
-int pthread_condattr_getpshared (const pthread_condattr_t * attr,
- int *pshared);
-
-int pthread_condattr_setpshared (pthread_condattr_t * attr,
- int pshared);
-
-/*
- * Condition Variable Functions
- */
-int pthread_cond_init (pthread_cond_t * cond,
- const pthread_condattr_t * attr);
-
-int pthread_cond_destroy (pthread_cond_t * cond);
-
-int pthread_cond_wait (pthread_cond_t * cond,
- pthread_mutex_t * mutex);
-
-int pthread_cond_timedwait (pthread_cond_t * cond,
- pthread_mutex_t * mutex,
- const struct timespec *abstime);
-
-int pthread_cond_signal (pthread_cond_t * cond);
-
-int pthread_cond_broadcast (pthread_cond_t * cond);
-
-/*
- * Scheduling
- */
-int pthread_setschedparam (pthread_t thread,
- int policy,
- const struct sched_param *param);
-
-int pthread_getschedparam (pthread_t thread,
- int *policy,
- struct sched_param *param);
-
-int pthread_setconcurrency (int);
-
-int pthread_getconcurrency (void);
-
-/*
- * Read-Write Lock Functions
- */
-int pthread_rwlock_init(pthread_rwlock_t *lock,
- const pthread_rwlockattr_t *attr);
-
-int pthread_rwlock_destroy(pthread_rwlock_t *lock);
-
-int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
-
-int pthread_rwlock_trywrlock(pthread_rwlock_t *);
-
-int pthread_rwlock_rdlock(pthread_rwlock_t *lock);
-
-int pthread_rwlock_wrlock(pthread_rwlock_t *lock);
-
-int pthread_rwlock_unlock(pthread_rwlock_t *lock);
-
-
-/*
- * Non-portable functions
- */
-
-/*
- * Compatibility with Linux.
- */
-int pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, int kind);
-int pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, int *kind);
-
-/*
- * Possibly supported by other POSIX threads implementations
- */
-int pthread_delay_np (struct timespec * interval);
-
-/*
- * Returns the Win32 HANDLE for the POSIX thread.
- */
-HANDLE pthread_getw32threadhandle_np(pthread_t thread);
-
-/*
- * Returns the number of CPUs available to the process.
- */
-int pthread_getprocessors_np(int * count);
-
-/*
- * Useful if an application wants to statically link
- * the lib rather than load the DLL at run-time.
- */
-int pthread_win32_process_attach_np(void);
-int pthread_win32_process_detach_np(void);
-int pthread_win32_thread_attach_np(void);
-int pthread_win32_thread_detach_np(void);
-
-
-/*
- * Protected Methods
- *
- * This function blocks until the given WIN32 handle
- * is signaled or pthread_cancel had been called.
- * This function allows the caller to hook into the
- * PThreads cancel mechanism. It is implemented using
- *
- * WaitForMultipleObjects
- *
- * on 'waitHandle' and a manually reset WIN32 Event
- * used to implement pthread_cancel. The 'timeout'
- * argument to TimedWait is simply passed to
- * WaitForMultipleObjects.
- */
-int pthreadCancelableWait (HANDLE waitHandle);
-int pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout);
-
-/*
- * Thread-Safe C Runtime Library Mappings.
- */
-#ifndef _UWIN
-#if 1
-#if (! defined(HAVE_ERRNO)) && (! defined(_REENTRANT)) && (! defined(_MT))
-int * _errno( void );
-#endif
-#else
-#if (! defined(NEED_ERRNO)) || (! defined( _REENTRANT ) && (! defined( _MT ) || ! defined( _MD )))
-#if defined(PTW32_BUILD)
-__declspec( dllexport ) int * _errno( void );
-#else
-int * _errno( void );
-#endif
-#endif
-#endif
-#endif
-
-/*
- * WIN32 C runtime library had been made thread-safe
- * without affecting the user interface. Provide
- * mappings from the UNIX thread-safe versions to
- * the standard C runtime library calls.
- * Only provide function mappings for functions that
- * actually exist on WIN32.
- */
-
-#if !defined(__MINGW32__)
-#define strtok_r( _s, _sep, _lasts ) \
- ( *(_lasts) = strtok( (_s), (_sep) ) )
-#endif /* !__MINGW32__ */
-
-#define asctime_r( _tm, _buf ) \
- ( strcpy( (_buf), asctime( (_tm) ) ), \
- (_buf) )
-
-#define ctime_r( _clock, _buf ) \
- ( strcpy( (_buf), ctime( (_clock) ) ), \
- (_buf) )
-
-#define gmtime_r( _clock, _result ) \
- ( *(_result) = *gmtime( (_clock) ), \
- (_result) )
-
-#define localtime_r( _clock, _result ) \
- ( *(_result) = *localtime( (_clock) ), \
- (_result) )
-
-#define rand_r( _seed ) \
- ( _seed == _seed? rand() : rand() )
-
-
-#ifdef __cplusplus
-
-/*
- * Internal exceptions
- */
-class ptw32_exception {};
-class ptw32_exception_cancel : public ptw32_exception {};
-class ptw32_exception_exit : public ptw32_exception {};
-
-#endif
-
-/* FIXME: This is only required if the library was built using SEH */
-/*
- * Get internal SEH tag
- */
-DWORD ptw32_get_exception_services_code(void);
-
-#ifndef PTW32_BUILD
-
-#ifdef __CLEANUP_SEH
-
-/*
- * Redefine the SEH __except keyword to ensure that applications
- * propagate our internal exceptions up to the library's internal handlers.
- */
-#define __except( E ) \
- __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \
- ? EXCEPTION_CONTINUE_SEARCH : ( E ) )
-
-#endif /* __CLEANUP_SEH */
-
-#ifdef __cplusplus
-
-/*
- * Redefine the C++ catch keyword to ensure that applications
- * propagate our internal exceptions up to the library's internal handlers.
- */
-#ifdef _MSC_VER
- /*
- * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll'
- * if you want Pthread-Win32 cancelation and pthread_exit to work.
- */
-
-#ifndef PtW32NoCatchWarn
-
-#pragma message("When compiling applications with MSVC++ and C++ exception handling:")
-#pragma message(" Replace any 'catch( ... )' with 'PtW32CatchAll' in POSIX threads")
-#pragma message(" if you want POSIX thread cancelation and pthread_exit to work.")
-
-#endif
-
-#define PtW32CatchAll \
- catch( ptw32_exception & ) { throw; } \
- catch( ... )
-
-#else /* _MSC_VER */
-
-#define catch( E ) \
- catch( ptw32_exception & ) { throw; } \
- catch( E )
-
-#endif /* _MSC_VER */
-
-#endif /* __cplusplus */
-
-#endif /* ! PTW32_BUILD */
-
-#ifdef __cplusplus
-} /* End of extern "C" */
-#endif /* __cplusplus */
-
-#endif /* PTHREAD_H */
diff --git a/win32/include/sched.h b/win32/include/sched.h deleted file mode 100644 index c9aaeb8a4..000000000 --- a/win32/include/sched.h +++ /dev/null @@ -1,89 +0,0 @@ -/*
- * Module: sched.h
- *
- * Purpose:
- * Provides an implementation of POSIX realtime extensions
- * as defined in
- *
- * POSIX 1003.1b-1993 (POSIX.1b)
- *
- * Pthreads-win32 - POSIX Threads Library for Win32
- * Copyright (C) 1998
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA
- */
-#ifndef _SCHED_H
-#define _SCHED_H
-
-#if defined(__MINGW32__) || defined(_UWIN)
-/* For pid_t */
-# include <sys/types.h>
-/* Required by Unix 98 */
-# include <time.h>
-#else
-typedef int pid_t;
-#endif
-
-/* Thread scheduling policies */
-
-enum {
- SCHED_OTHER = 0,
- SCHED_FIFO,
- SCHED_RR,
- SCHED_MIN = SCHED_OTHER,
- SCHED_MAX = SCHED_RR
-};
-
-struct sched_param {
- int sched_priority;
-};
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-int sched_yield (void);
-
-int sched_get_priority_min (int policy);
-
-int sched_get_priority_max (int policy);
-
-int sched_setscheduler (pid_t pid, int policy);
-
-int sched_getscheduler (pid_t pid);
-
-/*
- * Note that this macro returns ENOTSUP rather than
- * ENOSYS as might be expected. However, returning ENOSYS
- * should mean that sched_get_priority_{min,max} are
- * not implemented as well as sched_rr_get_interval.
- * This is not the case, since we just don't support
- * round-robin scheduling. Therefore I have chosen to
- * return the same value as sched_setscheduler when
- * SCHED_RR is passed to it.
- */
-#define sched_rr_get_interval(_pid, _interval) \
- ( errno = ENOTSUP, (int) -1 )
-
-
-#ifdef __cplusplus
-} /* End of extern "C" */
-#endif /* __cplusplus */
-
-
-#endif /* !_SCHED_H */
-
diff --git a/win32/include/semaphore.h b/win32/include/semaphore.h deleted file mode 100644 index a0255cf6f..000000000 --- a/win32/include/semaphore.h +++ /dev/null @@ -1,101 +0,0 @@ -/*
- * Module: semaphore.h
- *
- * Purpose:
- * Semaphores aren't actually part of the PThreads standard.
- * They are defined by the POSIX Standard:
- *
- * POSIX 1003.1b-1993 (POSIX.1b)
- *
- * Pthreads-win32 - POSIX Threads Library for Win32
- * Copyright (C) 1998
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA
- */
-#if !defined( SEMAPHORE_H )
-#define SEMAPHORE_H
-
-/*
- * This is a duplicate of what is in the autoconf config.h,
- * which is only used when building the pthread-win32 libraries.
- */
-
-#ifndef PTW32_CONFIG_H
-# if defined(WINCE)
-# define NEED_ERRNO
-# define NEED_SEM
-# endif
-# if defined(_UWIN) || defined(__MINGW32__)
-# define HAVE_MODE_T
-# endif
-#endif
-
-/*
- *
- */
-
-#ifdef NEED_SEM
-#include "need_errno.h"
-#else
-#include <errno.h>
-#endif
-
-#define _POSIX_SEMAPHORES
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-#ifndef HAVE_MODE_T
-typedef unsigned int mode_t;
-#endif
-
-
-typedef struct sem_t_ * sem_t;
-
-int sem_init (sem_t * sem,
- int pshared,
- unsigned int value);
-
-int sem_destroy (sem_t * sem);
-
-int sem_trywait (sem_t * sem);
-
-int sem_wait (sem_t * sem);
-
-int sem_post (sem_t * sem);
-
-int sem_post_multiple (sem_t * sem,
- int count);
-
-int sem_open (const char * name,
- int oflag,
- mode_t mode,
- unsigned int value);
-
-int sem_close (sem_t * sem);
-
-int sem_unlink (const char * name);
-
-int sem_getvalue (sem_t * sem,
- int * sval);
-
-#ifdef __cplusplus
-} /* End of extern "C" */
-#endif /* __cplusplus */
-
-#endif /* !SEMAPHORE_H */
diff --git a/win32/include/timer.h b/win32/include/timer.h deleted file mode 100644 index 9be9d0557..000000000 --- a/win32/include/timer.h +++ /dev/null @@ -1,39 +0,0 @@ -#include <time.h>
-#include <winsock.h>
-#include "pthread.h"
-
-#ifndef _ITIMER_
-#define _ITIMER_
-
-#define ITIMER_REAL 0
-#define ITIMER_VIRTUAL 1
-
-// time reference
-// ----------------------------------
-//
-// 1,000 milliseconds / sec
-// 1,000,000 microseconds / sec
-// 1,000,000,000 nanoseconds / sec
-//
-// timeval.time_sec = seconds
-// timeval.time_usec = microseconds
-
-struct itimerval
-{
- struct timeval it_interval; /* timer interval */
- struct timeval it_value; /* current value */
-};
-
-struct timezone {
- int tz_minuteswest; /* minutes west of Greenwich */
- int tz_dsttime; /* type of dst correction */
-};
-
-int gettimeofday( struct timeval *tp, struct timezone *tzp );
-int setitimer( int which, struct itimerval * value, struct itimerval *ovalue );
-int pause( void );
-
-unsigned int sleep( unsigned int seconds );
-int nanosleep( const struct timespec *rqtp, struct timespec *rmtp );
-
-#endif
\ No newline at end of file diff --git a/win32/include/xine/attributes.h b/win32/include/xine/attributes.h deleted file mode 100644 index eac90ea9e..000000000 --- a/win32/include/xine/attributes.h +++ /dev/null @@ -1,44 +0,0 @@ -/*
- * attributes.h
- * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- *
- * mpeg2dec is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * mpeg2dec is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* use gcc attribs to align critical data structures */
-
-#ifndef ATTRIBUTE_H_
-#define ATTRIBUTE_H_
-
-#ifdef ATTRIBUTE_ALIGNED_MAX
-#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
-#else
-#define ATTR_ALIGN(align)
-#endif
-
-/* disable GNU __attribute__ extension, when not compiling with GNU C */
-#if defined(__GNUC__)
-#ifndef ATTRIBUTE_PACKED
-#define ATTRIBUTE_PACKED 1
-#endif
-#else
-#undef ATTRIBUTE_PACKED
-#define __attribute__(x) /**/
-#endif
-
-#endif /* ATTRIBUTE_H_ */
-
diff --git a/win32/include/xine/compat.h b/win32/include/xine/compat.h deleted file mode 100644 index 6c2906f14..000000000 --- a/win32/include/xine/compat.h +++ /dev/null @@ -1,58 +0,0 @@ -/*
- * Copyright (C) 2000-2001 the xine project
- *
- * This file is part of xine, a unix video player.
- *
- * xine is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * xine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: compat.h,v 1.1 2003/04/20 16:42:10 guenter Exp $
- *
- */
-
-#ifndef XINE_COMPAT_H
-#define XINE_COMPAT_H
-
-#include <limits.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined _MSC_VER
-#define __XINE_FUNCTION__ __FILE__
-#elif defined __GNUC__
-#define __XINE_FUNCTION__ __FUNCTION__
-#else
-#define __XINE_FUNCTION__ __func__
-#endif
-
-#ifndef NAME_MAX
-#define XINE_NAME_MAX 256
-#else
-#define XINE_NAME_MAX NAME_MAX
-#endif
-
-#ifndef PATH_MAX
-#define XINE_PATH_MAX 768
-#else
-#define XINE_PATH_MAX PATH_MAX
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/win32/include/xine/xine.h b/win32/include/xine/xine.h deleted file mode 100644 index 193d7b7a9..000000000 --- a/win32/include/xine/xine.h +++ /dev/null @@ -1,1580 +0,0 @@ -/*
- * Copyright (C) 2000-2002 the xine project
- *
- * This file is part of xine, a free video player.
- *
- * xine is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * xine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: xine.h,v 1.1 2003/04/20 16:42:10 guenter Exp $
- *
- * public xine-lib (libxine) interface and documentation
- *
- *
- * some programming guidelines about this api:
- * -------------------------------------------
- *
- * (1) libxine has (per stream instance) a fairly static memory
- * model
- * (2) as a rule of thumb, never free() or realloc() any pointers
- * returned by the xine engine (unless stated otherwise)
- * or, in other words:
- * do not free() stuff you have not malloc()ed
- * (3) xine is multi-threaded, make sure your programming environment
- * can handle this.
- * for x11-related stuff this means that you either have to properly
- * use xlockdisplay() or use two seperate connections to the x-server
- *
- */
-
-#ifndef HAVE_XINE_H
-#define HAVE_XINE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <inttypes.h>
-#include <sys/time.h>
-#include <time.h>
-
-
-/*********************************************************************
- * xine opaque data types *
- *********************************************************************/
-
-typedef struct xine_s xine_t;
-typedef struct xine_stream_s xine_stream_t;
-typedef struct xine_audio_port_s xine_audio_port_t;
-typedef struct xine_video_port_s xine_video_port_t;
-
-/* convenience types: simple player UIs might want to call ports drivers */
-typedef xine_audio_port_t xine_ao_driver_t;
-typedef xine_video_port_t xine_vo_driver_t;
-
-
-/*********************************************************************
- * global engine handling *
- *********************************************************************/
-
-/*
- * version information
- */
-
-/* dynamic info from actually linked libxine */
-const char *xine_get_version_string (void);
-void xine_get_version (int *major, int *minor, int *sub);
-
-/* compare given version to libxine version,
- return 1 if compatible, 0 otherwise */
-int xine_check_version (int major, int minor, int sub) ;
-
-/* static info - which libxine release this header came from */
-#define XINE_MAJOR_VERSION 1
-#define XINE_MINOR_VERSION 0
-#define XINE_SUB_VERSION 0
-#define XINE_VERSION "1-beta10"
-
-/*
- * pre-init the xine engine
- *
- * will first malloc and init a xine_t, create an empty config
- * system, then scan through all installed plugins and add them
- * to an internal list for later use.
- *
- * to fully init the xine engine, you have to load config values
- * (either using your own storage method and calling
- * xine_config_register_entry, or by using the xine_load_config
- * utility function - see below) and then call xine_init
- *
- * the only proper way to shut down the xine engine is to
- * call xine_exit() - do not try to free() the xine pointer
- * yourself and do not try to access any internal data structures
- */
-xine_t *xine_new (void);
-
-/*
- * post_init the xine engine
- */
-void xine_init (xine_t *self);
-
-/*
- * helper functions to find and init audio/video drivers
- * from xine's plugin collection
- *
- * id : identifier of the driver, may be NULL for auto-detection
- * data : special data struct for ui/driver communications, depends
- * on driver
- * visual: video driver flavor selector, constants see below
- *
- * both functions may return NULL if driver failed to load, was not
- * found ...
- *
- * use xine_close_audio/video_driver() to close loaded drivers
- * and free resources allocated by them
- */
-xine_audio_port_t *xine_open_audio_driver (xine_t *self, const char *id,
- void *data);
-xine_video_port_t *xine_open_video_driver (xine_t *self, const char *id,
- int visual, void *data);
-
-void xine_close_audio_driver (xine_t *self, xine_audio_port_t *driver);
-void xine_close_video_driver (xine_t *self, xine_video_port_t *driver);
-
-/* valid visual types */
-#define XINE_VISUAL_TYPE_NONE 0
-#define XINE_VISUAL_TYPE_X11 1
-#define XINE_VISUAL_TYPE_AA 2
-#define XINE_VISUAL_TYPE_FB 3
-#define XINE_VISUAL_TYPE_GTK 4
-#define XINE_VISUAL_TYPE_DFB 5
-#define XINE_VISUAL_TYPE_PM 6 /* used by the OS/2 port */
-#define XINE_VISUAL_TYPE_WIN32 7 /* used by the WIN32/_MSC_VER port */
-
-/*
- * free all resources, close all plugins, close engine.
- * self pointer is no longer valid after this call.
- */
-void xine_exit (xine_t *self);
-
-
-/*********************************************************************
- * stream handling *
- *********************************************************************/
-
-/*
- * create a new stream for media playback/access
- *
- * returns xine_stream_t* if OK,
- * NULL on error (use xine_get_error for details)
- *
- * the only proper way to free the stream pointer returned by this
- * function is to call xine_dispose() on it. do not try to access any
- * fields in xine_stream_t, they're all private and subject to change
- * without further notice.
- */
-xine_stream_t *xine_stream_new (xine_t *self,
- xine_audio_port_t *ao, xine_video_port_t *vo);
-
-/*
- * Make one stream the slave of another.
- * This establishes a binary master slave relation on streams, where
- * certain operations (specified by parameter "affection") on the master
- * stream are also applied to the slave stream.
- * If you want more than one stream to react to one master, you have to
- * apply the calls in a top down way:
- * xine_stream_master_slave(stream1, stream2, 3);
- * xine_stream_master_slave(stream2, stream3, 3);
- * This will make stream1 affect stream2 and stream2 affect stream3, so
- * effectively, operations on stream1 propagate to stream2 and 3.
- *
- * Please note that subsequent master_slave calls on the same streams
- * will overwrite their previous master/slave setting.
- * Be sure to not mess around.
- *
- * returns 1 on success, 0 on failure
- */
-int xine_stream_master_slave(xine_stream_t *master, xine_stream_t *slave,
- int affection);
-
-/* affection is some of the following ORed together: */
-/* playing the master plays the slave */
-#define XINE_MASTER_SLAVE_PLAY (1<<0)
-/* slave stops on master stop */
-#define XINE_MASTER_SLAVE_STOP (1<<1)
-
-/*
- * open a stream
- *
- * look for input / demux / decoder plugins, find out about the format
- * see if it is supported, set up internal buffers and threads
- *
- * returns 1 if OK, 0 on error (use xine_get_error for details)
- */
-int xine_open (xine_stream_t *stream, const char *mrl);
-
-/*
- * play a stream from a given position
- *
- * start_pos: 0..65535
- * start_time: milliseconds
- * if both start position parameters are != 0 start_pos will be used
- * for non-seekable streams both values will be ignored
- *
- * returns 1 if OK, 0 on error (use xine_get_error for details)
- */
-int xine_play (xine_stream_t *stream, int start_pos, int start_time);
-
-/*
- * set xine to a trick mode for fast forward, backwards playback,
- * low latency seeking. Please note that this works only with some
- * input plugins. mode constants see below.
- *
- * returns 1 if OK, 0 on error (use xine_get_error for details)
- */
-int xine_trick_mode (xine_stream_t *stream, int mode, int value);
-
-/* trick modes */
-#define XINE_TRICK_MODE_OFF 0
-#define XINE_TRICK_MODE_SEEK_TO_POSITION 1
-#define XINE_TRICK_MODE_SEEK_TO_TIME 2
-#define XINE_TRICK_MODE_FAST_FORWARD 3
-#define XINE_TRICK_MODE_FAST_REWIND 4
-
-/*
- * stop stream playback
- * xine_stream_t stays valid for new xine_open or xine_play
- */
-void xine_stop (xine_stream_t *stream);
-
-/*
- * stop stream playback, free all stream-related resources
- * xine_stream_t stays valid for new xine_open
- */
-void xine_close (xine_stream_t *stream);
-
-/*
- * ask current/recent input plugin to eject media - may or may not work,
- * depending on input plugin capabilities
- */
-int xine_eject (xine_stream_t *stream);
-
-/*
- * stop playback, dispose all stream-related resources
- * xine_stream_t no longer valid when after this
- */
-void xine_dispose (xine_stream_t *stream);
-
-/*
- * set/get engine parameters.
- */
-void xine_engine_set_param(xine_t *self, int param, int value);
-int xine_engine_get_param(xine_t *self, int param);
-
-#define XINE_ENGINE_PARAM_VERBOSITY 1
-
-/*
- * set/get xine stream parameters
- * e.g. playback speed, constants see below
- */
-void xine_set_param (xine_stream_t *stream, int param, int value);
-int xine_get_param (xine_stream_t *stream, int param);
-
-/*
- * xine engine parameters
- */
-#define XINE_PARAM_SPEED 1 /* see below */
-#define XINE_PARAM_AV_OFFSET 2 /* unit: 1/90000 sec */
-#define XINE_PARAM_AUDIO_CHANNEL_LOGICAL 3 /* -1 => auto, -2 => off */
-#define XINE_PARAM_SPU_CHANNEL 4
-#define XINE_PARAM_VIDEO_CHANNEL 5
-#define XINE_PARAM_AUDIO_VOLUME 6 /* 0..100 */
-#define XINE_PARAM_AUDIO_MUTE 7 /* 1=>mute, 0=>unmute */
-#define XINE_PARAM_AUDIO_COMPR_LEVEL 8 /* <100=>off, % compress otherw*/
-#define XINE_PARAM_AUDIO_AMP_LEVEL 9 /* 0..200, 100=>100% (default) */
-#define XINE_PARAM_AUDIO_REPORT_LEVEL 10 /* 1=>send events, 0=> don't */
-#define XINE_PARAM_VERBOSITY 11 /* control console output */
-#define XINE_PARAM_SPU_OFFSET 12 /* unit: 1/90000 sec */
-#define XINE_PARAM_IGNORE_VIDEO 13 /* disable video decoding */
-#define XINE_PARAM_IGNORE_AUDIO 14 /* disable audio decoding */
-#define XINE_PARAM_IGNORE_SPU 15 /* disable spu decoding */
-#define XINE_PARAM_ENABLE_BROADCAST 16 /* (not implemented yet) */
-#define XINE_PARAM_METRONOM_PREBUFFER 17 /* unit: 1/90000 sec */
-
-
-/* speed values */
-#define XINE_SPEED_PAUSE 0
-#define XINE_SPEED_SLOW_4 1
-#define XINE_SPEED_SLOW_2 2
-#define XINE_SPEED_NORMAL 4
-#define XINE_SPEED_FAST_2 8
-#define XINE_SPEED_FAST_4 16
-
-/* video parameters */
-#define XINE_PARAM_VO_DEINTERLACE 0x01000000 /* bool */
-#define XINE_PARAM_VO_ASPECT_RATIO 0x01000001 /* see below */
-#define XINE_PARAM_VO_HUE 0x01000002 /* 0..65535 */
-#define XINE_PARAM_VO_SATURATION 0x01000003 /* 0..65535 */
-#define XINE_PARAM_VO_CONTRAST 0x01000004 /* 0..65535 */
-#define XINE_PARAM_VO_BRIGHTNESS 0x01000005 /* 0..65535 */
-#define XINE_PARAM_VO_ZOOM_X 0x01000008 /* percent */
-#define XINE_PARAM_VO_ZOOM_Y 0x0100000d /* percent */
-#define XINE_PARAM_VO_PAN_SCAN 0x01000009 /* bool */
-#define XINE_PARAM_VO_TVMODE 0x0100000a /* ??? */
-
-#define XINE_VO_ZOOM_STEP 100
-#define XINE_VO_ZOOM_MAX 400
-#define XINE_VO_ZOOM_MIN -85
-
-/* possible ratios for XINE_PARAM_VO_ASPECT_RATIO */
-#define XINE_VO_ASPECT_AUTO 0
-#define XINE_VO_ASPECT_SQUARE 1 /* 1:1 */
-#define XINE_VO_ASPECT_4_3 2 /* 4:3 */
-#define XINE_VO_ASPECT_ANAMORPHIC 3 /* 16:9 */
-#define XINE_VO_ASPECT_DVB 4 /* 1:2 */
-#define XINE_VO_ASPECT_NUM_RATIOS 5
-#define XINE_VO_ASPECT_PAN_SCAN 41
-#define XINE_VO_ASPECT_DONT_TOUCH 42
-
-/* stream format detection strategies */
-
-/* recognize stream type first by content then by extension. */
-#define XINE_DEMUX_DEFAULT_STRATEGY 0
-/* recognize stream type first by extension then by content. */
-#define XINE_DEMUX_REVERT_STRATEGY 1
-/* recognize stream type by content only. */
-#define XINE_DEMUX_CONTENT_STRATEGY 2
-/* recognize stream type by extension only. */
-#define XINE_DEMUX_EXTENSION_STRATEGY 3
-
-/* verbosity settings */
-#define XINE_VERBOSITY_NONE 0
-#define XINE_VERBOSITY_LOG 1
-#define XINE_VERBOSITY_DEBUG 2
-
-/*
- * snapshot function
- *
- * image format can be YUV 4:2:0 or 4:2:2
- * will copy the image data into memory that <img> points to
- * (interleaved for yuv 4:2:2 or planary for 4:2:0)
- *
- * returns 1 on success, 0 failure.
- */
-int xine_get_current_frame (xine_stream_t *stream,
- int *width, int *height,
- int *ratio_code, int *format,
- uint8_t *img);
-
-/* xine image formats */
-#define XINE_IMGFMT_YV12 (('2'<<24)|('1'<<16)|('V'<<8)|'Y')
-#define XINE_IMGFMT_YUY2 (('2'<<24)|('Y'<<16)|('U'<<8)|'Y')
-
-
-/*********************************************************************
- * media processing *
- *********************************************************************/
-
-#ifdef XINE_ENABLE_EXPERIMENTAL_FEATURES
-
-/*
- * access to decoded audio and video frames from a stream
- * these functions are intended to provide the basis for
- * re-encoding and other video processing applications
- *
- * warning: highly experimental
- *
- */
-
-xine_video_port_t *xine_new_framegrab_video_port (xine_t *self);
-
-typedef struct {
-
- int64_t vpts; /* timestamp 1/90000 sec for a/v sync */
- int64_t duration;
- int width, height;
- int colorspace; /* XINE_IMGFMT_* */
- double aspect_ratio;
-
- int pos_stream; /* bytes from stream start */
- int pos_time; /* milliseconds */
-
- uint8_t *data;
- void *xine_frame; /* used internally by xine engine */
-} xine_video_frame_t;
-
-int xine_get_next_video_frame (xine_video_port_t *port,
- xine_video_frame_t *frame);
-
-void xine_free_video_frame (xine_video_port_t *port, xine_video_frame_t *frame);
-
-xine_audio_port_t *xine_new_framegrab_audio_port (xine_t *self);
-
-typedef struct {
-
- int64_t vpts; /* timestamp 1/90000 sec for a/v sync */
- int num_samples;
- int sample_rate;
- int num_channels;
- int bits_per_sample; /* per channel */
-
- off_t pos_stream; /* bytes from stream start */
- int pos_time; /* milliseconds */
-
- uint8_t *data;
- void *xine_frame; /* used internally by xine engine */
-} xine_audio_frame_t;
-
-int xine_get_next_audio_frame (xine_audio_port_t *port,
- xine_audio_frame_t *frame);
-
-void xine_free_audio_frame (xine_audio_port_t *port, xine_audio_frame_t *frame);
-
- /*
- * maybe future aproach:
- */
-
-int xine_get_video_frame (xine_stream_t *stream,
- int timestamp, /* msec */
- int *width, int *height,
- int *ratio_code,
- int *duration, /* msec */
- int *format,
- uint8_t *img);
-
-/* TODO: xine_get_audio_frame */
-
-#endif
-
-
-/*********************************************************************
- * post plugin handling *
- *********************************************************************/
-
-/*
- * post effect plugin functions
- *
- * after the data leaves the decoder it can pass an arbitrary tree
- * of post plugins allowing for effects to be applied to the video
- * frames/audio buffers before they reach the output stage
- */
-
-typedef struct xine_post_s xine_post_t;
-
-struct xine_post_s {
-
- /* a NULL-terminated array of audio input ports this post plugin
- * provides; you can hand these to other post plugin's outputs or
- * pass them to the initialization of streams
- */
- xine_audio_port_t **audio_input;
-
- /* a NULL-terminated array of video input ports this post plugin
- * provides; you can hand these to other post plugin's outputs or
- * pass them to the initialization of streams
- */
- xine_video_port_t **video_input;
-
- /* the type of the post plugin
- * one of XINE_POST_TYPE_* can be used here
- */
- int type;
-
-};
-
-/*
- * initialize a post plugin
- *
- * returns xine_post_t* on success, NULL on failure
- *
- * Initializes the post plugin with the given name and connects its
- * outputs to the NULL-terminated arrays of audio and video ports.
- * Some plugins also care about the number of inputs you request
- * (e.g. mixer plugins), others simply ignore this number.
- */
-xine_post_t *xine_post_init(xine_t *xine, const char *name,
- int inputs,
- xine_audio_port_t **audio_target,
- xine_video_port_t **video_target);
-
-/* get a list of all available post plugins */
-const char *const *xine_list_post_plugins(xine_t *xine);
-
-/* get a list of all post plugins of one type */
-const char *const *xine_list_post_plugins_typed(xine_t *xine, int type);
-
-/*
- * post plugin input/output
- *
- * These structures encapsulate inputs/outputs for post plugins
- * to transfer arbitrary data. Frontends can also provide inputs
- * and outputs and connect them to post plugins to exchange data
- * with them.
- */
-
-typedef struct xine_post_in_s xine_post_in_t;
-typedef struct xine_post_out_s xine_post_out_t;
-
-struct xine_post_in_s {
-
- /* the name identifying this input */
- const char *name;
-
- /* the datatype of this input, use one of XINE_POST_DATA_* here */
- int type;
-
- /* the data pointer; input is directed to this memory location,
- * so you simply access the pointer to access the input data */
- void *data;
-
-};
-
-struct xine_post_out_s {
-
- /* the name identifying this output */
- const char *name;
-
- /* the datatype of this output, use one of XINE_POST_DATA_* here */
- int type;
-
- /* the data pointer; output should be directed to this memory location,
- * so in the easy case you simply write through the pointer */
- void *data;
-
- /* this function is called, when the output should be redirected
- * to another input, you sould set the data pointer to direct
- * any output to this new input;
- * a special situation is, when this function is called with a NULL
- * argument: in this case you should disconnect the data pointer
- * from any output and if necessary to avoid writing to some stray
- * memory you should make it point to some dummy location,
- * returns 1 on success, 0 on failure;
- * if you do not implement rewiring, set this to NULL */
- int (*rewire) (xine_post_out_t *self, void *data);
-
-};
-
-/* get a list of all inputs of a post plugin */
-const char *const *xine_post_list_inputs(xine_post_t *self);
-
-/* get a list of all outputs of a post plugin */
-const char *const *xine_post_list_outputs(xine_post_t *self);
-
-/* retrieve one specific input of a post plugin */
-const xine_post_in_t *xine_post_input(xine_post_t *self, char *name);
-
-/* retrieve one specific output of a post plugin */
-const xine_post_out_t *xine_post_output(xine_post_t *self, char *name);
-
-/*
- * wire an input to an output
- * returns 1 on success, 0 on failure
- */
-int xine_post_wire(xine_post_out_t *source, xine_post_in_t *target);
-
-/*
- * wire a video port to a video output
- * This can be used to rewire different post plugins to the video output
- * plugin layer. The ports you hand in at xine_post_init() will already
- * be wired with the post plugin, so you need this function for
- * _re_connecting only.
- *
- * returns 1 on success, 0 on failure
- */
-int xine_post_wire_video_port(xine_post_out_t *source, xine_video_port_t *vo);
-
-/*
- * wire an audio port to an audio output
- * This can be used to rewire different post plugins to the audio output
- * plugin layer. The ports you hand in at xine_post_init() will already
- * be wired with the post plugin, so you need this function for
- * _re_connecting only.
- *
- * returns 1 on success, 0 on failure
- */
-int xine_post_wire_audio_port(xine_post_out_t *source, xine_audio_port_t *vo);
-
-/*
- * Extracts an output for a stream. Use this to rewire the outputs of streams.
- */
-xine_post_out_t * xine_get_video_source(xine_stream_t *stream);
-xine_post_out_t * xine_get_audio_source(xine_stream_t *stream);
-
-/*
- * disposes the post plugin
- * please make sure that no other post plugin and no stream is
- * connected to any of this plugin's inputs
- */
-void xine_post_dispose(xine_t *xine, xine_post_t *self);
-
-
-/* post plugin types */
-#define XINE_POST_TYPE_VIDEO_FILTER 0x010000
-#define XINE_POST_TYPE_VIDEO_VISUALIZATION 0x010001
-#define XINE_POST_TYPE_VIDEO_COMPOSE 0x010002
-#define XINE_POST_TYPE_AUDIO_FILTER 0x020000
-#define XINE_POST_TYPE_AUDIO_VISUALIZATION 0x020001
-
-
-/* post plugin data types */
-
-/* video port data
- * input->data is a xine_video_port_t*
- * output->data usually is a xine_video_port_t**
- */
-#define XINE_POST_DATA_VIDEO 0
-
-/* audio port data
- * input->data is a xine_audio_port_t*
- * output->data usually is a xine_audio_port_t**
- */
-#define XINE_POST_DATA_AUDIO 1
-
-/* integer data
- * input->data is a int*
- * output->data usually is a int*
- */
-#define XINE_POST_DATA_INT 3
-
-/* double precision floating point data
- * input->data is a double*
- * output->data usually is a double*
- */
-#define XINE_POST_DATA_DOUBLE 4
-
-
-/*********************************************************************
- * information retrieval *
- *********************************************************************/
-
-/*
- * xine log functions
- *
- * frontends can display xine log output using these functions
- */
-int xine_get_log_section_count(xine_t *self);
-
-/* return a NULL terminated array of log sections names */
-const char *const *xine_get_log_names(xine_t *self);
-
-/* print some log information to <buf> section */
-void xine_log (xine_t *self, int buf,
- const char *format, ...);
-
-/* get log messages of specified section */
-const char *const *xine_get_log (xine_t *self, int buf);
-
-/* log callback will be called whenever something is logged */
-typedef void (*xine_log_cb_t) (void *user_data, int section);
-void xine_register_log_cb (xine_t *self, xine_log_cb_t cb,
- void *user_data);
-
-/*
- * error handling / engine status
- */
-
-/* return last error */
-int xine_get_error (xine_stream_t *stream);
-
-/* get current xine engine status (constants see below) */
-int xine_get_status (xine_stream_t *stream);
-
-/*
- * engine status codes
- */
-#define XINE_STATUS_IDLE 0 /* no mrl assigned */
-#define XINE_STATUS_STOP 1
-#define XINE_STATUS_PLAY 2
-#define XINE_STATUS_QUIT 3
-
-/*
- * xine error codes
- */
-#define XINE_ERROR_NONE 0
-#define XINE_ERROR_NO_INPUT_PLUGIN 1
-#define XINE_ERROR_NO_DEMUX_PLUGIN 2
-#define XINE_ERROR_DEMUX_FAILED 3
-#define XINE_ERROR_MALFORMED_MRL 4
-
-/*
- * try to find out audio/spu language of given channel
- * (use -1 for current channel)
- *
- * returns 1 on success, 0 on failure
- */
-int xine_get_audio_lang (xine_stream_t *stream, int channel,
- char *lang);
-int xine_get_spu_lang (xine_stream_t *stream, int channel,
- char *lang);
-
-/*
- * get position / length information
- *
- * depending of the nature and system layer of the stream,
- * some or all of this information may be unavailable or incorrect
- * (e.g. live network streams may not have a valid length)
- *
- * returns 1 on success, 0 on failure (data was not updated,
- * probably because it's not known yet... try again later)
- */
-int xine_get_pos_length (xine_stream_t *stream,
- int *pos_stream, /* 0..65535 */
- int *pos_time, /* milliseconds */
- int *length_time);/* milliseconds */
-
-/*
- * get information about the stream such as
- * video width/height, codecs, audio format, title, author...
- *
- * constants see below
- */
-uint32_t xine_get_stream_info (xine_stream_t *stream, int info);
-const char *xine_get_meta_info (xine_stream_t *stream, int info);
-
-/* xine_get_stream_info */
-#define XINE_STREAM_INFO_BITRATE 0
-#define XINE_STREAM_INFO_SEEKABLE 1
-#define XINE_STREAM_INFO_VIDEO_WIDTH 2
-#define XINE_STREAM_INFO_VIDEO_HEIGHT 3
-#define XINE_STREAM_INFO_VIDEO_RATIO 4 /* *10000 */
-#define XINE_STREAM_INFO_VIDEO_CHANNELS 5
-#define XINE_STREAM_INFO_VIDEO_STREAMS 6
-#define XINE_STREAM_INFO_VIDEO_BITRATE 7
-#define XINE_STREAM_INFO_VIDEO_FOURCC 8
-#define XINE_STREAM_INFO_VIDEO_HANDLED 9 /* codec available? */
-#define XINE_STREAM_INFO_FRAME_DURATION 10 /* 1/90000 sec */
-#define XINE_STREAM_INFO_AUDIO_CHANNELS 11
-#define XINE_STREAM_INFO_AUDIO_BITS 12
-#define XINE_STREAM_INFO_AUDIO_SAMPLERATE 13
-#define XINE_STREAM_INFO_AUDIO_BITRATE 14
-#define XINE_STREAM_INFO_AUDIO_FOURCC 15
-#define XINE_STREAM_INFO_AUDIO_HANDLED 16 /* codec available? */
-#define XINE_STREAM_INFO_HAS_CHAPTERS 17
-#define XINE_STREAM_INFO_HAS_VIDEO 18
-#define XINE_STREAM_INFO_HAS_AUDIO 19
-#define XINE_STREAM_INFO_IGNORE_VIDEO 20
-#define XINE_STREAM_INFO_IGNORE_AUDIO 21
-#define XINE_STREAM_INFO_IGNORE_SPU 22
-#define XINE_STREAM_INFO_VIDEO_HAS_STILL 23
-#define XINE_STREAM_INFO_MAX_AUDIO_CHANNEL 24
-#define XINE_STREAM_INFO_MAX_SPU_CHANNEL 25
-#define XINE_STREAM_INFO_AUDIO_MODE 26
-
-/* xine_get_meta_info */
-#define XINE_META_INFO_TITLE 0
-#define XINE_META_INFO_COMMENT 1
-#define XINE_META_INFO_ARTIST 2
-#define XINE_META_INFO_GENRE 3
-#define XINE_META_INFO_ALBUM 4
-#define XINE_META_INFO_YEAR 5
-#define XINE_META_INFO_VIDEOCODEC 6
-#define XINE_META_INFO_AUDIOCODEC 7
-#define XINE_META_INFO_SYSTEMLAYER 8
-#define XINE_META_INFO_INPUT_PLUGIN 9
-
-
-/*********************************************************************
- * plugin management / autoplay / mrl browsing *
- *********************************************************************/
-
-/*
- * note: the pointers to strings or string arrays returned
- * by some of these functions are pointers to statically
- * alloced internal xine memory chunks.
- * they're only valid between xine function calls
- * and should never be free()d.
- */
-
-typedef struct {
- char *origin; /* file plugin: path */
- char *mrl; /* <type>://<location> */
- char *link;
- uint32_t type; /* see below */
- off_t size; /* size of this source, may be 0 */
-} xine_mrl_t;
-
-/* mrl types */
-#define XINE_MRL_TYPE_unknown (0 << 0)
-#define XINE_MRL_TYPE_dvd (1 << 0)
-#define XINE_MRL_TYPE_vcd (1 << 1)
-#define XINE_MRL_TYPE_net (1 << 2)
-#define XINE_MRL_TYPE_rtp (1 << 3)
-#define XINE_MRL_TYPE_stdin (1 << 4)
-#define XINE_MRL_TYPE_cda (1 << 5)
-#define XINE_MRL_TYPE_file (1 << 6)
-#define XINE_MRL_TYPE_file_fifo (1 << 7)
-#define XINE_MRL_TYPE_file_chardev (1 << 8)
-#define XINE_MRL_TYPE_file_directory (1 << 9)
-#define XINE_MRL_TYPE_file_blockdev (1 << 10)
-#define XINE_MRL_TYPE_file_normal (1 << 11)
-#define XINE_MRL_TYPE_file_symlink (1 << 12)
-#define XINE_MRL_TYPE_file_sock (1 << 13)
-#define XINE_MRL_TYPE_file_exec (1 << 14)
-#define XINE_MRL_TYPE_file_backup (1 << 15)
-#define XINE_MRL_TYPE_file_hidden (1 << 16)
-
-/* get a list of browsable input plugin ids */
-const char *const *xine_get_browsable_input_plugin_ids (xine_t *self) ;
-
-/*
- * ask input plugin named <plugin_id> to return
- * a list of available MRLs in domain/directory <start_mrl>.
- *
- * <start_mrl> may be NULL indicating the toplevel domain/dir
- * returns <start_mrl> if <start_mrl> is a valid MRL, not a directory
- * returns NULL if <start_mrl> is an invalid MRL, not even a directory.
- */
-xine_mrl_t **xine_get_browse_mrls (xine_t *self,
- const char *plugin_id,
- const char *start_mrl,
- int *num_mrls);
-
-/* get a list of plugins that support the autoplay feature */
-const char *const *xine_get_autoplay_input_plugin_ids (xine_t *self);
-
-/* get autoplay MRL list from input plugin named <plugin_id> */
-char **xine_get_autoplay_mrls (xine_t *self,
- const char *plugin_id,
- int *num_mrls);
-
-/* get a list of file extensions for file types supported by xine
- * the list is separated by spaces
- *
- * the pointer returned can be free()ed when no longer used */
-char *xine_get_file_extensions (xine_t *self);
-
-/* get a list of mime types supported by xine
- *
- * the pointer returned can be free()ed when no longer used */
-char *xine_get_mime_types (xine_t *self);
-
-/* get the demuxer identifier that handles a given mime type
- *
- * the pointer returned can be free()ed when no longer used
- * returns NULL if no demuxer is available to handle this. */
-char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type);
-
-/* get a description string for an input plugin */
-const char *xine_get_input_plugin_description (xine_t *self,
- const char *plugin_id);
-
-/* get lists of available audio and video output plugins */
-const char *const *xine_list_audio_output_plugins (xine_t *self) ;
-const char *const *xine_list_video_output_plugins (xine_t *self) ;
-
-
-/*********************************************************************
- * visual specific gui <-> xine engine communication *
- *********************************************************************/
-
-/* talk to video output driver - old method */
-int xine_gui_send_vo_data (xine_stream_t *self,
- int type, void *data);
-
-/* new (preferred) method to talk to video driver. */
-int xine_port_send_gui_data (xine_video_port_t *vo,
- int type, void *data);
-
-typedef struct {
-
- /* area of that drawable to be used by video */
- int x,y,w,h;
-
-} x11_rectangle_t;
-
-/*
- * this is the visual data struct any x11 gui
- * must supply to the xine_open_video_driver call
- * ("data" parameter)
- */
-typedef struct {
-
- /* some information about the display */
- void *display; /* Display* */
- int screen;
-
- /* drawable to display the video in/on */
- unsigned long d; /* Drawable */
-
- void *user_data;
-
- /*
- * dest size callback
- *
- * this will be called by the video driver to find out
- * how big the video output area size will be for a
- * given video size. The ui should _not_ adjust it's
- * video out area, just do some calculations and return
- * the size. This will be called for every frame, ui
- * implementation should be fast.
- * dest_pixel_aspect should be set to the used display pixel aspect.
- * NOTE: Semantics has changed: video_width and video_height
- * are no longer pixel aspect corrected. Get the old semantics
- * in the UI with
- * *dest_pixel_aspect = display_pixel_aspect;
- * if (video_pixel_aspect >= display_pixel_aspect)
- * video_width = video_width * video_pixel_aspect / display_pixel_aspect + .5;
- * else
- * video_height = video_height * display_pixel_aspect / video_pixel_aspect + .5;
- */
- void (*dest_size_cb) (void *user_data,
- int video_width, int video_height,
- double video_pixel_aspect,
- int *dest_width, int *dest_height,
- double *dest_pixel_aspect);
-
- /*
- * frame output callback
- *
- * this will be called by the video driver for every frame
- * it's about to draw. ui can adapt it's size if necessary
- * here.
- * note: the ui doesn't have to adjust itself to this
- * size, this is just to be taken as a hint.
- * ui must return the actual size of the video output
- * area and the video output driver will do it's best
- * to adjust the video frames to that size (while
- * preserving aspect ratio and stuff).
- * dest_x, dest_y: offset inside window
- * dest_width, dest_height: available drawing space
- * dest_pixel_aspect: display pixel aspect
- * win_x, win_y: window absolute screen position
- * NOTE: Semantics has changed: video_width and video_height
- * are no longer pixel aspect corrected. Get the old semantics
- * in the UI with
- * *dest_pixel_aspect = display_pixel_aspect;
- * if (video_pixel_aspect >= display_pixel_aspect)
- * video_width = video_width * video_pixel_aspect / display_pixel_aspect + .5;
- * else
- * video_height = video_height * display_pixel_aspect / video_pixel_aspect + .5;
- */
- void (*frame_output_cb) (void *user_data,
- int video_width, int video_height,
- double video_pixel_aspect,
- int *dest_x, int *dest_y,
- int *dest_width, int *dest_height,
- double *dest_pixel_aspect,
- int *win_x, int *win_y);
-
-} x11_visual_t;
-
-/*
- * this is the visual data struct any fb gui
- * may supply to the xine_open_video_driver call
- * ("data" parameter) to get frame_output_cd calls
- */
-
-typedef struct {
-
- void (*frame_output_cb) (void *user_data,
- int video_width, int video_height,
- double video_pixel_aspect,
- int *dest_x, int *dest_y,
- int *dest_width, int *dest_height,
- double *dest_pixel_aspect,
- int *win_x, int *win_y);
-
- void *user_data;
-
-} fb_visual_t;
-
-/*
- * "type" constants for xine_gui_send_vo_data (...)
- */
-
-/* xevent *data */
-#define XINE_GUI_SEND_COMPLETION_EVENT 1
-
-/* Drawable data */
-#define XINE_GUI_SEND_DRAWABLE_CHANGED 2
-
-/* xevent *data */
-#define XINE_GUI_SEND_EXPOSE_EVENT 3
-
-/* x11_rectangle_t *data */
-#define XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO 4
-
-/* int data */
-#define XINE_GUI_SEND_VIDEOWIN_VISIBLE 5
-
-/* *data contains chosen visual, select a new one or change it to NULL
- * to indicate the visual to use or that no visual will work */
-/* XVisualInfo **data */
-#define XINE_GUI_SEND_SELECT_VISUAL 8
-
-
-/*********************************************************************
- * xine health check stuff *
- *********************************************************************/
-
-#define XINE_HEALTH_CHECK_OK 0
-#define XINE_HEALTH_CHECK_FAIL 1
-#define XINE_HEALTH_CHECK_UNSUPPORTED 2
-#define XINE_HEALTH_CHECK_NO_SUCH_CHECK 3
-
-#define CHECK_KERNEL 0
-#define CHECK_MTRR 1
-#define CHECK_CDROM 2
-#define CHECK_DVDROM 3
-#define CHECK_DMA 4
-#define CHECK_X 5
-#define CHECK_XV 6
-
-struct xine_health_check_s {
- int status;
- const char* cdrom_dev;
- const char* dvd_dev;
- char* msg;
- char* title;
- char* explanation;
-};
-
-typedef struct xine_health_check_s xine_health_check_t;
-xine_health_check_t* xine_health_check(xine_health_check_t*, int check_num);
-
-
-/*********************************************************************
- * configuration system *
- *********************************************************************/
-
-/*
- * config entry data types
- */
-
-#define XINE_CONFIG_TYPE_UNKNOWN 0
-#define XINE_CONFIG_TYPE_RANGE 1
-#define XINE_CONFIG_TYPE_STRING 2
-#define XINE_CONFIG_TYPE_ENUM 3
-#define XINE_CONFIG_TYPE_NUM 4
-#define XINE_CONFIG_TYPE_BOOL 5
-
-typedef struct xine_cfg_entry_s xine_cfg_entry_t;
-
-typedef void (*xine_config_cb_t) (void *user_data,
- xine_cfg_entry_t *entry);
-struct xine_cfg_entry_s {
- const char *key; /* unique id (example: gui.logo_mrl) */
-
- int type;
-
- /* type unknown */
- char *unknown_value;
-
- /* type string */
- char *str_value;
- char *str_default;
- char *str_sticky;
-
- /* common to range, enum, num, bool: */
- int num_value;
- int num_default;
-
- /* type range specific: */
- int range_min;
- int range_max;
-
- /* type enum specific: */
- char **enum_values;
-
- /* help info for the user */
- const char *description;
- const char *help;
-
- /* user experience level */
- int exp_level; /* 0 => beginner,
- 10 => advanced user,
- 20 => expert */
-
- /* callback function and data for live changeable values */
- xine_config_cb_t callback;
- void *callback_data;
-
-};
-
-const char *xine_config_register_string (xine_t *self,
- const char *key,
- const char *def_value,
- const char *description,
- const char *help,
- int exp_level,
- xine_config_cb_t changed_cb,
- void *cb_data);
-
-int xine_config_register_range (xine_t *self,
- const char *key,
- int def_value,
- int min, int max,
- const char *description,
- const char *help,
- int exp_level,
- xine_config_cb_t changed_cb,
- void *cb_data);
-
-int xine_config_register_enum (xine_t *self,
- const char *key,
- int def_value,
- char **values,
- const char *description,
- const char *help,
- int exp_level,
- xine_config_cb_t changed_cb,
- void *cb_data);
-
-int xine_config_register_num (xine_t *self,
- const char *key,
- int def_value,
- const char *description,
- const char *help,
- int exp_level,
- xine_config_cb_t changed_cb,
- void *cb_data);
-
-int xine_config_register_bool (xine_t *self,
- const char *key,
- int def_value,
- const char *description,
- const char *help,
- int exp_level,
- xine_config_cb_t changed_cb,
- void *cb_data);
-
-/*
- * the following functions will copy data from the internal xine_config
- * data database to the xine_cfg_entry_t *entry you provide
- *
- * they return 1 on success, 0 on failure
- */
-
-/* get first config item */
-int xine_config_get_first_entry (xine_t *self, xine_cfg_entry_t *entry);
-
-/* get next config item (iterate through the items) */
-int xine_config_get_next_entry (xine_t *self, xine_cfg_entry_t *entry);
-
-/* search for a config entry by key */
-int xine_config_lookup_entry (xine_t *self, const char *key,
- xine_cfg_entry_t *entry);
-
-/*
- * update a config entry (which was returned from lookup_entry() )
- *
- * xine will make a deep copy of the data in the entry into it's internal
- * config database.
- */
-void xine_config_update_entry (xine_t *self,
- const xine_cfg_entry_t *entry);
-
-/*
- * load/save config data from/to afile (e.g. $HOME/.xine/config)
- */
-void xine_config_load (xine_t *self, const char *cfg_filename);
-void xine_config_save (xine_t *self, const char *cfg_filename);
-void xine_config_reset (xine_t *self);
-
-
-/*********************************************************************
- * asynchroneous xine event mechanism *
- *********************************************************************/
-
-/*
- * to receive events you have to register an event queue with
- * the xine engine (xine_event_new_queue, see below).
- *
- * then you can either
- * 1) check for incoming events regularly (xine_event_get/wait),
- * process them and free them using xine_event_free
- * 2) use xine_event_create_listener_thread and specify a callback
- * which will then be called for each event
- *
- * to send events to every module listening you don't need
- * to register an event queue but simply call xine_event_send.
- */
-
-/* event types */
-#define XINE_EVENT_UI_PLAYBACK_FINISHED 1 /* frontend can e.g. move on to next playlist entry */
-#define XINE_EVENT_UI_CHANNELS_CHANGED 2 /* inform ui that new channel info is available */
-#define XINE_EVENT_UI_SET_TITLE 3 /* request title display change in ui */
-#define XINE_EVENT_UI_MESSAGE 4 /* message (dialog) for the ui to display */
-#define XINE_EVENT_FRAME_FORMAT_CHANGE 5 /* e.g. aspect ratio change during dvd playback */
-#define XINE_EVENT_AUDIO_LEVEL 6 /* report current audio level (l/r) */
-#define XINE_EVENT_QUIT 7 /* last event sent when stream is disposed */
-#define XINE_EVENT_PROGRESS 8 /* index creation/network connections */
-#define XINE_EVENT_MRL_REFERENCE 9 /* demuxer->frontend: MRL reference(s) for the real stream */
-#define XINE_EVENT_UI_NUM_BUTTONS 10 /* number of buttons for interactive menus */
-
-/* input events coming from frontend */
-#define XINE_EVENT_INPUT_MOUSE_BUTTON 101
-#define XINE_EVENT_INPUT_MOUSE_MOVE 102
-#define XINE_EVENT_INPUT_MENU1 103
-#define XINE_EVENT_INPUT_MENU2 104
-#define XINE_EVENT_INPUT_MENU3 105
-#define XINE_EVENT_INPUT_MENU4 106
-#define XINE_EVENT_INPUT_MENU5 107
-#define XINE_EVENT_INPUT_MENU6 108
-#define XINE_EVENT_INPUT_MENU7 109
-#define XINE_EVENT_INPUT_UP 110
-#define XINE_EVENT_INPUT_DOWN 111
-#define XINE_EVENT_INPUT_LEFT 112
-#define XINE_EVENT_INPUT_RIGHT 113
-#define XINE_EVENT_INPUT_SELECT 114
-#define XINE_EVENT_INPUT_NEXT 115
-#define XINE_EVENT_INPUT_PREVIOUS 116
-#define XINE_EVENT_INPUT_ANGLE_NEXT 117
-#define XINE_EVENT_INPUT_ANGLE_PREVIOUS 118
-#define XINE_EVENT_INPUT_BUTTON_FORCE 119
-#define XINE_EVENT_INPUT_NUMBER_0 120
-#define XINE_EVENT_INPUT_NUMBER_1 121
-#define XINE_EVENT_INPUT_NUMBER_2 122
-#define XINE_EVENT_INPUT_NUMBER_3 123
-#define XINE_EVENT_INPUT_NUMBER_4 124
-#define XINE_EVENT_INPUT_NUMBER_5 125
-#define XINE_EVENT_INPUT_NUMBER_6 126
-#define XINE_EVENT_INPUT_NUMBER_7 127
-#define XINE_EVENT_INPUT_NUMBER_8 128
-#define XINE_EVENT_INPUT_NUMBER_9 129
-#define XINE_EVENT_INPUT_NUMBER_10_ADD 130
-
-/* specific event types */
-#define XINE_EVENT_SET_V4L2 200
-#define XINE_EVENT_PVR_SAVE 201
-#define XINE_EVENT_PVR_REPORT_NAME 202
-#define XINE_EVENT_PVR_REALTIME 203
-
-/*
- * xine event struct
- */
-typedef struct {
- int type; /* event type (constants see above) */
- xine_stream_t *stream; /* stream this event belongs to */
-
- void *data; /* contents depending on type */
- int data_length;
-
- /* you do not have to provide this, it will be filled in by xine_event_send() */
- struct timeval tv; /* timestamp of event creation */
-} xine_event_t;
-
-/*
- * input event dynamic data
- */
-typedef struct {
- xine_event_t event;
- uint8_t button; /* Generally 1 = left, 2 = mid, 3 = right */
- uint16_t x,y; /* In Image space */
-} xine_input_data_t;
-
-/*
- * UI event dynamic data - send information to/from UI.
- */
-typedef struct {
- int num_buttons;
- int str_len;
- char str[256]; /* might be longer */
-} xine_ui_data_t;
-
-/*
- * Send messages to UI. used mostly to report errors.
- */
-typedef struct {
- /*
- * old xine-ui versions expect xine_ui_data_t type.
- * this struct is added for compatibility.
- */
- xine_ui_data_t compatibility;
-
- /* See XINE_MSG_xxx for defined types. */
- int type;
-
- /* defined types are provided with a standard explanation.
- * note: zero means no explanation.
- */
- int explanation; /* add to struct address to get a valid (char *) */
-
- /* parameters are zero terminated strings */
- int num_parameters;
- int parameters; /* add to struct address to get a valid (char *) */
-
- /* where messages are stored, will be longer
- *
- * this field begins with the message text itself (\0-terminated),
- * followed by (optional) \0-terminated parameter strings
- * the end marker is \0 \0
- */
- char messages[1];
-} xine_ui_message_data_t;
-
-
-/*
- * notify frame format change
- */
-typedef struct {
- int width;
- int height;
- int aspect;
-} xine_format_change_data_t;
-
-/*
- * audio level for left/right channel
- */
-typedef struct {
- int left;
- int right; /* 0..255 */
-} xine_audio_level_data_t;
-
-/*
- * index generation / buffering
- */
-typedef struct {
- const char *description; /* e.g. "connecting..." */
- int percent;
-} xine_progress_data_t;
-
-/*
- * mrl reference data is sent by demuxers when a reference stream is found.
- * this stream just contains pointers (urls) to the real data, which are
- * passed to frontend using this event type. (examples: .asx, .mov and .ram)
- *
- * ideally, frontends should add these mrls to a "hierarchical playlist".
- * that is, instead of the original file, the ones provided here should be
- * played instead. on pratice, just using a simple playlist should work.
- *
- * mrl references should be played in the same order they are received, just
- * after the current stream finishes.
- * alternative playlists may be provided and should be used in case of
- * failure of the primary playlist.
- */
-typedef struct {
- int alternative; /* alternative playlist number, usually 0 */
- char mrl[1]; /* might (will) be longer */
-} xine_mrl_reference_data_t;
-
-
-#ifdef XINE_ENABLE_EXPERIMENTAL_FEATURES
-
-/*
- * configuration options for video4linux-like input plugins
- */
-typedef struct {
- /* input selection */
- int input; /* select active input from card */
- int channel; /* channel number */
- int radio; /* ask for a radio channel */
- uint32_t frequency; /* frequency divided by 62.5KHz or 62.5 Hz */
- uint32_t transmission; /* The transmission standard. */
-
- /* video parameters */
- uint32_t framerate_numerator; /* framerate as numerator/denominator */
- uint32_t framerate_denominator;
- uint32_t framelines; /* Total lines per frame including blanking */
- uint32_t colorstandard; /* One of the V4L2_COLOR_STD_* values */
- uint32_t colorsubcarrier; /* The color subcarrier frequency */
- int frame_width; /* scaled frame width */
- int frame_height; /* scaled frame height */
-
- /* used by pvr plugin */
- int32_t session_id; /* -1 stops pvr recording */
-} xine_set_v4l2_data_t;
-
-/*
- * ask pvr to save (ie. do not discard) the current session
- * see comments on input_pvr.c to understand how it works.
- */
-typedef struct {
- /* mode values:
- * -1 = do nothing, just set the name
- * 0 = truncate current session and save from now on
- * 1 = save from last sync point
- * 2 = save everything on current session
- */
- int mode;
- int id;
- char name[256]; /* name for saving, might be longer */
-} xine_pvr_save_data_t;
-
-typedef struct {
- /* mode values:
- * 0 = non realtime
- * 1 = realtime
- */
- int mode;
-} xine_pvr_realtime_t;
-
-#endif
-
-/*
- * Defined message types for XINE_EVENT_UI_MESSAGE
- * This is the mechanism to report async errors from engine.
- *
- * If frontend knows about the XINE_MSG_xxx type it may safely
- * ignore the 'explanation' field and provide it's own custom
- * dialog to the 'parameters'.
- *
- * right column specifies the usual parameters.
- */
-
-#define XINE_MSG_NO_ERROR 0 /* (messages to UI) */
-#define XINE_MSG_GENERAL_WARNING 1 /* (warning message) */
-#define XINE_MSG_UNKNOWN_HOST 2 /* (host name) */
-#define XINE_MSG_UNKNOWN_DEVICE 3 /* (device name) */
-#define XINE_MSG_NETWORK_UNREACHABLE 4 /* none */
-#define XINE_MSG_CONNECTION_REFUSED 5 /* (host name) */
-#define XINE_MSG_FILE_NOT_FOUND 6 /* (file name or mrl) */
-#define XINE_MSG_READ_ERROR 7 /* (device/file/mrl) */
-#define XINE_MSG_LIBRARY_LOAD_ERROR 8 /* (library/decoder) */
-#define XINE_MSG_ENCRYPTED_SOURCE 9 /* none */
-
-/* opaque xine_event_queue_t */
-typedef struct xine_event_queue_s xine_event_queue_t;
-
-/*
- * register a new event queue
- *
- * you have to receive messages from this queue regularly
- *
- * use xine_event_dispose_queue to unregister and free the queue
- */
-xine_event_queue_t *xine_event_new_queue (xine_stream_t *stream);
-void xine_event_dispose_queue (xine_event_queue_t *queue);
-
-/*
- * receive events (poll)
- *
- * use xine_event_free on the events received from these calls
- * when they're no longer needed
- */
-xine_event_t *xine_event_get (xine_event_queue_t *queue);
-xine_event_t *xine_event_wait (xine_event_queue_t *queue);
-void xine_event_free (xine_event_t *event);
-
-/*
- * receive events (callback)
- *
- * a thread is created which will receive all events from
- * the specified queue, call your callback on each of them
- * and will then free the event when your callback returns
- *
- */
-typedef void (*xine_event_listener_cb_t) (void *user_data,
- const xine_event_t *event);
-void xine_event_create_listener_thread (xine_event_queue_t *queue,
- xine_event_listener_cb_t callback,
- void *user_data);
-
-/*
- * send an event to all queues
- *
- * the event will be copied so you can free or reuse
- * *event as soon as xine_event_send returns.
- */
-void xine_event_send (xine_stream_t *stream, const xine_event_t *event);
-
-
-/*********************************************************************
- * OSD (on screen display) *
- *********************************************************************/
-
-#define XINE_TEXT_PALETTE_SIZE 11
-
-#define XINE_OSD_TEXT1 (0 * XINE_TEXT_PALETTE_SIZE)
-#define XINE_OSD_TEXT2 (1 * XINE_TEXT_PALETTE_SIZE)
-#define XINE_OSD_TEXT3 (2 * XINE_TEXT_PALETTE_SIZE)
-#define XINE_OSD_TEXT4 (3 * XINE_TEXT_PALETTE_SIZE)
-#define XINE_OSD_TEXT5 (4 * XINE_TEXT_PALETTE_SIZE)
-#define XINE_OSD_TEXT6 (5 * XINE_TEXT_PALETTE_SIZE)
-#define XINE_OSD_TEXT7 (6 * XINE_TEXT_PALETTE_SIZE)
-#define XINE_OSD_TEXT8 (7 * XINE_TEXT_PALETTE_SIZE)
-#define XINE_OSD_TEXT9 (8 * XINE_TEXT_PALETTE_SIZE)
-#define XINE_OSD_TEXT10 (9 * XINE_TEXT_PALETTE_SIZE)
-
-/* white text, black border, transparent background */
-#define XINE_TEXTPALETTE_WHITE_BLACK_TRANSPARENT 0
-/* white text, noborder, transparent background */
-#define XINE_TEXTPALETTE_WHITE_NONE_TRANSPARENT 1
-/* white text, no border, translucid background */
-#define XINE_TEXTPALETTE_WHITE_NONE_TRANSLUCID 2
-/* yellow text, black border, transparent background */
-#define XINE_TEXTPALETTE_YELLOW_BLACK_TRANSPARENT 3
-
-typedef struct xine_osd_s xine_osd_t;
-
-xine_osd_t *xine_osd_new (xine_stream_t *self, int x, int y,
- int width, int height);
-void xine_osd_draw_point (xine_osd_t *self, int x, int y, int color);
-
-void xine_osd_draw_line (xine_osd_t *self, int x1, int y1,
- int x2, int y2, int color);
-void xine_osd_draw_rect (xine_osd_t *self, int x1, int y1,
- int x2, int y2,
- int color, int filled );
-/* for freetype2 fonts x1 and y1 specifies the beginning of the baseline,
- for xine fonts x1 and y1 specifies the upper left corner of the text
- to be rendered */
-void xine_osd_draw_text (xine_osd_t *self, int x1, int y1,
- const char *text, int color_base);
-void xine_osd_draw_bitmap (xine_osd_t *self, uint8_t *bitmap,
- int x1, int y1, int width, int height,
- uint8_t *palette_map);
-/* for freetype2 fonts the height is taken from _baseline_ to top */
-void xine_osd_get_text_size (xine_osd_t *self, const char *text,
- int *width, int *height);
-/* with freetype2 support compiled in, you can also specify a font file
- as 'fontname' here */
-void xine_osd_set_font (xine_osd_t *self, const char *fontname,
- int size);
-/* set position were overlay will be blended */
-void xine_osd_set_position (xine_osd_t *self, int x, int y);
-void xine_osd_show (xine_osd_t *self, int64_t vpts);
-void xine_osd_hide (xine_osd_t *self, int64_t vpts);
-/* empty drawing area */
-void xine_osd_clear (xine_osd_t *self);
-/*
- * close osd rendering engine
- * loaded fonts are unloaded
- * osd objects are closed
- */
-void xine_osd_free (xine_osd_t *self);
-void xine_osd_set_palette (xine_osd_t *self,
- const uint32_t *const color,
- const uint8_t *const trans );
-/*
- * set on existing text palette
- * (-1 to set used specified palette)
- *
- * color_base specifies the first color index to use for this text
- * palette. The OSD palette is then modified starting at this
- * color index, up to the size of the text palette.
- *
- * Use OSD_TEXT1, OSD_TEXT2, ... for some preassigned color indices.
- */
-void xine_osd_set_text_palette (xine_osd_t *self,
- int palette_number,
- int color_base );
-/* get palette (color and transparency) */
-void xine_osd_get_palette (xine_osd_t *self, uint32_t *color,
- uint8_t *trans);
-
-
-/*********************************************************************
- * TV-mode API, to make it possible to use nvtvd to view movies *
- *********************************************************************/
-
-/* connect to nvtvd server and save current TV and X settings */
-void xine_tvmode_init (xine_t *self);
-
-/* try to change TV state if enabled
- * type select 'regular' (0) or 'TV' (1) state
- * width frame width the mode should match best or 0 if unknown
- * height frame height the mode should match best or 0 if unknown
- * fps frame rate the mode should match best or 0 if unknown
- * returns: finally selected state
- */
-int xine_tvmode_switch (xine_t *self, int type, int width, int height, double fps);
-
-/* adapt (maximum) output size to visible area if necessary and return pixel
- * aspect and real frame rate if available
- */
-void xine_tvmode_size (xine_t *self, int *width, int *height,
- double *pixelratio, double *fps);
-
-/* restore old TV and X settings and close nvtvd connection */
-void xine_tvmode_exit (xine_t *self);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/win32/include/xine/xineutils.h b/win32/include/xine/xineutils.h deleted file mode 100644 index 33696e718..000000000 --- a/win32/include/xine/xineutils.h +++ /dev/null @@ -1,957 +0,0 @@ -/*
- * Copyright (C) 2000-2002 the xine project
- *
- * This file is part of xine, a free video player.
- *
- * xine is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * xine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: xineutils.h,v 1.1 2003/04/20 16:42:10 guenter Exp $
- *
- */
-#ifndef XINEUTILS_H
-#define XINEUTILS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <inttypes.h>
-#include <pthread.h>
-#include "attributes.h"
-#include "compat.h"
-#include "xmlparser.h"
-#include "xine_buffer.h"
-#include "configfile.h"
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-
-#if defined(__SUNPRO_C) || !defined(XINE_COMPILE)
-#define inline
-#endif
-
- /*
- * debugable mutexes
- */
-
- typedef struct {
- pthread_mutex_t mutex;
- char id[80];
- char *locked_by;
- } xine_mutex_t;
-
- int xine_mutex_init (xine_mutex_t *mutex, const pthread_mutexattr_t *mutexattr,
- char *id);
-
- int xine_mutex_lock (xine_mutex_t *mutex, char *who);
- int xine_mutex_unlock (xine_mutex_t *mutex, char *who);
- int xine_mutex_destroy (xine_mutex_t *mutex);
-
-
-
- /* CPU Acceleration */
-
-/*
- * The type of an value that fits in an MMX register (note that long
- * long constant values MUST be suffixed by LL and unsigned long long
- * values by ULL, lest they be truncated by the compiler)
- */
-
-/* generic accelerations */
-#define MM_ACCEL_MLIB 0x00000001
-
-/* x86 accelerations */
-#define MM_ACCEL_X86_MMX 0x80000000
-#define MM_ACCEL_X86_3DNOW 0x40000000
-#define MM_ACCEL_X86_MMXEXT 0x20000000
-#define MM_ACCEL_X86_SSE 0x10000000
-#define MM_ACCEL_X86_SSE2 0x08000000
-/* powerpc accelerations */
-#define MM_ACCEL_PPC_ALTIVEC 0x04000000
-/* x86 compat defines */
-#define MM_MMX MM_ACCEL_X86_MMX
-#define MM_3DNOW MM_ACCEL_X86_3DNOW
-#define MM_MMXEXT MM_ACCEL_X86_MMXEXT
-#define MM_SSE MM_ACCEL_X86_SSE
-#define MM_SSE2 MM_ACCEL_X86_SSE2
-
-uint32_t xine_mm_accel (void);
-/* uint32_t xine_mm_support (void) ; */
-
-#ifdef ARCH_X86
-
-typedef union {
-#ifdef _MSC_VER
- int64_t q; /* Quadword (64-bit) value */
- uint64_t uq; /* Unsigned Quadword */
-#else
- long long q; /* Quadword (64-bit) value */
- unsigned long long uq; /* Unsigned Quadword */
-#endif
- int d[2]; /* 2 Doubleword (32-bit) values */
- unsigned int ud[2]; /* 2 Unsigned Doubleword */
- short w[4]; /* 4 Word (16-bit) values */
- unsigned short uw[4]; /* 4 Unsigned Word */
- char b[8]; /* 8 Byte (8-bit) values */
- unsigned char ub[8]; /* 8 Unsigned Byte */
- float s[2]; /* Single-precision (32-bit) value */
-} ATTR_ALIGN(8) mmx_t; /* On an 8-byte (64-bit) boundary */
-
-
-
-#define mmx_i2r(op,imm,reg) \
- __asm__ __volatile__ (#op " %0, %%" #reg \
- : /* nothing */ \
- : "i" (imm) )
-
-#define mmx_m2r(op,mem,reg) \
- __asm__ __volatile__ (#op " %0, %%" #reg \
- : /* nothing */ \
- : "m" (mem))
-
-#define mmx_r2m(op,reg,mem) \
- __asm__ __volatile__ (#op " %%" #reg ", %0" \
- : "=m" (mem) \
- : /* nothing */ )
-
-#define mmx_r2r(op,regs,regd) \
- __asm__ __volatile__ (#op " %" #regs ", %" #regd)
-
-
-#define emms() __asm__ __volatile__ ("emms")
-
-#define movd_m2r(var,reg) mmx_m2r (movd, var, reg)
-#define movd_r2m(reg,var) mmx_r2m (movd, reg, var)
-#define movd_r2r(regs,regd) mmx_r2r (movd, regs, regd)
-
-#define movq_m2r(var,reg) mmx_m2r (movq, var, reg)
-#define movq_r2m(reg,var) mmx_r2m (movq, reg, var)
-#define movq_r2r(regs,regd) mmx_r2r (movq, regs, regd)
-
-#define packssdw_m2r(var,reg) mmx_m2r (packssdw, var, reg)
-#define packssdw_r2r(regs,regd) mmx_r2r (packssdw, regs, regd)
-#define packsswb_m2r(var,reg) mmx_m2r (packsswb, var, reg)
-#define packsswb_r2r(regs,regd) mmx_r2r (packsswb, regs, regd)
-
-#define packuswb_m2r(var,reg) mmx_m2r (packuswb, var, reg)
-#define packuswb_r2r(regs,regd) mmx_r2r (packuswb, regs, regd)
-
-#define paddb_m2r(var,reg) mmx_m2r (paddb, var, reg)
-#define paddb_r2r(regs,regd) mmx_r2r (paddb, regs, regd)
-#define paddd_m2r(var,reg) mmx_m2r (paddd, var, reg)
-#define paddd_r2r(regs,regd) mmx_r2r (paddd, regs, regd)
-#define paddw_m2r(var,reg) mmx_m2r (paddw, var, reg)
-#define paddw_r2r(regs,regd) mmx_r2r (paddw, regs, regd)
-
-#define paddsb_m2r(var,reg) mmx_m2r (paddsb, var, reg)
-#define paddsb_r2r(regs,regd) mmx_r2r (paddsb, regs, regd)
-#define paddsw_m2r(var,reg) mmx_m2r (paddsw, var, reg)
-#define paddsw_r2r(regs,regd) mmx_r2r (paddsw, regs, regd)
-
-#define paddusb_m2r(var,reg) mmx_m2r (paddusb, var, reg)
-#define paddusb_r2r(regs,regd) mmx_r2r (paddusb, regs, regd)
-#define paddusw_m2r(var,reg) mmx_m2r (paddusw, var, reg)
-#define paddusw_r2r(regs,regd) mmx_r2r (paddusw, regs, regd)
-
-#define pand_m2r(var,reg) mmx_m2r (pand, var, reg)
-#define pand_r2r(regs,regd) mmx_r2r (pand, regs, regd)
-
-#define pandn_m2r(var,reg) mmx_m2r (pandn, var, reg)
-#define pandn_r2r(regs,regd) mmx_r2r (pandn, regs, regd)
-
-#define pcmpeqb_m2r(var,reg) mmx_m2r (pcmpeqb, var, reg)
-#define pcmpeqb_r2r(regs,regd) mmx_r2r (pcmpeqb, regs, regd)
-#define pcmpeqd_m2r(var,reg) mmx_m2r (pcmpeqd, var, reg)
-#define pcmpeqd_r2r(regs,regd) mmx_r2r (pcmpeqd, regs, regd)
-#define pcmpeqw_m2r(var,reg) mmx_m2r (pcmpeqw, var, reg)
-#define pcmpeqw_r2r(regs,regd) mmx_r2r (pcmpeqw, regs, regd)
-
-#define pcmpgtb_m2r(var,reg) mmx_m2r (pcmpgtb, var, reg)
-#define pcmpgtb_r2r(regs,regd) mmx_r2r (pcmpgtb, regs, regd)
-#define pcmpgtd_m2r(var,reg) mmx_m2r (pcmpgtd, var, reg)
-#define pcmpgtd_r2r(regs,regd) mmx_r2r (pcmpgtd, regs, regd)
-#define pcmpgtw_m2r(var,reg) mmx_m2r (pcmpgtw, var, reg)
-#define pcmpgtw_r2r(regs,regd) mmx_r2r (pcmpgtw, regs, regd)
-
-#define pmaddwd_m2r(var,reg) mmx_m2r (pmaddwd, var, reg)
-#define pmaddwd_r2r(regs,regd) mmx_r2r (pmaddwd, regs, regd)
-
-#define pmulhw_m2r(var,reg) mmx_m2r (pmulhw, var, reg)
-#define pmulhw_r2r(regs,regd) mmx_r2r (pmulhw, regs, regd)
-
-#define pmullw_m2r(var,reg) mmx_m2r (pmullw, var, reg)
-#define pmullw_r2r(regs,regd) mmx_r2r (pmullw, regs, regd)
-
-#define por_m2r(var,reg) mmx_m2r (por, var, reg)
-#define por_r2r(regs,regd) mmx_r2r (por, regs, regd)
-
-#define pslld_i2r(imm,reg) mmx_i2r (pslld, imm, reg)
-#define pslld_m2r(var,reg) mmx_m2r (pslld, var, reg)
-#define pslld_r2r(regs,regd) mmx_r2r (pslld, regs, regd)
-#define psllq_i2r(imm,reg) mmx_i2r (psllq, imm, reg)
-#define psllq_m2r(var,reg) mmx_m2r (psllq, var, reg)
-#define psllq_r2r(regs,regd) mmx_r2r (psllq, regs, regd)
-#define psllw_i2r(imm,reg) mmx_i2r (psllw, imm, reg)
-#define psllw_m2r(var,reg) mmx_m2r (psllw, var, reg)
-#define psllw_r2r(regs,regd) mmx_r2r (psllw, regs, regd)
-
-#define psrad_i2r(imm,reg) mmx_i2r (psrad, imm, reg)
-#define psrad_m2r(var,reg) mmx_m2r (psrad, var, reg)
-#define psrad_r2r(regs,regd) mmx_r2r (psrad, regs, regd)
-#define psraw_i2r(imm,reg) mmx_i2r (psraw, imm, reg)
-#define psraw_m2r(var,reg) mmx_m2r (psraw, var, reg)
-#define psraw_r2r(regs,regd) mmx_r2r (psraw, regs, regd)
-
-#define psrld_i2r(imm,reg) mmx_i2r (psrld, imm, reg)
-#define psrld_m2r(var,reg) mmx_m2r (psrld, var, reg)
-#define psrld_r2r(regs,regd) mmx_r2r (psrld, regs, regd)
-#define psrlq_i2r(imm,reg) mmx_i2r (psrlq, imm, reg)
-#define psrlq_m2r(var,reg) mmx_m2r (psrlq, var, reg)
-#define psrlq_r2r(regs,regd) mmx_r2r (psrlq, regs, regd)
-#define psrlw_i2r(imm,reg) mmx_i2r (psrlw, imm, reg)
-#define psrlw_m2r(var,reg) mmx_m2r (psrlw, var, reg)
-#define psrlw_r2r(regs,regd) mmx_r2r (psrlw, regs, regd)
-
-#define psubb_m2r(var,reg) mmx_m2r (psubb, var, reg)
-#define psubb_r2r(regs,regd) mmx_r2r (psubb, regs, regd)
-#define psubd_m2r(var,reg) mmx_m2r (psubd, var, reg)
-#define psubd_r2r(regs,regd) mmx_r2r (psubd, regs, regd)
-#define psubw_m2r(var,reg) mmx_m2r (psubw, var, reg)
-#define psubw_r2r(regs,regd) mmx_r2r (psubw, regs, regd)
-
-#define psubsb_m2r(var,reg) mmx_m2r (psubsb, var, reg)
-#define psubsb_r2r(regs,regd) mmx_r2r (psubsb, regs, regd)
-#define psubsw_m2r(var,reg) mmx_m2r (psubsw, var, reg)
-#define psubsw_r2r(regs,regd) mmx_r2r (psubsw, regs, regd)
-
-#define psubusb_m2r(var,reg) mmx_m2r (psubusb, var, reg)
-#define psubusb_r2r(regs,regd) mmx_r2r (psubusb, regs, regd)
-#define psubusw_m2r(var,reg) mmx_m2r (psubusw, var, reg)
-#define psubusw_r2r(regs,regd) mmx_r2r (psubusw, regs, regd)
-
-#define punpckhbw_m2r(var,reg) mmx_m2r (punpckhbw, var, reg)
-#define punpckhbw_r2r(regs,regd) mmx_r2r (punpckhbw, regs, regd)
-#define punpckhdq_m2r(var,reg) mmx_m2r (punpckhdq, var, reg)
-#define punpckhdq_r2r(regs,regd) mmx_r2r (punpckhdq, regs, regd)
-#define punpckhwd_m2r(var,reg) mmx_m2r (punpckhwd, var, reg)
-#define punpckhwd_r2r(regs,regd) mmx_r2r (punpckhwd, regs, regd)
-
-#define punpcklbw_m2r(var,reg) mmx_m2r (punpcklbw, var, reg)
-#define punpcklbw_r2r(regs,regd) mmx_r2r (punpcklbw, regs, regd)
-#define punpckldq_m2r(var,reg) mmx_m2r (punpckldq, var, reg)
-#define punpckldq_r2r(regs,regd) mmx_r2r (punpckldq, regs, regd)
-#define punpcklwd_m2r(var,reg) mmx_m2r (punpcklwd, var, reg)
-#define punpcklwd_r2r(regs,regd) mmx_r2r (punpcklwd, regs, regd)
-
-#define pxor_m2r(var,reg) mmx_m2r (pxor, var, reg)
-#define pxor_r2r(regs,regd) mmx_r2r (pxor, regs, regd)
-
-
-/* 3DNOW extensions */
-
-#define pavgusb_m2r(var,reg) mmx_m2r (pavgusb, var, reg)
-#define pavgusb_r2r(regs,regd) mmx_r2r (pavgusb, regs, regd)
-
-
-/* AMD MMX extensions - also available in intel SSE */
-
-
-#define mmx_m2ri(op,mem,reg,imm) \
- __asm__ __volatile__ (#op " %1, %0, %%" #reg \
- : /* nothing */ \
- : "X" (mem), "X" (imm))
-#define mmx_r2ri(op,regs,regd,imm) \
- __asm__ __volatile__ (#op " %0, %%" #regs ", %%" #regd \
- : /* nothing */ \
- : "X" (imm) )
-
-#define mmx_fetch(mem,hint) \
- __asm__ __volatile__ ("prefetch" #hint " %0" \
- : /* nothing */ \
- : "X" (mem))
-
-
-#define maskmovq(regs,maskreg) mmx_r2ri (maskmovq, regs, maskreg)
-
-#define movntq_r2m(mmreg,var) mmx_r2m (movntq, mmreg, var)
-
-#define pavgb_m2r(var,reg) mmx_m2r (pavgb, var, reg)
-#define pavgb_r2r(regs,regd) mmx_r2r (pavgb, regs, regd)
-#define pavgw_m2r(var,reg) mmx_m2r (pavgw, var, reg)
-#define pavgw_r2r(regs,regd) mmx_r2r (pavgw, regs, regd)
-
-#define pextrw_r2r(mmreg,reg,imm) mmx_r2ri (pextrw, mmreg, reg, imm)
-
-#define pinsrw_r2r(reg,mmreg,imm) mmx_r2ri (pinsrw, reg, mmreg, imm)
-
-#define pmaxsw_m2r(var,reg) mmx_m2r (pmaxsw, var, reg)
-#define pmaxsw_r2r(regs,regd) mmx_r2r (pmaxsw, regs, regd)
-
-#define pmaxub_m2r(var,reg) mmx_m2r (pmaxub, var, reg)
-#define pmaxub_r2r(regs,regd) mmx_r2r (pmaxub, regs, regd)
-
-#define pminsw_m2r(var,reg) mmx_m2r (pminsw, var, reg)
-#define pminsw_r2r(regs,regd) mmx_r2r (pminsw, regs, regd)
-
-#define pminub_m2r(var,reg) mmx_m2r (pminub, var, reg)
-#define pminub_r2r(regs,regd) mmx_r2r (pminub, regs, regd)
-
-#define pmovmskb(mmreg,reg) \
- __asm__ __volatile__ ("movmskps %" #mmreg ", %" #reg)
-
-#define pmulhuw_m2r(var,reg) mmx_m2r (pmulhuw, var, reg)
-#define pmulhuw_r2r(regs,regd) mmx_r2r (pmulhuw, regs, regd)
-
-#define prefetcht0(mem) mmx_fetch (mem, t0)
-#define prefetcht1(mem) mmx_fetch (mem, t1)
-#define prefetcht2(mem) mmx_fetch (mem, t2)
-#define prefetchnta(mem) mmx_fetch (mem, nta)
-
-#define psadbw_m2r(var,reg) mmx_m2r (psadbw, var, reg)
-#define psadbw_r2r(regs,regd) mmx_r2r (psadbw, regs, regd)
-
-#define pshufw_m2r(var,reg,imm) mmx_m2ri(pshufw, var, reg, imm)
-#define pshufw_r2r(regs,regd,imm) mmx_r2ri(pshufw, regs, regd, imm)
-
-#define sfence() __asm__ __volatile__ ("sfence\n\t")
-
-typedef union {
- float sf[4]; /* Single-precision (32-bit) value */
-} ATTR_ALIGN(16) sse_t; /* On a 16 byte (128-bit) boundary */
-
-
-#define sse_i2r(op, imm, reg) \
- __asm__ __volatile__ (#op " %0, %%" #reg \
- : /* nothing */ \
- : "X" (imm) )
-
-#define sse_m2r(op, mem, reg) \
- __asm__ __volatile__ (#op " %0, %%" #reg \
- : /* nothing */ \
- : "X" (mem))
-
-#define sse_r2m(op, reg, mem) \
- __asm__ __volatile__ (#op " %%" #reg ", %0" \
- : "=X" (mem) \
- : /* nothing */ )
-
-#define sse_r2r(op, regs, regd) \
- __asm__ __volatile__ (#op " %" #regs ", %" #regd)
-
-#define sse_r2ri(op, regs, regd, imm) \
- __asm__ __volatile__ (#op " %0, %%" #regs ", %%" #regd \
- : /* nothing */ \
- : "X" (imm) )
-
-#define sse_m2ri(op, mem, reg, subop) \
- __asm__ __volatile__ (#op " %0, %%" #reg ", " #subop \
- : /* nothing */ \
- : "X" (mem))
-
-
-#define movaps_m2r(var, reg) sse_m2r(movaps, var, reg)
-#define movaps_r2m(reg, var) sse_r2m(movaps, reg, var)
-#define movaps_r2r(regs, regd) sse_r2r(movaps, regs, regd)
-
-#define movntps_r2m(xmmreg, var) sse_r2m(movntps, xmmreg, var)
-
-#define movups_m2r(var, reg) sse_m2r(movups, var, reg)
-#define movups_r2m(reg, var) sse_r2m(movups, reg, var)
-#define movups_r2r(regs, regd) sse_r2r(movups, regs, regd)
-
-#define movhlps_r2r(regs, regd) sse_r2r(movhlps, regs, regd)
-
-#define movlhps_r2r(regs, regd) sse_r2r(movlhps, regs, regd)
-
-#define movhps_m2r(var, reg) sse_m2r(movhps, var, reg)
-#define movhps_r2m(reg, var) sse_r2m(movhps, reg, var)
-
-#define movlps_m2r(var, reg) sse_m2r(movlps, var, reg)
-#define movlps_r2m(reg, var) sse_r2m(movlps, reg, var)
-
-#define movss_m2r(var, reg) sse_m2r(movss, var, reg)
-#define movss_r2m(reg, var) sse_r2m(movss, reg, var)
-#define movss_r2r(regs, regd) sse_r2r(movss, regs, regd)
-
-#define shufps_m2r(var, reg, index) sse_m2ri(shufps, var, reg, index)
-#define shufps_r2r(regs, regd, index) sse_r2ri(shufps, regs, regd, index)
-
-#define cvtpi2ps_m2r(var, xmmreg) sse_m2r(cvtpi2ps, var, xmmreg)
-#define cvtpi2ps_r2r(mmreg, xmmreg) sse_r2r(cvtpi2ps, mmreg, xmmreg)
-
-#define cvtps2pi_m2r(var, mmreg) sse_m2r(cvtps2pi, var, mmreg)
-#define cvtps2pi_r2r(xmmreg, mmreg) sse_r2r(cvtps2pi, mmreg, xmmreg)
-
-#define cvttps2pi_m2r(var, mmreg) sse_m2r(cvttps2pi, var, mmreg)
-#define cvttps2pi_r2r(xmmreg, mmreg) sse_r2r(cvttps2pi, mmreg, xmmreg)
-
-#define cvtsi2ss_m2r(var, xmmreg) sse_m2r(cvtsi2ss, var, xmmreg)
-#define cvtsi2ss_r2r(reg, xmmreg) sse_r2r(cvtsi2ss, reg, xmmreg)
-
-#define cvtss2si_m2r(var, reg) sse_m2r(cvtss2si, var, reg)
-#define cvtss2si_r2r(xmmreg, reg) sse_r2r(cvtss2si, xmmreg, reg)
-
-#define cvttss2si_m2r(var, reg) sse_m2r(cvtss2si, var, reg)
-#define cvttss2si_r2r(xmmreg, reg) sse_r2r(cvtss2si, xmmreg, reg)
-
-#define movmskps(xmmreg, reg) \
- __asm__ __volatile__ ("movmskps %" #xmmreg ", %" #reg)
-
-#define addps_m2r(var, reg) sse_m2r(addps, var, reg)
-#define addps_r2r(regs, regd) sse_r2r(addps, regs, regd)
-
-#define addss_m2r(var, reg) sse_m2r(addss, var, reg)
-#define addss_r2r(regs, regd) sse_r2r(addss, regs, regd)
-
-#define subps_m2r(var, reg) sse_m2r(subps, var, reg)
-#define subps_r2r(regs, regd) sse_r2r(subps, regs, regd)
-
-#define subss_m2r(var, reg) sse_m2r(subss, var, reg)
-#define subss_r2r(regs, regd) sse_r2r(subss, regs, regd)
-
-#define mulps_m2r(var, reg) sse_m2r(mulps, var, reg)
-#define mulps_r2r(regs, regd) sse_r2r(mulps, regs, regd)
-
-#define mulss_m2r(var, reg) sse_m2r(mulss, var, reg)
-#define mulss_r2r(regs, regd) sse_r2r(mulss, regs, regd)
-
-#define divps_m2r(var, reg) sse_m2r(divps, var, reg)
-#define divps_r2r(regs, regd) sse_r2r(divps, regs, regd)
-
-#define divss_m2r(var, reg) sse_m2r(divss, var, reg)
-#define divss_r2r(regs, regd) sse_r2r(divss, regs, regd)
-
-#define rcpps_m2r(var, reg) sse_m2r(rcpps, var, reg)
-#define rcpps_r2r(regs, regd) sse_r2r(rcpps, regs, regd)
-
-#define rcpss_m2r(var, reg) sse_m2r(rcpss, var, reg)
-#define rcpss_r2r(regs, regd) sse_r2r(rcpss, regs, regd)
-
-#define rsqrtps_m2r(var, reg) sse_m2r(rsqrtps, var, reg)
-#define rsqrtps_r2r(regs, regd) sse_r2r(rsqrtps, regs, regd)
-
-#define rsqrtss_m2r(var, reg) sse_m2r(rsqrtss, var, reg)
-#define rsqrtss_r2r(regs, regd) sse_r2r(rsqrtss, regs, regd)
-
-#define sqrtps_m2r(var, reg) sse_m2r(sqrtps, var, reg)
-#define sqrtps_r2r(regs, regd) sse_r2r(sqrtps, regs, regd)
-
-#define sqrtss_m2r(var, reg) sse_m2r(sqrtss, var, reg)
-#define sqrtss_r2r(regs, regd) sse_r2r(sqrtss, regs, regd)
-
-#define andps_m2r(var, reg) sse_m2r(andps, var, reg)
-#define andps_r2r(regs, regd) sse_r2r(andps, regs, regd)
-
-#define andnps_m2r(var, reg) sse_m2r(andnps, var, reg)
-#define andnps_r2r(regs, regd) sse_r2r(andnps, regs, regd)
-
-#define orps_m2r(var, reg) sse_m2r(orps, var, reg)
-#define orps_r2r(regs, regd) sse_r2r(orps, regs, regd)
-
-#define xorps_m2r(var, reg) sse_m2r(xorps, var, reg)
-#define xorps_r2r(regs, regd) sse_r2r(xorps, regs, regd)
-
-#define maxps_m2r(var, reg) sse_m2r(maxps, var, reg)
-#define maxps_r2r(regs, regd) sse_r2r(maxps, regs, regd)
-
-#define maxss_m2r(var, reg) sse_m2r(maxss, var, reg)
-#define maxss_r2r(regs, regd) sse_r2r(maxss, regs, regd)
-
-#define minps_m2r(var, reg) sse_m2r(minps, var, reg)
-#define minps_r2r(regs, regd) sse_r2r(minps, regs, regd)
-
-#define minss_m2r(var, reg) sse_m2r(minss, var, reg)
-#define minss_r2r(regs, regd) sse_r2r(minss, regs, regd)
-
-#define cmpps_m2r(var, reg, op) sse_m2ri(cmpps, var, reg, op)
-#define cmpps_r2r(regs, regd, op) sse_r2ri(cmpps, regs, regd, op)
-
-#define cmpeqps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 0)
-#define cmpeqps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 0)
-
-#define cmpltps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 1)
-#define cmpltps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 1)
-
-#define cmpleps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 2)
-#define cmpleps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 2)
-
-#define cmpunordps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 3)
-#define cmpunordps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 3)
-
-#define cmpneqps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 4)
-#define cmpneqps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 4)
-
-#define cmpnltps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 5)
-#define cmpnltps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 5)
-
-#define cmpnleps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 6)
-#define cmpnleps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 6)
-
-#define cmpordps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 7)
-#define cmpordps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 7)
-
-#define cmpss_m2r(var, reg, op) sse_m2ri(cmpss, var, reg, op)
-#define cmpss_r2r(regs, regd, op) sse_r2ri(cmpss, regs, regd, op)
-
-#define cmpeqss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 0)
-#define cmpeqss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 0)
-
-#define cmpltss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 1)
-#define cmpltss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 1)
-
-#define cmpless_m2r(var, reg) sse_m2ri(cmpss, var, reg, 2)
-#define cmpless_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 2)
-
-#define cmpunordss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 3)
-#define cmpunordss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 3)
-
-#define cmpneqss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 4)
-#define cmpneqss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 4)
-
-#define cmpnltss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 5)
-#define cmpnltss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 5)
-
-#define cmpnless_m2r(var, reg) sse_m2ri(cmpss, var, reg, 6)
-#define cmpnless_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 6)
-
-#define cmpordss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 7)
-#define cmpordss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 7)
-
-#define comiss_m2r(var, reg) sse_m2r(comiss, var, reg)
-#define comiss_r2r(regs, regd) sse_r2r(comiss, regs, regd)
-
-#define ucomiss_m2r(var, reg) sse_m2r(ucomiss, var, reg)
-#define ucomiss_r2r(regs, regd) sse_r2r(ucomiss, regs, regd)
-
-#define unpcklps_m2r(var, reg) sse_m2r(unpcklps, var, reg)
-#define unpcklps_r2r(regs, regd) sse_r2r(unpcklps, regs, regd)
-
-#define unpckhps_m2r(var, reg) sse_m2r(unpckhps, var, reg)
-#define unpckhps_r2r(regs, regd) sse_r2r(unpckhps, regs, regd)
-
-#define fxrstor(mem) \
- __asm__ __volatile__ ("fxrstor %0" \
- : /* nothing */ \
- : "X" (mem))
-
-#define fxsave(mem) \
- __asm__ __volatile__ ("fxsave %0" \
- : /* nothing */ \
- : "X" (mem))
-
-#define stmxcsr(mem) \
- __asm__ __volatile__ ("stmxcsr %0" \
- : /* nothing */ \
- : "X" (mem))
-
-#define ldmxcsr(mem) \
- __asm__ __volatile__ ("ldmxcsr %0" \
- : /* nothing */ \
- : "X" (mem))
-#endif /*ARCH_X86 */
-
-
-
- /* Optimized/fast memcpy */
-
-/*
- TODO : fix dll linkage problem for xine_fast_memcpy on win32
-
- xine_fast_memcpy dll linkage is screwy here.
- declairing as dllinport seems to fix the problem
- but causes compiler warning with libxineutils
-*/
-#ifdef _MSC_VER
-void __declspec( dllimport ) *(* xine_fast_memcpy)(void *to, const void *from, size_t len);
-#else
-extern void *(* xine_fast_memcpy)(void *to, const void *from, size_t len);
-#endif
-
-#ifdef HAVE_XINE_INTERNAL_H
-/* Benchmark available memcpy methods */
-void xine_probe_fast_memcpy(config_values_t *config);
-#endif
-
-
-/*
- * Debug stuff
- */
-/*
- * profiling (unworkable in non DEBUG isn't defined)
- */
-void xine_profiler_init (void);
-int xine_profiler_allocate_slot (char *label);
-void xine_profiler_start_count (int id);
-void xine_profiler_stop_count (int id);
-void xine_profiler_print_results (void);
-
-/*
- * Allocate and clean memory size_t 'size', then return the pointer
- * to the allocated memory.
- */
-void *xine_xmalloc(size_t size);
-
-/*
- * Same as above, but memory is aligned to 'alignement'.
- * **base is used to return pointer to un-aligned memory, use
- * this to free the mem chunk
- */
-void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base);
-
-/*
- * Get user home directory.
- */
-const char *xine_get_homedir(void);
-
-/*
- * Clean a string (remove spaces and '=' at the begin,
- * and '\n', '\r' and spaces at the end.
- */
-char *xine_chomp (char *str);
-
-/*
- * A thread-safe usecond sleep
- */
-void xine_usec_sleep(unsigned usec);
-
-
- /*
- * Some string functions
- */
-
-
-void xine_strdupa(char *dest, char *src);
-#define xine_strdupa(d, s) do { \
- (d) = NULL; \
- if((s) != NULL) { \
- (d) = (char *) alloca(strlen((s)) + 1); \
- strcpy((d), (s)); \
- } \
- } while(0)
-
-/* Shamefully copied from glibc 2.2.3 */
-#ifdef HAVE_STRPBRK
-#define xine_strpbrk strpbrk
-#else
-static inline char *_x_strpbrk(const char *s, const char *accept) {
-
- while(*s != '\0') {
- const char *a = accept;
- while(*a != '\0')
- if(*a++ == *s)
- return(char *) s;
- ++s;
- }
-
- return NULL;
-}
-#define xine_strpbrk _x_strpbrk
-#endif
-
-#ifdef HAVE_STRSEP
-#define xine_strsep strsep
-#else
-static inline char *_x_strsep(char **stringp, const char *delim) {
- char *begin, *end;
-
- begin = *stringp;
- if(begin == NULL)
- return NULL;
-
- if(delim[0] == '\0' || delim[1] == '\0') {
- char ch = delim[0];
-
- if(ch == '\0')
- end = NULL;
- else {
- if(*begin == ch)
- end = begin;
- else if(*begin == '\0')
- end = NULL;
- else
- end = strchr(begin + 1, ch);
- }
- }
- else
- end = xine_strpbrk(begin, delim);
-
- if(end) {
- *end++ = '\0';
- *stringp = end;
- }
- else
- *stringp = NULL;
-
- return begin;
-}
-#define xine_strsep _x_strsep
-#endif
-
-
-#ifdef HAVE_SETENV
-#define xine_setenv setenv
-#else
-static inline void _x_setenv(const char *name, const char *val, int _xx)
-{
- int len = strlen(name) + strlen(val) + 2;
- char *env;
-
- env = (char*)malloc(len);
-
- if (env != NULL) {
- strcpy(env, name);
- strcat(env, "=");
- strcat(env, val);
- putenv(env);
- }
-}
-#define xine_setenv _x_setenv
-#endif
-
-/*
- * Color Conversion Utility Functions
- * The following data structures and functions facilitate the conversion
- * of RGB images to packed YUV (YUY2) images. There are also functions to
- * convert from YUV9 -> YV12. All of the meaty details are written in
- * color.c.
- */
-
-typedef struct yuv_planes_s {
-
- unsigned char *y;
- unsigned char *u;
- unsigned char *v;
- unsigned int row_width; /* frame width */
- unsigned int row_count; /* frame height */
-
-} yuv_planes_t;
-
-void init_yuv_conversion(void);
-void init_yuv_planes(yuv_planes_t *yuv_planes, int width, int height);
-void free_yuv_planes(yuv_planes_t *yuv_planes);
-
-extern void (*yuv444_to_yuy2)
- (yuv_planes_t *yuv_planes, unsigned char *yuy2_map, int pitch);
-extern void (*yuv9_to_yv12)
- (unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch,
- unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch,
- unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch,
- int width, int height);
-extern void (*yuv411_to_yv12)
- (unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch,
- unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch,
- unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch,
- int width, int height);
-
-#define SCALEFACTOR 65536
-#define CENTERSAMPLE 128
-
-#define COMPUTE_Y(r, g, b) \
- (unsigned char) \
- ((y_r_table[r] + y_g_table[g] + y_b_table[b]) / SCALEFACTOR)
-#define COMPUTE_U(r, g, b) \
- (unsigned char) \
- ((u_r_table[r] + u_g_table[g] + u_b_table[b]) / SCALEFACTOR + CENTERSAMPLE)
-#define COMPUTE_V(r, g, b) \
- (unsigned char) \
- ((v_r_table[r] + v_g_table[g] + v_b_table[b]) / SCALEFACTOR + CENTERSAMPLE)
-
-#define UNPACK_BGR15(packed_pixel, r, g, b) \
- b = (packed_pixel & 0x7C00) >> 7; \
- g = (packed_pixel & 0x03E0) >> 2; \
- r = (packed_pixel & 0x001F) << 3;
-
-#define UNPACK_BGR16(packed_pixel, r, g, b) \
- b = (packed_pixel & 0xF800) >> 8; \
- g = (packed_pixel & 0x07E0) >> 3; \
- r = (packed_pixel & 0x001F) << 3;
-
-#define UNPACK_RGB15(packed_pixel, r, g, b) \
- r = (packed_pixel & 0x7C00) >> 7; \
- g = (packed_pixel & 0x03E0) >> 2; \
- b = (packed_pixel & 0x001F) << 3;
-
-#define UNPACK_RGB16(packed_pixel, r, g, b) \
- r = (packed_pixel & 0xF800) >> 8; \
- g = (packed_pixel & 0x07E0) >> 3; \
- b = (packed_pixel & 0x001F) << 3;
-
-extern int y_r_table[256];
-extern int y_g_table[256];
-extern int y_b_table[256];
-
-extern int u_r_table[256];
-extern int u_g_table[256];
-extern int u_b_table[256];
-
-extern int v_r_table[256];
-extern int v_g_table[256];
-extern int v_b_table[256];
-
-
-/* backtrace printout funtion for use in XINE_ASSERT() macro */
-void xine_print_trace(void);
-
-
-#ifdef DEBUG
-# define XINE_ABORT() \
- abort();
-#else
-# define XINE_ABORT()
- /* don't abort */
-#endif
-
-/**
- * Provide assert like feature with better description of failure
- * Thanks to Mark Thomas
- */
-#if __GNUC__
-# define XINE_ASSERT(exp, desc, args...) \
- do { \
- if (!(exp)) { \
- printf("%s:%s:%d: assertion `%s' failed. " desc "\n\n", \
- __FILE__, __XINE_FUNCTION__, __LINE__, #exp, ##args); \
- xine_print_trace(); \
- XINE_ABORT(); \
- } \
- } while(0)
-#else /* not GNU C, assume we have a C99 compiler */
-
-#ifdef _MSC_VER
-/*
- #define XINE_ASSERT(exp, desc) ((void)((exp) || \
- (printf desc, _assert(#exp, __FILE__, __LINE__), 0)))
-
-*/
-# define XINE_ASSERT(exp, desc) \
- do { \
- if (!(exp)) { \
- printf("%s:%s:%d: assertion `%s' failed. ", \
- __FILE__, __XINE_FUNCTION__, __LINE__, #exp); \
- printf(desc); \
- printf("\n\n"); \
- xine_print_trace(); \
- XINE_ABORT(); \
- } \
- } while(0)
-#else
-# define XINE_ASSERT(exp, ...) \
- do { \
- if (!(exp)) { \
- printf("%s:%s:%d: assertion `%s' failed. ", \
- __FILE__, __XINE_FUNCTION__, __LINE__, #exp); \
- printf(__VA_ARGS__); \
- printf("\n\n"); \
- xine_print_trace(); \
- XINE_ABORT(); \
- } \
- } while(0)
-#endif /* _MSC_VER */
-
-#endif
-
-
-/******** double chained lists with builtin iterator *******/
-
-typedef struct xine_node_s {
-
- struct xine_node_s *next, *prev;
-
- void *content;
-
- int priority;
-
-} xine_node_t;
-
-
-typedef struct {
-
- xine_node_t *first, *last, *cur;
-
-} xine_list_t;
-
-
-
-xine_list_t *xine_list_new (void);
-
-
-/**
- * dispose the whole list.
- * note: disposes _only_ the list structure, content must be free()d elsewhere
- */
-void xine_list_free(xine_list_t *l);
-
-
-/**
- * returns: Boolean
- */
-int xine_list_is_empty (xine_list_t *l);
-
-/**
- * return content of first entry in list.
- */
-void *xine_list_first_content (xine_list_t *l);
-
-/**
- * return next content in list.
- */
-void *xine_list_next_content (xine_list_t *l);
-
-/**
- * Return last content of list.
- */
-void *xine_list_last_content (xine_list_t *l);
-
-/**
- * Return previous content of list.
- */
-void *xine_list_prev_content (xine_list_t *l);
-
-/**
- * Append content to list, sorted by decreasing priority.
- */
-void xine_list_append_priority_content (xine_list_t *l, void *content, int priority);
-
-/**
- * Append content to list.
- */
-void xine_list_append_content (xine_list_t *l, void *content);
-
-/**
- * Insert content in list.
- */
-void xine_list_insert_content (xine_list_t *l, void *content);
-
-/**
- * Remove current content in list.
- * note: removes only the list entry; content must be free()d elsewhere.
- */
-void xine_list_delete_current (xine_list_t *l);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/win32/include/zconf.h b/win32/include/zconf.h deleted file mode 100644 index 90d1a107a..000000000 --- a/win32/include/zconf.h +++ /dev/null @@ -1,279 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-1998 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id: zconf.h,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
-
-#ifndef _ZCONF_H
-#define _ZCONF_H
-
-/*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
- */
-#ifdef Z_PREFIX
-# define deflateInit_ z_deflateInit_
-# define deflate z_deflate
-# define deflateEnd z_deflateEnd
-# define inflateInit_ z_inflateInit_
-# define inflate z_inflate
-# define inflateEnd z_inflateEnd
-# define deflateInit2_ z_deflateInit2_
-# define deflateSetDictionary z_deflateSetDictionary
-# define deflateCopy z_deflateCopy
-# define deflateReset z_deflateReset
-# define deflateParams z_deflateParams
-# define inflateInit2_ z_inflateInit2_
-# define inflateSetDictionary z_inflateSetDictionary
-# define inflateSync z_inflateSync
-# define inflateSyncPoint z_inflateSyncPoint
-# define inflateReset z_inflateReset
-# define compress z_compress
-# define compress2 z_compress2
-# define uncompress z_uncompress
-# define adler32 z_adler32
-# define crc32 z_crc32
-# define get_crc_table z_get_crc_table
-
-# define Byte z_Byte
-# define uInt z_uInt
-# define uLong z_uLong
-# define Bytef z_Bytef
-# define charf z_charf
-# define intf z_intf
-# define uIntf z_uIntf
-# define uLongf z_uLongf
-# define voidpf z_voidpf
-# define voidp z_voidp
-#endif
-
-#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
-# define WIN32
-#endif
-#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
-# ifndef __32BIT__
-# define __32BIT__
-# endif
-#endif
-#if defined(__MSDOS__) && !defined(MSDOS)
-# define MSDOS
-#endif
-
-/*
- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
- * than 64k bytes at a time (needed on systems with 16-bit int).
- */
-#if defined(MSDOS) && !defined(__32BIT__)
-# define MAXSEG_64K
-#endif
-#ifdef MSDOS
-# define UNALIGNED_OK
-#endif
-
-#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
-# define STDC
-#endif
-#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
-# ifndef STDC
-# define STDC
-# endif
-#endif
-
-#ifndef STDC
-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-# define const
-# endif
-#endif
-
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
-# define NO_DUMMY_DECL
-#endif
-
-/* Old Borland C incorrectly complains about missing returns: */
-#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
-# define NEED_DUMMY_RETURN
-#endif
-
-
-/* Maximum value for memLevel in deflateInit2 */
-#ifndef MAX_MEM_LEVEL
-# ifdef MAXSEG_64K
-# define MAX_MEM_LEVEL 8
-# else
-# define MAX_MEM_LEVEL 9
-# endif
-#endif
-
-/* Maximum value for windowBits in deflateInit2 and inflateInit2.
- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
- * created by gzip. (Files created by minigzip can still be extracted by
- * gzip.)
- */
-#ifndef MAX_WBITS
-# define MAX_WBITS 15 /* 32K LZ77 window */
-#endif
-
-/* The memory requirements for deflate are (in bytes):
- (1 << (windowBits+2)) + (1 << (memLevel+9))
- that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
- plus a few kilobytes for small objects. For example, if you want to reduce
- the default memory requirements from 256K to 128K, compile with
- make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
- Of course this will generally degrade compression (there's no free lunch).
-
- The memory requirements for inflate are (in bytes) 1 << windowBits
- that is, 32K for windowBits=15 (default value) plus a few kilobytes
- for small objects.
-*/
-
- /* Type declarations */
-
-#ifndef OF /* function prototypes */
-# ifdef STDC
-# define OF(args) args
-# else
-# define OF(args) ()
-# endif
-#endif
-
-/* The following definitions for FAR are needed only for MSDOS mixed
- * model programming (small or medium model with some far allocations).
- * This was tested only with MSC; for other MSDOS compilers you may have
- * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
- * just define FAR to be empty.
- */
-#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
- /* MSC small or medium model */
-# define SMALL_MEDIUM
-# ifdef _MSC_VER
-# define FAR _far
-# else
-# define FAR far
-# endif
-#endif
-#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
-# ifndef __32BIT__
-# define SMALL_MEDIUM
-# define FAR _far
-# endif
-#endif
-
-/* Compile with -DZLIB_DLL for Windows DLL support */
-#if defined(ZLIB_DLL)
-# if defined(_WINDOWS) || defined(WINDOWS)
-# ifdef FAR
-# undef FAR
-# endif
-# include <windows.h>
-# define ZEXPORT WINAPI
-# ifdef WIN32
-# define ZEXPORTVA WINAPIV
-# else
-# define ZEXPORTVA FAR _cdecl _export
-# endif
-# endif
-# if defined (__BORLANDC__)
-# if (__BORLANDC__ >= 0x0500) && defined (WIN32)
-# include <windows.h>
-# define ZEXPORT __declspec(dllexport) WINAPI
-# define ZEXPORTRVA __declspec(dllexport) WINAPIV
-# else
-# if defined (_Windows) && defined (__DLL__)
-# define ZEXPORT _export
-# define ZEXPORTVA _export
-# endif
-# endif
-# endif
-#endif
-
-#if defined (__BEOS__)
-# if defined (ZLIB_DLL)
-# define ZEXTERN extern __declspec(dllexport)
-# else
-# define ZEXTERN extern __declspec(dllimport)
-# endif
-#endif
-
-#ifndef ZEXPORT
-# define ZEXPORT
-#endif
-#ifndef ZEXPORTVA
-# define ZEXPORTVA
-#endif
-#ifndef ZEXTERN
-# define ZEXTERN extern
-#endif
-
-#ifndef FAR
-# define FAR
-#endif
-
-#if !defined(MACOS) && !defined(TARGET_OS_MAC)
-typedef unsigned char Byte; /* 8 bits */
-#endif
-typedef unsigned int uInt; /* 16 bits or more */
-typedef unsigned long uLong; /* 32 bits or more */
-
-#ifdef SMALL_MEDIUM
- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
-# define Bytef Byte FAR
-#else
- typedef Byte FAR Bytef;
-#endif
-typedef char FAR charf;
-typedef int FAR intf;
-typedef uInt FAR uIntf;
-typedef uLong FAR uLongf;
-
-#ifdef STDC
- typedef void FAR *voidpf;
- typedef void *voidp;
-#else
- typedef Byte FAR *voidpf;
- typedef Byte *voidp;
-#endif
-
-#ifdef HAVE_UNISTD_H
-# include <sys/types.h> /* for off_t */
-# include <unistd.h> /* for SEEK_* and off_t */
-# define z_off_t off_t
-#endif
-#ifndef SEEK_SET
-# define SEEK_SET 0 /* Seek from beginning of file. */
-# define SEEK_CUR 1 /* Seek from current position. */
-# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
-#endif
-#ifndef z_off_t
-# define z_off_t long
-#endif
-
-/* MVS linker does not support external names larger than 8 bytes */
-#if defined(__MVS__)
-# pragma map(deflateInit_,"DEIN")
-# pragma map(deflateInit2_,"DEIN2")
-# pragma map(deflateEnd,"DEEND")
-# pragma map(inflateInit_,"ININ")
-# pragma map(inflateInit2_,"ININ2")
-# pragma map(inflateEnd,"INEND")
-# pragma map(inflateSync,"INSY")
-# pragma map(inflateSetDictionary,"INSEDI")
-# pragma map(inflate_blocks,"INBL")
-# pragma map(inflate_blocks_new,"INBLNE")
-# pragma map(inflate_blocks_free,"INBLFR")
-# pragma map(inflate_blocks_reset,"INBLRE")
-# pragma map(inflate_codes_free,"INCOFR")
-# pragma map(inflate_codes,"INCO")
-# pragma map(inflate_fast,"INFA")
-# pragma map(inflate_flush,"INFLU")
-# pragma map(inflate_mask,"INMA")
-# pragma map(inflate_set_dictionary,"INSEDI2")
-# pragma map(inflate_copyright,"INCOPY")
-# pragma map(inflate_trees_bits,"INTRBI")
-# pragma map(inflate_trees_dynamic,"INTRDY")
-# pragma map(inflate_trees_fixed,"INTRFI")
-# pragma map(inflate_trees_free,"INTRFR")
-#endif
-
-#endif /* _ZCONF_H */
diff --git a/win32/include/zlib.h b/win32/include/zlib.h deleted file mode 100644 index 34fe85f41..000000000 --- a/win32/include/zlib.h +++ /dev/null @@ -1,893 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.1.3, July 9th, 1998
-
- Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jean-loup Gailly Mark Adler
- jloup@gzip.org madler@alumni.caltech.edu
-
-
- The data format used by the zlib library is described by RFCs (Request for
- Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
- (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
-*/
-
-#ifndef _ZLIB_H
-#define _ZLIB_H
-
-#include "zconf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ZLIB_VERSION "1.1.3"
-
-/*
- The 'zlib' compression library provides in-memory compression and
- decompression functions, including integrity checks of the uncompressed
- data. This version of the library supports only one compression method
- (deflation) but other algorithms will be added later and will have the same
- stream interface.
-
- Compression can be done in a single step if the buffers are large
- enough (for example if an input file is mmap'ed), or can be done by
- repeated calls of the compression function. In the latter case, the
- application must provide more input and/or consume the output
- (providing more output space) before each call.
-
- The library also supports reading and writing files in gzip (.gz) format
- with an interface similar to that of stdio.
-
- The library does not install any signal handler. The decoder checks
- the consistency of the compressed data, so the library should never
- crash even in case of corrupted input.
-*/
-
-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
-typedef void (*free_func) OF((voidpf opaque, voidpf address));
-
-struct internal_state;
-
-typedef struct z_stream_s {
- Bytef *next_in; /* next input byte */
- uInt avail_in; /* number of bytes available at next_in */
- uLong total_in; /* total nb of input bytes read so far */
-
- Bytef *next_out; /* next output byte should be put there */
- uInt avail_out; /* remaining free space at next_out */
- uLong total_out; /* total nb of bytes output so far */
-
- char *msg; /* last error message, NULL if no error */
- struct internal_state FAR *state; /* not visible by applications */
-
- alloc_func zalloc; /* used to allocate the internal state */
- free_func zfree; /* used to free the internal state */
- voidpf opaque; /* private data object passed to zalloc and zfree */
-
- int data_type; /* best guess about the data type: ascii or binary */
- uLong adler; /* adler32 value of the uncompressed data */
- uLong reserved; /* reserved for future use */
-} z_stream;
-
-typedef z_stream FAR *z_streamp;
-
-/*
- The application must update next_in and avail_in when avail_in has
- dropped to zero. It must update next_out and avail_out when avail_out
- has dropped to zero. The application must initialize zalloc, zfree and
- opaque before calling the init function. All other fields are set by the
- compression library and must not be updated by the application.
-
- The opaque value provided by the application will be passed as the first
- parameter for calls of zalloc and zfree. This can be useful for custom
- memory management. The compression library attaches no meaning to the
- opaque value.
-
- zalloc must return Z_NULL if there is not enough memory for the object.
- If zlib is used in a multi-threaded application, zalloc and zfree must be
- thread safe.
-
- On 16-bit systems, the functions zalloc and zfree must be able to allocate
- exactly 65536 bytes, but will not be required to allocate more than this
- if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
- pointers returned by zalloc for objects of exactly 65536 bytes *must*
- have their offset normalized to zero. The default allocation function
- provided by this library ensures this (see zutil.c). To reduce memory
- requirements and avoid any allocation of 64K objects, at the expense of
- compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
-
- The fields total_in and total_out can be used for statistics or
- progress reports. After compression, total_in holds the total size of
- the uncompressed data and may be saved for use in the decompressor
- (particularly if the decompressor wants to decompress everything in
- a single step).
-*/
-
- /* constants */
-
-#define Z_NO_FLUSH 0
-#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
-#define Z_SYNC_FLUSH 2
-#define Z_FULL_FLUSH 3
-#define Z_FINISH 4
-/* Allowed flush values; see deflate() below for details */
-
-#define Z_OK 0
-#define Z_STREAM_END 1
-#define Z_NEED_DICT 2
-#define Z_ERRNO (-1)
-#define Z_STREAM_ERROR (-2)
-#define Z_DATA_ERROR (-3)
-#define Z_MEM_ERROR (-4)
-#define Z_BUF_ERROR (-5)
-#define Z_VERSION_ERROR (-6)
-/* Return codes for the compression/decompression functions. Negative
- * values are errors, positive values are used for special but normal events.
- */
-
-#define Z_NO_COMPRESSION 0
-#define Z_BEST_SPEED 1
-#define Z_BEST_COMPRESSION 9
-#define Z_DEFAULT_COMPRESSION (-1)
-/* compression levels */
-
-#define Z_FILTERED 1
-#define Z_HUFFMAN_ONLY 2
-#define Z_DEFAULT_STRATEGY 0
-/* compression strategy; see deflateInit2() below for details */
-
-#define Z_BINARY 0
-#define Z_ASCII 1
-#define Z_UNKNOWN 2
-/* Possible values of the data_type field */
-
-#define Z_DEFLATED 8
-/* The deflate compression method (the only one supported in this version) */
-
-#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
-
-#define zlib_version zlibVersion()
-/* for compatibility with versions < 1.0.2 */
-
- /* basic functions */
-
-ZEXTERN const char * ZEXPORT zlibVersion OF((void));
-/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
- If the first character differs, the library code actually used is
- not compatible with the zlib.h header file used by the application.
- This check is automatically made by deflateInit and inflateInit.
- */
-
-/*
-ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
-
- Initializes the internal stream state for compression. The fields
- zalloc, zfree and opaque must be initialized before by the caller.
- If zalloc and zfree are set to Z_NULL, deflateInit updates them to
- use default allocation functions.
-
- The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
- 1 gives best speed, 9 gives best compression, 0 gives no compression at
- all (the input data is simply copied a block at a time).
- Z_DEFAULT_COMPRESSION requests a default compromise between speed and
- compression (currently equivalent to level 6).
-
- deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if level is not a valid compression level,
- Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
- with the version assumed by the caller (ZLIB_VERSION).
- msg is set to null if there is no error message. deflateInit does not
- perform any compression: this will be done by deflate().
-*/
-
-
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
-/*
- deflate compresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may introduce some
- output latency (reading input without producing any output) except when
- forced to flush.
-
- The detailed semantics are as follows. deflate performs one or both of the
- following actions:
-
- - Compress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in and avail_in are updated and
- processing will resume at this point for the next call of deflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. This action is forced if the parameter flush is non zero.
- Forcing flush frequently degrades the compression ratio, so this parameter
- should be set only when necessary (in interactive applications).
- Some output may be provided even if flush is not set.
-
- Before the call of deflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating avail_in or avail_out accordingly; avail_out
- should never be zero before the call. The application can consume the
- compressed output when it wants, for example when the output buffer is full
- (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
- and with zero avail_out, it must be called again after making room in the
- output buffer because there might be more output pending.
-
- If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
- flushed to the output buffer and the output is aligned on a byte boundary, so
- that the decompressor can get all input data available so far. (In particular
- avail_in is zero after the call if enough output space has been provided
- before the call.) Flushing may degrade compression for some compression
- algorithms and so it should be used only when necessary.
-
- If flush is set to Z_FULL_FLUSH, all output is flushed as with
- Z_SYNC_FLUSH, and the compression state is reset so that decompression can
- restart from this point if previous compressed data has been damaged or if
- random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
- the compression.
-
- If deflate returns with avail_out == 0, this function must be called again
- with the same value of the flush parameter and more output space (updated
- avail_out), until the flush is complete (deflate returns with non-zero
- avail_out).
-
- If the parameter flush is set to Z_FINISH, pending input is processed,
- pending output is flushed and deflate returns with Z_STREAM_END if there
- was enough output space; if deflate returns with Z_OK, this function must be
- called again with Z_FINISH and more output space (updated avail_out) but no
- more input data, until it returns with Z_STREAM_END or an error. After
- deflate has returned Z_STREAM_END, the only possible operations on the
- stream are deflateReset or deflateEnd.
-
- Z_FINISH can be used immediately after deflateInit if all the compression
- is to be done in a single step. In this case, avail_out must be at least
- 0.1% larger than avail_in plus 12 bytes. If deflate does not return
- Z_STREAM_END, then it must be called again as described above.
-
- deflate() sets strm->adler to the adler32 checksum of all input read
- so far (that is, total_in bytes).
-
- deflate() may update data_type if it can make a good guess about
- the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
- binary. This field is only for information purposes and does not affect
- the compression algorithm in any manner.
-
- deflate() returns Z_OK if some progress has been made (more input
- processed or more output produced), Z_STREAM_END if all input has been
- consumed and all output has been produced (only when flush is set to
- Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
- if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
- (for example avail_in or avail_out was zero).
-*/
-
-
-ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
-
- deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
- stream state was inconsistent, Z_DATA_ERROR if the stream was freed
- prematurely (some input or output was discarded). In the error case,
- msg may be set but then points to a static string (which must not be
- deallocated).
-*/
-
-
-/*
-ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
-
- Initializes the internal stream state for decompression. The fields
- next_in, avail_in, zalloc, zfree and opaque must be initialized before by
- the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
- value depends on the compression method), inflateInit determines the
- compression method from the zlib header and allocates all data structures
- accordingly; otherwise the allocation will be deferred to the first call of
- inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
- use default allocation functions.
-
- inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
- version assumed by the caller. msg is set to null if there is no error
- message. inflateInit does not perform any decompression apart from reading
- the zlib header if present: this will be done by inflate(). (So next_in and
- avail_in may be modified, but next_out and avail_out are unchanged.)
-*/
-
-
-ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
-/*
- inflate decompresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may some
- introduce some output latency (reading input without producing any output)
- except when forced to flush.
-
- The detailed semantics are as follows. inflate performs one or both of the
- following actions:
-
- - Decompress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in is updated and processing
- will resume at this point for the next call of inflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. inflate() provides as much output as possible, until there
- is no more input data or no more space in the output buffer (see below
- about the flush parameter).
-
- Before the call of inflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming
- more output, and updating the next_* and avail_* values accordingly.
- The application can consume the uncompressed output when it wants, for
- example when the output buffer is full (avail_out == 0), or after each
- call of inflate(). If inflate returns Z_OK and with zero avail_out, it
- must be called again after making room in the output buffer because there
- might be more output pending.
-
- If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much
- output as possible to the output buffer. The flushing behavior of inflate is
- not specified for values of the flush parameter other than Z_SYNC_FLUSH
- and Z_FINISH, but the current implementation actually flushes as much output
- as possible anyway.
-
- inflate() should normally be called until it returns Z_STREAM_END or an
- error. However if all decompression is to be performed in a single step
- (a single call of inflate), the parameter flush should be set to
- Z_FINISH. In this case all pending input is processed and all pending
- output is flushed; avail_out must be large enough to hold all the
- uncompressed data. (The size of the uncompressed data may have been saved
- by the compressor for this purpose.) The next operation on this stream must
- be inflateEnd to deallocate the decompression state. The use of Z_FINISH
- is never required, but can be used to inform inflate that a faster routine
- may be used for the single inflate() call.
-
- If a preset dictionary is needed at this point (see inflateSetDictionary
- below), inflate sets strm-adler to the adler32 checksum of the
- dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise
- it sets strm->adler to the adler32 checksum of all output produced
- so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
- an error code as described below. At the end of the stream, inflate()
- checks that its computed adler32 checksum is equal to that saved by the
- compressor and returns Z_STREAM_END only if the checksum is correct.
-
- inflate() returns Z_OK if some progress has been made (more input processed
- or more output produced), Z_STREAM_END if the end of the compressed data has
- been reached and all uncompressed output has been produced, Z_NEED_DICT if a
- preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
- corrupted (input stream not conforming to the zlib format or incorrect
- adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
- (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if no progress is possible or if there was not
- enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
- case, the application may then call inflateSync to look for a good
- compression block.
-*/
-
-
-ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any
- pending output.
-
- inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
- was inconsistent. In the error case, msg may be set but then points to a
- static string (which must not be deallocated).
-*/
-
- /* Advanced functions */
-
-/*
- The following functions are needed only in some special applications.
-*/
-
-/*
-ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
- int level,
- int method,
- int windowBits,
- int memLevel,
- int strategy));
-
- This is another version of deflateInit with more compression options. The
- fields next_in, zalloc, zfree and opaque must be initialized before by
- the caller.
-
- The method parameter is the compression method. It must be Z_DEFLATED in
- this version of the library.
-
- The windowBits parameter is the base two logarithm of the window size
- (the size of the history buffer). It should be in the range 8..15 for this
- version of the library. Larger values of this parameter result in better
- compression at the expense of memory usage. The default value is 15 if
- deflateInit is used instead.
-
- The memLevel parameter specifies how much memory should be allocated
- for the internal compression state. memLevel=1 uses minimum memory but
- is slow and reduces compression ratio; memLevel=9 uses maximum memory
- for optimal speed. The default value is 8. See zconf.h for total memory
- usage as a function of windowBits and memLevel.
-
- The strategy parameter is used to tune the compression algorithm. Use the
- value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
- filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
- string match). Filtered data consists mostly of small values with a
- somewhat random distribution. In this case, the compression algorithm is
- tuned to compress them better. The effect of Z_FILTERED is to force more
- Huffman coding and less string matching; it is somewhat intermediate
- between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
- the compression ratio but not the correctness of the compressed output even
- if it is not set appropriately.
-
- deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
- method). msg is set to null if there is no error message. deflateInit2 does
- not perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the compression dictionary from the given byte sequence
- without producing any compressed output. This function must be called
- immediately after deflateInit, deflateInit2 or deflateReset, before any
- call of deflate. The compressor and decompressor must use exactly the same
- dictionary (see inflateSetDictionary).
-
- The dictionary should consist of strings (byte sequences) that are likely
- to be encountered later in the data to be compressed, with the most commonly
- used strings preferably put towards the end of the dictionary. Using a
- dictionary is most useful when the data to be compressed is short and can be
- predicted with good accuracy; the data can then be compressed better than
- with the default empty dictionary.
-
- Depending on the size of the compression data structures selected by
- deflateInit or deflateInit2, a part of the dictionary may in effect be
- discarded, for example if the dictionary is larger than the window size in
- deflate or deflate2. Thus the strings most likely to be useful should be
- put at the end of the dictionary, not at the front.
-
- Upon return of this function, strm->adler is set to the Adler32 value
- of the dictionary; the decompressor may later use this value to determine
- which dictionary has been used by the compressor. (The Adler32 value
- applies to the whole dictionary even if only a subset of the dictionary is
- actually used by the compressor.)
-
- deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state is
- inconsistent (for example if deflate has already been called for this stream
- or if the compression method is bsort). deflateSetDictionary does not
- perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
- z_streamp source));
-/*
- Sets the destination stream as a complete copy of the source stream.
-
- This function can be useful when several compression strategies will be
- tried, for example when there are several ways of pre-processing the input
- data with a filter. The streams that will be discarded should then be freed
- by calling deflateEnd. Note that deflateCopy duplicates the internal
- compression state which can be quite large, so this strategy is slow and
- can consume lots of memory.
-
- deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being NULL). msg is left unchanged in both source and
- destination.
-*/
-
-ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
-/*
- This function is equivalent to deflateEnd followed by deflateInit,
- but does not free and reallocate all the internal compression state.
- The stream will keep the same compression level and any other attributes
- that may have been set by deflateInit2.
-
- deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
- int level,
- int strategy));
-/*
- Dynamically update the compression level and compression strategy. The
- interpretation of level and strategy is as in deflateInit2. This can be
- used to switch between compression and straight copy of the input data, or
- to switch to a different kind of input data requiring a different
- strategy. If the compression level is changed, the input available so far
- is compressed with the old level (and may be flushed); the new level will
- take effect only at the next call of deflate().
-
- Before the call of deflateParams, the stream state must be set as for
- a call of deflate(), since the currently available input may have to
- be compressed and flushed. In particular, strm->avail_out must be non-zero.
-
- deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
- stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
- if strm->avail_out was zero.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
- int windowBits));
-
- This is another version of inflateInit with an extra parameter. The
- fields next_in, avail_in, zalloc, zfree and opaque must be initialized
- before by the caller.
-
- The windowBits parameter is the base two logarithm of the maximum window
- size (the size of the history buffer). It should be in the range 8..15 for
- this version of the library. The default value is 15 if inflateInit is used
- instead. If a compressed stream with a larger window size is given as
- input, inflate() will return with the error code Z_DATA_ERROR instead of
- trying to allocate a larger window.
-
- inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
- memLevel). msg is set to null if there is no error message. inflateInit2
- does not perform any decompression apart from reading the zlib header if
- present: this will be done by inflate(). (So next_in and avail_in may be
- modified, but next_out and avail_out are unchanged.)
-*/
-
-ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the decompression dictionary from the given uncompressed byte
- sequence. This function must be called immediately after a call of inflate
- if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
- can be determined from the Adler32 value returned by this call of
- inflate. The compressor and decompressor must use exactly the same
- dictionary (see deflateSetDictionary).
-
- inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
- parameter is invalid (such as NULL dictionary) or the stream state is
- inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
- expected one (incorrect Adler32 value). inflateSetDictionary does not
- perform any decompression: this will be done by subsequent calls of
- inflate().
-*/
-
-ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
-/*
- Skips invalid compressed data until a full flush point (see above the
- description of deflate with Z_FULL_FLUSH) can be found, or until all
- available input is skipped. No output is provided.
-
- inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
- if no more input was provided, Z_DATA_ERROR if no flush point has been found,
- or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
- case, the application may save the current current value of total_in which
- indicates where valid compressed data was found. In the error case, the
- application may repeatedly call inflateSync, providing more input each time,
- until success or end of the input data.
-*/
-
-ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
-/*
- This function is equivalent to inflateEnd followed by inflateInit,
- but does not free and reallocate all the internal decompression state.
- The stream will keep attributes that may have been set by inflateInit2.
-
- inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being NULL).
-*/
-
-
- /* utility functions */
-
-/*
- The following utility functions are implemented on top of the
- basic stream-oriented functions. To simplify the interface, some
- default options are assumed (compression level and memory usage,
- standard memory allocation functions). The source code of these
- utility functions can easily be modified if you need special options.
-*/
-
-ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Compresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be at least 0.1% larger than
- sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
- compressed buffer.
- This function can be used to compress a whole file at once if the
- input file is mmap'ed.
- compress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer.
-*/
-
-ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen,
- int level));
-/*
- Compresses the source buffer into the destination buffer. The level
- parameter has the same meaning as in deflateInit. sourceLen is the byte
- length of the source buffer. Upon entry, destLen is the total size of the
- destination buffer, which must be at least 0.1% larger than sourceLen plus
- 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
-
- compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_BUF_ERROR if there was not enough room in the output buffer,
- Z_STREAM_ERROR if the level parameter is invalid.
-*/
-
-ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be large enough to hold the
- entire uncompressed data. (The size of the uncompressed data must have
- been saved previously by the compressor and transmitted to the decompressor
- by some mechanism outside the scope of this compression library.)
- Upon exit, destLen is the actual size of the compressed buffer.
- This function can be used to decompress a whole file at once if the
- input file is mmap'ed.
-
- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer, or Z_DATA_ERROR if the input data was corrupted.
-*/
-
-
-typedef voidp gzFile;
-
-ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
-/*
- Opens a gzip (.gz) file for reading or writing. The mode parameter
- is as in fopen ("rb" or "wb") but can also include a compression level
- ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
- Huffman only compression as in "wb1h". (See the description
- of deflateInit2 for more information about the strategy parameter.)
-
- gzopen can be used to read a file which is not in gzip format; in this
- case gzread will directly read from the file without decompression.
-
- gzopen returns NULL if the file could not be opened or if there was
- insufficient memory to allocate the (de)compression state; errno
- can be checked to distinguish the two cases (if errno is zero, the
- zlib error is Z_MEM_ERROR). */
-
-ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
-/*
- gzdopen() associates a gzFile with the file descriptor fd. File
- descriptors are obtained from calls like open, dup, creat, pipe or
- fileno (in the file has been previously opened with fopen).
- The mode parameter is as in gzopen.
- The next call of gzclose on the returned gzFile will also close the
- file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
- descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
- gzdopen returns NULL if there was insufficient memory to allocate
- the (de)compression state.
-*/
-
-ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
-/*
- Dynamically update the compression level or strategy. See the description
- of deflateInit2 for the meaning of these parameters.
- gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
- opened for writing.
-*/
-
-ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
-/*
- Reads the given number of uncompressed bytes from the compressed file.
- If the input file was not in gzip format, gzread copies the given number
- of bytes into the buffer.
- gzread returns the number of uncompressed bytes actually read (0 for
- end of file, -1 for error). */
-
-ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
- const voidp buf, unsigned len));
-/*
- Writes the given number of uncompressed bytes into the compressed file.
- gzwrite returns the number of uncompressed bytes actually written
- (0 in case of error).
-*/
-
-ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
-/*
- Converts, formats, and writes the args to the compressed file under
- control of the format string, as in fprintf. gzprintf returns the number of
- uncompressed bytes actually written (0 in case of error).
-*/
-
-ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
-/*
- Writes the given null-terminated string to the compressed file, excluding
- the terminating null character.
- gzputs returns the number of characters written, or -1 in case of error.
-*/
-
-ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
-/*
- Reads bytes from the compressed file until len-1 characters are read, or
- a newline character is read and transferred to buf, or an end-of-file
- condition is encountered. The string is then terminated with a null
- character.
- gzgets returns buf, or Z_NULL in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
-/*
- Writes c, converted to an unsigned char, into the compressed file.
- gzputc returns the value that was written, or -1 in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
-/*
- Reads one byte from the compressed file. gzgetc returns this byte
- or -1 in case of end of file or error.
-*/
-
-ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
-/*
- Flushes all pending output into the compressed file. The parameter
- flush is as in the deflate() function. The return value is the zlib
- error number (see function gzerror below). gzflush returns Z_OK if
- the flush parameter is Z_FINISH and all output could be flushed.
- gzflush should be called only when strictly necessary because it can
- degrade compression.
-*/
-
-ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
- z_off_t offset, int whence));
-/*
- Sets the starting position for the next gzread or gzwrite on the
- given compressed file. The offset represents a number of bytes in the
- uncompressed data stream. The whence parameter is defined as in lseek(2);
- the value SEEK_END is not supported.
- If the file is opened for reading, this function is emulated but can be
- extremely slow. If the file is opened for writing, only forward seeks are
- supported; gzseek then compresses a sequence of zeroes up to the new
- starting position.
-
- gzseek returns the resulting offset location as measured in bytes from
- the beginning of the uncompressed stream, or -1 in case of error, in
- particular if the file is opened for writing and the new starting position
- would be before the current position.
-*/
-
-ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
-/*
- Rewinds the given file. This function is supported only for reading.
-
- gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
-*/
-
-ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
-/*
- Returns the starting position for the next gzread or gzwrite on the
- given compressed file. This position represents a number of bytes in the
- uncompressed data stream.
-
- gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
-*/
-
-ZEXTERN int ZEXPORT gzeof OF((gzFile file));
-/*
- Returns 1 when EOF has previously been detected reading the given
- input stream, otherwise zero.
-*/
-
-ZEXTERN int ZEXPORT gzclose OF((gzFile file));
-/*
- Flushes all pending output if necessary, closes the compressed file
- and deallocates all the (de)compression state. The return value is the zlib
- error number (see function gzerror below).
-*/
-
-ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
-/*
- Returns the error message for the last error which occurred on the
- given compressed file. errnum is set to zlib error number. If an
- error occurred in the file system and not in the compression library,
- errnum is set to Z_ERRNO and the application may consult errno
- to get the exact error code.
-*/
-
- /* checksum functions */
-
-/*
- These functions are not related to compression but are exported
- anyway because they might be useful in applications using the
- compression library.
-*/
-
-ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
-
-/*
- Update a running Adler-32 checksum with the bytes buf[0..len-1] and
- return the updated checksum. If buf is NULL, this function returns
- the required initial value for the checksum.
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
- much faster. Usage example:
-
- uLong adler = adler32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- adler = adler32(adler, buffer, length);
- }
- if (adler != original_adler) error();
-*/
-
-ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
-/*
- Update a running crc with the bytes buf[0..len-1] and return the updated
- crc. If buf is NULL, this function returns the required initial value
- for the crc. Pre- and post-conditioning (one's complement) is performed
- within this function so it shouldn't be done by the application.
- Usage example:
-
- uLong crc = crc32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- crc = crc32(crc, buffer, length);
- }
- if (crc != original_crc) error();
-*/
-
-
- /* various hacks, don't look :) */
-
-/* deflateInit and inflateInit are macros to allow checking the zlib version
- * and the compiler's view of z_stream:
- */
-ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
- int windowBits, int memLevel,
- int strategy, const char *version,
- int stream_size));
-ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
- const char *version, int stream_size));
-#define deflateInit(strm, level) \
- deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit(strm) \
- inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
-#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
- deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
- (strategy), ZLIB_VERSION, sizeof(z_stream))
-#define inflateInit2(strm, windowBits) \
- inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
-
-
-#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
- struct internal_state {int dummy;}; /* hack for buggy compilers */
-#endif
-
-ZEXTERN const char * ZEXPORT zError OF((int err));
-ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
-ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _ZLIB_H */
diff --git a/win32/source/xineui.cpp b/win32/source/xineui.cpp index 5214547e4..1059694ec 100644 --- a/win32/source/xineui.cpp +++ b/win32/source/xineui.cpp @@ -1,864 +1,864 @@ -/*
- * Copyright (C) 2000-2001 the xine project
- *
- * This file is part of xine for win32 video player.
- *
- * xine is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * xine is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * Xine win32 UI
- * by Matthew Grooms <elon@altavista.com>
- */
-
-#include "xineui.h"
-#include "common.h"
-
-/*
-#define LOG 1
-*/
-/**/
-
-static char **video_driver_ids;
-static char **audio_driver_ids;
-
-
-static void config_update(xine_cfg_entry_t *entry,
- int type, int min, int max, int value, char *string) {
-
- switch(type) {
-
- case XINE_CONFIG_TYPE_UNKNOWN:
- fprintf(stderr, "Config key '%s' isn't registered yet.\n", entry->key);
- return;
- break;
-
- case XINE_CONFIG_TYPE_RANGE:
- entry->range_min = min;
- entry->range_max = max;
- break;
-
- case XINE_CONFIG_TYPE_STRING:
- entry->str_value = string;
- break;
-
- case XINE_CONFIG_TYPE_ENUM:
- case XINE_CONFIG_TYPE_NUM:
- case XINE_CONFIG_TYPE_BOOL:
- entry->num_value = value;
- break;
-
- default:
- fprintf(stderr, "Unknown config type %d\n", type);
- return;
- break;
- }
-
- xine_config_update_entry(gGui->xine, entry);
-}
-
-static void config_update_num(char *key, int value) {
- xine_cfg_entry_t entry;
-
- if(xine_config_lookup_entry(gGui->xine, key, &entry))
- config_update(&entry, XINE_CONFIG_TYPE_NUM, 0, 0, value, NULL);
- else
- fprintf(stderr, "WOW, key %s isn't registered\n", key);
-}
-
-/*
- * Try to load video output plugin, by stored name or probing
- */
-static xine_video_port_t *load_video_out_driver(int driver_number, win32_visual_t *vis) {
- xine_video_port_t *video_port = NULL;
- int driver_num;
-
-
- /*
- * Setting default (configfile stuff need registering before updating, etc...).
- */
- driver_num =
- xine_config_register_enum(gGui->xine, "video.driver",
- 0, video_driver_ids,
- ("video driver to use"),
- ("Choose video driver. "
- "NOTE: you may restart xine to use the new driver"),
- CONFIG_LEVEL_ADV,
- CONFIG_NO_CB,
- CONFIG_NO_DATA);
-
- if (driver_number < 0) {
- /* video output driver auto-probing */
- const char *const *driver_ids;
- int i;
-
- if((!strcasecmp(video_driver_ids[driver_num], "none")) ||
- (!strcasecmp(video_driver_ids[driver_num], "null"))) {
-
- /*vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t));*/
- video_port = xine_open_video_driver(gGui->xine,
- video_driver_ids[driver_num],
- XINE_VISUAL_TYPE_NONE,
- (void *) vis);
- if (video_port)
- return video_port;
-
- }
- else if(strcasecmp(video_driver_ids[driver_num], "auto")) {
-
- vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t));
- video_port = xine_open_video_driver(gGui->xine,
- video_driver_ids[driver_num],
- XINE_VISUAL_TYPE_WIN32,
- (void *) vis);
- if (video_port)
- return video_port;
- }
-
- /* note: xine-lib can do auto-probing for us if we want.
- * but doing it here should do no harm.
- */
- i = 0;
- driver_ids = xine_list_video_output_plugins (gGui->xine);
-
- while (driver_ids[i]) {
-
- printf (("main: probing <%s> video output plugin\n"), driver_ids[i]);
-
- /*vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t));*/
- video_port = xine_open_video_driver(gGui->xine,
- driver_ids[i],
- XINE_VISUAL_TYPE_WIN32,
- (void *) vis);
- if (video_port) {
- return video_port;
- }
-
- i++;
- }
-
- if (!video_port) {
- printf (("main: all available video drivers failed.\n"));
- exit (1);
- }
-
- }
- else {
-
- /* 'none' plugin is a special case, just change the visual type */
- if((!strcasecmp(video_driver_ids[driver_number], "none"))
- || (!strcasecmp(video_driver_ids[driver_number], "null"))) {
-
- vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t));
- video_port = xine_open_video_driver(gGui->xine,
- video_driver_ids[driver_number],
- XINE_VISUAL_TYPE_NONE,
- (void *) &vis);
-
- /* do not save on config, otherwise user would never see images again... */
- }
- else {
- vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t));
- video_port = xine_open_video_driver(gGui->xine,
- video_driver_ids[driver_number],
- XINE_VISUAL_TYPE_WIN32,
- (void *) &vis);
-
-#if (0)
- /* save requested driver (-V) */
- if(video_port)
- config_update_num("video.driver", driver_number);
-#endif
- }
-
- if(!video_port) {
- printf (("main: video driver <%s> failed\n"), video_driver_ids[driver_number]);
- exit (1);
- }
-
- }
-
- return video_port;
-}
-
-/*
- * Try to load audio output plugin, by stored name or probing
- */
-static xine_audio_port_t *load_audio_out_driver(int driver_number) {
- xine_audio_port_t *audio_port = NULL;
- int driver_num;
-
- /*
- * Setting default (configfile stuff need registering before updating, etc...).
- */
- driver_num =
- xine_config_register_enum(gGui->xine, "video.driver",
- 0, video_driver_ids,
- ("video driver to use"),
- ("Choose video driver. "
- "NOTE: you may restart xine to use the new driver"),
- CONFIG_LEVEL_ADV,
- CONFIG_NO_CB,
- CONFIG_NO_DATA);
-
-
- driver_num =
- xine_config_register_enum(gGui->xine, "audio.driver",
- 0, audio_driver_ids,
- ("audio driver to use"),
- ("Choose audio driver. "
- "NOTE: you may restart xine to use the new driver"),
- CONFIG_LEVEL_ADV,
- CONFIG_NO_CB,
- CONFIG_NO_DATA);
-
- if (driver_number < 0) {
- const char *const *driver_ids;
- int i;
-
- if (strcasecmp(audio_driver_ids[driver_num], "auto")) {
-
- /* don't want to load an audio driver ? */
- if (!strncasecmp(audio_driver_ids[driver_num], "NULL", 4)) {
- printf(("main: not using any audio driver (as requested).\n"));
- return NULL;
- }
-
- audio_port = xine_open_audio_driver(gGui->xine,
- audio_driver_ids[driver_num],
- NULL);
- if (audio_port)
- return audio_port;
- }
-
- /* note: xine-lib can do auto-probing for us if we want.
- * but doing it here should do no harm.
- */
- i = 0;
- driver_ids = xine_list_audio_output_plugins (gGui->xine);
-
- while (driver_ids[i]) {
-
- printf (("main: probing <%s> audio output plugin\n"), driver_ids[i]);
-
- audio_port = xine_open_audio_driver(gGui->xine,
- driver_ids[i],
- NULL);
- if (audio_port) {
- return audio_port;
- }
-
- i++;
- }
-
- printf(("main: audio driver probing failed => no audio output\n"));
- }
- else {
-
- /* don't want to load an audio driver ? */
- if (!strncasecmp (audio_driver_ids[driver_number], "NULL", 4)) {
-
- printf(("main: not using any audio driver (as requested).\n"));
-
- /* calling -A null is useful to developers, but we should not save it at
- * config. if user doesn't have a sound card he may go to setup screen
- * changing audio.driver to NULL in order to make xine start a bit faster.
- */
-
- }
- else {
-
- audio_port = xine_open_audio_driver(gGui->xine, audio_driver_ids[driver_number], NULL);
-
- if (!audio_port) {
- printf (("main: audio driver <%s> failed\n"), audio_driver_ids[driver_number]);
- exit (1);
- }
-
- /* save requested driver (-A) */
- config_update_num("audio.driver", driver_number);
- }
-
- }
-
- return audio_port;
-}
-
-
-static void event_listener(void *user_data, const xine_event_t *event) {
- struct timeval tv;
-
- XINE_UI * xine_ui = ( XINE_UI * ) user_data;
-
- /*
- * Ignoring finished event logo is displayed (or played), that save us
- * from a loop of death
- */
- if(gGui->logo_mode && (event->type == XINE_EVENT_UI_PLAYBACK_FINISHED))
- return;
-
- gettimeofday (&tv, NULL);
-
- if(abs(tv.tv_sec - event->tv.tv_sec) > 3) {
- printf("Event too old, discarding\n");
- return;
- }
-
-
- switch( event->type )
- {
- case XINE_EVENT_UI_CHANNELS_CHANGED:
- {
- xine_ui->spu_channel = xine_get_param(gGui->stream, XINE_PARAM_SPU_CHANNEL);
- xine_ui->audio_channel = xine_get_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL);
- }
- break;
-
- case XINE_EVENT_UI_PLAYBACK_FINISHED:
- xine_ui->Stop();
- xine_ui->Play( xine_ui->playindex + 1 );
- break;
-
-#if (0)
- case XINE_EVENT_NEED_NEXT_MRL:
- {
- xine_next_mrl_event_t * xine_next_mrl_event = ( xine_next_mrl_event_t * ) xine_event;
-
- PLAYITEM * playitem = 0;
- if( xine_ui->playindex < ( xine_ui->playcount - 1 ) )
- {
- xine_ui->mrl_short_name = xine_ui->playlist[ xine_ui->playindex + 1 ]->mrl_short_name;
- xine_ui->mrl_long_name = xine_ui->playlist[ xine_ui->playindex + 1 ]->mrl_long_name;
- xine_next_mrl_event->mrl = xine_ui->mrl_long_name;
- xine_ui->playindex++;
- }
- else
- xine_next_mrl_event->mrl = 0;
-
- xine_next_mrl_event->handled = 1;
- }
- break;
-
- case XINE_EVENT_BRANCHED:
-#ifdef LOG
- printf("xineui.cpp : event received XINE_EVENT_BRANCHED\n");
-#endif
-// gui_branched_callback ();
- break;
-#endif
-
- /* e.g. aspect ratio change during dvd playback */
- case XINE_EVENT_FRAME_FORMAT_CHANGE:
-#ifdef LOG
- printf("xineui.cpp : event received XINE_EVENT_FRAME_FORMAT_CHANGE\n");
-#endif
- break;
-
- /* report current audio level (l/r) */
- case XINE_EVENT_AUDIO_LEVEL:
- if(event->stream == gGui->stream) {
- xine_audio_level_data_t *aevent = (xine_audio_level_data_t *) event->data;
-
- printf("XINE_EVENT_AUDIO_LEVEL: left 0>%d<255, right 0>%d<255\n",
- aevent->left, aevent->right);
- }
- break;
-
- /* last event sent when stream is disposed */
- case XINE_EVENT_QUIT:
-#ifdef LOG
- printf("xineui.cpp : event received XINE_EVENT_QUIT\n");
-#endif
- break;
-
- default:
-#ifdef LOG
- printf("xineui.cpp : unsupported event received 0x%X\n", event->type);
-#endif
- break;
-
- }
-}
-
-_XINE_UI::_XINE_UI()
-{
- memset( this, 0, sizeof( _XINE_UI ) );
-}
-
-_XINE_UI::~_XINE_UI()
-{
- EndGui();
- EndXine();
-}
-
-bool _XINE_UI::InitGui( HINSTANCE hinstance )
-{
- if( !hinstance )
- return false;
-
- hinst = hinstance;
-
- if( !init_ctrlwnd() )
- return false;
-
- if( !init_videownd() )
- return false;
-
- return true;
-}
-
-void _XINE_UI::EndGui()
-{
- end_ctrlwnd();
- end_videownd();
-}
-
-bool _XINE_UI::InitXine()
-{
- int i;
- int audio_channel = -1;
- int spu_channel = -1;
- char *audio_driver_id = NULL;
- char *video_driver_id = NULL;
- int driver_num;
- int session = -1;
- char *session_mrl = NULL;
- int major, minor, sub;
-
- /* Check xine library version */
- if( !xine_check_version( 0, 9, 4 ) )
- {
- xine_get_version(&major, &minor, &sub);
- error( "require xine library version 0.9.4, found %d.%d.%d.\n",
- major, minor, sub );
- return false;
- }
-
- gGui = (gGui_t *) xine_xmalloc(sizeof(gGui_t));
- gui = gGui;
-
- gGui->stream = NULL;
- gGui->debug_level = 0;
- gGui->autoscan_plugin = NULL;
- gGui->network = 0;
- gGui->use_root_window = 0;
-
- /*gGui->vo_port*/
-
-#ifdef HAVE_XF86VIDMODE
- gGui->XF86VidMode_fullscreen = 0;
-#endif
-
-#if (0)
- /* generate and init a config "object" */
- char * cfgfile = "config";
- gGui->configfile = ( char * ) xine_xmalloc( ( strlen( ( xine_get_homedir( ) ) ) + strlen( cfgfile ) ) +2 );
- sprintf( configfile, "%s/%s", ( xine_get_homedir() ), cfgfile );
-
- /*config = config_file_init( configfile );*/
-
-#else
- /*
- * Initialize config
- */
- {
- char *cfgdir = ".xine";
- char *cfgfile = "config";
-
- if (!(gGui->configfile = getenv ("XINERC"))) {
- gGui->configfile = (char *) xine_xmalloc(strlen(xine_get_homedir())
- + strlen(cfgdir)
- + strlen(cfgfile)
- + 3);
- sprintf (gGui->configfile, "%s/%s", xine_get_homedir(), cfgdir);
- mkdir (gGui->configfile, 0755);
- sprintf (gGui->configfile + strlen(gGui->configfile), "/%s", cfgfile);
- }
-
-#if (0)
- /* Popup setup window if there is no config file */
- if(stat(gGui->configfile, &st) < 0)
- gGui->actions_on_start[aos++] = ACTID_SETUP;
-#endif
-
- }
-#endif
-
-
- gGui->xine = xine_new();
- xine_config_load(gGui->xine, gGui->configfile);
-
-#if (0)
- /*
- * init gui
- */
- gui_init(_argc - optind, &_argv[optind], &window_attribute);
-#endif
-
- pthread_mutex_init(&gGui->download_mutex, NULL);
-
-#if (0)
- /* Automatically start playback if new_mode is enabled and playlist is filled */
- if(gGui->smart_mode &&
- (gGui->playlist.num || actions_on_start(gGui->actions_on_start, ACTID_PLAYLIST)) &&
- (!(actions_on_start(gGui->actions_on_start, ACTID_PLAY))))
- gGui->actions_on_start[aos++] = ACTID_PLAY;
-#endif
-
- /*
- * xine init
- */
- xine_init(gGui->xine);
-
-
- /*
- * load and init output drivers
- */
- /* Video out plugin */
- driver_num = -1;
- {
- const char *const *vids = xine_list_video_output_plugins(gGui->xine);
- int i = 0;
-
- while(vids[i++]);
-
- video_driver_ids = (char **) xine_xmalloc(sizeof(char *) * (i + 1));
- i = 0;
- video_driver_ids[i] = strdup("auto");
- while(vids[i]) {
- video_driver_ids[i + 1] = strdup(vids[i]);
- i++;
- }
-
- video_driver_ids[i + 1] = NULL;
-
- if(video_driver_id) {
- for(i = 0; video_driver_ids[i] != NULL; i++) {
- if(!strcasecmp(video_driver_id, video_driver_ids[i])) {
- driver_num = i;
- break;
- }
- }
- }
- gGui->vo_port = load_video_out_driver(driver_num, &win32_visual);
- }
-
- {
- xine_cfg_entry_t cfg_vo_entry;
-
- if(xine_config_lookup_entry(gGui->xine, "video.driver", &cfg_vo_entry)) {
-
- if(!strcasecmp(video_driver_ids[cfg_vo_entry.num_value], "dxr3")) {
- xine_cfg_entry_t cfg_entry;
- }
- }
- }
- SAFE_FREE(video_driver_id);
-
- /* Audio out plugin */
- driver_num = -1;
- {
- const char *const *aids = xine_list_audio_output_plugins(gGui->xine);
- int i = 0;
-
- while(aids[i++]);
-
- audio_driver_ids = (char **) xine_xmalloc(sizeof(char *) * (i + 2));
- i = 0;
- audio_driver_ids[i] = strdup("auto");
- audio_driver_ids[i + 1] = strdup("null");
- while(aids[i]) {
- audio_driver_ids[i + 2] = strdup(aids[i]);
- i++;
- }
-
- audio_driver_ids[i + 2] = NULL;
-
- if(audio_driver_id) {
- for(i = 0; audio_driver_ids[i] != NULL; i++) {
- if(!strcasecmp(audio_driver_id, audio_driver_ids[i])) {
- driver_num = i;
- break;
- }
- }
- }
- gGui->ao_port = load_audio_out_driver(driver_num);
- }
- SAFE_FREE(audio_driver_id);
-
- /* post_init(); */
-
- gGui->stream = xine_stream_new(gGui->xine, gGui->ao_port, gGui->vo_port);
- gGui->spu_stream = xine_stream_new(gGui->xine, NULL, gGui->vo_port);
-
-#if (0)
- osd_init();
-
- /*
- * Setup logo.
- */
- gGui->logo_mode = 0;
- gGui->logo_has_changed = 0;
- gGui->logo_mrl = xine_config_register_string (gGui->xine, "gui.logo_mrl", XINE_LOGO_MRL,
- _("Logo mrl"),
- CONFIG_NO_HELP,
- CONFIG_LEVEL_EXP,
- main_change_logo_cb,
- CONFIG_NO_DATA);
-#endif
-
- gGui->event_queue = xine_event_new_queue(gGui->stream);
- xine_event_create_listener_thread(gGui->event_queue, event_listener, this);
-
- xine_tvmode_init(gGui->xine);
-
-
-#if 1
- xine_set_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, audio_channel);
- xine_set_param(gGui->stream, XINE_PARAM_SPU_CHANNEL, spu_channel);
-#else
- xine_set_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, 0);
- xine_set_param(gGui->stream, XINE_PARAM_SPU_CHANNEL, 0);
-#endif
-
-
-#if 0
- /* Visual animation stream init */
- gGui->visual_anim.stream = xine_stream_new(gGui->xine, NULL, gGui->vo_port);
- gGui->visual_anim.event_queue = xine_event_new_queue(gGui->visual_anim.stream);
- gGui->visual_anim.current = 0;
- xine_event_create_listener_thread(gGui->visual_anim.event_queue, event_listener, this);
- xine_set_param(gGui->visual_anim.stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, -2);
- xine_set_param(gGui->visual_anim.stream, XINE_PARAM_SPU_CHANNEL, -2);
-#endif
-
-#if (0)
- /* Playlist scanning feature stream */
- gGui->playlist.scan_stream = xine_stream_new(gGui->xine, gGui->ao_port, gGui->vo_port);
- xine_set_param(gGui->playlist.scan_stream, XINE_PARAM_SPU_CHANNEL, -2);
-#endif
-
- return true;
-}
-
-void _XINE_UI::EndXine()
-{
- if( gui && gui->xine )
- xine_exit( gui->xine );
-}
-
-void _XINE_UI::error( LPSTR szfmt, ... )
-{
- char tempbuff[ 256 ];
- *tempbuff = 0;
- wvsprintf( &tempbuff[ strlen( tempbuff ) ], szfmt, ( char * )( &szfmt + 1 ) );
- MessageBox( 0, tempbuff, "Error", MB_ICONERROR | MB_OK | MB_APPLMODAL | MB_SYSTEMMODAL );
-}
-
-void _XINE_UI::warning( LPSTR szfmt, ... )
-{
- char tempbuff[ 256 ];
- *tempbuff = 0;
- wvsprintf( &tempbuff[ strlen( tempbuff ) ], szfmt, ( char * )( &szfmt + 1 ) );
- MessageBox( 0, tempbuff, "Warning", MB_ICONWARNING | MB_OK | MB_APPLMODAL | MB_SYSTEMMODAL );
-}
-
-PLAYITEM * _XINE_UI::PlaylistAdd( char * short_name, char * long_name, int type )
-{
- if( playcount >= MAX_PLAYITEMS )
- return false;
-
- PLAYITEM * playitem = new PLAYITEM;
-
- playitem->mrl_short_name = strdup( short_name );
- playitem->mrl_long_name = strdup( long_name );
- playitem->mrl_type = type;
-
- playlist[ playcount ] = playitem;
- playcount++;
-
- return playitem;
-}
-
-bool _XINE_UI::PlaylistDel( int index )
-{
- if( index >= playcount )
- return false;
-
- PLAYITEM * playitem = playlist[ index ];
-
- free( playitem->mrl_short_name );
- free( playitem->mrl_long_name );
-
- delete playitem;
-
- memcpy( &playlist[ index ], &playlist[ index + 1 ], ( playcount - index ) * sizeof( PLAYITEM * ) );
- playcount--;
-
- if( ( index < playindex ) && ( playcount > 0 ) )
- playindex--;
-
- if( index == playindex )
- {
- if( playindex >= playcount )
- playindex--;
-
- mrl_short_name = 0;
- mrl_long_name = 0;
- Stop();
- }
-
- return true;
-}
-
-bool _XINE_UI::Play( int newindex )
-{
- int pos_stream, pos_time;
- int length_time;
-
- // if we are paused, just continue playing
-
- if( mode == XINE_STATUS_PLAY )
- {
- SetSpeed( XINE_SPEED_NORMAL );
- return true;
- }
-
- // make sure the playindex is valid
-
- if( ( newindex >= 0 ) && ( newindex < playcount ) )
- playindex = newindex;
- else
- return false;
-
- // is this different mrl then we are already playing
-
- if( newindex == playindex )
- {
- // its the same, play from current time
-
- HWND htimebar = GetDlgItem( hctrlwnd, ID_TIMEBAR );
- mrl_time_current = SendMessage( htimebar, TBM_GETPOS, (WPARAM) 0, (LPARAM) 0 );
- }
- else
- {
- // its different, rewind and play from 0
-
- mrl_time_current = 0;
- }
-
- // store our new mrl info
-
- mrl_short_name = playlist[ playindex ]->mrl_short_name;
- mrl_long_name = playlist[ playindex ]->mrl_long_name;
- mrl_type = playlist[ playindex ]->mrl_type;
-
- // play our mrl
- if(!xine_open(gGui->stream, (const char *)mrl_long_name)) {
- return 0;
- }
-
- if(xine_play(gGui->stream, 0, mrl_time_current))
- {
- mrl_time_length = 0;
- if (xine_get_pos_length (gGui->stream, &pos_stream, &pos_time, &length_time))
- {
- mrl_time_length = length_time/1000;
- }
-
- /*mrl_time_length = xine_get_stream_length( gGui->stream )/1000;*/
-
- HWND htimebar = GetDlgItem( hctrlwnd, ID_TIMEBAR );
- SendMessage( htimebar, TBM_SETRANGE, (WPARAM) TRUE, (LPARAM) MAKELONG( 0, mrl_time_length ) );
- mode = XINE_STATUS_PLAY;
-
- // start our update loop
-
- UpdateLoop();
- }
-
- return true;
-}
-
-bool _XINE_UI::Stop()
-{
- mode = XINE_STATUS_STOP;
- mrl_time_current = 0;
- UpdateCtrl();
- UpdatePanel();
- xine_stop( gGui->stream );
-
- return true;
-}
-
-bool _XINE_UI::SetSpeed( int speed )
-{
- /*xine_set_speed( gGui->stream, speed );*/
- xine_set_param(gGui->stream, XINE_PARAM_SPEED, speed);
- return true;
-}
-
-int _XINE_UI::GetSpeed()
-{
- /*return xine_get_speed( gGui->stream );*/
- return xine_get_param(gGui->stream, XINE_PARAM_SPEED);
-
-}
-
-bool _XINE_UI::SetTime( int time )
-{
- if( mode == XINE_STATUS_PLAY )
- {
- if(!xine_open(gGui->stream, (const char *)mrl_long_name)) {
- return false;
- }
-
- xine_play(gGui->stream, 0, time);
-
-
- mrl_time_current = time;
- }
-
- return true;
-}
-
-bool _XINE_UI::SelectSpuChannel( int channel )
-{
- xine_set_param(gGui->stream, XINE_PARAM_SPU_CHANNEL, channel);
- return true;
-}
-
-bool _XINE_UI::SelectAudioChannel( int channel )
-{
- xine_set_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, channel);
- return true;
-}
-
-bool _XINE_UI::SetVolume( int volume )
-{
- xine_set_param(gGui->stream, XINE_PARAM_AUDIO_VOLUME, volume);
- return true;
-}
-
-bool _XINE_UI::SetMute( bool mute )
-{
- xine_set_param(gGui->stream, XINE_PARAM_AUDIO_MUTE, mute);
- return true;
-}
-
-bool _XINE_UI::DriverMessage( int type, void * param )
-{
- gGui->vo_port->driver->gui_data_exchange( gGui->vo_port->driver, type, param );
- return true;
-}
-
+/* + * Copyright (C) 2000-2001 the xine project + * + * This file is part of xine for win32 video player. + * + * xine is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * xine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * Xine win32 UI + * by Matthew Grooms <elon@altavista.com> + */ + +#include "xineui.h" +#include "common.h" + +/* +#define LOG 1 +*/ +/**/ + +static char **video_driver_ids; +static char **audio_driver_ids; + + +static void config_update(xine_cfg_entry_t *entry, + int type, int min, int max, int value, char *string) { + + switch(type) { + + case XINE_CONFIG_TYPE_UNKNOWN: + fprintf(stderr, "Config key '%s' isn't registered yet.\n", entry->key); + return; + break; + + case XINE_CONFIG_TYPE_RANGE: + entry->range_min = min; + entry->range_max = max; + break; + + case XINE_CONFIG_TYPE_STRING: + entry->str_value = string; + break; + + case XINE_CONFIG_TYPE_ENUM: + case XINE_CONFIG_TYPE_NUM: + case XINE_CONFIG_TYPE_BOOL: + entry->num_value = value; + break; + + default: + fprintf(stderr, "Unknown config type %d\n", type); + return; + break; + } + + xine_config_update_entry(gGui->xine, entry); +} + +static void config_update_num(char *key, int value) { + xine_cfg_entry_t entry; + + if(xine_config_lookup_entry(gGui->xine, key, &entry)) + config_update(&entry, XINE_CONFIG_TYPE_NUM, 0, 0, value, NULL); + else + fprintf(stderr, "WOW, key %s isn't registered\n", key); +} + +/* + * Try to load video output plugin, by stored name or probing + */ +static xine_video_port_t *load_video_out_driver(int driver_number, win32_visual_t *vis) { + xine_video_port_t *video_port = NULL; + int driver_num; + + + /* + * Setting default (configfile stuff need registering before updating, etc...). + */ + driver_num = + xine_config_register_enum(gGui->xine, "video.driver", + 0, video_driver_ids, + ("video driver to use"), + ("Choose video driver. " + "NOTE: you may restart xine to use the new driver"), + CONFIG_LEVEL_ADV, + CONFIG_NO_CB, + CONFIG_NO_DATA); + + if (driver_number < 0) { + /* video output driver auto-probing */ + const char *const *driver_ids; + int i; + + if((!strcasecmp(video_driver_ids[driver_num], "none")) || + (!strcasecmp(video_driver_ids[driver_num], "null"))) { + + /*vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t));*/ + video_port = xine_open_video_driver(gGui->xine, + video_driver_ids[driver_num], + XINE_VISUAL_TYPE_NONE, + (void *) vis); + if (video_port) + return video_port; + + } + else if(strcasecmp(video_driver_ids[driver_num], "auto")) { + + vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t)); + video_port = xine_open_video_driver(gGui->xine, + video_driver_ids[driver_num], + XINE_VISUAL_TYPE_DIRECTX, + (void *) vis); + if (video_port) + return video_port; + } + + /* note: xine-lib can do auto-probing for us if we want. + * but doing it here should do no harm. + */ + i = 0; + driver_ids = xine_list_video_output_plugins (gGui->xine); + + while (driver_ids[i]) { + + printf (("main: probing <%s> video output plugin\n"), driver_ids[i]); + + /*vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t));*/ + video_port = xine_open_video_driver(gGui->xine, + driver_ids[i], + XINE_VISUAL_TYPE_WIN32, + (void *) vis); + if (video_port) { + return video_port; + } + + i++; + } + + if (!video_port) { + printf (("main: all available video drivers failed.\n")); + exit (1); + } + + } + else { + + /* 'none' plugin is a special case, just change the visual type */ + if((!strcasecmp(video_driver_ids[driver_number], "none")) + || (!strcasecmp(video_driver_ids[driver_number], "null"))) { + + vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t)); + video_port = xine_open_video_driver(gGui->xine, + video_driver_ids[driver_number], + XINE_VISUAL_TYPE_NONE, + (void *) &vis); + + /* do not save on config, otherwise user would never see images again... */ + } + else { + vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t)); + video_port = xine_open_video_driver(gGui->xine, + video_driver_ids[driver_number], + XINE_VISUAL_TYPE_WIN32, + (void *) &vis); + +#if (0) + /* save requested driver (-V) */ + if(video_port) + config_update_num("video.driver", driver_number); +#endif + } + + if(!video_port) { + printf (("main: video driver <%s> failed\n"), video_driver_ids[driver_number]); + exit (1); + } + + } + + return video_port; +} + +/* + * Try to load audio output plugin, by stored name or probing + */ +static xine_audio_port_t *load_audio_out_driver(int driver_number) { + xine_audio_port_t *audio_port = NULL; + int driver_num; + + /* + * Setting default (configfile stuff need registering before updating, etc...). + */ + driver_num = + xine_config_register_enum(gGui->xine, "video.driver", + 0, video_driver_ids, + ("video driver to use"), + ("Choose video driver. " + "NOTE: you may restart xine to use the new driver"), + CONFIG_LEVEL_ADV, + CONFIG_NO_CB, + CONFIG_NO_DATA); + + + driver_num = + xine_config_register_enum(gGui->xine, "audio.driver", + 0, audio_driver_ids, + ("audio driver to use"), + ("Choose audio driver. " + "NOTE: you may restart xine to use the new driver"), + CONFIG_LEVEL_ADV, + CONFIG_NO_CB, + CONFIG_NO_DATA); + + if (driver_number < 0) { + const char *const *driver_ids; + int i; + + if (strcasecmp(audio_driver_ids[driver_num], "auto")) { + + /* don't want to load an audio driver ? */ + if (!strncasecmp(audio_driver_ids[driver_num], "NULL", 4)) { + printf(("main: not using any audio driver (as requested).\n")); + return NULL; + } + + audio_port = xine_open_audio_driver(gGui->xine, + audio_driver_ids[driver_num], + NULL); + if (audio_port) + return audio_port; + } + + /* note: xine-lib can do auto-probing for us if we want. + * but doing it here should do no harm. + */ + i = 0; + driver_ids = xine_list_audio_output_plugins (gGui->xine); + + while (driver_ids[i]) { + + printf (("main: probing <%s> audio output plugin\n"), driver_ids[i]); + + audio_port = xine_open_audio_driver(gGui->xine, + driver_ids[i], + NULL); + if (audio_port) { + return audio_port; + } + + i++; + } + + printf(("main: audio driver probing failed => no audio output\n")); + } + else { + + /* don't want to load an audio driver ? */ + if (!strncasecmp (audio_driver_ids[driver_number], "NULL", 4)) { + + printf(("main: not using any audio driver (as requested).\n")); + + /* calling -A null is useful to developers, but we should not save it at + * config. if user doesn't have a sound card he may go to setup screen + * changing audio.driver to NULL in order to make xine start a bit faster. + */ + + } + else { + + audio_port = xine_open_audio_driver(gGui->xine, audio_driver_ids[driver_number], NULL); + + if (!audio_port) { + printf (("main: audio driver <%s> failed\n"), audio_driver_ids[driver_number]); + exit (1); + } + + /* save requested driver (-A) */ + config_update_num("audio.driver", driver_number); + } + + } + + return audio_port; +} + + +static void event_listener(void *user_data, const xine_event_t *event) { + struct timeval tv; + + XINE_UI * xine_ui = ( XINE_UI * ) user_data; + + /* + * Ignoring finished event logo is displayed (or played), that save us + * from a loop of death + */ + if(gGui->logo_mode && (event->type == XINE_EVENT_UI_PLAYBACK_FINISHED)) + return; + + gettimeofday (&tv, NULL); + + if(abs(tv.tv_sec - event->tv.tv_sec) > 3) { + printf("Event too old, discarding\n"); + return; + } + + + switch( event->type ) + { + case XINE_EVENT_UI_CHANNELS_CHANGED: + { + xine_ui->spu_channel = xine_get_param(gGui->stream, XINE_PARAM_SPU_CHANNEL); + xine_ui->audio_channel = xine_get_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL); + } + break; + + case XINE_EVENT_UI_PLAYBACK_FINISHED: + xine_ui->Stop(); + xine_ui->Play( xine_ui->playindex + 1 ); + break; + +#if (0) + case XINE_EVENT_NEED_NEXT_MRL: + { + xine_next_mrl_event_t * xine_next_mrl_event = ( xine_next_mrl_event_t * ) xine_event; + + PLAYITEM * playitem = 0; + if( xine_ui->playindex < ( xine_ui->playcount - 1 ) ) + { + xine_ui->mrl_short_name = xine_ui->playlist[ xine_ui->playindex + 1 ]->mrl_short_name; + xine_ui->mrl_long_name = xine_ui->playlist[ xine_ui->playindex + 1 ]->mrl_long_name; + xine_next_mrl_event->mrl = xine_ui->mrl_long_name; + xine_ui->playindex++; + } + else + xine_next_mrl_event->mrl = 0; + + xine_next_mrl_event->handled = 1; + } + break; + + case XINE_EVENT_BRANCHED: +#ifdef LOG + printf("xineui.cpp : event received XINE_EVENT_BRANCHED\n"); +#endif +// gui_branched_callback (); + break; +#endif + + /* e.g. aspect ratio change during dvd playback */ + case XINE_EVENT_FRAME_FORMAT_CHANGE: +#ifdef LOG + printf("xineui.cpp : event received XINE_EVENT_FRAME_FORMAT_CHANGE\n"); +#endif + break; + + /* report current audio level (l/r) */ + case XINE_EVENT_AUDIO_LEVEL: + if(event->stream == gGui->stream) { + xine_audio_level_data_t *aevent = (xine_audio_level_data_t *) event->data; + + printf("XINE_EVENT_AUDIO_LEVEL: left 0>%d<255, right 0>%d<255\n", + aevent->left, aevent->right); + } + break; + + /* last event sent when stream is disposed */ + case XINE_EVENT_QUIT: +#ifdef LOG + printf("xineui.cpp : event received XINE_EVENT_QUIT\n"); +#endif + break; + + default: +#ifdef LOG + printf("xineui.cpp : unsupported event received 0x%X\n", event->type); +#endif + break; + + } +} + +_XINE_UI::_XINE_UI() +{ + memset( this, 0, sizeof( _XINE_UI ) ); +} + +_XINE_UI::~_XINE_UI() +{ + EndGui(); + EndXine(); +} + +bool _XINE_UI::InitGui( HINSTANCE hinstance ) +{ + if( !hinstance ) + return false; + + hinst = hinstance; + + if( !init_ctrlwnd() ) + return false; + + if( !init_videownd() ) + return false; + + return true; +} + +void _XINE_UI::EndGui() +{ + end_ctrlwnd(); + end_videownd(); +} + +bool _XINE_UI::InitXine() +{ + int i; + int audio_channel = -1; + int spu_channel = -1; + char *audio_driver_id = NULL; + char *video_driver_id = NULL; + int driver_num; + int session = -1; + char *session_mrl = NULL; + int major, minor, sub; + + /* Check xine library version */ + if( !xine_check_version( 0, 9, 4 ) ) + { + xine_get_version(&major, &minor, &sub); + error( "require xine library version 0.9.4, found %d.%d.%d.\n", + major, minor, sub ); + return false; + } + + gGui = (gGui_t *) xine_xmalloc(sizeof(gGui_t)); + gui = gGui; + + gGui->stream = NULL; + gGui->debug_level = 0; + gGui->autoscan_plugin = NULL; + gGui->network = 0; + gGui->use_root_window = 0; + + /*gGui->vo_port*/ + +#ifdef HAVE_XF86VIDMODE + gGui->XF86VidMode_fullscreen = 0; +#endif + +#if (0) + /* generate and init a config "object" */ + char * cfgfile = "config"; + gGui->configfile = ( char * ) xine_xmalloc( ( strlen( ( xine_get_homedir( ) ) ) + strlen( cfgfile ) ) +2 ); + sprintf( configfile, "%s/%s", ( xine_get_homedir() ), cfgfile ); + + /*config = config_file_init( configfile );*/ + +#else + /* + * Initialize config + */ + { + char *cfgdir = ".xine"; + char *cfgfile = "config"; + + if (!(gGui->configfile = getenv ("XINERC"))) { + gGui->configfile = (char *) xine_xmalloc(strlen(xine_get_homedir()) + + strlen(cfgdir) + + strlen(cfgfile) + + 3); + sprintf (gGui->configfile, "%s/%s", xine_get_homedir(), cfgdir); + mkdir (gGui->configfile, 0755); + sprintf (gGui->configfile + strlen(gGui->configfile), "/%s", cfgfile); + } + +#if (0) + /* Popup setup window if there is no config file */ + if(stat(gGui->configfile, &st) < 0) + gGui->actions_on_start[aos++] = ACTID_SETUP; +#endif + + } +#endif + + + gGui->xine = xine_new(); + xine_config_load(gGui->xine, gGui->configfile); + +#if (0) + /* + * init gui + */ + gui_init(_argc - optind, &_argv[optind], &window_attribute); +#endif + + pthread_mutex_init(&gGui->download_mutex, NULL); + +#if (0) + /* Automatically start playback if new_mode is enabled and playlist is filled */ + if(gGui->smart_mode && + (gGui->playlist.num || actions_on_start(gGui->actions_on_start, ACTID_PLAYLIST)) && + (!(actions_on_start(gGui->actions_on_start, ACTID_PLAY)))) + gGui->actions_on_start[aos++] = ACTID_PLAY; +#endif + + /* + * xine init + */ + xine_init(gGui->xine); + + + /* + * load and init output drivers + */ + /* Video out plugin */ + driver_num = -1; + { + const char *const *vids = xine_list_video_output_plugins(gGui->xine); + int i = 0; + + while(vids[i++]); + + video_driver_ids = (char **) xine_xmalloc(sizeof(char *) * (i + 1)); + i = 0; + video_driver_ids[i] = strdup("auto"); + while(vids[i]) { + video_driver_ids[i + 1] = strdup(vids[i]); + i++; + } + + video_driver_ids[i + 1] = NULL; + + if(video_driver_id) { + for(i = 0; video_driver_ids[i] != NULL; i++) { + if(!strcasecmp(video_driver_id, video_driver_ids[i])) { + driver_num = i; + break; + } + } + } + gGui->vo_port = load_video_out_driver(driver_num, &win32_visual); + } + + { + xine_cfg_entry_t cfg_vo_entry; + + if(xine_config_lookup_entry(gGui->xine, "video.driver", &cfg_vo_entry)) { + + if(!strcasecmp(video_driver_ids[cfg_vo_entry.num_value], "dxr3")) { + xine_cfg_entry_t cfg_entry; + } + } + } + SAFE_FREE(video_driver_id); + + /* Audio out plugin */ + driver_num = -1; + { + const char *const *aids = xine_list_audio_output_plugins(gGui->xine); + int i = 0; + + while(aids[i++]); + + audio_driver_ids = (char **) xine_xmalloc(sizeof(char *) * (i + 2)); + i = 0; + audio_driver_ids[i] = strdup("auto"); + audio_driver_ids[i + 1] = strdup("null"); + while(aids[i]) { + audio_driver_ids[i + 2] = strdup(aids[i]); + i++; + } + + audio_driver_ids[i + 2] = NULL; + + if(audio_driver_id) { + for(i = 0; audio_driver_ids[i] != NULL; i++) { + if(!strcasecmp(audio_driver_id, audio_driver_ids[i])) { + driver_num = i; + break; + } + } + } + gGui->ao_port = load_audio_out_driver(driver_num); + } + SAFE_FREE(audio_driver_id); + + /* post_init(); */ + + gGui->stream = xine_stream_new(gGui->xine, gGui->ao_port, gGui->vo_port); + gGui->spu_stream = xine_stream_new(gGui->xine, NULL, gGui->vo_port); + +#if (0) + osd_init(); + + /* + * Setup logo. + */ + gGui->logo_mode = 0; + gGui->logo_has_changed = 0; + gGui->logo_mrl = xine_config_register_string (gGui->xine, "gui.logo_mrl", XINE_LOGO_MRL, + _("Logo mrl"), + CONFIG_NO_HELP, + CONFIG_LEVEL_EXP, + main_change_logo_cb, + CONFIG_NO_DATA); +#endif + + gGui->event_queue = xine_event_new_queue(gGui->stream); + xine_event_create_listener_thread(gGui->event_queue, event_listener, this); + + xine_tvmode_init(gGui->xine); + + +#if 1 + xine_set_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, audio_channel); + xine_set_param(gGui->stream, XINE_PARAM_SPU_CHANNEL, spu_channel); +#else + xine_set_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, 0); + xine_set_param(gGui->stream, XINE_PARAM_SPU_CHANNEL, 0); +#endif + + +#if 0 + /* Visual animation stream init */ + gGui->visual_anim.stream = xine_stream_new(gGui->xine, NULL, gGui->vo_port); + gGui->visual_anim.event_queue = xine_event_new_queue(gGui->visual_anim.stream); + gGui->visual_anim.current = 0; + xine_event_create_listener_thread(gGui->visual_anim.event_queue, event_listener, this); + xine_set_param(gGui->visual_anim.stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, -2); + xine_set_param(gGui->visual_anim.stream, XINE_PARAM_SPU_CHANNEL, -2); +#endif + +#if (0) + /* Playlist scanning feature stream */ + gGui->playlist.scan_stream = xine_stream_new(gGui->xine, gGui->ao_port, gGui->vo_port); + xine_set_param(gGui->playlist.scan_stream, XINE_PARAM_SPU_CHANNEL, -2); +#endif + + return true; +} + +void _XINE_UI::EndXine() +{ + if( gui && gui->xine ) + xine_exit( gui->xine ); +} + +void _XINE_UI::error( LPSTR szfmt, ... ) +{ + char tempbuff[ 256 ]; + *tempbuff = 0; + wvsprintf( &tempbuff[ strlen( tempbuff ) ], szfmt, ( char * )( &szfmt + 1 ) ); + MessageBox( 0, tempbuff, "Error", MB_ICONERROR | MB_OK | MB_APPLMODAL | MB_SYSTEMMODAL ); +} + +void _XINE_UI::warning( LPSTR szfmt, ... ) +{ + char tempbuff[ 256 ]; + *tempbuff = 0; + wvsprintf( &tempbuff[ strlen( tempbuff ) ], szfmt, ( char * )( &szfmt + 1 ) ); + MessageBox( 0, tempbuff, "Warning", MB_ICONWARNING | MB_OK | MB_APPLMODAL | MB_SYSTEMMODAL ); +} + +PLAYITEM * _XINE_UI::PlaylistAdd( char * short_name, char * long_name, int type ) +{ + if( playcount >= MAX_PLAYITEMS ) + return false; + + PLAYITEM * playitem = new PLAYITEM; + + playitem->mrl_short_name = strdup( short_name ); + playitem->mrl_long_name = strdup( long_name ); + playitem->mrl_type = type; + + playlist[ playcount ] = playitem; + playcount++; + + return playitem; +} + +bool _XINE_UI::PlaylistDel( int index ) +{ + if( index >= playcount ) + return false; + + PLAYITEM * playitem = playlist[ index ]; + + free( playitem->mrl_short_name ); + free( playitem->mrl_long_name ); + + delete playitem; + + memcpy( &playlist[ index ], &playlist[ index + 1 ], ( playcount - index ) * sizeof( PLAYITEM * ) ); + playcount--; + + if( ( index < playindex ) && ( playcount > 0 ) ) + playindex--; + + if( index == playindex ) + { + if( playindex >= playcount ) + playindex--; + + mrl_short_name = 0; + mrl_long_name = 0; + Stop(); + } + + return true; +} + +bool _XINE_UI::Play( int newindex ) +{ + int pos_stream, pos_time; + int length_time; + + // if we are paused, just continue playing + + if( mode == XINE_STATUS_PLAY ) + { + SetSpeed( XINE_SPEED_NORMAL ); + return true; + } + + // make sure the playindex is valid + + if( ( newindex >= 0 ) && ( newindex < playcount ) ) + playindex = newindex; + else + return false; + + // is this different mrl then we are already playing + + if( newindex == playindex ) + { + // its the same, play from current time + + HWND htimebar = GetDlgItem( hctrlwnd, ID_TIMEBAR ); + mrl_time_current = SendMessage( htimebar, TBM_GETPOS, (WPARAM) 0, (LPARAM) 0 ); + } + else + { + // its different, rewind and play from 0 + + mrl_time_current = 0; + } + + // store our new mrl info + + mrl_short_name = playlist[ playindex ]->mrl_short_name; + mrl_long_name = playlist[ playindex ]->mrl_long_name; + mrl_type = playlist[ playindex ]->mrl_type; + + // play our mrl + if(!xine_open(gGui->stream, (const char *)mrl_long_name)) { + return 0; + } + + if(xine_play(gGui->stream, 0, mrl_time_current)) + { + mrl_time_length = 0; + if (xine_get_pos_length (gGui->stream, &pos_stream, &pos_time, &length_time)) + { + mrl_time_length = length_time/1000; + } + + /*mrl_time_length = xine_get_stream_length( gGui->stream )/1000;*/ + + HWND htimebar = GetDlgItem( hctrlwnd, ID_TIMEBAR ); + SendMessage( htimebar, TBM_SETRANGE, (WPARAM) TRUE, (LPARAM) MAKELONG( 0, mrl_time_length ) ); + mode = XINE_STATUS_PLAY; + + // start our update loop + + UpdateLoop(); + } + + return true; +} + +bool _XINE_UI::Stop() +{ + mode = XINE_STATUS_STOP; + mrl_time_current = 0; + UpdateCtrl(); + UpdatePanel(); + xine_stop( gGui->stream ); + + return true; +} + +bool _XINE_UI::SetSpeed( int speed ) +{ + /*xine_set_speed( gGui->stream, speed );*/ + xine_set_param(gGui->stream, XINE_PARAM_SPEED, speed); + return true; +} + +int _XINE_UI::GetSpeed() +{ + /*return xine_get_speed( gGui->stream );*/ + return xine_get_param(gGui->stream, XINE_PARAM_SPEED); + +} + +bool _XINE_UI::SetTime( int time ) +{ + if( mode == XINE_STATUS_PLAY ) + { + if(!xine_open(gGui->stream, (const char *)mrl_long_name)) { + return false; + } + + xine_play(gGui->stream, 0, time); + + + mrl_time_current = time; + } + + return true; +} + +bool _XINE_UI::SelectSpuChannel( int channel ) +{ + xine_set_param(gGui->stream, XINE_PARAM_SPU_CHANNEL, channel); + return true; +} + +bool _XINE_UI::SelectAudioChannel( int channel ) +{ + xine_set_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, channel); + return true; +} + +bool _XINE_UI::SetVolume( int volume ) +{ + xine_set_param(gGui->stream, XINE_PARAM_AUDIO_VOLUME, volume); + return true; +} + +bool _XINE_UI::SetMute( bool mute ) +{ + xine_set_param(gGui->stream, XINE_PARAM_AUDIO_MUTE, mute); + return true; +} + +bool _XINE_UI::DriverMessage( int type, void * param ) +{ + gGui->vo_port->driver->gui_data_exchange( gGui->vo_port->driver, type, param ); + return true; +} + |