mirror of
https://github.com/mpv-player/mpv
synced 2024-09-12 23:45:53 +02:00
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1043 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
96d03d719d
commit
a951103bc7
18
DOCS/SOLARIS
18
DOCS/SOLARIS
@ -3,3 +3,21 @@ Notes for Solaris users
|
|||||||
|
|
||||||
1. To build the package you will need GNU make (gmake, /opt/sfw/gmake),
|
1. To build the package you will need GNU make (gmake, /opt/sfw/gmake),
|
||||||
native Solaris make will not work.
|
native Solaris make will not work.
|
||||||
|
|
||||||
|
2. Due to two bugs in solaris 8 x86, you cannot reliably play DVDs using a
|
||||||
|
capacity >4GB:
|
||||||
|
|
||||||
|
- The sd(7D) driver on solaris 8 x86 driver has bug when accessing a
|
||||||
|
disk block >4GB on a device using a logical blocksize != DEV_BSIZE
|
||||||
|
(i.e. CDROM and DVD media). Due to a 32bit int overflow, a disk
|
||||||
|
address modulo 4GB is accessed.
|
||||||
|
(http://groups.yahoo.com/group/solarisonintel/message/22516)
|
||||||
|
|
||||||
|
- The similar bug is present in the hsfs(7FS) filesystem code (aka ISO9660),
|
||||||
|
hsfs currently does not support partitions/disks >4GB, all data is
|
||||||
|
accessed modulo 4GB
|
||||||
|
(http://groups.yahoo.com/group/solarisonintel/message/22592)
|
||||||
|
|
||||||
|
--
|
||||||
|
Jürgen Keil
|
||||||
|
|
||||||
|
3
Makefile
3
Makefile
@ -15,7 +15,7 @@ PRG_CFG = codec-cfg
|
|||||||
#prefix = /usr/local
|
#prefix = /usr/local
|
||||||
BINDIR = ${prefix}/bin
|
BINDIR = ${prefix}/bin
|
||||||
# BINDIR = /usr/local/bin
|
# BINDIR = /usr/local/bin
|
||||||
SRCS = find_sub.c aviprint.c dll_init.c dec_audio.c aviwrite.c aviheader.c asfheader.c demux_avi.c demux_asf.c demux_mpg.c demuxer.c stream.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c dvdauth.c spudec.c
|
SRCS = find_sub.c aviprint.c dll_init.c dec_audio.c aviwrite.c aviheader.c asfheader.c demux_avi.c demux_asf.c demux_mpg.c demuxer.c stream.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c dvdauth.c spudec.c asf_streaming.c network.c url.c http.c
|
||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
CFLAGS = $(OPTFLAGS) -Iloader -Ilibvo $(CSS_INC) # -Wall
|
CFLAGS = $(OPTFLAGS) -Iloader -Ilibvo $(CSS_INC) # -Wall
|
||||||
A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3 $(ALSA_LIB) $(ESD_LIB)
|
A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3 $(ALSA_LIB) $(ESD_LIB)
|
||||||
@ -120,3 +120,4 @@ ifneq ($(wildcard .depend),)
|
|||||||
include .depend
|
include .depend
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
20
configure
vendored
20
configure
vendored
@ -124,10 +124,10 @@ params:
|
|||||||
--enable-xmmp use XMMP audio drivers
|
--enable-xmmp use XMMP audio drivers
|
||||||
--enable-lirc enable LIRC (remote control) support
|
--enable-lirc enable LIRC (remote control) support
|
||||||
|
|
||||||
--disable-oss disable OSS sound support [autodetect]
|
--disable-ossaudio disable OSS sound support [autodetect]
|
||||||
--disable-alsa disable alsa sound support [autodetect]
|
--disable-alsa disable alsa sound support [autodetect]
|
||||||
--disable-esd disable esd sound support [autodetect]
|
--disable-esd disable esd sound support [autodetect]
|
||||||
--disable-sun disable Sun sound support [autodetect]
|
--disable-sunaudio disable Sun sound support [autodetect]
|
||||||
|
|
||||||
--disable-gcc-checking disable gcc version checking
|
--disable-gcc-checking disable gcc version checking
|
||||||
|
|
||||||
@ -630,11 +630,23 @@ rm -f $TMPC $TMPO
|
|||||||
# ---
|
# ---
|
||||||
# try to detect type of audio supported on this machine
|
# try to detect type of audio supported on this machine
|
||||||
|
|
||||||
|
cat > $TMPC << EOF
|
||||||
|
#include <sys/soundcard.h>
|
||||||
|
int main( void ) { int arg = SNDCTL_DSP_SETFRAGMENT; }
|
||||||
|
EOF
|
||||||
|
|
||||||
_oss_audio=no
|
_oss_audio=no
|
||||||
[ -c /dev/dsp ] && _oss_audio=yes
|
$_cc -o $TMPO $TMPC 2> /dev/null && _oss_audio=yes
|
||||||
|
|
||||||
|
|
||||||
|
cat > $TMPC << EOF
|
||||||
|
#include <sys/audioio.h>
|
||||||
|
int main( void ) { audio_info_t info; AUDIO_INITINFO(&info); }
|
||||||
|
EOF
|
||||||
|
|
||||||
_sun_audio=no
|
_sun_audio=no
|
||||||
[ -c /dev/audio -a -c /dev/audioctl ] && _sun_audio=yes
|
$_cc -o $TMPO $TMPC 2> /dev/null && _sun_audio=yes
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
|
126
dvdauth.c
126
dvdauth.c
@ -7,19 +7,56 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <linux/cdrom.h>
|
//#include <string.h> // FIXME: conflicts with fs.h
|
||||||
// FIXME #include <string.h> conflicts with #include <linux/fs.h> (below)
|
|
||||||
//#include <string.h> // FIXME this conflicts with #include <linux/fs.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <css.h>
|
#include <css.h>
|
||||||
|
#if CSS_MAJOR_VERSION > 0 || (CSS_MAJOR_VERSION == 0 && CSS_MINOR_VERSION > 1)
|
||||||
|
# include <dvd.h>
|
||||||
|
# undef OLD_CSS_API
|
||||||
|
#else
|
||||||
|
# if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
|
# include <sys/dvdio.h>
|
||||||
|
# elif defined(__linux__)
|
||||||
|
# include <linux/cdrom.h>
|
||||||
|
# elif defined(__sun)
|
||||||
|
# include <sun/dvdio.h>
|
||||||
|
# else
|
||||||
|
# error "Need the DVD ioctls"
|
||||||
|
# endif
|
||||||
|
# define OLD_CSS_API 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "dvdauth.h"
|
#include "dvdauth.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if OLD_CSS_API
|
||||||
|
/*
|
||||||
|
* provide some backward compatibiliy macros to compile this
|
||||||
|
* code using the old libcss-0.1
|
||||||
|
*/
|
||||||
|
#define DVDHandle int
|
||||||
|
#define DVDOpenFailed (-1)
|
||||||
|
|
||||||
|
#define DVDAuth(hdl, s) ioctl(hdl, DVD_AUTH, s)
|
||||||
|
#define DVDOpenDevice(path) open(path, O_RDONLY)
|
||||||
|
#define DVDCloseDevice(hdl) close(hdl)
|
||||||
|
#define CSSDVDisEncrypted(hdl) CSSisEncrypted(hdl)
|
||||||
|
#define CSSDVDAuthDisc CSSAuthDisc
|
||||||
|
#define CSSDVDAuthTitlePath(hdl,key_title,path) \
|
||||||
|
CSSAuthTitle(hdl,key_title,path_to_lba(path))
|
||||||
|
|
||||||
|
#else /*OLD_CSS_API*/
|
||||||
|
|
||||||
|
#define DVDHandle struct dvd_device *
|
||||||
|
#define DVDOpenFailed NULL
|
||||||
|
|
||||||
|
#endif /*OLD_CSS_API*/
|
||||||
|
|
||||||
|
|
||||||
char *dvd_auth_device=NULL;
|
char *dvd_auth_device=NULL;
|
||||||
unsigned char key_disc[2048];
|
unsigned char key_disc[2048];
|
||||||
unsigned char key_title[5];
|
unsigned char key_title[5];
|
||||||
@ -27,28 +64,51 @@ unsigned char *dvdimportkey=NULL;
|
|||||||
int descrambling=0;
|
int descrambling=0;
|
||||||
|
|
||||||
|
|
||||||
|
#if OLD_CSS_API
|
||||||
|
/*
|
||||||
|
* With the old libcss-0.1 api, we have to find out the LBA for
|
||||||
|
* a title for title authentication.
|
||||||
|
*/
|
||||||
|
#ifdef __linux__
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#ifndef FIBMAP
|
#ifndef FIBMAP
|
||||||
#define FIBMAP 1
|
#define FIBMAP 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int path_to_lba (char *path)
|
||||||
static int path_to_lba ( int fd )
|
|
||||||
{
|
{
|
||||||
int lba = 0;
|
int fd, lba = 0;
|
||||||
if (ioctl(fd, FIBMAP, &lba) < 0) {
|
|
||||||
perror ("ioctl FIBMAP");
|
if ((fd = open(path, O_RDONLY)) == -1) {
|
||||||
fprintf(stderr,"Hint: run mplayer as root!\n");
|
fprintf(stderr, "Cannot open file %s: %s",
|
||||||
// close(fd);
|
path ? path : "(NULL)", strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return lba;
|
if (ioctl(fd, FIBMAP, &lba) != 0) {
|
||||||
|
perror ("ioctl FIBMAP");
|
||||||
|
fprintf(stderr,"Hint: run mplayer as root!\n");
|
||||||
|
close(fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
return lba;
|
||||||
}
|
}
|
||||||
|
#else /*linux*/
|
||||||
|
static int path_to_lba (char *path)
|
||||||
|
{
|
||||||
|
#warning translating pathname to iso9660 LBA is not supported on this platform
|
||||||
|
fprintf(stderr, "Translating pathname to iso9660 LBA is not supported on this platform\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif /*linux*/
|
||||||
|
#endif /*OLD_CSS_API*/
|
||||||
|
|
||||||
|
|
||||||
|
static void reset_agids ( DVDHandle dvd )
|
||||||
static void reset_agids ( int fd )
|
|
||||||
{
|
{
|
||||||
dvd_authinfo ai;
|
dvd_authinfo ai;
|
||||||
int i;
|
int i;
|
||||||
@ -56,7 +116,7 @@ static void reset_agids ( int fd )
|
|||||||
memset(&ai, 0, sizeof(ai));
|
memset(&ai, 0, sizeof(ai));
|
||||||
ai.type = DVD_INVALIDATE_AGID;
|
ai.type = DVD_INVALIDATE_AGID;
|
||||||
ai.lsa.agid = i;
|
ai.lsa.agid = i;
|
||||||
ioctl(fd, DVD_AUTH, &ai);
|
DVDAuth(dvd, &ai);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,49 +147,45 @@ int dvd_import_key ( unsigned char *hexkey )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int dvd_auth ( char *dev , int fd )
|
int dvd_auth ( char *dev , char *filename )
|
||||||
{
|
{
|
||||||
int devfd; /* FD of DVD device */
|
DVDHandle dvd; /* DVD device handle */
|
||||||
int lba;
|
|
||||||
|
|
||||||
|
if ((dvd=DVDOpenDevice(dev)) == DVDOpenFailed) {
|
||||||
if ((devfd=open(dev,O_RDONLY))<0) {
|
|
||||||
fprintf(stderr,"DVD: cannot open DVD device \"%s\".\n",dev);
|
fprintf(stderr,"DVD: cannot open DVD device \"%s\".\n",dev);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CSSisEncrypted(devfd)) {
|
if (!CSSDVDisEncrypted(dvd)) {
|
||||||
printf("DVD is unencrypted! Skipping authentication!\n(note: you should not use -dvd switch for unencrypted discs!)\n");
|
printf("DVD is unencrypted! Skipping authentication!\n(note: you should not use -dvd switch for unencrypted discs!)\n");
|
||||||
|
DVDCloseDevice(dvd);
|
||||||
return 0;
|
return 0;
|
||||||
} else printf("DVD is encrypted, issuing authentication ...\n");
|
} else printf("DVD is encrypted, issuing authentication ...\n");
|
||||||
|
|
||||||
/* reset AGIDs */
|
/* reset AGIDs */
|
||||||
reset_agids(devfd);
|
reset_agids(dvd);
|
||||||
|
|
||||||
/* authenticate disc */
|
/* authenticate disc */
|
||||||
if (CSSAuthDisc(devfd,key_disc)) {
|
if (CSSDVDAuthDisc(dvd,key_disc)) {
|
||||||
fprintf(stderr,"DVD: CSSAuthDisc() failed.\n");
|
fprintf(stderr,"DVD: CSSDVDAuthDisc() failed.\n");
|
||||||
|
DVDCloseDevice(dvd);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* authenticate title */
|
if (CSSDVDAuthTitlePath(dvd,key_title,filename)) {
|
||||||
lba=path_to_lba(fd);
|
fprintf(stderr,"DVD: CSSDVDAuthTitle() failed.\n");
|
||||||
if (lba==-1) {
|
DVDCloseDevice(dvd);
|
||||||
fprintf(stderr,"DVD: path_to_lba() failed.\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (CSSAuthTitle(devfd,key_title,lba)) {
|
|
||||||
fprintf(stderr,"DVD: CSSAuthTitle() failed.\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* decrypting title */
|
/* decrypting title */
|
||||||
if (CSSDecryptTitleKey (key_title, key_disc) < 0) {
|
if (CSSDecryptTitleKey (key_title, key_disc) < 0) {
|
||||||
fprintf(stderr,"DVD: CSSDecryptTitleKey() failed.\n");
|
fprintf(stderr,"DVD: CSSDecryptTitleKey() failed.\n");
|
||||||
|
DVDCloseDevice(dvd);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
close(devfd);
|
DVDCloseDevice(dvd);
|
||||||
printf("DVD title key is: %02X%02X%02X%02X%02X\n",key_title[0],key_title[1],key_title[2],key_title[3],key_title[4]);
|
printf("DVD title key is: %02X%02X%02X%02X%02X\n",key_title[0],key_title[1],key_title[2],key_title[3],key_title[4]);
|
||||||
descrambling=1;
|
descrambling=1;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "config.h"
|
//#include "config.h"
|
||||||
#ifdef HAVE_LIBCSS
|
#ifdef HAVE_LIBCSS
|
||||||
#ifndef _MPLAYER_CSS_H
|
#ifndef _MPLAYER_CSS_H
|
||||||
#define _MPLAYER_CSS_H
|
#define _MPLAYER_CSS_H
|
||||||
@ -9,8 +9,8 @@ extern unsigned char key_title[];
|
|||||||
extern unsigned char *dvdimportkey;
|
extern unsigned char *dvdimportkey;
|
||||||
extern int descrambling;
|
extern int descrambling;
|
||||||
|
|
||||||
int dvd_auth ( char *, int );
|
int dvd_auth ( char *, char * );
|
||||||
int dvd_import_key ( unsigned char * );
|
int dvd_import_key ( unsigned char * );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
10
mplayer.c
10
mplayer.c
@ -70,11 +70,9 @@
|
|||||||
#include "opendivx/decore.h"
|
#include "opendivx/decore.h"
|
||||||
|
|
||||||
|
|
||||||
//extern int vo_screenwidth;
|
#ifdef X11_FULLSCREEN
|
||||||
|
|
||||||
int audio_fd=-1;
|
|
||||||
|
|
||||||
extern int vo_screenwidth;
|
extern int vo_screenwidth;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern char* win32_codec_name; // must be set before calling DrvOpen() !!!
|
extern char* win32_codec_name; // must be set before calling DrvOpen() !!!
|
||||||
|
|
||||||
@ -666,8 +664,8 @@ if(vcd_track){
|
|||||||
printf("DVD command line requested key is stored for descrambling.\n");
|
printf("DVD command line requested key is stored for descrambling.\n");
|
||||||
}
|
}
|
||||||
if (dvd_auth_device) {
|
if (dvd_auth_device) {
|
||||||
if (dvd_auth(dvd_auth_device,f)) {
|
// if (dvd_auth(dvd_auth_device,f)) {
|
||||||
// if (dvd_auth(dvd_auth_device,filename)) {
|
if (dvd_auth(dvd_auth_device,filename)) {
|
||||||
GUI_MSG( mplErrorDVDAuth )
|
GUI_MSG( mplErrorDVDAuth )
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user