[vlc-devel] [vlc-commits] dvdnav: add DEMUX_GET_(TITLE|SEEKPOINT)

Hugo Beauzée-Luyssen hugo at beauzee.fr
Wed Jan 17 10:45:14 CET 2018


On Sun, Dec 3, 2017, at 1:27 PM, Rémi Denis-Courmont wrote:
> vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Dec  
> 3 12:14:15 2017 +0200| [9c3b6f02eaebe836425829dfd0c517b1f6f67ad3] | 
> committer: Rémi Denis-Courmont
> 
> dvdnav: add DEMUX_GET_(TITLE|SEEKPOINT)
> 
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9c3b6f02eaebe836425829dfd0c517b1f6f67ad3
> ---
> 
>  modules/access/dvdnav.c | 34 ++++++++++++++++++++++------------
>  1 file changed, 22 insertions(+), 12 deletions(-)
> 
> diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
> index 705e2f985d..955cd98d24 100644
> --- a/modules/access/dvdnav.c
> +++ b/modules/access/dvdnav.c
> @@ -155,6 +155,8 @@ struct demux_sys_t
>      /* */
>      int           i_title;
>      input_title_t **title;
> +    int           cur_title;
> +    int           cur_seekpoint;
>  
>      /* length of program group chain */
>      mtime_t     i_pgc_length;
> @@ -643,13 +645,13 @@ static int Control( demux_t *p_demux, int i_query, 
> va_list args )
>  
>              p_demux->info.i_update |=
>                  INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
> -            p_demux->info.i_title = i;
> -            p_demux->info.i_seekpoint = 0;
> +            p_sys->cur_title = i;
> +            p_sys->cur_seekpoint = 0;
>              return VLC_SUCCESS;
>  
>          case DEMUX_SET_SEEKPOINT:
>              i = va_arg( args, int );
> -            if( p_demux->info.i_title == 0 )
> +            if( p_sys->cur_title == 0 )
>              {
>                  static const int argtab[] = {
>                      DVD_MENU_Escape,
> @@ -665,16 +667,24 @@ static int Control( demux_t *p_demux, int i_query, 
> va_list args )
>                             dvdnav_menu_call(p_sys->dvdnav,argtab[i]) )
>                      return VLC_EGENERIC;
>              }
> -            else if( dvdnav_part_play( p_sys->dvdnav, p_demux-
> >info.i_title,
> +            else if( dvdnav_part_play( p_sys->dvdnav, p_sys->cur_title,
>                                         i + 1 ) != DVDNAV_STATUS_OK )
>              {
>                  msg_Warn( p_demux, "cannot set title/chapter" );
>                  return VLC_EGENERIC;
>              }
>              p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
> -            p_demux->info.i_seekpoint = i;
> +            p_sys->cur_seekpoint = i;
>              return VLC_SUCCESS;
>  
> +        case DEMUX_GET_TITLE:
> +            *va_arg( args, int * ) = p_sys->cur_title;
> +            break;
> +
> +        case DEMUX_GET_SEEKPOINT:
> +            *va_arg( args, int * ) = p_sys->cur_seekpoint;
> +            break;
> +
>          case DEMUX_GET_PTS_DELAY:
>              *va_arg( args, int64_t * ) =
>                  INT64_C(1000) * var_InheritInteger( p_demux, "disc-
> caching" );
> @@ -755,8 +765,8 @@ static int Control( demux_t *p_demux, int i_query, 
> va_list args )
>              }
>              p_demux->info.i_update |=
>                  INPUT_UPDATE_TITLE | INPUT_UPDATE_SEEKPOINT;
> -            p_demux->info.i_title = 0;
> -            p_demux->info.i_seekpoint = 2;
> +            p_sys->cur_title = 0;
> +            p_sys->cur_seekpoint = 2;
>              break;
>          }
>  
> @@ -802,7 +812,7 @@ static int Demux( demux_t *p_demux )
>      {
>          msg_Warn( p_demux, "cannot get next block (%s)",
>                    dvdnav_err_to_string( p_sys->dvdnav ) );
> -        if( p_demux->info.i_title == 0 )
> +        if( p_sys->cur_title == 0 )
>          {
>              msg_Dbg( p_demux, "jumping to first title" );
>              return ControlInternal( p_demux, DEMUX_SET_TITLE, 1 ) == 
> VLC_SUCCESS ? 1 : -1;
> @@ -969,10 +979,10 @@ static int Demux( demux_t *p_demux )
>                                         &i_part ) == DVDNAV_STATUS_OK )
>          {
>              if( i_title >= 0 && i_title < p_sys->i_title &&
> -                p_demux->info.i_title != i_title )
> +                p_sys->cur_title != i_title )
>              {
>                  p_demux->info.i_update |= INPUT_UPDATE_TITLE;
> -                p_demux->info.i_title = i_title;
> +                p_sys->cur_title = i_title;
>              }
>          }
>          break;
> @@ -1006,12 +1016,12 @@ static int Demux( demux_t *p_demux )
>              if( i_title >= 0 && i_title < p_sys->i_title )
>              {
>                  p_demux->info.i_update |= INPUT_UPDATE_TITLE;
> -                p_demux->info.i_title = i_title;
> +                p_sys->cur_title = i_title;
>  
>                  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;
> +                    p_sys->cur_seekpoint = i_part - 1;
>                  }
>              }
>          }
> 
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits

Hi,

Any objection about backporting this to 3.0?
This is needed to know if the current title is a menu, which helps a lot when casting a DVD.

Regards,

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list