Commit 17f7243a authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen Committed by Jean-Baptiste Kempf

bluray: Prepare menu handling

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 091a4267
...@@ -44,6 +44,10 @@ ...@@ -44,6 +44,10 @@
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
#define BD_MENU_TEXT N_( "Bluray menus" )
#define BD_MENU_LONGTEXT N_( "Use bluray menus. If disabled, "\
"the movie will start directly" )
/* Callbacks */ /* Callbacks */
static int blurayOpen ( vlc_object_t * ); static int blurayOpen ( vlc_object_t * );
static void blurayClose( vlc_object_t * ); static void blurayClose( vlc_object_t * );
...@@ -55,6 +59,7 @@ vlc_module_begin () ...@@ -55,6 +59,7 @@ vlc_module_begin ()
set_category( CAT_INPUT ) set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACCESS ) set_subcategory( SUBCAT_INPUT_ACCESS )
set_capability( "access_demux", 200) set_capability( "access_demux", 200)
add_bool( "bluray-menu", false, BD_MENU_TEXT, BD_MENU_LONGTEXT, false )
add_shortcut( "bluray", "file" ) add_shortcut( "bluray", "file" )
...@@ -71,6 +76,9 @@ struct demux_sys_t ...@@ -71,6 +76,9 @@ struct demux_sys_t
unsigned int i_longest_title; unsigned int i_longest_title;
input_title_t **pp_title; input_title_t **pp_title;
/* Menus */
bool b_menu;
/* TS stream */ /* TS stream */
stream_t *p_parser; stream_t *p_parser;
}; };
...@@ -79,7 +87,7 @@ struct demux_sys_t ...@@ -79,7 +87,7 @@ struct demux_sys_t
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static int blurayControl(demux_t *, int, va_list); static int blurayControl(demux_t *, int, va_list);
static int blurayDemux (demux_t *); static int blurayDemux(demux_t *);
static int blurayInitTitles(demux_t *p_demux ); static int blurayInitTitles(demux_t *p_demux );
static int bluraySetTitle(demux_t *p_demux, int i_title); static int bluraySetTitle(demux_t *p_demux, int i_title);
...@@ -198,17 +206,29 @@ static int blurayOpen( vlc_object_t *object ) ...@@ -198,17 +206,29 @@ static int blurayOpen( vlc_object_t *object )
*/ */
bd_get_event(p_sys->bluray, NULL); bd_get_event(p_sys->bluray, NULL);
/* get title request */ p_sys->b_menu = var_InheritBool( p_demux, "bluray-menu" );
if ((pos_title = strrchr(bd_path, ':'))) { if ( p_sys->b_menu )
/* found character ':' for title information */ {
*(pos_title++) = '\0'; /*
i_title = atoi(pos_title); * libbluray will start playback from "First-Title" title
* Therefore, We don't have to select any title.
*/
bd_play( p_sys->bluray );
} }
else
{
/* get title request */
if ((pos_title = strrchr(bd_path, ':'))) {
/* found character ':' for title information */
*(pos_title++) = '\0';
i_title = atoi(pos_title);
}
/* set start title number */ /* set start title number */
if (bluraySetTitle(p_demux, i_title) != VLC_SUCCESS) { if (bluraySetTitle(p_demux, i_title) != VLC_SUCCESS) {
msg_Err( p_demux, "Could not set the title %d", i_title ); msg_Err( p_demux, "Could not set the title %d", i_title );
goto error; goto error;
}
} }
p_sys->p_parser = stream_DemuxNew(p_demux, "ts", p_demux->out); p_sys->p_parser = stream_DemuxNew(p_demux, "ts", p_demux->out);
...@@ -504,12 +524,28 @@ static int blurayDemux(demux_t *p_demux) ...@@ -504,12 +524,28 @@ static int blurayDemux(demux_t *p_demux)
return -1; return -1;
} }
blurayHandleEvents(p_demux); int nread = -1;
int nread = bd_read(p_sys->bluray, p_block->p_buffer, if (p_sys->b_menu == false) {
NB_TS_PACKETS * BD_TS_PACKET_SIZE); blurayHandleEvents(p_demux);
if (nread < 0) { nread = bd_read(p_sys->bluray, p_block->p_buffer,
block_Release(p_block); NB_TS_PACKETS * BD_TS_PACKET_SIZE);
return nread; if (nread < 0) {
block_Release(p_block);
return nread;
}
}
else {
BD_EVENT e;
nread = bd_read_ext( p_sys->bluray, p_block->p_buffer,
NB_TS_PACKETS * BD_TS_PACKET_SIZE, &e );
if ( nread == 0 ) {
if ( e.event == BD_EVENT_NONE )
msg_Info( p_demux, "We reached the end of a title" );
else
blurayHandleEvent( p_demux, &e );
block_Release(p_block);
return 1;
}
} }
p_block->i_buffer = nread; p_block->i_buffer = nread;
......
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