*(psz_name + strlen(psz_name) - 1) = '\0';
}
#endif
- decode_URI( psz_name );
/* Try some simple probing to avoid going through dvdnav_open too often */
if( ProbeDVD( p_demux, psz_name ) != VLC_SUCCESS )
}
}
+ /* Free the array of titles */
+ for( int i = 0; i < p_sys->i_title; i++ )
+ vlc_input_title_Delete( p_sys->title[i] );
+ TAB_CLEAN( p_sys->i_title, p_sys->title );
+
dvdnav_close( p_sys->dvdnav );
free( p_sys );
}
dvdnav_get_number_of_titles( p_sys->dvdnav, &i_titles );
for( i = 1; i <= i_titles; i++ )
{
- int32_t i_chapters = 0;
- int j;
-
- dvdnav_get_number_of_parts( p_sys->dvdnav, i, &i_chapters );
-
+ int32_t i_chapters;
+ uint64_t i_title_length;
+
+#if defined(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS)
+ uint64_t *p_chapters_time;
+ i_chapters = dvdnav_describe_title_chapters( p_sys->dvdnav, i,
+ &p_chapters_time,
+ &i_title_length );
+ if( i_chapters > 0 )
+ free( p_chapters_time );
+ else
+ i_title_length = 0;
+#else
+ if( dvdnav_get_number_of_parts( p_sys->dvdnav, i, &i_chapters ) != DVDNAV_STATUS_OK )
+ i_chapters = 0;
+ i_title_length = 0;
+#endif
t = vlc_input_title_New();
- for( j = 0; j < __MAX( i_chapters, 1 ); j++ )
+ t->i_length = i_title_length * 1000 / 90;
+ for( int j = 0; j < __MAX( i_chapters, 1 ); j++ )
{
s = vlc_seekpoint_New();
TAB_APPEND( t->i_seekpoint, t->seekpoint, s );
demux_sys_t *p_sys = p_demux->p_sys;
const uint8_t *p = pkt;
- while( p < &pkt[i_pkt] )
+ while( (p - pkt) <= (i_pkt - 6) )
{
+ /* ps_pkt_size() needs at least 6 bytes */
int i_size = ps_pkt_size( p, &pkt[i_pkt] - p );
- block_t *p_pkt;
if( i_size <= 0 )
{
break;
}
/* Create a block */
- p_pkt = block_New( p_demux, i_size );
+ block_t *p_pkt = block_New( p_demux, i_size );
memcpy( p_pkt->p_buffer, p, i_size);
/* Parse it and send it */