[vlc-devel] [PATCH 10/12] access: dvdnav: handle angles
Francois Cartegnie
fcvlcdev at free.fr
Thu Apr 2 20:40:18 CEST 2020
---
modules/access/dvdnav.c | 42 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 40 insertions(+), 2 deletions(-)
diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index f082f1021b..cb27f4c2f0 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -161,6 +161,7 @@ typedef struct
input_title_t **title;
int cur_title;
int cur_seekpoint;
+ int cur_angle;
unsigned updates;
/* length of program group chain */
@@ -304,8 +305,10 @@ static int CommonOpen( vlc_object_t *p_this,
}
}
- i_angle = var_CreateGetInteger( p_demux, "dvdnav-angle" );
- if( i_angle <= 0 ) i_angle = 1;
+ p_sys->cur_angle = 1 + var_CreateGetInteger( p_demux, "dvdnav-angle" );
+ if( p_sys->cur_angle <= 0 ||
+ !dvdnav_angle_change( p_sys->dvdnav, p_sys->cur_angle ) )
+ p_sys->cur_angle = 1;
p_sys->still.b_enabled = false;
vlc_mutex_init( &p_sys->still.lock );
@@ -695,6 +698,19 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
RandomAccessCleanup( p_sys );
return VLC_SUCCESS;
+ case DEMUX_SET_ANGLE:
+ {
+ i = va_arg( args, int );
+ if( dvdnav_angle_change( p_sys->dvdnav, i + 1 ) != DVDNAV_STATUS_OK )
+ {
+ msg_Err(p_demux,"Can't change angle to %d", i);
+ return VLC_EGENERIC;
+ }
+ p_sys->cur_angle = i + 1;
+ msg_Err(p_demux,"angle to %d", i);
+ break;
+ }
+
case DEMUX_TEST_AND_CLEAR_FLAGS:
{
unsigned *restrict flags = va_arg(args, unsigned *);
@@ -711,6 +727,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
*va_arg( args, int * ) = p_sys->cur_seekpoint;
break;
+ case DEMUX_GET_ANGLE:
+ {
+ *va_arg( args, int * ) = p_sys->cur_angle - 1;
+ break;
+ }
+
case DEMUX_GET_PTS_DELAY:
*va_arg( args, vlc_tick_t * ) =
VLC_TICK_FROM_MS( var_InheritInteger( p_demux, "disc-caching" ) );
@@ -1028,6 +1050,7 @@ static int Demux( demux_t *p_demux )
p_sys->cur_title = i_title;
}
}
+ p_sys->updates |= INPUT_UPDATE_ANGLE;
break;
}
@@ -1070,6 +1093,7 @@ static int Demux( demux_t *p_demux )
p_sys->cur_seekpoint = i_part - 1;
}
}
+ p_sys->updates |= INPUT_UPDATE_ANGLE;
}
break;
}
@@ -1098,6 +1122,15 @@ static int Demux( demux_t *p_demux )
p_sys->i_vobu_flush = p_dsi_gi->vobu_1stref_ea;
}
+ int32_t current_angle, angle_count;
+ if( dvdnav_get_angle_info( p_sys->dvdnav, ¤t_angle, &angle_count ) &&
+ current_angle != p_sys->cur_angle && current_angle > 0 )
+ {
+ p_sys->cur_angle = current_angle;
+ msg_Dbg(p_demux,"angle changed to %d", current_angle);
+ p_sys->updates |= INPUT_UPDATE_ANGLE;
+ }
+
#ifdef DVDNAV_DEBUG
msg_Dbg( p_demux, "DVDNAV_NAV_PACKET" );
#endif
@@ -1260,6 +1293,10 @@ static void DemuxTitles( demux_t *p_demux )
uint64_t i_title_length;
uint64_t *p_chapters_time;
+ int32_t angles;
+ if(!dvdnav_get_number_of_angles(p_sys->dvdnav, i, &angles) || angles < 1)
+ angles = 1;
+
int32_t i_chapters = dvdnav_describe_title_chapters( p_sys->dvdnav, i,
&p_chapters_time,
&i_title_length );
@@ -1270,6 +1307,7 @@ static void DemuxTitles( demux_t *p_demux )
}
t = vlc_input_title_New();
t->i_length = FROM_SCALE_NZ(i_title_length);
+ t->i_additional_angles = angles - 1;
for( int j = 0; j < __MAX( i_chapters, 1 ); j++ )
{
s = vlc_seekpoint_New();
--
2.25.1
More information about the vlc-devel
mailing list