[MPlayer-dev-eng] Preliminary dvd navigation support through libdvdnav
David Holm
dholm at telia.com
Wed Dec 19 22:40:51 CET 2001
As a sidenote I should point out that it works with audio and video
output through -vc mpegpes, and likely mpegpes only (with this patch).
Since I have a dxr3 in this computer I work with mpegpes all the time
and always forget to test it with anything else. Still, this patch isn't
ment to be used for anything than experimental use...
David Holm wrote:
>Hi,
>I have been pretty quiet lately, been working hard on my realtime mpeg
>encoder (and still it won't work =(.
>
>But suddenly I popup with this little patch for mplayer =) which enables dvd
>navigation support by using the yet to be released libdvdnav from
>dvd.sourceforge.net..
>This is mostly a
>will-Arpi-accept-this-patch-when-its-done-since-it-does-lot-of-stuff-with-mplayer-code
>release, so it isn't very useful yet (dvd's play, but navigation doesn't work
>yet). Also libdvdnav is not released yet and is still in development so the
>purpose is almost exclusively to get Arpi's permission to continiue work on
>this (in the manner I have begun). (no, I don't want write access to cvs root
>back, write access to the dxr3 code is sufficient =).
>
>To use this you will have to fetch the cvs module named (unfortunately)
>xine-dvdnav from dvd.sourceforge.net, forget that it is called xine =).
>Configure and make it, don't make install unless you want to use it in xine
>as well. Then enter a patched mplayer and issue "./configure
>--with-libdvdnav=$(XINE-DVDNAVDIR)/libdvdnav/" if you did everything right
>mplayer should say something like "Checking for DVD support ... libdvdnav".
>libdvdnav can be linked against libdvdread which can be linked with libcss so
>insert favourite CSS-license-warning here.
>
>If it doesn't work let me now, or more importantly, if I'm allowed to
>continiue development let me know.... I'd prefer to have kbdkeys+enter for
>dvd navigation, but that is pushing it right?
>I know there are lots of issues, a/v sync, subpics etc. As I said, this is
>more of a may-I-continiue development patch than anything else.
>
>//David Holm
>
>
>------------------------------------------------------------------------
>
>diff -Naur main/Makefile main.nav/Makefile
>--- main/Makefile Tue Dec 18 19:14:23 2001
>+++ main.nav/Makefile Wed Dec 19 21:10:00 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 main/cfg-common.h main.nav/cfg-common.h
>--- main/cfg-common.h Tue Dec 18 19:14:23 2001
>+++ main.nav/cfg-common.h Wed Dec 19 19:27:30 2001
>@@ -11,7 +11,9 @@
> #else
> {"vcd", "VCD support is NOT available on this system!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0},
> #endif
>-#ifdef USE_DVDREAD
>+#ifdef USE_DVDNAV
>+ {"dvd", &dvd_title, CONF_TYPE_FLAG, 0, 0, 1},
>+#elif USE_DVDREAD
> {"dvd", &dvd_title, CONF_TYPE_INT, CONF_RANGE, 1, 99},
> {"dvdangle", &dvd_angle, CONF_TYPE_INT, CONF_RANGE, 1, 99},
> {"chapter", &dvd_chapter, CONF_TYPE_INT, CONF_RANGE, 1, 99},
>diff -Naur main/configure main.nav/configure
>--- main/configure Tue Dec 18 19:14:23 2001
>+++ main.nav/configure Wed Dec 19 19:47:55 2001
>@@ -186,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)
>@@ -663,6 +664,7 @@
> _mad=auto
> _vorbis=auto
> _css=auto
>+_dvdnav=no
> _dvdread=auto
> _xanim=auto
> _xinerama=auto
>@@ -826,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'
>@@ -2016,8 +2022,24 @@
> _css=no
> cc_check -lcss && _css=yes
> fi
>-# dvdread preferred to DeCSS
>-if test "$_dvdread" = yes ; then
>+if test "$_dvdnav" = yes ; then
>+ cat > $TMPC <<EOF
>+#include <dvdnav.h>
>+int main(void) { dvdnav_t *dvd=0; return 0; }
>+EOF
>+ _dvdnav=no
>+ cc_check -I$_dvdnavdir -L$_dvdnavdir/.libs -ldvdnav && _dvdnav=yes
>+fi
>+# dvdnav preferred to dvdread preferred to DeCSS
>+if test "$_dvdnav" = yes ; then
>+ _largefiles=yes
>+ _def_dvdnav='#define USE_DVDNAV 1'
>+ _def_dvdread='#undef USE_DVDREAD'
>+ _def_css='#undef HAVE_LIBCSS'
>+ _ld_css="-L$_dvdnavdir/.libs -ldvdnav -ldvdread"
>+ _inc_css="-I$_dvdnavdir"
>+ echores "libdvdnav"
>+elif test "$_dvdread" = yes ; then
> _largefiles=yes
> _def_dvdread='#define USE_DVDREAD 1'
> _def_css='#undef HAVE_LIBCSS'
>@@ -2677,6 +2699,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
>@@ -2821,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 main/libmpdemux/open.c main.nav/libmpdemux/open.c
>--- main/libmpdemux/open.c Wed Dec 19 14:53:41 2001
>+++ main.nav/libmpdemux/open.c Wed Dec 19 20:26:42 2001
>@@ -26,7 +26,11 @@
> int dvd_chapter=1;
> int dvd_angle=1;
>
>-#ifdef USE_DVDREAD
>+#ifdef USE_DVDNAV
>+
>+#include <dvdnav.h>
>+
>+#elif USE_DVDREAD
>
> #include <dvdread/dvd_reader.h>
> #include <dvdread/ifo_types.h>
>@@ -104,7 +108,21 @@
> #endif
>
> //============ Open DVD title ==============
>-#ifdef USE_DVDREAD
>+#ifdef USE_DVDNAV
>+if(dvd_title){
>+ 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;
>+}
>+#elif USE_DVDREAD
> if(dvd_title){
> // int ret,ret2;
> dvd_priv_t *d;
>diff -Naur 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 Wed Dec 19 21:04:57 2001
>@@ -57,7 +57,28 @@
> len=vcd_read(s->fd,s->buffer);break;
> #endif
> #endif
>-#ifdef USE_DVDREAD
>+#ifdef USE_DVDNAV
>+ case STREAMTYPE_DVD: {
>+ int event;
>+ 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) );
>+ switch(event)
>+ {
>+ case DVDNAV_HIGHLIGHT: {
>+ dvdnav_highlight_event_t *hevent = (dvdnav_highlight_event_t*)(s->buffer);
>+ break;
>+ }
>+ case DVDNAV_SPU_CLUT_CHANGE: {
>+ break;
>+ }
>+ case DVDNAV_STOP: {
>+ len = -1;
>+ }
>+ }
>+
>+ break;
>+ }
>+#elif USE_DVDREAD
> case STREAMTYPE_DVD: {
> off_t pos=dvd_read_sector(s->priv,s->buffer);
> if(pos>=0){
>diff -Naur main/libmpdemux/stream.h main.nav/libmpdemux/stream.h
>--- main/libmpdemux/stream.h Wed Dec 19 14:53:41 2001
>+++ main.nav/libmpdemux/stream.h Wed Dec 19 21:04:47 2001
>@@ -165,7 +165,11 @@
> extern int dvd_angle;
> //#endif
>
>-#ifdef USE_DVDREAD
>+#ifdef USE_DVDNAV
>+
>+#include <dvdnav.h>
>+
>+#elif USE_DVDREAD
>
> #include <dvdread/dvd_reader.h>
> #include <dvdread/ifo_types.h>
>diff -Naur 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 Wed Dec 19 21:06:14 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 main/mplayer.c main.nav/mplayer.c
>--- main/mplayer.c Wed Dec 19 17:56:54 2001
>+++ main.nav/mplayer.c Wed Dec 19 21:30:56 2001
>@@ -1805,6 +1805,20 @@
> (c=lirc_mp_getinput())>0 ||
> #endif
> (!use_stdin && (c=getch2(0))>0) || (c=mplayer_get_key())>0) switch(c){
>+#ifdef USE_DVDNAV
>+ // DVD navigation support
>+ // Up key
>+ case 'e':
>+ dvdnav_upper_button_select(stream->priv);break;
>+ case 'c':
>+ dvdnav_lower_button_select(stream->priv);break;
>+ case 'f':
>+ dvdnav_right_button_select(stream->priv);break;
>+ case 's':
>+ dvdnav_left_button_select(stream->priv);break;
>+ case 'r':
>+ dvdnav_button_activate(stream->priv);break;
>+#endif
> // seek 10 sec
> case KEY_RIGHT:
> osd_function=OSD_FFW;
>
More information about the MPlayer-dev-eng
mailing list