diff -Naur -x CVS -x *.o -x *.a -x .* main/Makefile main.nav/Makefile --- main/Makefile Wed Dec 26 09:46:38 2001 +++ main.nav/Makefile Sun Dec 23 22:07:39 2001 @@ -44,7 +44,7 @@ CODEC_LIBS = -Lg72x -lg72x -Lmp3lib -lMP3 -Llibac3 -lac3 -Lliba52 -la52 -Lxa -lxa -Llibmpeg2 -lmpeg2 $(AV_LIB) COMMON_LIBS = -Llinux -losdep -Lpostproc -lpostproc -CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader $(VO_INC) $(EXTRA_INC) # -Wall +CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader $(VO_INC) $(CSS_INC) $(EXTRA_INC) # -Wall PARTS = g72x libmpdemux mp3lib libac3 liba52 libmp1e libmpeg2 opendivx libavcodec libao2 drivers drivers/syncfb linux postproc xa ifeq ($(VO2),yes) diff -Naur -x CVS -x *.o -x *.a -x .* main/configure main.nav/configure --- main/configure Wed Dec 26 09:46:38 2001 +++ main.nav/configure Sun Dec 23 22:07:39 2001 @@ -191,6 +186,7 @@ --with-x11libdir=DIR X library files in DIR --with-csslibdir=DIR libcss in DIR --with-madlibdir=DIR libmad (libmad shared lib.) in DIR + --with-libdvdnav=DIR libdvdnav in DIR --with-win32libdir=DIR W*ndows DLL files in DIR --with-xanimlibdir=DIR XAnim DLL files in DIR --with-sdl-config=PATH path to sdl*-config (e.g.: /opt/bin/sdl-config) @@ -668,6 +664,7 @@ _mad=auto _vorbis=auto _css=auto +_dvdnav=no _dvdread=auto _xanim=auto _xinerama=auto @@ -831,6 +828,10 @@ _mlibdir=`echo $ac_option | cut -d '=' -f 2` _mlib=yes ;; + --with-libdvdnav=*) + _dvdnavdir=`echo $ac_option | cut -d '=' -f 2` + _dvdnav=yes + ;; --enable-profile) _profile='-p' @@ -2024,12 +2022,27 @@ _css=no cc_check -lcss && _css=yes fi +if test "$_dvdnav" = yes ; then + cat > $TMPC < +int main(void) { dvdnav_t *dvd=0; return 0; } +EOF + _dvdnav=no + cc_check -I$_dvdnavdir -L$_dvdnavdir/.libs -ldvdnav && _dvdnav=yes +fi +if test "$_dvdnav" = yes ; then + _largefiles=yes + _def_dvdnav='#define USE_DVDNAV 1' + _ld_css="-L$_dvdnavdir/.libs -ldvdnav" + _inc_css="-I$_dvdnavdir" + echores "libdvdnav" +fi # dvdread preferred to DeCSS if test "$_dvdread" = yes ; then _largefiles=yes _def_dvdread='#define USE_DVDREAD 1' _def_css='#undef HAVE_LIBCSS' - _ld_css='-ldvdread' + _ld_css="-ldvdread $_ld_css" _inputmodules="dvdread $_inputmodules" echores "libdvdread" elif test "$_css" = yes ; then @@ -2686,6 +2698,7 @@ LIRC_LIB = $_ld_lirc CSS_USE = $_css CSS_LIB = $_ld_css +CSS_INC = $_inc_css SDL_INC = $_inc_sdl W32_DEP = $_dep_win32 W32_LIB = $_ld_win32 @@ -2832,6 +2844,9 @@ /* DeCSS support using libcss */ $_def_css +/* DVD navigation support using libdvdnav */ +$_def_dvdnav + /* Define this to enable MPEG 1/2 image postprocessing (requires FAST cpu!) */ #define MPEG12_POSTPROC 1 diff -Naur -x CVS -x *.o -x *.a -x .* main/libmpdemux/open.c main.nav/libmpdemux/open.c --- main/libmpdemux/open.c Wed Dec 26 09:46:39 2001 +++ main.nav/libmpdemux/open.c Sun Dec 23 22:07:39 2001 @@ -25,7 +25,13 @@ int dvd_title=0; int dvd_chapter=1; int dvd_angle=1; +int dvd_nav=0; +#ifdef USE_DVDNAV + +#include + +#endif #ifdef USE_DVDREAD #include @@ -104,8 +110,23 @@ #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_DVD); + stream->priv=(void*)dvdnav; + return stream; +} +#endif #ifdef USE_DVDREAD -if(dvd_title){ +else if(dvd_title){ // int ret,ret2; dvd_priv_t *d; int ttn,pgc_id,pgn; diff -Naur -x CVS -x *.o -x *.a -x .* main/libmpdemux/stream.c main.nav/libmpdemux/stream.c --- main/libmpdemux/stream.c Mon Dec 3 18:14:36 2001 +++ main.nav/libmpdemux/stream.c Sun Dec 23 22:07:39 2001 @@ -27,6 +27,12 @@ #endif +#ifdef USE_DVDNAV +#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); @@ -57,8 +63,48 @@ len=vcd_read(s->fd,s->buffer);break; #endif #endif + case STREAMTYPE_DVD: if(dvd_nav) { +#ifdef USE_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_HIGHLIGHT: { + dvdnav_highlight_event_t *hevent = (dvdnav_highlight_event_t*)(s->buffer); + printf( "Highlight\n" ); + break; + } + case DVDNAV_STILL_FRAME: { + 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: { + s->eof=1; + len=0; + break; + } + default: + } +#endif #ifdef USE_DVDREAD - case STREAMTYPE_DVD: { + break; + } + else if(dvd_title) + { off_t pos=dvd_read_sector(s->priv,s->buffer); if(pos>=0){ len=2048; // full sector diff -Naur -x CVS -x *.o -x *.a -x .* main/libmpdemux/stream.h main.nav/libmpdemux/stream.h --- main/libmpdemux/stream.h Wed Dec 26 09:46:39 2001 +++ main.nav/libmpdemux/stream.h Sun Dec 23 22:07:39 2001 @@ -165,8 +163,14 @@ extern int dvd_title; extern int dvd_chapter; extern int dvd_angle; +extern int dvd_nav; //#endif +#ifdef USE_DVDNAV + +#include + +#endif #ifdef USE_DVDREAD #include diff -Naur -x CVS -x *.o -x *.a -x .* main/libvo/sub.c main.nav/libvo/sub.c --- main/libvo/sub.c Wed Nov 28 13:44:39 2001 +++ main.nav/libvo/sub.c Sun Dec 23 22:07:39 2001 @@ -273,7 +273,7 @@ } void *vo_spudec=NULL; -#ifdef USE_DVDREAD +#ifdef USE_DVDREAD || USE_DVDNAV inline static void vo_draw_spudec(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){ spudec_draw(vo_spudec, draw_alpha); } @@ -303,7 +303,7 @@ if(vo_osd_progbar_type>=0 && vo_font->font[OSD_PB_0]>=0){ vo_draw_text_progbar(dxs,dys,draw_alpha); } -#ifdef USE_DVDREAD +#ifdef USE_DVDREAD || USE_DVDNAV if(vo_spudec){ vo_draw_spudec(dxs,dys,draw_alpha); } diff -Naur -x CVS -x *.o -x *.a -x .* main/mplayer.c main.nav/mplayer.c --- main/mplayer.c Wed Dec 26 09:46:38 2001 +++ main.nav/mplayer.c Sun Dec 23 22:07:39 2001 @@ -54,6 +54,9 @@ #include "codec-cfg.h" #include "dvdauth.h" +#ifdef USE_DVDNAV +#include +#endif #ifdef USE_DVDREAD #include "spudec.h" #endif @@ -579,7 +558,7 @@ } - if(!num_filenames && !vcd_track && !dvd_title && !tv_param_on){ + if(!num_filenames && !vcd_track && !dvd_title && !dvd_nav && !tv_param_on){ if(!use_gui){ // no file/vcd/dvd -> show HELP: printf("%s",help_text); @@ -1852,6 +1823,47 @@ (c=lirc_mp_getinput())>0 || #endif (!use_stdin && (c=getch2(0))>0) || (c=mplayer_get_key())>0) switch(c){ +#ifdef USE_DVDNAV + case KEY_RIGHT: + if(dvd_nav) { + dvdnav_right_button_select(stream->priv); + } else { + osd_function=OSD_FFW; + rel_seek_secs+=10; + } + break; + case KEY_LEFT: + if(dvd_nav) { + dvdnav_left_button_select(stream->priv); + } else { + osd_function=OSD_REW; + rel_seek_secs-=10; + } + break; + case KEY_UP: + if(dvd_nav) { + dvdnav_upper_button_select(stream->priv); + } else { + osd_function=OSD_FFW; + rel_seek_secs+=60; + } + break; + case KEY_DOWN: + if(dvd_nav) { + dvdnav_lower_button_select(stream->priv); + } else { + osd_function=OSD_REW; + rel_seek_secs-=60; + } + break; + case KEY_ENTER: + if(dvd_nav) { + dvdnav_button_activate(stream->priv); + } else { + eof=2; // jump to next file + } + break; +#else // seek 10 sec case KEY_RIGHT: osd_function=OSD_FFW; @@ -1866,6 +1878,10 @@ case KEY_DOWN: osd_function=OSD_REW; rel_seek_secs-=60;break; + case KEY_ENTER: // ESC + eof=2; // jump to next file + break; +#endif // seek 10 min case KEY_PAGE_UP: rel_seek_secs+=600;break; @@ -1882,13 +1898,16 @@ break; // quit case KEY_ESC: // ESC +#ifdef USE_DVDNAV + if(dvd_nav) { + dvdnav_menu_call(stream->priv,DVD_MENU_Root); + break; + } +#endif case 'q': exit_player(MSGTR_Exit_quit); case '>': if(curr_filename>=num_filenames-1) break; - case KEY_ENTER: // ESC - eof=2; // jump to next file - break; case '<': if(curr_filename < 1) break;