[Solved] Patches to make lua dvd chapters work with 2.1.6

*nix specific usage questions
nokangaroo
Blank Cone
Blank Cone
Posts: 29
Joined: 30 Dec 2010 17:11

[Solved] Patches to make lua dvd chapters work with 2.1.6

Postby nokangaroo » 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:

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++ )
dvdread.c.diff:

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 ); /*

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: [Solved] Patches to make lua dvd chapters work with 2.1.

Postby Jean-Baptiste Kempf » 26 Jan 2015 10:51

Please share formated patches.

Moreover, do we need to apply those to 2.2.0 ?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

nokangaroo
Blank Cone
Blank Cone
Posts: 29
Joined: 30 Dec 2010 17:11

[Solved] Patches to make lua dvd chapters work with 2.1.6

Postby nokangaroo » 29 Jan 2015 11:52

No need to use then with 2.2.0 - as I said, that's where I ***stole*** them from. As for formatted patches,
I assume you mean this (hope it works, it is without the changes to cli.lua)

Two patches are taken from the archlinux vlc-2.1.5 build:

vlc-2.1.5-ffmpeg-2.4.patch
vlc-2.0.7-vaapi-compat.patch
See https://www.archlinux.org/packages/extra/x86_64/vlc/

The dvdnav and dvdread changes are taken from vlc-2.2.0. The change to
src/video_output/event.h is to disable the middle-click shortcut to show the
controller, because it is redundant, and because I use the middle-click for
an openbox command to open a zenity window.

The reason for patching modules/access/dvdnav.c and modules/access/dvdread.c
was that with vlc-2.1.5 the chapter command did not work with DVDs; it said
chapter 0 regardless of the actual chapter. In vlc-2.2.0 this is fixed.

Code: Select all

diff --git a/configure.ac b/configure.ac index 4554c60..21a2951 100644 --- a/configure.ac +++ b/configure.ac @@ -2243,8 +2243,8 @@ AC_ARG_ENABLE(avcodec, [ --enable-avcodec libavcodec codec (default enabled)]) AS_IF([test "${enable_avcodec}" != "no"], [ PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 53.34.0 libavutil >= 51.22.0], [ - PKG_CHECK_EXISTS([libavcodec < 56],, [ - AC_MSG_ERROR([libavcodec versions 56 and later are not supported yet.]) + PKG_CHECK_EXISTS([libavcodec < 57],, [ + AC_MSG_ERROR([libavcodec versions 57 and later are not supported yet.]) ]) VLC_SAVE_FLAGS CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}" diff --git a/m4/intl.m4 b/m4/intl.m4 index dffcd88..67feb58 100644 --- a/m4/intl.m4 +++ b/m4/intl.m4 @@ -1,4 +1,4 @@ -# intl.m4 serial 24 (gettext-0.18.3) +# intl.m4 serial 25 (gettext-0.18.3) dnl Copyright (C) 1995-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -42,6 +42,7 @@ AC_DEFUN([AM_INTL_SUBDIR], AC_REQUIRE([gl_XSIZE])dnl AC_REQUIRE([gl_FCNTL_O_FLAGS])dnl AC_REQUIRE([gt_INTL_MACOSX])dnl + AC_REQUIRE([gl_EXTERN_INLINE])dnl dnl Support for automake's --enable-silent-rules. case "$enable_silent_rules" in diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c index 13aaa3d..1ba59e2 100644 --- a/modules/access/dvdnav.c +++ b/modules/access/dvdnav.c @@ -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 @@ static int Open( vlc_object_t *p_this ) 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 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) *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 @@ static int Demux( demux_t *p_demux ) 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 @@ static int Demux( demux_t *p_demux ) 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 @@ static int Demux( demux_t *p_demux ) 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 @@ static void DemuxTitles( demux_t *p_demux ) /* 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 @@ static void DemuxTitles( demux_t *p_demux ) 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++ ) diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c index a239053..f1c6429 100644 --- a/modules/access/dvdread.c +++ b/modules/access/dvdread.c @@ -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 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) /* 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 @@ static int Demux( demux_t *p_demux ) /* 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 @@ static int Demux( demux_t *p_demux ) 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 @@ static int DvdReadSetArea( demux_t *p_demux, int i_title, int i_chapter, { 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 @@ static void DvdReadHandleDSI( demux_t *p_demux, uint8_t *p_data ) /* * 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 ); /* diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c index 9914bbd..22aa4b1 100644 --- a/modules/codec/avcodec/vaapi.c +++ b/modules/codec/avcodec/vaapi.c @@ -36,6 +36,7 @@ #include <libavcodec/vaapi.h> #include <X11/Xlib.h> #include <va/va_x11.h> +#include <va/va_compat.h> #include "avcodec.h" #include "va.h" diff --git a/src/video_output/event.h b/src/video_output/event.h index c8123e8..972d44f 100644 --- a/src/video_output/event.h +++ b/src/video_output/event.h @@ -68,9 +68,6 @@ static inline void vout_SendEventMousePressed(vout_thread_t *vout, int button) var_SetBool(vout->p_libvlc, "intf-popupmenu", false); return; } - case MOUSE_BUTTON_CENTER: - var_ToggleBool(vout->p_libvlc, "intf-toggle-fscontrol"); - return; case MOUSE_BUTTON_RIGHT: var_SetBool(vout->p_libvlc, "intf-popupmenu", true); return;


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 9 guests