summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-28 20:40:21 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-28 20:40:21 +0000
commit5475823f41bfe971bec6dd2208dd7c01bc11edd8 (patch)
tree69fec4aa970acebcae084d086f6a7846f5b669f2 /libmpdemux
parente55db72e97eb5f652db237cb16abb79d4f2c927d (diff)
downloadmpv-5475823f41bfe971bec6dd2208dd7c01bc11edd8.tar.bz2
mpv-5475823f41bfe971bec6dd2208dd7c01bc11edd8.tar.xz
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5381 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/open.c26
-rw-r--r--libmpdemux/stream.c99
-rw-r--r--libmpdemux/stream.h2
3 files changed, 126 insertions, 1 deletions
diff --git a/libmpdemux/open.c b/libmpdemux/open.c
index 2e8f55d6de..ce37aa1d45 100644
--- a/libmpdemux/open.c
+++ b/libmpdemux/open.c
@@ -31,6 +31,11 @@ int dvd_last_chapter=0;
int dvd_angle=1;
char* dvd_device=NULL;
char* cdrom_device=NULL;
+int dvd_nav=0;
+
+#ifdef USE_DVDNAM
+#include <dvdnav.h>
+#endif
#ifdef USE_DVDREAD
@@ -110,10 +115,29 @@ if(vcd_track){
#endif
//============ Open DVD title ==============
+#ifdef USE_DVDNAV
+if(dvd_nav){
+ dvdnav_t *dvdnav;
+ int event,len,tmplen=0;
+ if(!filename) filename=DEFAULT_DVD_DEVICE;
+ if(dvdnav_open(&dvdnav,filename)!=DVDNAV_STATUS_OK) {
+ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,filename);
+ return NULL;
+ }
+
+ stream=new_stream(-1,STREAMTYPE_DVDNAV);
+ if (!stream) {
+ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_Exit_error);
+ return NULL;
+ }
+ stream->priv=(void*)dvdnav;
+ return stream;
+}
+#endif
#ifdef USE_DVDREAD
if(dvd_title){
// int ret,ret2;
- dvd_priv_t *d;
+ dvd_priv_t *d;
int ttn,pgc_id,pgn;
dvd_reader_t *dvd;
dvd_file_t *title;
diff --git a/libmpdemux/stream.c b/libmpdemux/stream.c
index 7247f588e7..402c9a1cf8 100644
--- a/libmpdemux/stream.c
+++ b/libmpdemux/stream.c
@@ -28,6 +28,13 @@ extern int verbose; // defined in mplayer.c
#endif
+#ifdef USE_DVDNAV
+#include <dvdnav.h>
+#include <../linux/timer.h>
+static int still_sleep_until;
+static int sleeping=0;
+static int stillen=0;
+#endif
#ifdef USE_DVDREAD
int dvd_read_sector(void* d,void* p2);
void dvd_seek(void* d,off_t pos);
@@ -59,6 +66,98 @@ int stream_fill_buffer(stream_t *s){
len=vcd_read(s->fd,s->buffer);break;
#endif
#endif
+#ifdef USE_DVDNAV
+ case STREAMTYPE_DVDNAV: {
+ int event = DVDNAV_NOP;
+ if(sleeping)
+ {
+ dvdnav_still_skip(s->priv);
+ if(sleeping==1) if(GetTimer()>=still_sleep_until) sleeping = 0;
+ len = stillen;
+ }
+ if(dvdnav_get_next_block(s->priv,s->buffer,&event,&len)!=DVDNAV_STATUS_OK)
+ printf( "Error getting next block from DVD (%s)\n",dvdnav_err_to_string(s->priv) );
+ else switch(event) {
+ case DVDNAV_BLOCK_OK: {
+ /* be silent about this one */
+ break;
+ }
+ case DVDNAV_HIGHLIGHT: {
+ dvdnav_highlight_event_t *hevent = (dvdnav_highlight_event_t*)(s->buffer);
+ if (!hevent) {
+ printf("Highlight event broken\n");
+ break;
+ }
+
+ if (hevent->display)
+ {
+ printf( "Highlight (%u,%u)-(%u,%u) (button %d)\n",
+ hevent->sx,hevent->sy,
+ hevent->ex,hevent->ey,
+ hevent->buttonN );
+ }
+ else {
+ printf("Highlight Hide\n");
+ }
+ break;
+ }
+ case DVDNAV_STILL_FRAME: {
+ printf( "Still Frame\n" );
+ dvdnav_still_event_t *still_event = (dvdnav_still_event_t*)(s->buffer);
+ if(still_event->length==0xff) { printf( "Sleeping indefinately\n" ); sleeping=2; }
+ else {
+ InitTimer();
+ still_sleep_until = GetTimer() + still_event->length*1000000;
+ printf( "Sleeping %d sec(s)\n", still_event->length );
+ sleeping=1;
+ }
+ stillen = len;
+ break;
+ }
+ case DVDNAV_STOP: {
+ printf( "Nav Stop\n" );
+ len=0;
+ break;
+ }
+ case DVDNAV_NOP: {
+ printf("Nav NOP\n");
+ break;
+ }
+ case DVDNAV_SPU_STREAM_CHANGE: {
+ printf("Nav SPU Stream Change\n");
+ break;
+ }
+ case DVDNAV_AUDIO_STREAM_CHANGE: {
+ printf("Nav Audio Stream Change\n");
+ break;
+ }
+ case DVDNAV_VTS_CHANGE: {
+ printf("Nav VTS Change\n");
+ break;
+ }
+ case DVDNAV_CELL_CHANGE: {
+ printf("Nav Cell Change\n");
+ break;
+ }
+ case DVDNAV_NAV_PACKET: {
+ // printf("Nav Packet\n");
+ break;
+ }
+ case DVDNAV_SPU_CLUT_CHANGE: {
+ printf("Nav SPU CLUT Change\n");
+ break;
+ }
+ case DVDNAV_SEEK_DONE: {
+ printf("Nav Seek Done\n");
+ break;
+ }
+ default:
+ printf("Weird nav event %d\n",event);
+ break;
+ }
+ break;
+ }
+#endif
#ifdef USE_DVDREAD
case STREAMTYPE_DVD: {
off_t pos=dvd_read_sector(s->priv,s->buffer);
diff --git a/libmpdemux/stream.h b/libmpdemux/stream.h
index 404bfac4d6..4426ef0e05 100644
--- a/libmpdemux/stream.h
+++ b/libmpdemux/stream.h
@@ -16,6 +16,7 @@
#define STREAMTYPE_PLAYLIST 6
#define STREAMTYPE_MF 7
#define STREAMTYPE_DS 8
+#define STREAMTYPE_DVDNAV 9
#define VCD_SECTOR_SIZE 2352
#define VCD_SECTOR_OFFS 24
@@ -197,6 +198,7 @@ extern int dvd_title;
extern int dvd_chapter;
extern int dvd_last_chapter;
extern int dvd_angle;
+extern int dvd_nav;
int dvd_parse_chapter_range(struct config*, const char*);
//#endif