[Mplayer-cvslog] CVS: main configure.FreeBSD,NONE,1.1 vcd_read_fbsd.c,NONE,1.1 Makefile,1.37,1.38 configure,1.54,1.55 mplayer.c,1.137,1.138 stream.c,1.7,1.8

GEREOFFY arpi_esp at users.sourceforge.net
Sun Jun 3 02:31:43 CEST 2001


Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv11294

Modified Files:
	Makefile configure mplayer.c stream.c 
Added Files:
	configure.FreeBSD vcd_read_fbsd.c 
Log Message:
FreeBSD support by Vladimir Kushnir vkushnir at Alfacom.net

--- NEW FILE ---
#!/bin/sh

#
# MPlayer configurator.   (C) 2000 Pontscho/fresh!mindworkz
#				   pontscho at makacs.poliod.hu
#
# Changes in reversed order:
#
# 2001/05/40 by LGB
#  - added --prefix support
#
# 2001/05/22 by Nick Kurshev
#  - added definition of CPU clone
#
# 2001/04/16 by LGB
#  - added libcss stuffs
#
# 2001/04/15 by Pontscho
#  - added --disable-select option
[...1243 lines suppressed...]
 echo
fi

if [ $_sdl = outdated ]; then
 echo "You have libSDL installed, but your version is outdated (earlier then"
 echo "v.1.1.7), SDL support has been disabled please update, if you want to"
 echo "use it (libSDL v1.1.8 and v1.2.0 are tested and known to work, recent"
 echo "versions are available from http://www.libsdl.org/)."
 echo "After updating you need to re-run ./configure and recompile to enable SDL."
 echo
fi

if [ $_win32libdirnotify = yes ]; then
 echo "Missing WIN32 codecs dir at $_win32libdir !"
 echo "Make it and copy DLL files to there! (You can get them from your windows"
 echo "directory or download ftp://thot.banki.hu/esp-team/linux/MPlayer/w32codec.zip"
else
 echo "Ok, Win32 codecs directory at $_win32libdir already exists."
fi


--- NEW FILE ---
//=================== VideoCD ==========================
#define	CDROM_LEADOUT	0xAA

typedef	struct {
	unsigned char   unused;
	unsigned char   minute;
	unsigned char   second;
	unsigned char   frame;
} cdrom_msf;

static struct ioc_read_toc_single_entry vcd_entry;

static inline void vcd_set_msf(unsigned int sect){
  vcd_entry.entry.addr.msf.frame=sect%75;
  sect=sect/75;
  vcd_entry.entry.addr.msf.second=sect%60;
  sect=sect/60;
  vcd_entry.entry.addr.msf.minute=sect;
}

static inline unsigned int vcd_get_msf(){
  return vcd_entry.entry.addr.msf.frame +
        (vcd_entry.entry.addr.msf.second+
         vcd_entry.entry.addr.msf.minute*60)*75;
}

int vcd_seek_to_track(int fd,int track){
  vcd_entry.address_format = CD_MSF_FORMAT;
  vcd_entry.track  = track;
  if (ioctl(fd, CDIOREADTOCENTRY, &vcd_entry)) {
    perror("ioctl dif1");
    return -1;
  }
  return VCD_SECTOR_DATA*vcd_get_msf();
}

int vcd_get_track_end(int fd,int track){
  struct ioc_toc_header tochdr;
  if (ioctl(fd,CDIOREADTOCHEADER,&tochdr)==-1)
    { perror("read CDROM toc header: "); return -1; }
  vcd_entry.address_format = CD_MSF_FORMAT;
  vcd_entry.track  = track<tochdr.ending_track?(track+1):CDROM_LEADOUT;
  if (ioctl(fd, CDIOREADTOCENTRY, &vcd_entry)) {
    perror("ioctl dif2");
    return -1;
  }
  return VCD_SECTOR_DATA*vcd_get_msf();
}

void vcd_read_toc(int fd){
  struct ioc_toc_header tochdr;
  int i;
  if (ioctl(fd,CDIOREADTOCHEADER,&tochdr)==-1)
    { perror("read CDROM toc header: "); return; }
  for (i=tochdr.starting_track ; i<=tochdr.ending_track ; i++){
      struct ioc_read_toc_single_entry tocentry;

      tocentry.track  = i;
      tocentry.address_format = CD_MSF_FORMAT;

      if (ioctl(fd,CDIOREADTOCENTRY,&tocentry)==-1)
	{ perror("read CDROM toc entry: "); return; }
        
      printf("track %02d:  adr=%d  ctrl=%d  format=%d  %02d:%02d:%02d\n",
          (int)tocentry.track,
          (int)tocentry.entry.addr_type,
          (int)tocentry.entry.control,
          (int)tocentry.address_format,
          (int)tocentry.entry.addr.msf.minute,
          (int)tocentry.entry.addr.msf.second,
          (int)tocentry.entry.addr.msf.frame
      );
    }
}

static char vcd_buf[VCD_SECTOR_SIZE];

static int vcd_read(int fd,char *mem){
      memcpy(vcd_buf,&vcd_entry.entry.addr.msf,sizeof(cdrom_msf));
/*      if(ioctl(fd,CDROMREADRAW,vcd_buf)==-1) return 0; */ // EOF?
/*      if(ioctl(fd,CDRIOCSETBLOCKSIZE,VCD_SECTOR_SIZE)==-1) return 0;
      if (pread(fd,vcd_buf,VCD_SECTOR_SIZE,ntohl(vcd_entry.entry.addr.lba)*VCD_SECTOR_SIZE) != VCD_SECTOR_SIZE) return 0; */ // EOF?
      vcd_entry.entry.addr.msf.frame++;
      if (vcd_entry.entry.addr.msf.frame==75){
        vcd_entry.entry.addr.msf.frame=0;
        vcd_entry.entry.addr.msf.second++;
        if (vcd_entry.entry.addr.msf.second==60){
          vcd_entry.entry.addr.msf.second=0;
          vcd_entry.entry.addr.msf.minute++;
        }
      }

      memcpy(mem,&vcd_buf[VCD_SECTOR_OFFS],VCD_SECTOR_DATA);
      return VCD_SECTOR_DATA;
}

//================== VCD CACHE =======================
#ifdef VCD_CACHE

static int vcd_cache_size=0;
static char *vcd_cache_data=NULL;
static int *vcd_cache_sectors=NULL;
static int vcd_cache_index=0; // index to first free (or oldest) cache sector
static int vcd_cache_current=-1;

void vcd_cache_init(int s){
  vcd_cache_size=s;
  vcd_cache_sectors=malloc(s*sizeof(int));
  vcd_cache_data=malloc(s*VCD_SECTOR_SIZE);
  memset(vcd_cache_sectors,255,s*sizeof(int));
}

static inline void vcd_cache_seek(int sect){
  vcd_cache_current=sect;
}

int vcd_cache_read(int fd,char* mem){
int i;
char* vcd_buf;
  for(i=0;i<vcd_cache_size;i++)
    if(vcd_cache_sectors[i]==vcd_cache_current){
      // found in the cache! :)
      vcd_buf=&vcd_cache_data[i*VCD_SECTOR_SIZE];
      ++vcd_cache_current;
      memcpy(mem,&vcd_buf[VCD_SECTOR_OFFS],VCD_SECTOR_DATA);
      return VCD_SECTOR_DATA;
    }
  // NEW cache entry:
  vcd_buf=&vcd_cache_data[vcd_cache_index*VCD_SECTOR_SIZE];
  vcd_cache_sectors[vcd_cache_index]=vcd_cache_current;
  ++vcd_cache_index;if(vcd_cache_index>=vcd_cache_size)vcd_cache_index=0;
  // read data!
  vcd_set_msf(vcd_cache_current);
  memcpy(vcd_buf,&vcd_entry.entry.addr.msf,sizeof(struct cdrom_msf));
/*  if(ioctl(fd,CDROMREADRAW,vcd_buf)==-1) return 0; */ // EOF?
  ++vcd_cache_current;
  memcpy(mem,&vcd_buf[VCD_SECTOR_OFFS],VCD_SECTOR_DATA);
  return VCD_SECTOR_DATA;
}

#endif

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/Makefile,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** Makefile	2001/06/02 23:28:42	1.37
--- Makefile	2001/06/03 00:31:41	1.38
***************
*** 65,69 ****
  
  $(PRG):	.depend mplayer.o $(OBJS) loader/libloader.a $(DS_DEP) libmpeg2/libmpeg2.a opendivx/libdecore.a $(COMMONLIBS) encore/libencore.a
! 	$(CC) $(CFLAGS) -o $(PRG) mplayer.o $(OBJS) $(XMM_LIBS) $(LIRC_LIBS) $(A_LIBS) -lm $(TERMCAP_LIB) -Lloader -lloader $(DS_LIB) -ldl -Llibmpeg2 -lmpeg2 -Lopendivx -ldecore $(VO_LIBS) -Llibao2 -lao $(CSS_LIB) -Lencore -lencore -lpthread
  
  # $(PRG_HQ):	.depend mplayerHQ.o $(OBJS) loader/libloader.a libmpeg2/libmpeg2.a opendivx/libdecore.a $(COMMONLIBS) encore/libencore.a
--- 65,69 ----
  
  $(PRG):	.depend mplayer.o $(OBJS) loader/libloader.a $(DS_DEP) libmpeg2/libmpeg2.a opendivx/libdecore.a $(COMMONLIBS) encore/libencore.a
! 	$(CC) $(CFLAGS) -o $(PRG) mplayer.o $(OBJS) $(XMM_LIBS) $(LIRC_LIBS) $(A_LIBS) -lm $(TERMCAP_LIB) -Lloader -lloader $(DS_LIB) -Llibmpeg2 -lmpeg2 -Lopendivx -ldecore $(VO_LIBS) -Llibao2 -lao $(CSS_LIB) -Lencore -lencore $(ARCH_LIBS)
  
  # $(PRG_HQ):	.depend mplayerHQ.o $(OBJS) loader/libloader.a libmpeg2/libmpeg2.a opendivx/libdecore.a $(COMMONLIBS) encore/libencore.a

Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -r1.54 -r1.55
*** configure	2001/06/02 16:02:38	1.54
--- configure	2001/06/03 00:31:41	1.55
***************
*** 895,898 ****
--- 895,899 ----
  DS_LIB = $_dshowlib
  prefix = $_prefix
+ ARCH_LIBS = -ldl -lpthread
  
  EOF

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -C2 -r1.137 -r1.138
*** mplayer.c	2001/06/03 00:24:49	1.137
--- mplayer.c	2001/06/03 00:31:41	1.138
***************
*** 18,22 ****
--- 18,26 ----
  #include <fcntl.h>
  #include <sys/soundcard.h>
+ #ifdef __FreeBSD__
+ #include <sys/cdio.h>
+ #else
  #include <linux/cdrom.h>
+ #endif
  
  #include "version.h"
***************
*** 445,449 ****
  // movie info:
  int out_fmt=0;
! char *dsp="/dev/dsp";
  int force_ni=0;
  char *conffile;
--- 449,453 ----
  // movie info:
  int out_fmt=0;
! char *dsp=NULL;
  int force_ni=0;
  char *conffile;
***************
*** 576,580 ****
  
  // check audio_out
! //audio_out=audio_out_drivers[0];
  
  // check codec.conf
--- 580,585 ----
  
  // check audio_out
! audio_out=audio_out_drivers[0];
! if(dsp) audio_out->control(AOCONTROL_SET_DEVICE,dsp);
  
  // check codec.conf

Index: stream.c
===================================================================
RCS file: /cvsroot/mplayer/main/stream.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** stream.c	2001/05/03 23:32:55	1.7
--- stream.c	2001/06/03 00:31:41	1.8
***************
*** 10,14 ****
--- 10,19 ----
  //#include <fcntl.h>
  
+ #ifdef __FreeBSD__
+ #include <sys/cdio.h>
+ #include <sys/cdrio.h>
+ #else
  #include <linux/cdrom.h>
+ #endif
  
  #include "stream.h"
***************
*** 16,20 ****
--- 21,30 ----
  extern int verbose; // defined in mplayer.c
  
+ #ifdef __FreeBSD__
+ #warning "VCD support under FreeBSD not implemented yet"
+ #include "vcd_read_fbsd.c" 
+ #else
  #include "vcd_read.c"
+ #endif
  
  //=================== STREAMER =========================


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list