// AVI & MPEG Player v0.18 (C) 2000-2001. by A'rpi/ESP-team
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <time.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "version.h"
#include "config.h"
#ifdef __FreeBSD__
#include <sys/cdrio.h>
#endif
#ifdef sun
#define DEFAULT_CDROM_DEVICE "/vol/dev/aliases/cdrom0"
#else
#define DEFAULT_CDROM_DEVICE "/dev/cdrom"
#endif
#include "cfgparser.h"
#include "cfg-mplayer-def.h"
#ifdef USE_SUB
#include "subreader.h"
#endif
#ifdef USE_LIBVO2
#include "libvo2/libvo2.h"
#else
#include "libvo/video_out.h"
#endif
//#ifdef USE_OSD
#include "libvo/sub.h"
//#endif
#include "libao2/audio_out.h"
#include "libmpeg2/mpeg2.h"
#include "libmpeg2/mpeg2_internal.h"
#include "loader.h"
#include "wine/avifmt.h"
#include "codec-cfg.h"
#include "dvdauth.h"
#include "spudec.h"
extern char* win32_codec_name; // must be set before calling DrvOpen() !!!
#include "linux/getch2.h"
#include "linux/keycodes.h"
#include "linux/timer.h"
#include "linux/shmem.h"
#ifdef HAVE_LIRC
#include "lirc_mp.h"
#endif
#include "help_mp.h"
#ifdef STREAMING
#include "url.h"
#include "network.h"
static URL_t* url;
#endif
#define DEBUG if(0)
#ifdef HAVE_GUI
int nogui=1;
#endif
int verbose=0;
#define ABS(x) (((x)>=0)?(x):(-(x)))
#ifdef USE_SUB
void find_sub(subtitle* subtitles,int key);
#endif
static int
usec_sleep(int usec_delay)
{
#if 1
struct timespec ts;
ts.tv_sec = usec_delay / 1000000;
ts.tv_nsec = (usec_delay % 1000000) * 1000;
return nanosleep(&ts, NULL);
#else
return usleep(usec_delay);
#endif
}
//**************************************************************************//
// Config file
//**************************************************************************//
static int cfg_inc_verbose(struct config *conf){
++verbose;
return 0;
}
static int cfg_include(struct config *conf, char *filename){
return parse_config_file(conf, filename);
}
char *get_path(char *filename){
char *homedir;
char *buff;
static char *config_dir = "/.mplayer";
int len;
if ((homedir = getenv("HOME")) == NULL)
return NULL;
len = strlen(homedir) + strlen(config_dir) + 1;
if (filename == NULL) {
if ((buff = (char *) malloc(len)) == NULL)
return NULL;
sprintf(buff, "%s%s", homedir, conf
|