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 @@ ...@@ -2,7 +2,7 @@
* demux2 adaptation layer. * demux2 adaptation layer.
***************************************************************************** *****************************************************************************
* Copyright (C) 2004 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -45,10 +45,10 @@ vlc_module_begin(); ...@@ -45,10 +45,10 @@ vlc_module_begin();
/* Hack */ /* Hack */
add_shortcut( "nsv" ); add_shortcut( "nsv" );
add_shortcut( "rm" );
add_shortcut( "ts2" ); add_shortcut( "ts2" );
add_shortcut( "ps2" ); add_shortcut( "ps2" );
add_shortcut( "dvdnav" ); add_shortcut( "dvdnav" );
add_shortcut( "dvdnavsimple" );
add_shortcut( "ffmpeg" ); add_shortcut( "ffmpeg" );
vlc_module_end(); vlc_module_end();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dvdnav.c: DVD module using the dvdnav library. * dvdnav.c: DVD module using the dvdnav library.
***************************************************************************** *****************************************************************************
* Copyright (C) 2004 VideoLAN * 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> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -56,12 +56,14 @@ vlc_module_begin(); ...@@ -56,12 +56,14 @@ vlc_module_begin();
CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE ); CACHING_TEXT, CACHING_LONGTEXT, VLC_TRUE );
set_capability( "access", 0 ); set_capability( "access", 0 );
add_shortcut( "dvdnav" ); add_shortcut( "dvdnav" );
add_shortcut( "dvdnavsimple" );
set_callbacks( AccessOpen, AccessClose ); set_callbacks( AccessOpen, AccessClose );
add_submodule(); add_submodule();
set_description( _("DVDnav Input (demux)") ); set_description( _("DVDnav Input (demux)") );
set_capability( "demux2", 1 ); set_capability( "demux2", 0 );
add_shortcut( "dvdnav" ); add_shortcut( "dvdnav" );
add_shortcut( "dvdnavsimple" );
set_callbacks( DemuxOpen, DemuxClose ); set_callbacks( DemuxOpen, DemuxClose );
vlc_module_end(); vlc_module_end();
...@@ -118,6 +120,7 @@ struct demux_sys_t ...@@ -118,6 +120,7 @@ struct demux_sys_t
/* */ /* */
vlc_bool_t b_es_out_ok; vlc_bool_t b_es_out_ok;
vlc_bool_t b_simple;
}; };
static int DemuxControl( demux_t *, int, va_list ); static int DemuxControl( demux_t *, int, va_list );
...@@ -155,13 +158,13 @@ static int AccessOpen( vlc_object_t *p_this ) ...@@ -155,13 +158,13 @@ static int AccessOpen( vlc_object_t *p_this )
/* We try only if we are forced */ /* We try only if we are forced */
if( p_input->psz_demux && *p_input->psz_demux && 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)" ); msg_Warn( p_input, "dvdnav access discarded (demuxer forced)" );
return VLC_EGENERIC; 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; VLC_TRUE : VLC_FALSE;
psz_name = ParseCL( VLC_OBJECT(p_input), p_input->psz_name, b_force, 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 ) ...@@ -196,7 +199,14 @@ static int AccessOpen( vlc_object_t *p_this )
p_input->i_mtu = 0; p_input->i_mtu = 0;
/* force dvdnav plugin */ /* 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" ); p_input->psz_demux = strdup( "dvdnav" );
}
/* Update default_pts to a suitable value for udp access */ /* Update default_pts to a suitable value for udp access */
var_Create( p_input, "dvdnav-caching", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT ); var_Create( p_input, "dvdnav-caching", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
...@@ -294,9 +304,10 @@ static int DemuxOpen( vlc_object_t *p_this ) ...@@ -294,9 +304,10 @@ static int DemuxOpen( vlc_object_t *p_this )
vlc_value_t val, text; vlc_value_t val, text;
int i_title, i_titles, i_chapter, i_chapters, i_angle, i; int i_title, i_titles, i_chapter, i_chapters, i_angle, i;
char *psz_name; char *psz_name;
char psz_lang[3] = "en";
if( strcmp( p_demux->psz_access, "dvdnav" ) || if( strncmp( p_demux->psz_access, "dvdnav", 6 ) ||
strcmp( p_demux->psz_demux, "dvdnav" ) ) strncmp( p_demux->psz_demux, "dvdnav", 6 ) )
{ {
msg_Warn( p_demux, "dvdnav module discarded" ); msg_Warn( p_demux, "dvdnav module discarded" );
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -313,6 +324,13 @@ static int DemuxOpen( vlc_object_t *p_this ) ...@@ -313,6 +324,13 @@ static int DemuxOpen( vlc_object_t *p_this )
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
memset( p_sys, 0, 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 ); ps_track_init( p_sys->tk );
p_sys->i_aspect = -1; p_sys->i_aspect = -1;
...@@ -339,12 +357,9 @@ static int DemuxOpen( vlc_object_t *p_this ) ...@@ -339,12 +357,9 @@ static int DemuxOpen( vlc_object_t *p_this )
msg_Warn( p_demux, "cannot set PGC positioning flag" ); msg_Warn( p_demux, "cannot set PGC positioning flag" );
} }
if( dvdnav_menu_language_select( p_sys->dvdnav, "en" ) != if( dvdnav_menu_language_select ( p_sys->dvdnav,"en") != DVDNAV_STATUS_OK||
DVDNAV_STATUS_OK || dvdnav_audio_language_select( p_sys->dvdnav,"en") != DVDNAV_STATUS_OK||
dvdnav_audio_language_select( p_sys->dvdnav, "en" ) != dvdnav_spu_language_select ( p_sys->dvdnav,"en") != DVDNAV_STATUS_OK )
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)", msg_Warn( p_demux, "something failed while setting en language (%s)",
dvdnav_err_to_string( p_sys->dvdnav ) ); dvdnav_err_to_string( p_sys->dvdnav ) );
...@@ -363,7 +378,8 @@ static int DemuxOpen( vlc_object_t *p_this ) ...@@ -363,7 +378,8 @@ static int DemuxOpen( vlc_object_t *p_this )
{ {
msg_Warn( p_demux, "cannot set title/chapter" ); msg_Warn( p_demux, "cannot set title/chapter" );
} }
if( !p_sys->b_simple )
{
/* Get p_input and create variable */ /* Get p_input and create variable */
p_sys->p_input = p_sys->p_input =
vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_ANYWHERE ); vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_ANYWHERE );
...@@ -402,6 +418,7 @@ static int DemuxOpen( vlc_object_t *p_this ) ...@@ -402,6 +418,7 @@ static int DemuxOpen( vlc_object_t *p_this )
p_sys->p_ev->p_demux = p_demux; p_sys->p_ev->p_demux = p_demux;
vlc_thread_create( p_sys->p_ev, "dvdnav event thread handler", EventThread, vlc_thread_create( p_sys->p_ev, "dvdnav event thread handler", EventThread,
VLC_THREAD_PRIORITY_LOW, VLC_FALSE ); VLC_THREAD_PRIORITY_LOW, VLC_FALSE );
}
/* fill p_demux field */ /* fill p_demux field */
p_demux->pf_control = DemuxControl; p_demux->pf_control = DemuxControl;
...@@ -419,9 +436,12 @@ static void DemuxClose( vlc_object_t *p_this ) ...@@ -419,9 +436,12 @@ static void DemuxClose( vlc_object_t *p_this )
demux_t *p_demux = (demux_t*)p_this; demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
if( !p_sys->b_simple )
{
/* stop the event handler */ /* stop the event handler */
p_sys->p_ev->b_die = VLC_TRUE; p_sys->p_ev->b_die = VLC_TRUE;
vlc_thread_join( p_sys->p_ev ); 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-mutex" );
var_Destroy( p_sys->p_input, "highlight" ); var_Destroy( p_sys->p_input, "highlight" );
...@@ -433,6 +453,7 @@ static void DemuxClose( vlc_object_t *p_this ) ...@@ -433,6 +453,7 @@ static void DemuxClose( vlc_object_t *p_this )
var_Destroy( p_sys->p_input, "contrast" ); var_Destroy( p_sys->p_input, "contrast" );
vlc_object_release( p_sys->p_input ); vlc_object_release( p_sys->p_input );
}
dvdnav_close( p_sys->dvdnav ); dvdnav_close( p_sys->dvdnav );
free( p_sys ); free( p_sys );
...@@ -498,12 +519,15 @@ static int DemuxDemux( demux_t *p_demux ) ...@@ -498,12 +519,15 @@ static int DemuxDemux( demux_t *p_demux )
int i_len; int i_len;
if( !p_sys->b_es_out_ok ) if( !p_sys->b_es_out_ok )
{
if( !p_sys->b_simple )
{ {
/* We do ourself the selection/unselection /* We do ourself the selection/unselection
* Problem: bypass --audio-channel and --spu-channel * Problem: bypass --audio-channel and --spu-channel
* Solution: call ourself dvdnav_??set_channel -> TODO * Solution: call ourself dvdnav_??set_channel -> TODO
*/ */
es_out_Control( p_demux->out, ES_OUT_SET_MODE, ES_OUT_MODE_NONE ); es_out_Control( p_demux->out, ES_OUT_SET_MODE, ES_OUT_MODE_NONE );
}
p_sys->b_es_out_ok = VLC_TRUE; p_sys->b_es_out_ok = VLC_TRUE;
} }
...@@ -529,6 +553,8 @@ static int DemuxDemux( demux_t *p_demux ) ...@@ -529,6 +553,8 @@ static int DemuxDemux( demux_t *p_demux )
case DVDNAV_STILL_FRAME: case DVDNAV_STILL_FRAME:
{ {
dvdnav_still_event_t *event = (dvdnav_still_event_t*)packet; dvdnav_still_event_t *event = (dvdnav_still_event_t*)packet;
if( !p_sys->b_simple )
{
vlc_mutex_lock( &p_sys->p_ev->lock ); vlc_mutex_lock( &p_sys->p_ev->lock );
if( !p_sys->p_ev->b_still ) if( !p_sys->p_ev->b_still )
{ {
...@@ -547,6 +573,11 @@ static int DemuxDemux( demux_t *p_demux ) ...@@ -547,6 +573,11 @@ static int DemuxDemux( demux_t *p_demux )
} }
vlc_mutex_unlock( &p_sys->p_ev->lock ); vlc_mutex_unlock( &p_sys->p_ev->lock );
msleep( 40000 ); msleep( 40000 );
}
else
{
dvdnav_still_skip( p_sys->dvdnav );
}
break; break;
} }
case DVDNAV_SPU_STREAM_CHANGE: case DVDNAV_SPU_STREAM_CHANGE:
...@@ -561,7 +592,10 @@ static int DemuxDemux( demux_t *p_demux ) ...@@ -561,7 +592,10 @@ static int DemuxDemux( demux_t *p_demux )
msg_Dbg( p_demux, " - physical_pan_scan=%d", msg_Dbg( p_demux, " - physical_pan_scan=%d",
event->physical_pan_scan ); event->physical_pan_scan );
if( !p_sys->b_simple )
{
ESSubtitleUpdate( p_demux ); ESSubtitleUpdate( p_demux );
}
break; break;
} }
case DVDNAV_AUDIO_STREAM_CHANGE: case DVDNAV_AUDIO_STREAM_CHANGE:
...@@ -597,6 +631,21 @@ static int DemuxDemux( demux_t *p_demux ) ...@@ -597,6 +631,21 @@ static int DemuxDemux( demux_t *p_demux )
} }
tk->b_seen = VLC_FALSE; 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; break;
} }
case DVDNAV_CELL_CHANGE: case DVDNAV_CELL_CHANGE:
...@@ -634,8 +683,10 @@ static int DemuxDemux( demux_t *p_demux ) ...@@ -634,8 +683,10 @@ static int DemuxDemux( demux_t *p_demux )
msg_Dbg( p_demux, "DVDNAV_HIGHLIGHT" ); msg_Dbg( p_demux, "DVDNAV_HIGHLIGHT" );
msg_Dbg( p_demux, " - display=%d", event->display ); msg_Dbg( p_demux, " - display=%d", event->display );
msg_Dbg( p_demux, " - buttonN=%d", event->buttonN ); msg_Dbg( p_demux, " - buttonN=%d", event->buttonN );
if( !p_sys->b_simple )
{
ButtonUpdate( p_demux ); ButtonUpdate( p_demux );
}
break; 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