Commit 77a52019 authored by Laurent Aimar's avatar Laurent Aimar

* dvdnav: added a dvdnavsimple shortcut : it skips the menu and all

 still frames, it doesn't handle the es selection (this way --sout-all
 will work).
  A major problem is that ES aren't added in a logical way like dvd and
dvdread do (audio/video). I don't know how to retrieve it from dvdnav.
(it's the same for dvdnav and dvdnavsimple)
parent 1570d3b9
......@@ -2,7 +2,7 @@
* demux2 adaptation layer.
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: demux2.c,v 1.9 2004/01/29 17:14:04 fenrir Exp $
* $Id: demux2.c,v 1.10 2004/01/30 01:38:53 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -45,10 +45,10 @@ vlc_module_begin();
/* Hack */
add_shortcut( "nsv" );
add_shortcut( "rm" );
add_shortcut( "ts2" );
add_shortcut( "ps2" );
add_shortcut( "dvdnav" );
add_shortcut( "dvdnavsimple" );
add_shortcut( "ffmpeg" );
vlc_module_end();
......
......@@ -2,7 +2,7 @@
* dvdnav.c: DVD module using the dvdnav library.
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: dvdnav.c,v 1.8 2004/01/25 20:05:28 hartman Exp $
* $Id: dvdnav.c,v 1.9 2004/01/30 01:38:53 fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -56,12 +56,14 @@ vlc_module_begin();
CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
set_capability( "access", 0 );
add_shortcut( "dvdnav" );
add_shortcut( "dvdnavsimple" );
set_callbacks( AccessOpen, AccessClose );
add_submodule();
set_description( _("DVDnav Input (demux)") );
set_capability( "demux2", 1 );
set_capability( "demux2", 0 );
add_shortcut( "dvdnav" );
add_shortcut( "dvdnavsimple" );
set_callbacks( DemuxOpen, DemuxClose );
vlc_module_end();
......@@ -118,6 +120,7 @@ struct demux_sys_t
/* */
vlc_bool_t b_es_out_ok;
vlc_bool_t b_simple;
};
static int DemuxControl( demux_t *, int, va_list );
......@@ -155,13 +158,13 @@ static int AccessOpen( vlc_object_t *p_this )
/* We try only if we are forced */
if( p_input->psz_demux && *p_input->psz_demux &&
strcmp( p_input->psz_demux, "dvdnav" ) )
strncmp( p_input->psz_demux, "dvdnav", 6 ) )
{
msg_Warn( p_input, "dvdnav access discarded (demuxer forced)" );
return VLC_EGENERIC;
}
b_force = (p_input->psz_access && !strcmp(p_input->psz_access, "dvdnav")) ?
b_force = (p_input->psz_access && !strncmp(p_input->psz_access, "dvdnav", 6)) ?
VLC_TRUE : VLC_FALSE;
psz_name = ParseCL( VLC_OBJECT(p_input), p_input->psz_name, b_force,
......@@ -196,7 +199,14 @@ static int AccessOpen( vlc_object_t *p_this )
p_input->i_mtu = 0;
/* force dvdnav plugin */
if( p_input->psz_access && !strncmp(p_input->psz_access, "dvdnav", 6 ) )
{
p_input->psz_demux = strdup( p_input->psz_access );
}
else
{
p_input->psz_demux = strdup( "dvdnav" );
}
/* Update default_pts to a suitable value for udp access */
var_Create( p_input, "dvdnav-caching", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
......@@ -294,9 +304,10 @@ static int DemuxOpen( vlc_object_t *p_this )
vlc_value_t val, text;
int i_title, i_titles, i_chapter, i_chapters, i_angle, i;
char *psz_name;
char psz_lang[3] = "en";
if( strcmp( p_demux->psz_access, "dvdnav" ) ||
strcmp( p_demux->psz_demux, "dvdnav" ) )
if( strncmp( p_demux->psz_access, "dvdnav", 6 ) ||
strncmp( p_demux->psz_demux, "dvdnav", 6 ) )
{
msg_Warn( p_demux, "dvdnav module discarded" );
return VLC_EGENERIC;
......@@ -313,6 +324,13 @@ static int DemuxOpen( vlc_object_t *p_this )
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
memset( p_sys, 0, sizeof( demux_sys_t ) );
p_sys->b_simple = strcmp( p_demux->psz_access, "dvdnavsimple" ) ? VLC_FALSE : VLC_TRUE;
if( p_sys->b_simple && i_title < 1 )
{
/* skip menu part */
i_title = 1;
}
ps_track_init( p_sys->tk );
p_sys->i_aspect = -1;
......@@ -339,12 +357,9 @@ static int DemuxOpen( vlc_object_t *p_this )
msg_Warn( p_demux, "cannot set PGC positioning flag" );
}
if( dvdnav_menu_language_select( p_sys->dvdnav, "en" ) !=
DVDNAV_STATUS_OK ||
dvdnav_audio_language_select( p_sys->dvdnav, "en" ) !=
DVDNAV_STATUS_OK ||
dvdnav_spu_language_select( p_sys->dvdnav, "en" ) !=
DVDNAV_STATUS_OK )
if( dvdnav_menu_language_select ( p_sys->dvdnav,"en") != DVDNAV_STATUS_OK||
dvdnav_audio_language_select( p_sys->dvdnav,"en") != DVDNAV_STATUS_OK||
dvdnav_spu_language_select ( p_sys->dvdnav,"en") != DVDNAV_STATUS_OK )
{
msg_Warn( p_demux, "something failed while setting en language (%s)",
dvdnav_err_to_string( p_sys->dvdnav ) );
......@@ -363,7 +378,8 @@ static int DemuxOpen( vlc_object_t *p_this )
{
msg_Warn( p_demux, "cannot set title/chapter" );
}
if( !p_sys->b_simple )
{
/* Get p_input and create variable */
p_sys->p_input =
vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_ANYWHERE );
......@@ -402,6 +418,7 @@ static int DemuxOpen( vlc_object_t *p_this )
p_sys->p_ev->p_demux = p_demux;
vlc_thread_create( p_sys->p_ev, "dvdnav event thread handler", EventThread,
VLC_THREAD_PRIORITY_LOW, VLC_FALSE );
}
/* fill p_demux field */
p_demux->pf_control = DemuxControl;
......@@ -419,9 +436,12 @@ static void DemuxClose( vlc_object_t *p_this )
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
if( !p_sys->b_simple )
{
/* stop the event handler */
p_sys->p_ev->b_die = VLC_TRUE;
vlc_thread_join( p_sys->p_ev );
vlc_object_destroy( p_sys->p_ev );
var_Destroy( p_sys->p_input, "highlight-mutex" );
var_Destroy( p_sys->p_input, "highlight" );
......@@ -433,6 +453,7 @@ static void DemuxClose( vlc_object_t *p_this )
var_Destroy( p_sys->p_input, "contrast" );
vlc_object_release( p_sys->p_input );
}
dvdnav_close( p_sys->dvdnav );
free( p_sys );
......@@ -498,12 +519,15 @@ static int DemuxDemux( demux_t *p_demux )
int i_len;
if( !p_sys->b_es_out_ok )
{
if( !p_sys->b_simple )
{
/* We do ourself the selection/unselection
* Problem: bypass --audio-channel and --spu-channel
* Solution: call ourself dvdnav_??set_channel -> TODO
*/
es_out_Control( p_demux->out, ES_OUT_SET_MODE, ES_OUT_MODE_NONE );
}
p_sys->b_es_out_ok = VLC_TRUE;
}
......@@ -529,6 +553,8 @@ static int DemuxDemux( demux_t *p_demux )
case DVDNAV_STILL_FRAME:
{
dvdnav_still_event_t *event = (dvdnav_still_event_t*)packet;
if( !p_sys->b_simple )
{
vlc_mutex_lock( &p_sys->p_ev->lock );
if( !p_sys->p_ev->b_still )
{
......@@ -547,6 +573,11 @@ static int DemuxDemux( demux_t *p_demux )
}
vlc_mutex_unlock( &p_sys->p_ev->lock );
msleep( 40000 );
}
else
{
dvdnav_still_skip( p_sys->dvdnav );
}
break;
}
case DVDNAV_SPU_STREAM_CHANGE:
......@@ -561,7 +592,10 @@ static int DemuxDemux( demux_t *p_demux )
msg_Dbg( p_demux, " - physical_pan_scan=%d",
event->physical_pan_scan );
if( !p_sys->b_simple )
{
ESSubtitleUpdate( p_demux );
}
break;
}
case DVDNAV_AUDIO_STREAM_CHANGE:
......@@ -597,6 +631,21 @@ static int DemuxDemux( demux_t *p_demux )
}
tk->b_seen = VLC_FALSE;
}
if( p_sys->b_simple )
{
int32_t i_title = 0;
int32_t i_part = 0;
if( dvdnav_current_title_info( p_sys->dvdnav, &i_title, &i_part ) == DVDNAV_STATUS_OK )
{
if( i_title == 0 )
{
/* we have returned in menu, stop dvd */
/* FIXME is it the right way ? */
return 0;
}
}
}
break;
}
case DVDNAV_CELL_CHANGE:
......@@ -634,8 +683,10 @@ static int DemuxDemux( demux_t *p_demux )
msg_Dbg( p_demux, "DVDNAV_HIGHLIGHT" );
msg_Dbg( p_demux, " - display=%d", event->display );
msg_Dbg( p_demux, " - buttonN=%d", event->buttonN );
if( !p_sys->b_simple )
{
ButtonUpdate( p_demux );
}
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment