mirror of
https://github.com/mpv-player/mpv
synced 2025-01-18 21:31:13 +00:00
restored support for dvdnav only in the stream layer; all other functionalities are disabled
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18715 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
900e74381f
commit
f1871d5766
1
Makefile
1
Makefile
@ -114,6 +114,7 @@ COMMON_LIBS = libmpcodecs/libmpcodecs.a \
|
||||
postproc/libswscale.a \
|
||||
osdep/libosdep.a \
|
||||
$(DVDREAD_LIB) \
|
||||
$(DVDNAV_LIB) \
|
||||
$(CODEC_LIBS) \
|
||||
$(FREETYPE_LIB) \
|
||||
$(TERMCAP_LIB) \
|
||||
|
@ -27,6 +27,7 @@
|
||||
{"vcd", "-vcd N is deprecated, use vcd://N instead.\n", CONF_TYPE_PRINT, CONF_NOCFG ,0,0, NULL},
|
||||
{"cuefile", "-cuefile is deprecated, use cue://filename:N where N is the track number.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
|
||||
{"cdrom-device", &cdrom_device, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||
#undef USE_DVDNAV
|
||||
#ifdef USE_DVDNAV
|
||||
{"dvdnav", "-dvdnav is deprecated, use dvdnav:// instead.\n", CONF_TYPE_PRINT, 0, 0, 1, NULL},
|
||||
{"skipopening", &dvd_nav_skip_opening, CONF_TYPE_FLAG, 0, 0, 1, NULL},
|
||||
|
113
configure
vendored
113
configure
vendored
@ -1614,8 +1614,7 @@ _faac=auto
|
||||
_ladspa=auto
|
||||
_xmms=no
|
||||
_have_dvd=no
|
||||
# dvdnav disabled, it does not work
|
||||
#_dvdnav=no
|
||||
_dvdnav=no
|
||||
_dvdread=auto
|
||||
_dvdkit=auto
|
||||
_xanim=auto
|
||||
@ -1839,9 +1838,8 @@ for ac_option do
|
||||
--disable-dvdread) _dvdread=no ;;
|
||||
--enable-mpdvdkit) _dvdkit=yes ;;
|
||||
--disable-mpdvdkit) _dvdkit=no ;;
|
||||
# dvdnav disabled, it does not work
|
||||
# --enable-dvdnav) _dvdnav=yes ;;
|
||||
# --disable-dvdnav) _dvdnav=no ;;
|
||||
--enable-dvdnav) _dvdnav=yes ;;
|
||||
--disable-dvdnav) _dvdnav=no ;;
|
||||
--enable-xanim) _xanim=yes ;;
|
||||
--disable-xanim) _xanim=no ;;
|
||||
--enable-real) _real=yes ;;
|
||||
@ -2016,11 +2014,10 @@ for ac_option do
|
||||
--language=*)
|
||||
_language=`echo $ac_option | cut -d '=' -f 2`
|
||||
;;
|
||||
# dvdnav disabled, it does not work
|
||||
# --with-libdvdnav=*)
|
||||
# _dvdnavdir=`echo $ac_option | cut -d '=' -f 2`
|
||||
# _dvdnav=yes
|
||||
# ;;
|
||||
--with-libdvdnav=*)
|
||||
_dvdnavdir=`echo $ac_option | cut -d '=' -f 2`
|
||||
_dvdnav=yes
|
||||
;;
|
||||
|
||||
--with-codecsdir=*)
|
||||
_win32libdir=`echo $ac_option | cut -d '=' -f 2`
|
||||
@ -2140,10 +2137,9 @@ for ac_option do
|
||||
--with-glib-config=*)
|
||||
_glibconfig=`echo $ac_option | cut -d '=' -f 2`
|
||||
;;
|
||||
# dvdnav disabled, it does not work
|
||||
# --with-dvdnav-config=*)
|
||||
# _dvdnavconfig=`echo $ac_option | cut -d '=' -f 2`
|
||||
# ;;
|
||||
--with-dvdnav-config=*)
|
||||
_dvdnavconfig=`echo $ac_option | cut -d '=' -f 2`
|
||||
;;
|
||||
--with-madlibdir=*)
|
||||
_ld_mad=-L`echo $ac_option | cut -d '=' -f 2 | sed 's,:, -L,g'`
|
||||
;;
|
||||
@ -5188,48 +5184,52 @@ else
|
||||
_def_have_dvd='#undef HAVE_DVD'
|
||||
fi
|
||||
|
||||
# dvdnav disabled, it does not work
|
||||
# echocheck "DVD support (libdvdnav)"
|
||||
# if test "$_dvdnav" = yes ; then
|
||||
# cat > $TMPC <<EOF
|
||||
# #include <dvdnav.h>
|
||||
# int main(void) { dvdnav_t *dvd=0; return 0; }
|
||||
# EOF
|
||||
# _dvdnav=no
|
||||
# test -n "$_dvdnavdir" && _legal_dvdnavdir=-L$_dvdnavdir/.libs
|
||||
# if test -z "$_dvdnavconfig" ; then
|
||||
# if ( dvdnav-config --version ) >/dev/null 2>&1 ; then
|
||||
# _dvdnavconfig="dvdnav-config"
|
||||
# fi
|
||||
# fi
|
||||
# test -z "$_dvdnavdir" && test -n "$_dvdnavconfig" && _dvdnavdir=`$_dvdnavconfig --cflags`
|
||||
# _used_css=
|
||||
# test "$_dvdkit" = no && _used_css=$_ld_css
|
||||
# cc_check $_inc_extra -I$_dvdnavdir $_legal_dvdnavdir -ldvdnav $_used_css $_ld_dl $_ld_pthread && _dvdnav=yes
|
||||
# fi
|
||||
# if test "$_dvdnav" = yes ; then
|
||||
# _largefiles=yes
|
||||
# _def_dvdnav='#define USE_DVDNAV 1'
|
||||
# if test -n "$_legal_dvdnavdir" ; then
|
||||
# _ld_css="$_ld_css $_legal_dvdnavdir -ldvdnav"
|
||||
# elif test -n "$_dvdnavconfig" ; then
|
||||
# _ld_css="$_ld_css `$_dvdnavconfig --libs`"
|
||||
# else
|
||||
# _ld_css="$_ld_css -ldvdnav"
|
||||
# fi
|
||||
# if test -n "$_dvdnavconfig" ; then
|
||||
# _dvdnav_version=`$_dvdnavconfig --version | sed "s/\.//g"`
|
||||
# _def_dvdnav_version="#define DVDNAVVERSION $_dvdnav_version"
|
||||
# fi
|
||||
# if test -n "$_dvdnavdir" ; then
|
||||
# _inc_extra="$_inc_extra -I$_dvdnavdir"
|
||||
# fi
|
||||
# _inputmodules="dvdnav $_inputmodules"
|
||||
# else
|
||||
# _def_dvdnav='#undef USE_DVDNAV'
|
||||
# _noinputmodules="dvdnav $_noinputmodules"
|
||||
# fi
|
||||
# echores "$_dvdnav"
|
||||
echocheck "DVD support (libdvdnav)"
|
||||
if test "$_dvdnav" = yes ; then
|
||||
cat > $TMPC <<EOF
|
||||
#include <dvdnav.h>
|
||||
int main(void) { dvdnav_t *dvd=0; return 0; }
|
||||
EOF
|
||||
_dvdnav=no
|
||||
test -n "$_dvdnavdir" && _legal_dvdnavdir=-L$_dvdnavdir/.libs
|
||||
if test -z "$_dvdnavconfig" ; then
|
||||
if ( dvdnav-config --version ) >/dev/null 2>&1 ; then
|
||||
_dvdnavconfig="dvdnav-config"
|
||||
fi
|
||||
fi
|
||||
test -z "$_dvdnavdir" && test -n "$_dvdnavconfig" && _dvdnavdir=`$_dvdnavconfig --cflags`
|
||||
_used_css=
|
||||
#test "$_dvdkit" = no && _used_css=$_ld_css
|
||||
cc_check $_inc_extra -I$_dvdnavdir $_legal_dvdnavdir -ldvdnav $_used_css $_ld_dl $_ld_pthread && _dvdnav=yes
|
||||
fi
|
||||
if test "$_dvdnav" = yes ; then
|
||||
_largefiles=yes
|
||||
_def_dvdnav='#define USE_DVDNAV 1'
|
||||
_ld_dvdnav=
|
||||
if test -n "$_legal_dvdnavdir" ; then
|
||||
#_ld_css="$_ld_css $_legal_dvdnavdir -ldvdnav"
|
||||
_ld_dvdnav="$_legal_dvdnavdir -ldvdnav"
|
||||
elif test -n "$_dvdnavconfig" ; then
|
||||
#_ld_css="$_ld_css `$_dvdnavconfig --libs`"
|
||||
_ld_dvdnav="`$_dvdnavconfig --libs`"
|
||||
else
|
||||
#_ld_css="$_ld_css -ldvdnav"
|
||||
_ld_dvdnav="-ldvdnav"
|
||||
fi
|
||||
if test -n "$_dvdnavconfig" ; then
|
||||
_dvdnav_version=`$_dvdnavconfig --version | sed "s/\.//g"`
|
||||
_def_dvdnav_version="#define DVDNAVVERSION $_dvdnav_version"
|
||||
_inc_extra="$_inc_extra `$_dvdnavconfig --cflags`"
|
||||
fi
|
||||
if test -n "$_dvdnavdir" ; then
|
||||
_inc_extra="$_inc_extra -I$_dvdnavdir"
|
||||
fi
|
||||
_inputmodules="dvdnav $_inputmodules"
|
||||
else
|
||||
_def_dvdnav='#undef USE_DVDNAV'
|
||||
_noinputmodules="dvdnav $_noinputmodules"
|
||||
fi
|
||||
echores "$_dvdnav"
|
||||
|
||||
echocheck "cdparanoia"
|
||||
if test "$_cdparanoia" = auto ; then
|
||||
@ -7475,6 +7475,7 @@ HAVE_DVD = $_have_dvd
|
||||
DVDREAD = $_dvdread
|
||||
DVDREAD_LIB = $_ld_dvdread
|
||||
DVDKIT2 = $_dvdkit
|
||||
DVDNAV_LIB = $_ld_dvdnav
|
||||
SDL_INC = $_inc_sdl
|
||||
W32_DEP = $_dep_win32
|
||||
W32_LIB = $_ld_win32
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef USE_DVDNAV
|
||||
#include <dvdnav_internal.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
@ -10,11 +9,16 @@
|
||||
#include "osdep/timer.h"
|
||||
#include "input/input.h"
|
||||
#include "stream.h"
|
||||
#include "demuxer.h"
|
||||
#include "dvdnav_stream.h"
|
||||
#include "libvo/video_out.h"
|
||||
#include "spudec.h"
|
||||
#include "m_option.h"
|
||||
#include "m_struct.h"
|
||||
#include "help_mp.h"
|
||||
|
||||
extern char *dvd_device;
|
||||
extern char *audio_lang, *dvdsub_lang;
|
||||
|
||||
static struct stream_priv_s {
|
||||
int track;
|
||||
@ -27,6 +31,8 @@ static struct stream_priv_s {
|
||||
#define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f)
|
||||
/// URL definition
|
||||
static m_option_t stream_opts_fields[] = {
|
||||
{"filename", ST_OFF(device), CONF_TYPE_STRING, 0, 0, 0, NULL },
|
||||
{"hostname", ST_OFF(track), CONF_TYPE_INT, 0, 0, 0, NULL},
|
||||
{ NULL, NULL, 0, 0, 0, 0, NULL }
|
||||
};
|
||||
static struct m_struct_st stream_opts = {
|
||||
@ -73,15 +79,26 @@ dvdnav_priv_t * new_dvdnav_stream(char * filename) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dvdnav_stream_ignore_timers(dvdnav_priv,dvd_nav_skip_opening);
|
||||
|
||||
if(1) //from vlc: if not used dvdnav from cvs will fail
|
||||
{
|
||||
int len, event;
|
||||
char buf[2048];
|
||||
|
||||
dvdnav_get_next_block(dvdnav_priv->dvdnav,buf,&event,&len);
|
||||
}
|
||||
|
||||
/* turn on dvdnav caching */
|
||||
dvdnav_set_readahead_flag(dvdnav_priv->dvdnav,1);
|
||||
|
||||
dvdnav_set_readahead_flag(dvdnav_priv->dvdnav, 0);
|
||||
if(dvdnav_set_PGC_positioning_flag(dvdnav_priv->dvdnav, 1) != DVDNAV_STATUS_OK)
|
||||
mp_msg(MSGT_OPEN,MSGL_ERR,"stream_dvdnav, failed to set PGC positioning\n");
|
||||
#if 1
|
||||
/* report the title?! */
|
||||
if (dvdnav_get_title_string(dvdnav_priv->dvdnav,&title_str)==DVDNAV_STATUS_OK) {
|
||||
mp_msg(MSGT_OPEN,MSGL_INFO,"Title: '%s'\n",title_str);
|
||||
mp_msg(MSGT_IDENTIFY, MSGL_INFO,"Title: '%s'\n",title_str);
|
||||
}
|
||||
#endif
|
||||
|
||||
//dvdnav_event_clear(dvdnav_priv);
|
||||
|
||||
return dvdnav_priv;
|
||||
}
|
||||
@ -97,20 +114,6 @@ int dvdnav_stream_reset(dvdnav_priv_t * dvdnav_priv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void free_dvdnav_stream(dvdnav_priv_t * dvdnav_priv) {
|
||||
if (!dvdnav_priv) return;
|
||||
|
||||
dvdnav_close(dvdnav_priv->dvdnav);
|
||||
dvdnav_priv->dvdnav=NULL;
|
||||
free(dvdnav_priv);
|
||||
}
|
||||
|
||||
void dvdnav_stream_ignore_timers(dvdnav_priv_t * dvdnav_priv, int ignore) {
|
||||
if (!dvdnav_priv) return;
|
||||
|
||||
dvdnav_priv->ignore_timers=ignore;
|
||||
}
|
||||
|
||||
int dvdnav_stream_sleeping(dvdnav_priv_t * dvdnav_priv) {
|
||||
unsigned int now;
|
||||
|
||||
@ -126,10 +129,10 @@ int dvdnav_stream_sleeping(dvdnav_priv_t * dvdnav_priv) {
|
||||
}
|
||||
dvdnav_still_skip(dvdnav_priv->dvdnav); // continue past...
|
||||
dvdnav_priv->sleeping=0;
|
||||
printf("%s: woke up!\n",__FUNCTION__);
|
||||
mp_msg(MSGT_OPEN,MSGL_V, "%s: woke up!\n",__FUNCTION__);
|
||||
}
|
||||
dvd_nav_still=0;
|
||||
printf("%s: active\n",__FUNCTION__);
|
||||
mp_msg(MSGT_OPEN,MSGL_V, "%s: active\n",__FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -143,11 +146,11 @@ void dvdnav_stream_sleep(dvdnav_priv_t * dvdnav_priv, int seconds) {
|
||||
case 0:
|
||||
return;
|
||||
case 0xff:
|
||||
printf( "Sleeping indefinately\n" );
|
||||
mp_msg(MSGT_OPEN,MSGL_V, "Sleeping indefinately\n" );
|
||||
dvdnav_priv->sleeping=2;
|
||||
break;
|
||||
default:
|
||||
printf( "Sleeping %d sec(s)\n", seconds );
|
||||
mp_msg(MSGT_OPEN,MSGL_V, "Sleeping %d sec(s)\n", seconds );
|
||||
dvdnav_priv->sleep_until = GetTimer();// + seconds*1000000;
|
||||
dvdnav_priv->sleeping=1;
|
||||
break;
|
||||
@ -164,7 +167,7 @@ void dvdnav_stream_add_event(dvdnav_priv_t* dvdnav_priv, int event, unsigned cha
|
||||
if (!dvdnav_priv->started) return;
|
||||
|
||||
if (!(dvdnav_event=(dvdnav_event_t*)calloc(1,sizeof(*dvdnav_event)))) {
|
||||
printf("%s: dvdnav_event: out of memory!\n",__FUNCTION__);
|
||||
mp_msg(MSGT_OPEN,MSGL_V, "%s: dvdnav_event: out of memory!\n",__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
dvdnav_event->event=event;
|
||||
@ -173,7 +176,7 @@ void dvdnav_stream_add_event(dvdnav_priv_t* dvdnav_priv, int event, unsigned cha
|
||||
dvdnav_event->len=len;
|
||||
|
||||
if (!(cmd = (mp_cmd_t*)calloc(1,sizeof(*cmd)))) {
|
||||
printf("%s: mp_cmd_t: out of memory!\n",__FUNCTION__);
|
||||
mp_msg(MSGT_OPEN,MSGL_V, "%s: mp_cmd_t: out of memory!\n",__FUNCTION__);
|
||||
free(dvdnav_event->details);
|
||||
free(dvdnav_event);
|
||||
return;
|
||||
@ -182,26 +185,24 @@ void dvdnav_stream_add_event(dvdnav_priv_t* dvdnav_priv, int event, unsigned cha
|
||||
cmd->name=strdup("dvdnav_event"); // FIXME: do I really need a 'name'?
|
||||
cmd->nargs=1;
|
||||
cmd->args[0].v.v=dvdnav_event;
|
||||
|
||||
mp_input_queue_cmd(cmd);
|
||||
}
|
||||
|
||||
void dvdnav_stream_read(dvdnav_priv_t * dvdnav_priv, unsigned char *buf, int *len) {
|
||||
int dvdnav_stream_read(dvdnav_priv_t * dvdnav_priv, unsigned char *buf, int *len) {
|
||||
int event = DVDNAV_NOP;
|
||||
|
||||
if (!len) return;
|
||||
if (!len) return -1;
|
||||
*len=-1;
|
||||
if (!dvdnav_priv) return;
|
||||
if (!buf) return;
|
||||
if (!dvdnav_priv) return -1;
|
||||
if (!buf) return -1;
|
||||
|
||||
if (dvd_nav_still) {
|
||||
printf("%s: got a stream_read while I should be asleep!\n",__FUNCTION__);
|
||||
mp_msg(MSGT_OPEN,MSGL_V, "%s: got a stream_read while I should be asleep!\n",__FUNCTION__);
|
||||
*len=0;
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (dvdnav_get_next_block(dvdnav_priv->dvdnav,buf,&event,len)!=DVDNAV_STATUS_OK) {
|
||||
printf( "Error getting next block from DVD (%s)\n",dvdnav_err_to_string(dvdnav_priv->dvdnav) );
|
||||
mp_msg(MSGT_OPEN,MSGL_V, "Error getting next block from DVD %d (%s)\n",event, dvdnav_err_to_string(dvdnav_priv->dvdnav) );
|
||||
*len=-1;
|
||||
}
|
||||
else if (event!=DVDNAV_BLOCK_OK) {
|
||||
@ -210,9 +211,6 @@ void dvdnav_stream_read(dvdnav_priv_t * dvdnav_priv, unsigned char *buf, int *le
|
||||
switch (event) {
|
||||
case DVDNAV_STILL_FRAME: {
|
||||
dvdnav_still_event_t *still_event = (dvdnav_still_event_t*)(buf);
|
||||
|
||||
printf("************************************************************ STILL \n");
|
||||
|
||||
//if (dvdnav_priv->started) dvd_nav_still=1;
|
||||
//else
|
||||
dvdnav_still_skip(dvdnav_priv->dvdnav); // don't let dvdnav stall on this image
|
||||
@ -226,6 +224,7 @@ void dvdnav_stream_read(dvdnav_priv_t * dvdnav_priv, unsigned char *buf, int *le
|
||||
*len=0;
|
||||
}
|
||||
// printf("%s: got %d\n",__FUNCTION__,*len);
|
||||
return event;
|
||||
}
|
||||
|
||||
void dvdnav_stream_fullstart(dvdnav_priv_t * dvdnav_priv) {
|
||||
@ -237,15 +236,16 @@ void dvdnav_stream_fullstart(dvdnav_priv_t * dvdnav_priv) {
|
||||
|
||||
unsigned int * dvdnav_stream_get_palette(dvdnav_priv_t * dvdnav_priv) {
|
||||
if (!dvdnav_priv) {
|
||||
printf("%s: NULL dvdnav_priv\n",__FUNCTION__);
|
||||
mp_msg(MSGT_OPEN,MSGL_V, "%s: NULL dvdnav_priv\n",__FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
if (!dvdnav_priv->dvdnav) {
|
||||
printf("%s: NULL dvdnav_priv->dvdnav\n",__FUNCTION__);
|
||||
mp_msg(MSGT_OPEN,MSGL_V, "%s: NULL dvdnav_priv->dvdnav\n",__FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
#if 0
|
||||
if (!dvdnav_priv->dvdnav->vm) {
|
||||
printf("%s: NULL dvdnav_priv->dvdnav->vm\n",__FUNCTION__);
|
||||
mp_msg(MSGT_OPEN,MSGL_V, "%s: NULL dvdnav_priv->dvdnav->vm\n",__FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
if (!dvdnav_priv->dvdnav->vm->state.pgc) {
|
||||
@ -253,36 +253,116 @@ unsigned int * dvdnav_stream_get_palette(dvdnav_priv_t * dvdnav_priv) {
|
||||
return NULL;
|
||||
}
|
||||
return dvdnav_priv->dvdnav->vm->state.pgc->palette;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void update_title_len(stream_t *stream) {
|
||||
dvdnav_priv_t *priv = stream->priv;
|
||||
dvdnav_status_t status;
|
||||
uint32_t pos = 0, len = 0;
|
||||
|
||||
status = dvdnav_get_position(priv->dvdnav, &pos, &len);
|
||||
if(status == DVDNAV_STATUS_OK && len)
|
||||
stream->end_pos = (off_t) len * 2048;
|
||||
}
|
||||
|
||||
|
||||
static int seek(stream_t *s, off_t newpos) {
|
||||
uint32_t pos = 0, len = 0, sector = 0;
|
||||
dvdnav_priv_t *priv = s->priv;
|
||||
|
||||
if(newpos==0) {
|
||||
if(dvdnav_stream_reset((dvdnav_priv_t*)s->priv))
|
||||
if(dvdnav_stream_reset(priv->dvdnav))
|
||||
s->pos=0;
|
||||
}
|
||||
if(newpos!=s->pos)
|
||||
mp_msg(MSGT_STREAM,MSGL_INFO,"Cannot seek in DVDNAV streams yet!\n");
|
||||
else {
|
||||
if(s->end_pos && newpos > s->end_pos)
|
||||
newpos = s->end_pos;
|
||||
sector = newpos / 2048ULL;
|
||||
if(dvdnav_sector_search(priv->dvdnav, (uint64_t) sector, SEEK_SET) != DVDNAV_STATUS_OK)
|
||||
goto fail;
|
||||
|
||||
s->pos = newpos;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
fail:
|
||||
mp_msg(MSGT_STREAM,MSGL_INFO,"dvdnav_stream, seeking to %"PRIu64" failed: %s\n", newpos, dvdnav_err_to_string(priv->dvdnav));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void stream_dvd_close(stream_t *s) {
|
||||
dvd_close(s->priv);
|
||||
static void stream_dvdnav_close(stream_t *s) {
|
||||
dvdnav_priv_t *priv = s->priv;
|
||||
dvdnav_close(priv->dvdnav);
|
||||
priv->dvdnav = NULL;
|
||||
free(priv);
|
||||
}
|
||||
|
||||
|
||||
static int fill_buffer(stream_t *s, char *but, int len)
|
||||
{
|
||||
int event;
|
||||
dvdnav_priv_t* dvdnav_priv=s->priv;
|
||||
len=0;
|
||||
if(!s->end_pos)
|
||||
update_title_len(s);
|
||||
while(!len) /* grab all event until DVDNAV_BLOCK_OK (len=2048), DVDNAV_STOP or DVDNAV_STILL_FRAME */
|
||||
{
|
||||
if(-1==(event=dvdnav_stream_read(dvdnav_priv, s->buffer, &len)) || len==-1)
|
||||
{
|
||||
mp_msg(MSGT_CPLAYER,MSGL_ERR, "DVDNAV stream read error!\n");
|
||||
return 0;
|
||||
}
|
||||
switch (event) {
|
||||
case DVDNAV_STOP: return len;
|
||||
case DVDNAV_BLOCK_OK: return len;
|
||||
#if 0
|
||||
case DVDNAV_STILL_FRAME: {
|
||||
if(!dvdnav_priv->stillok) dvdnav_priv->stillcounter++;
|
||||
dvdnav_priv->lockstillcounter++;
|
||||
return len;
|
||||
break;
|
||||
}
|
||||
|
||||
case DVDNAV_WAIT: {
|
||||
if(dvdnav_priv->waitcounter>=DVDNAV_MAX_WAIT_FRAME) return len;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
if(dvdnav_priv->event.cell_really_change &&
|
||||
dvdnav_priv->started &&
|
||||
!dvdnav_priv->vts_domain)
|
||||
return len;
|
||||
#endif
|
||||
}
|
||||
mp_msg(MSGT_STREAM,MSGL_DBG2,"DVDNAV fill_buffer len: %d\n",len);
|
||||
return len;
|
||||
}
|
||||
|
||||
static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
|
||||
struct stream_priv_s* p = (struct stream_priv_s*)opts;
|
||||
char *filename, *name;
|
||||
char *filename;
|
||||
int event,len,tmplen=0;
|
||||
uint32_t pos, l2;
|
||||
dvdnav_priv_t *dvdnav_priv;
|
||||
dvdnav_status_t status;
|
||||
|
||||
mp_msg(MSGT_OPEN,MSGL_INFO,"URL: %s\n", filename);
|
||||
filename = strdup(stream->url);
|
||||
name = (filename[9] == '\0') ? NULL : filename + 9;
|
||||
if(!name) name=DEFAULT_DVD_DEVICE;
|
||||
if(!(dvdnav_priv=new_dvdnav_stream(name))) {
|
||||
mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,name);
|
||||
//mp_msg(MSGT_OPEN,MSGL_INFO,"URL: %s\n", filename);
|
||||
|
||||
if(p->device) filename = p->device;
|
||||
else if(dvd_device) filename= dvd_device;
|
||||
else filename = DEFAULT_DVD_DEVICE;
|
||||
if(!(dvdnav_priv=new_dvdnav_stream(filename))) {
|
||||
mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,filename);
|
||||
return STREAM_UNSUPORTED;
|
||||
}
|
||||
|
||||
if(dvdnav_title_play(dvdnav_priv->dvdnav, p->track) != DVDNAV_STATUS_OK) {
|
||||
mp_msg(MSGT_OPEN,MSGL_FATAL,"dvdnav_stream, couldn't select title %d, error '%s'\n", p->track, dvdnav_err_to_string(dvdnav_priv->dvdnav));
|
||||
return STREAM_UNSUPORTED;
|
||||
}
|
||||
|
||||
@ -290,9 +370,14 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
|
||||
stream->flags = STREAM_READ | STREAM_SEEK;
|
||||
stream->fill_buffer = fill_buffer;
|
||||
stream->seek = seek;
|
||||
stream->close = stream_dvd_close;
|
||||
stream->close = stream_dvdnav_close;
|
||||
stream->type = STREAMTYPE_DVDNAV;
|
||||
stream->priv=(void*)dvdnav_priv;
|
||||
*file_format = DEMUXER_TYPE_MPEG_PS;
|
||||
|
||||
update_title_len(stream);
|
||||
if(!stream->pos)
|
||||
mp_msg(MSGT_OPEN,MSGL_ERR, "INIT ERROR: %d, couldn't get init pos %s\r\n", status, dvdnav_err_to_string(dvdnav_priv->dvdnav));
|
||||
|
||||
return STREAM_OK;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ int dvdnav_stream_reset(dvdnav_priv_t * dvdnav_priv);
|
||||
void free_dvdnav_stream(dvdnav_priv_t * dvdnav_priv);
|
||||
|
||||
void dvdnav_stream_ignore_timers(dvdnav_priv_t * dvdnav_priv, int ignore);
|
||||
void dvdnav_stream_read(dvdnav_priv_t * dvdnav_priv, unsigned char *buf, int *len);
|
||||
int dvdnav_stream_read(dvdnav_priv_t * dvdnav_priv, unsigned char *buf, int *len);
|
||||
|
||||
void dvdnav_stream_sleep(dvdnav_priv_t *dvdnav_priv, int seconds);
|
||||
int dvdnav_stream_sleeping(dvdnav_priv_t * dvdnav_priv);
|
||||
|
@ -115,7 +115,7 @@ stream_info_t* auto_open_streams[] = {
|
||||
&stream_info_dvd,
|
||||
#endif
|
||||
#ifdef USE_DVDNAV
|
||||
&stream_info_dvdnav;
|
||||
&stream_info_dvdnav,
|
||||
#endif
|
||||
|
||||
&stream_info_null,
|
||||
|
Loading…
Reference in New Issue
Block a user