1
mirror of https://github.com/mpv-player/mpv synced 2025-01-01 04:36:24 +01:00

FreeBSD support by Vladimir Kushnir vkushnir@Alfacom.net

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@959 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi_esp 2001-06-03 00:31:41 +00:00
parent 8e97bbd1dd
commit 4cd35a04b9
10 changed files with 1478 additions and 4 deletions

19
DOCS/FREEBSD Normal file
View File

@ -0,0 +1,19 @@
Notes for FreeBSD users
=======================
1. To build the package you will need GNU make (gmake, /usr/ports/devel/gmake),
native BSD make will not work.
2. Configure script is different for FreeBSD; use configure.FreeBSD instead.
3. To run mplayer you will need to re-compile the kernel with
"options USER_LDT" (unless you are running -CURRENT, where this is default).
4. There's no VCD (well, it is not finished) or DVD support for FreeBSD yet.
Feel free to add them :-)
Enjoy (as do I)!
--
Vladimir Kushnir

View File

@ -64,7 +64,7 @@ mplayerwithoutlink: .depend mplayer.o $(OBJS) loader/libloader.a $(DS_DEP) libmp
@for a in mp3lib libac3 libmpeg2 libvo opendivx encore loader/DirectShow ; do $(MAKE) -C $$a all ; done
$(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
$(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
# $(CC) $(CFLAGS) -o $(PRG_HQ) mplayerHQ.o $(OBJS) $(XMM_LIBS) $(LIRC_LIBS) $(A_LIBS) -lm $(TERMCAP_LIB) -Lloader -lloader -ldl -Llibmpeg2 -lmpeg2 -Lopendivx -ldecore $(VO_LIBS) -Lencore -lencore -lpthread

1
configure vendored
View File

@ -894,6 +894,7 @@ WIN32_PATH=-DWIN32_PATH=\"$_win32libdir\"
DS_DEP = $_dshowdep
DS_LIB = $_dshowlib
prefix = $_prefix
ARCH_LIBS = -ldl -lpthread
EOF
# echo 'CFLAGS=$(OPTFLAGS) -Wall -DMPG12PLAY' >> config.mak

1282
configure.FreeBSD Normal file

File diff suppressed because it is too large Load Diff

View File

@ -136,7 +136,11 @@ static vo_info_t vo_info =
""
};
#ifdef __FreeBSD__
#include <SDL11/SDL.h>
#else
#include <SDL/SDL.h>
#endif
#define FS 0x01
#define VM 0x02

View File

@ -201,15 +201,27 @@ found:
void getch2_enable(){
struct termios tio_new;
#ifdef __FreeBSD__
ioctl(0,TIOCGETA,&tio_orig); /* tcgetattr(0,&tio_orig); */
#else
ioctl(0,TCGETS,&tio_orig); /* tcgetattr(0,&tio_orig); */
#endif
tio_new=tio_orig;
tio_new.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */
tio_new.c_cc[VMIN] = 1;
tio_new.c_cc[VTIME] = 0;
#ifdef __FreeBSD__
ioctl(0,TIOCSETA,&tio_new); /* tcsetattr(0,TCSANOW,&tio_new); */
#else
ioctl(0,TCSETS,&tio_new); /* tcsetattr(0,TCSANOW,&tio_new); */
#endif
}
void getch2_disable(){
#ifdef __FreeBSD__
ioctl(0,TIOCSETA,&tio_orig); /* tcsetattr(0,TCSANOW,&tio_orig); */
#else
ioctl(0,TCSETS,&tio_orig); /* tcsetattr(0,TCSANOW,&tio_orig); */
#endif
}

View File

@ -22,7 +22,7 @@ $(LIBNAME): .depend $(OBJS)
$(AR) r $(LIBNAME) $(OBJS)
test: test.c $(LIBNAME)
$(CC) test.c -Wall $(CFLAGS) -o test -L. -lDS_Filter -L.. -lloader -ldl -lpthread -lstdc++
$(CC) test.c -Wall $(CFLAGS) -o test -L. -lDS_Filter -L.. -lloader $(ARCH_LIBS) -lstdc++
all: $(LIBNAME)

View File

@ -17,7 +17,11 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/soundcard.h>
#ifdef __FreeBSD__
#include <sys/cdio.h>
#else
#include <linux/cdrom.h>
#endif
#include "version.h"
#include "config.h"
@ -444,7 +448,7 @@ int screen_size_y=0;//SCREEN_SIZE_Y;
int screen_size_xy=0;
// movie info:
int out_fmt=0;
char *dsp="/dev/dsp";
char *dsp=NULL;
int force_ni=0;
char *conffile;
int conffile_fd;
@ -575,7 +579,8 @@ if(!filename){
}
// check audio_out
//audio_out=audio_out_drivers[0];
audio_out=audio_out_drivers[0];
if(dsp) audio_out->control(AOCONTROL_SET_DEVICE,dsp);
// check codec.conf
if(!parse_codec_cfg(get_path("codecs.conf"))){

View File

@ -9,13 +9,23 @@
//#include <sys/stat.h>
//#include <fcntl.h>
#ifdef __FreeBSD__
#include <sys/cdio.h>
#include <sys/cdrio.h>
#else
#include <linux/cdrom.h>
#endif
#include "stream.h"
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 =========================

141
vcd_read_fbsd.h Normal file
View File

@ -0,0 +1,141 @@
//=================== 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