From 11d6de98aa87ee639423bdf0ddc3a4fccea3b876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= Date: Fri, 4 Sep 2015 22:44:31 +0300 Subject: [PATCH] input: remove byte offset from seekpoints/chapters The input thread and input manager have no use for this. --- include/vlc_input.h | 3 --- modules/access/vcdx/access.c | 20 ++++++++------------ src/input/control.c | 4 +--- src/input/input.c | 9 ++------- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/include/vlc_input.h b/include/vlc_input.h index eff1b9697f..81a93d7c48 100644 --- a/include/vlc_input.h +++ b/include/vlc_input.h @@ -47,7 +47,6 @@ *****************************************************************************/ struct seekpoint_t { - int64_t i_byte_offset; int64_t i_time_offset; char *psz_name; }; @@ -57,7 +56,6 @@ static inline seekpoint_t *vlc_seekpoint_New( void ) seekpoint_t *point = (seekpoint_t*)malloc( sizeof( seekpoint_t ) ); if( !point ) return NULL; - point->i_byte_offset = point->i_time_offset = -1; point->psz_name = NULL; return point; @@ -75,7 +73,6 @@ static inline seekpoint_t *vlc_seekpoint_Duplicate( const seekpoint_t *src ) seekpoint_t *point = vlc_seekpoint_New(); if( src->psz_name ) point->psz_name = strdup( src->psz_name ); point->i_time_offset = src->i_time_offset; - point->i_byte_offset = src->i_byte_offset; return point; } diff --git a/modules/access/vcdx/access.c b/modules/access/vcdx/access.c index fce3d77915..8dad04e7ad 100644 --- a/modules/access/vcdx/access.c +++ b/modules/access/vcdx/access.c @@ -231,9 +231,7 @@ VCDSeek( access_t * p_access, uint64_t i_pos ) if (!p_access || !p_access->p_sys) return VLC_EGENERIC; { vcdplayer_t *p_vcdplayer = (vcdplayer_t *)p_vcd_access->p_sys; - const input_title_t *t = p_vcdplayer->p_title[p_vcdplayer->i_cur_title]; unsigned int i_entry = VCDINFO_INVALID_ENTRY; - int i_seekpoint; /* Next sector to read */ p_vcdplayer->i_lsn = (i_pos / (uint64_t) M2F2_SECTOR_SIZE) + @@ -276,11 +274,15 @@ VCDSeek( access_t * p_access, uint64_t i_pos ) (long unsigned int) p_vcdplayer->origin_lsn, (long unsigned int) p_vcdplayer->i_lsn, i_pos, i_entry ); - +#if 0 /* Find seekpoint */ + const input_title_t *t = p_vcdplayer->p_title[p_vcdplayer->i_cur_title]; + int i_seekpoint; + for( i_seekpoint = 0; i_seekpoint < t->i_seekpoint; i_seekpoint++ ) { if( i_seekpoint + 1 >= t->i_seekpoint ) break; + if( i_pos < t->seekpoint[i_seekpoint + 1]->i_byte_offset ) break; } @@ -289,6 +291,7 @@ VCDSeek( access_t * p_access, uint64_t i_pos ) dbg_print( (INPUT_DBG_SEEK), "seekpoint change %d", i_seekpoint ); p_vcdplayer->i_cur_chapter = i_seekpoint; +#endif } p_access->info.b_eof = false; return VLC_SUCCESS; @@ -340,13 +343,9 @@ VCDEntryPoints( access_t * p_access ) vcdinfo_get_entry_lsn(p_vcdplayer->vcd, i); s->psz_name = strdup(psz_entry); - s->i_byte_offset = (p_vcdplayer->p_entries[i] - - vcdinfo_get_track_lsn(p_vcdplayer->vcd,i_track)) - * M2F2_SECTOR_SIZE; - dbg_print( INPUT_DBG_MRL, "%s, lsn %d, byte_offset %"PRId64"", - s->psz_name, p_vcdplayer->p_entries[i], - s->i_byte_offset); + dbg_print( INPUT_DBG_MRL, "%s, lsn %d", + s->psz_name, p_vcdplayer->p_entries[i]); TAB_APPEND( p_vcdplayer->p_title[i_track-1]->i_seekpoint, p_vcdplayer->p_title[i_track-1]->seekpoint, s ); @@ -398,7 +397,6 @@ VCDSegments( access_t * p_access ) snprintf( psz_segment, sizeof(psz_segment), "%s %02d", _("Segment"), i ); - s->i_byte_offset = 0; /* Not sure what this would mean here */ s->psz_name = strdup(psz_segment); TAB_APPEND( t->i_seekpoint, t->seekpoint, s ); } @@ -494,8 +492,6 @@ VCDLIDs( access_t * p_access ) snprintf( psz_lid, sizeof(psz_lid), "%s %02d", _("LID"), i_lid ); - s->i_byte_offset = 0; /* A lid doesn't have an offset - size associated with it */ s->psz_name = strdup(psz_lid); TAB_APPEND( t->i_seekpoint, t->seekpoint, s ); } diff --git a/src/input/control.c b/src/input/control.c index e498566a06..79a1029f45 100644 --- a/src/input/control.c +++ b/src/input/control.c @@ -586,7 +586,7 @@ static void UpdateBookmarksOption( input_thread_t *p_input ) } /* Create the "bookmarks" option value */ - const char *psz_format = "{name=%s,bytes=%"PRId64",time=%"PRId64"}"; + const char *psz_format = "{name=%s,time=%"PRId64"}"; int i_len = strlen( "bookmarks=" ); for( int i = 0; i < p_input->p->i_bookmark; i++ ) { @@ -594,7 +594,6 @@ static void UpdateBookmarksOption( input_thread_t *p_input ) i_len += snprintf( NULL, 0, psz_format, p_bookmark->psz_name, - p_bookmark->i_byte_offset, p_bookmark->i_time_offset/1000000 ); } @@ -612,7 +611,6 @@ static void UpdateBookmarksOption( input_thread_t *p_input ) psz_next += sprintf( psz_next, psz_format, p_bookmark->psz_name, - p_bookmark->i_byte_offset, p_bookmark->i_time_offset/1000000 ); if( i < p_input->p->i_bookmark - 1) diff --git a/src/input/input.c b/src/input/input.c index dfd03bc3a0..6b40a458fa 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -453,10 +453,6 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item, { p_seekpoint->psz_name = strdup(psz_start + 5); } - else if( !strncmp( psz_start, "bytes=", 6 ) ) - { - p_seekpoint->i_byte_offset = atoll(psz_start + 6); - } else if( !strncmp( psz_start, "time=", 5 ) ) { p_seekpoint->i_time_offset = atoll(psz_start + 5) * @@ -464,8 +460,8 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item, } psz_start = psz_end + 1; } - msg_Dbg( p_input, "adding bookmark: %s, bytes=%"PRId64", time=%"PRId64, - p_seekpoint->psz_name, p_seekpoint->i_byte_offset, + msg_Dbg( p_input, "adding bookmark: %s, time=%"PRId64, + p_seekpoint->psz_name, p_seekpoint->i_time_offset ); input_Control( p_input, INPUT_ADD_BOOKMARK, p_seekpoint ); vlc_seekpoint_Delete( p_seekpoint ); @@ -662,7 +658,6 @@ static void MainLoopStatistics( input_thread_t *p_input ) /* update current bookmark */ vlc_mutex_lock( &p_input->p->p_item->lock ); p_input->p->bookmark.i_time_offset = i_time; - p_input->p->bookmark.i_byte_offset = -1; vlc_mutex_unlock( &p_input->p->p_item->lock ); stats_ComputeInputStats( p_input, p_input->p->p_item->p_stats );