vlc_module_begin ()
set_shortname( N_("BD") )
- set_description( N_("BD Input") )
+ set_description( N_("Blu-Ray Disc Input") )
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACCESS )
add_integer( "bd-caching", DEFAULT_PTS_DELAY / 1000, NULL,
- CACHING_TEXT, CACHING_LONGTEXT, true );
+ CACHING_TEXT, CACHING_LONGTEXT, true )
set_capability( "access_demux", 60 )
add_shortcut( "bd" )
set_callbacks( Open, Close )
struct demux_sys_t
{
char *psz_base;
+ bool b_shortname;
/* */
int i_mpls;
static int Control( demux_t *, int, va_list );
static int Demux( demux_t * );
-static char *FindPathBase( const char * );
+static char *FindPathBase( const char *, bool *pb_shortname );
static int LoadPlaylist( demux_t * );
static int LoadClip( demux_t * );
return VLC_EGENERIC;
/* */
- char *psz_base = FindPathBase( p_demux->psz_path );
+ bool b_shortname;
+ char *psz_base = FindPathBase( p_demux->psz_path, &b_shortname );
if( !psz_base )
return VLC_EGENERIC;
if( !p_sys )
return VLC_EGENERIC;
p_sys->psz_base = psz_base;
+ p_sys->b_shortname = b_shortname;
TAB_INIT( p_sys->i_mpls, p_sys->pp_mpls );
TAB_INIT( p_sys->i_clpi, p_sys->pp_clpi );
TAB_INIT( p_sys->i_title, p_sys->pp_title );
/* */
const bool b_same_mpls = i_mpls == p_demux->info.i_title;
- const bool b_same_play_item = b_same_mpls &&
- i_play_item == p_sys->i_play_item;
+ //const bool b_same_play_item = b_same_mpls &&
+ // i_play_item == p_sys->i_play_item;
/* */
const bd_mpls_t *p_mpls = p_sys->pp_mpls[i_mpls];
if( !b_same_clpi )
{
char *psz_m2ts;
- if( asprintf( &psz_m2ts, "%s/STREAM/%05d.m2ts", p_sys->psz_base, p_mpls_clpi->i_id ) < 0 )
+ if( asprintf( &psz_m2ts, "%s/STREAM/%05d.%s",
+ p_sys->psz_base, p_mpls_clpi->i_id, p_sys->b_shortname ? "MTS" : "m2ts" ) < 0 )
return VLC_EGENERIC;
p_m2ts = stream_UrlNew( p_demux, psz_m2ts );
* - b_same_play_item is too strict, we should check the play_items connection.
* - a way to completely flush the demuxer is also needed !
*/
- const bool b_same_parser = b_same_play_item && false;
+ //const bool b_same_parser = b_same_play_item && false;
stream_t *p_parser = stream_DemuxNew( p_demux, "ts", p_sys->p_out );
if( !p_parser )
{
}
return i_length;
}
-static int SortMpls( void **pp_a, void **pp_b )
+static int SortMpls( const void *a, const void *b )
{
- const int64_t i_length_a = GetMplsUniqueDuration( *pp_a );
- const int64_t i_length_b = GetMplsUniqueDuration( *pp_b );
+ const bd_mpls_t * const *pp_mpls_a = a;
+ const bd_mpls_t * const *pp_mpls_b = b;
+
+ const int64_t i_length_a = GetMplsUniqueDuration( *pp_mpls_a );
+ const int64_t i_length_b = GetMplsUniqueDuration( *pp_mpls_b );
if( i_length_a == i_length_b )
return 0;
/*****************************************************************************
* Helpers:
*****************************************************************************/
+static int CheckFileList( const char *psz_base, const char *ppsz_name[] )
+{
+ for( int i = 0; ppsz_name[i] != NULL ; i++ )
+ {
+ struct stat s;
+ char *psz_tmp;
+
+ if( asprintf( &psz_tmp, "%s/%s", psz_base, ppsz_name[i] ) < 0 )
+ return VLC_EGENERIC;
+
+ bool b_ok = utf8_stat( psz_tmp, &s ) == 0 && S_ISREG( s.st_mode );
+
+ free( psz_tmp );
+ if( !b_ok )
+ return VLC_EGENERIC;
+ }
+ return VLC_SUCCESS;
+}
/* */
-static char *FindPathBase( const char *psz_path )
+static char *FindPathBase( const char *psz_path, bool *pb_shortname )
{
struct stat s;
char *psz_tmp;
}
/* Check presence of mandatory files */
- for( int i = 0;; i++ )
+ static const char *ppsz_name_long[] = {
+ "index.bdmv",
+ "MovieObject.bdmv",
+ NULL
+ };
+ static const char *ppsz_name_short[] = {
+ "INDEX.BDM",
+ "MOVIEOBJ.BDM",
+ NULL
+ };
+ *pb_shortname = false;
+ if( CheckFileList( psz_base, ppsz_name_long ) )
{
- static const char *ppsz_name[] = {
- "index.bdmv",
- "MovieObject.bdmv",
- NULL
- };
- if( !ppsz_name[i] )
- break;
-
- if( asprintf( &psz_tmp, "%s/%s", psz_base, ppsz_name[i] ) < 0 )
- goto error;
-
- bool b_ok = utf8_stat( psz_tmp, &s ) == 0 && S_ISREG( s.st_mode );
-
- free( psz_tmp );
- if( !b_ok )
+ if( CheckFileList( psz_base, ppsz_name_short ) )
goto error;
+ *pb_shortname = true;
}
-
return psz_base;
error:
}
/* */
-static int FilterMpls( const char *psz_name )
+static int FilterMplsLong( const char *psz_name )
{
return strlen( psz_name ) == strlen( "xxxxx.mpls" ) &&
!strcmp( &psz_name[5], ".mpls" );
}
+static int FilterMplsShort( const char *psz_name )
+{
+ return strlen( psz_name ) == strlen( "xxxxx.MPL" ) &&
+ !strcmp( &psz_name[5], ".MPL" );
+}
static void LoadMpls( demux_t *p_demux, const char *psz_name, int i_id )
{
}
/* */
-static int FilterClpi( const char *psz_name )
+static int FilterClpiLong( const char *psz_name )
{
return strlen( psz_name ) == strlen( "xxxxx.clpi" ) &&
!strcmp( &psz_name[5], ".clpi" );
}
+static int FilterClpiShort( const char *psz_name )
+{
+ return strlen( psz_name ) == strlen( "xxxxx.CPI" ) &&
+ !strcmp( &psz_name[5], ".CPI" );
+}
static void LoadClpi( demux_t *p_demux, const char *psz_name, int i_id )
{
static int LoadPlaylist( demux_t *p_demux )
{
- return Load( p_demux, "PLAYLIST", FilterMpls, LoadMpls );
+ return Load( p_demux, "PLAYLIST",
+ p_demux->p_sys->b_shortname ? FilterMplsShort : FilterMplsLong, LoadMpls );
}
static int LoadClip( demux_t *p_demux )
{
- return Load( p_demux, "CLIPINF", FilterClpi, LoadClpi );
+ return Load( p_demux, "CLIPINF",
+ p_demux->p_sys->b_shortname ? FilterClpiShort : FilterClpiLong, LoadClpi );
}
/* */