[Solved] Patches to make lua dvd chapters work with 2.1.6
Posted: 26 Jan 2015 10:14
These patches are not my own code; they are just diffs with the corresponding
files of vlc-2.2.0 (May be the first time in recorded history that this actually
worked). Tested with vlc-2.1.6.
dvdnav.c.diff:
dvdread.c.diff:
files of vlc-2.2.0 (May be the first time in recorded history that this actually
worked). Tested with vlc-2.1.6.
dvdnav.c.diff:
Code: Select all
--- vlc-2.1.5/modules/access/dvdnav.c.orig 2013-06-24 20:00:38.000000000 +0200
+++ vlc-2.1.5/modules/access/dvdnav.c 2014-09-28 00:03:12.000000000 +0200
@@ -2,7 +2,7 @@
* dvdnav.c: DVD module using the dvdnav library.
*****************************************************************************
* Copyright (C) 2004-2009 VLC authors and VideoLAN
- * $Id: 13aaa3d5bda6f374bbc344c964b585b398db1549 $
+ * $Id: 1ba59e20f58bfc95d1dee4139d434ecd5421c318 $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
@@ -38,9 +38,7 @@
#endif
#include <assert.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
+#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -282,9 +280,8 @@
msg_Warn( p_demux, "cannot set PGC positioning flag" );
}
- /* Set menu language
- * XXX A menu-language may be better than sub-language */
- psz_code = DemuxGetLanguageCode( p_demux, "sub-language" );
+ /* Set menu language */
+ psz_code = DemuxGetLanguageCode( p_demux, "menu-language" );
if( dvdnav_menu_language_select( p_sys->dvdnav, psz_code ) !=
DVDNAV_STATUS_OK )
{
@@ -500,7 +497,7 @@
*va_arg( args, int* ) = 1; /* Chapter offset */
/* Duplicate title infos */
- *ppp_title = malloc( sizeof( input_title_t ** ) * p_sys->i_title );
+ *ppp_title = malloc( p_sys->i_title * sizeof( input_title_t * ) );
for( i = 0; i < p_sys->i_title; i++ )
{
(*ppp_title)[i] = vlc_input_title_Duplicate( p_sys->title[i] );
@@ -796,7 +793,6 @@
tk->b_seen = false;
}
-#if defined(HAVE_DVDNAV_GET_VIDEO_RESOLUTION)
uint32_t i_width, i_height;
if( dvdnav_get_video_resolution( p_sys->dvdnav,
&i_width, &i_height ) )
@@ -816,7 +812,6 @@
p_sys->sar.i_den = 0;
break;
}
-#endif
if( dvdnav_current_title_info( p_sys->dvdnav, &i_title,
&i_part ) == DVDNAV_STATUS_OK )
@@ -861,8 +856,7 @@
p_demux->info.i_update |= INPUT_UPDATE_TITLE;
p_demux->info.i_title = i_title;
- if( i_part >= 1 && i_part <= p_sys->title[i_title]->i_seekpoint &&
- p_demux->info.i_seekpoint != i_part - 1 )
+ if( i_part >= 1 && i_part <= p_sys->title[i_title]->i_seekpoint )
{
p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
p_demux->info.i_seekpoint = i_part - 1;
@@ -1042,13 +1036,16 @@
/* Find out number of titles/chapters */
dvdnav_get_number_of_titles( p_sys->dvdnav, &i_titles );
+
+ if( i_titles > 90 )
+ msg_Err( p_demux, "This is probably an Arccos Protected DVD. This could take time..." );
+
for( i = 1; i <= i_titles; i++ )
{
int32_t i_chapters;
uint64_t i_title_length;
uint64_t *p_chapters_time;
-#if defined(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS)
i_chapters = dvdnav_describe_title_chapters( p_sys->dvdnav, i,
&p_chapters_time,
&i_title_length );
@@ -1057,12 +1054,6 @@
i_title_length = 0;
p_chapters_time = NULL;
}
-#else
- if( dvdnav_get_number_of_parts( p_sys->dvdnav, i, &i_chapters ) != DVDNAV_STATUS_OK )
- i_chapters = 0;
- i_title_length = 0;
- p_chapters_time = NULL;
-#endif
t = vlc_input_title_New();
t->i_length = i_title_length * 1000 / 90;
for( int j = 0; j < __MAX( i_chapters, 1 ); j++ )
Code: Select all
--- vlc-2.1.5/modules/access/dvdread.c.orig 2013-06-24 20:00:38.000000000 +0200
+++ vlc-2.1.5/modules/access/dvdread.c 2014-09-28 00:03:12.000000000 +0200
@@ -2,7 +2,7 @@
* dvdread.c : DvdRead input module for vlc
*****************************************************************************
* Copyright (C) 2001-2006 VLC authors and VideoLAN
- * $Id: a239053f0c3183029d46d394127dc5ad4f07c721 $
+ * $Id: f1c64294784ce8a55a8ec6dd2ba3d0bbfe283f1c $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
* Gildas Bazin <gbazin@videolan.org>
@@ -50,11 +50,8 @@
#include "../demux/ps.h"
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
#include <sys/types.h>
+#include <unistd.h>
#include <dvdread/dvd_reader.h>
#include <dvdread/ifo_types.h>
@@ -394,7 +391,7 @@
/* Duplicate title infos */
*pi_int = p_sys->i_titles;
- *ppp_title = malloc( sizeof(input_title_t **) * p_sys->i_titles );
+ *ppp_title = malloc( p_sys->i_titles * sizeof(input_title_t *) );
for( i = 0; i < p_sys->i_titles; i++ )
{
(*ppp_title)[i] = vlc_input_title_Duplicate(p_sys->titles[i]);
@@ -478,12 +475,15 @@
/* End of title */
if( p_sys->i_cur_cell >= p_sys->p_cur_pgc->nr_of_cells )
{
- if( p_sys->i_title + 1 >= p_sys->i_titles )
+ int k = p_sys->i_title;
+
+ /* Looking for a not broken title */
+ while( k < p_sys->i_titles && DvdReadSetArea( p_demux, ++k, 0, -1 ) != VLC_SUCCESS )
{
- return 0; /* EOF */
+ msg_Err(p_demux, "Failed next title, trying another: %i", k );
+ if( k >= p_sys->i_titles )
+ return 0; // EOF
}
-
- DvdReadSetArea( p_demux, p_sys->i_title + 1, 0, -1 );
}
if( p_sys->i_pack_len >= 1024 )
@@ -503,12 +503,15 @@
if( p_sys->i_cur_cell >= p_sys->p_cur_pgc->nr_of_cells )
{
- if( p_sys->i_title + 1 >= p_sys->i_titles )
+ int k = p_sys->i_title;
+
+ /* Looking for a not broken title */
+ while( k < p_sys->i_titles && DvdReadSetArea( p_demux, ++k, 0, -1 ) != VLC_SUCCESS )
{
- return 0; /* EOF */
+ msg_Err(p_demux, "Failed next title, trying another: %i", k );
+ if( k >= p_sys->i_titles )
+ return 0; // EOF
}
-
- DvdReadSetArea( p_demux, p_sys->i_title + 1, 0, -1 );
}
/*
@@ -729,7 +732,11 @@
{
int i_start_cell, i_end_cell;
- if( p_sys->p_title != NULL ) DVDCloseFile( p_sys->p_title );
+ if( p_sys->p_title != NULL )
+ {
+ DVDCloseFile( p_sys->p_title );
+ p_sys->p_title = NULL;
+ }
if( p_vts != NULL ) ifoClose( p_vts );
p_sys->i_title = i_title;
@@ -1155,7 +1162,7 @@
/*
* Store the timecodes so we can get the current time
*/
- p_sys->i_title_cur_time = (mtime_t) (p_sys->dsi_pack.dsi_gi.nv_pck_scr / 90 * 1000);
+ p_sys->i_title_cur_time = (mtime_t) p_sys->dsi_pack.dsi_gi.nv_pck_scr / 90 * 1000;
p_sys->i_cell_cur_time = (mtime_t) dvdtime_to_time( &p_sys->dsi_pack.dsi_gi.c_eltm, 0 );
/*