vlc | branch: master | Francois Cartegnie <[email protected]> | Mon Sep 4 22:09:41 2017 +0200| [38bef9cdb5cd74e81f4dcef879c740f06d394b67] | committer: Francois Cartegnie
libvlc: remove vlc_epg_Merge > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=38bef9cdb5cd74e81f4dcef879c740f06d394b67 --- NEWS | 1 + include/vlc_epg.h | 6 ---- src/libvlccore.sym | 1 - src/misc/epg.c | 77 ------------------------------------------------- test/src/misc/epg.c | 82 ----------------------------------------------------- 5 files changed, 1 insertion(+), 166 deletions(-) diff --git a/NEWS b/NEWS index fd309e300b..cab32bfd5a 100644 --- a/NEWS +++ b/NEWS @@ -266,6 +266,7 @@ libVLC: * Add libvlc_media_player_add_slave to replace libvlc_video_set_subtitle_file, working with MRL and supporting also audio slaves * Add vlc_epg_event_(New|Delete|Duplicate), vlc_epg_AddEvent, vlc_epg_Duplicate + and removes vlc_epg_Merge Logging * Support for the SystemD Journal diff --git a/include/vlc_epg.h b/include/vlc_epg.h index e95d111ad5..f7b9044e7c 100644 --- a/include/vlc_epg.h +++ b/include/vlc_epg.h @@ -111,12 +111,6 @@ VLC_API bool vlc_epg_AddEvent(vlc_epg_t *p_epg, vlc_epg_event_t *p_evt); VLC_API void vlc_epg_SetCurrent(vlc_epg_t *p_epg, int64_t i_start); /** - * It merges all the event of \p p_src and \p p_dst into \p p_dst. - * - */ -VLC_API void vlc_epg_Merge(vlc_epg_t *p_dst, const vlc_epg_t *p_src); - -/** * Returns a duplicated \p p_src and its associated events. * */ diff --git a/src/libvlccore.sym b/src/libvlccore.sym index 2d5d4feb55..929a6dcc1f 100644 --- a/src/libvlccore.sym +++ b/src/libvlccore.sym @@ -678,7 +678,6 @@ vlc_epg_Delete vlc_epg_Duplicate vlc_epg_AddEvent vlc_epg_SetCurrent -vlc_epg_Merge vlc_fifo_Lock vlc_fifo_Unlock vlc_fifo_Signal diff --git a/src/misc/epg.c b/src/misc/epg.c index 0fffdf2639..79105436e6 100644 --- a/src/misc/epg.c +++ b/src/misc/epg.c @@ -219,83 +219,6 @@ void vlc_epg_SetCurrent( vlc_epg_t *p_epg, int64_t i_start ) } } -static void vlc_epg_Prune( vlc_epg_t *p_dst ) -{ - /* Keep only 1 old event */ - if( p_dst->p_current ) - { - while( p_dst->i_event > 1 && p_dst->pp_event[0] != p_dst->p_current && p_dst->pp_event[1] != p_dst->p_current ) - { - vlc_epg_event_Delete( p_dst->pp_event[0] ); - TAB_ERASE( p_dst->i_event, p_dst->pp_event, 0 ); - } - } -} - -void vlc_epg_Merge( vlc_epg_t *p_dst_epg, const vlc_epg_t *p_src_epg ) -{ - if( p_src_epg->i_event == 0 ) - return; - - size_t i_dst=0; - size_t i_src=0; - for( ; i_src < p_src_epg->i_event; i_src++ ) - { - bool b_current = ( p_src_epg->pp_event[i_src] == p_src_epg->p_current ); - - vlc_epg_event_t *p_src = vlc_epg_event_Duplicate( p_src_epg->pp_event[i_src] ); - if( unlikely(!p_src) ) - return; - const int64_t i_src_end = p_src->i_start + p_src->i_duration; - - while( i_dst < p_dst_epg->i_event ) - { - vlc_epg_event_t *p_dst = p_dst_epg->pp_event[i_dst]; - const int64_t i_dst_end = p_dst->i_start + p_dst->i_duration; - - /* appended is before current, no overlap */ - if( p_dst->i_start >= i_src_end ) - { - break; - } - /* overlap case: appended would contain current's start (or are identical) */ - else if( ( p_dst->i_start >= p_src->i_start && p_dst->i_start < i_src_end ) || - /* overlap case: appended would contain current's end */ - ( i_dst_end > p_src->i_start && i_dst_end <= i_src_end ) ) - { - vlc_epg_event_Delete( p_dst ); - if( p_dst_epg->p_current == p_dst ) - { - b_current |= true; - p_dst_epg->p_current = NULL; - } - TAB_ERASE( p_dst_epg->i_event, p_dst_epg->pp_event, i_dst ); - } - else - { - i_dst++; - } - } - - TAB_INSERT( p_dst_epg->i_event, p_dst_epg->pp_event, p_src, i_dst ); - if( b_current ) - p_dst_epg->p_current = p_src; - } - - /* Remaining/trailing ones */ - for( ; i_src < p_src_epg->i_event; i_src++ ) - { - vlc_epg_event_t *p_src = vlc_epg_event_Duplicate( p_src_epg->pp_event[i_src] ); - if( unlikely(!p_src) ) - return; - TAB_APPEND( p_dst_epg->i_event, p_dst_epg->pp_event, p_src ); - if( p_src_epg->pp_event[i_src] == p_src_epg->p_current ) - p_dst_epg->p_current = p_src; - } - - vlc_epg_Prune( p_dst_epg ); -} - vlc_epg_t * vlc_epg_Duplicate( const vlc_epg_t *p_src ) { vlc_epg_t *p_epg = vlc_epg_New( p_src->i_id, p_src->i_source_id ); diff --git a/test/src/misc/epg.c b/test/src/misc/epg.c index a242a9d79f..24bb8f395a 100644 --- a/test/src/misc/epg.c +++ b/test/src/misc/epg.c @@ -135,87 +135,5 @@ int main( void ) assert_current( p_epg, "B" ); vlc_epg_Delete( p_epg ); - - /* Test epg merging */ - printf("--test %d\n", i++); - p_epg = vlc_epg_New( 0, 0 ); - assert(p_epg); - EPG_ADD( p_epg, 142, 20, "F" ); - EPG_ADD( p_epg, 122, 20, "E" ); - EPG_ADD( p_epg, 42, 20, "A" ); - EPG_ADD( p_epg, 62, 20, "B" ); - print_order( p_epg ); - - vlc_epg_t *p_epg2 = vlc_epg_New( 0, 0 ); - assert(p_epg2); - EPG_ADD( p_epg2, 102, 20, "D" ); - EPG_ADD( p_epg2, 82, 20, "C" ); - print_order( p_epg2 ); - - vlc_epg_Merge( p_epg, p_epg2 ); - printf("merged " ); - print_order( p_epg ); - - assert_events( p_epg, "ABCDEF", 6 ); - assert_events( p_epg2, "CD", 2 ); /* should be untouched */ - vlc_epg_Delete( p_epg ); - vlc_epg_Delete( p_epg2 ); - - - /* Test event overlapping */ - printf("--test %d\n", i++); - p_epg = vlc_epg_New( 0, 0 ); - assert(p_epg); - EPG_ADD( p_epg, 42, 20, "A" ); - EPG_ADD( p_epg, 62, 20, "B" ); - EPG_ADD( p_epg, 82, 20, "C" ); - EPG_ADD( p_epg, 102, 20, "D" ); - print_order( p_epg ); - vlc_epg_SetCurrent( p_epg, 62 ); - - p_epg2 = vlc_epg_New( 0, 0 ); - assert(p_epg2); - EPG_ADD( p_epg2, 41, 30, "E" ); - print_order( p_epg2 ); - - vlc_epg_Merge( p_epg, p_epg2 ); - printf("merged " ); - print_order( p_epg ); - assert_events( p_epg, "ECD", 3 ); - - assert_current( p_epg, "E" ); - - EPG_ADD( p_epg2, 70, 42, "F" ); - print_order( p_epg2 ); - vlc_epg_Merge( p_epg, p_epg2 ); - printf("merged " ); - print_order( p_epg ); - assert_events( p_epg, "F", 1 ); - - /* Test current overwriting */ - printf("--test %d\n", i++); - vlc_epg_SetCurrent( p_epg, 70 ); - assert_current( p_epg, "F" ); - print_order( p_epg ); - print_order( p_epg2 ); - vlc_epg_Merge( p_epg, p_epg2 ); - printf("merged " ); - print_order( p_epg ); - assert_events( p_epg, "F", 1 ); - assert_current( p_epg, "F" ); - - printf("--test %d\n", i++); - print_order( p_epg ); - EPG_ADD( p_epg2, 270, 42, "Z" ); - vlc_epg_SetCurrent( p_epg2, 270 ); - print_order( p_epg2 ); - vlc_epg_Merge( p_epg, p_epg2 ); - printf("merged " ); - print_order( p_epg ); - assert_current( p_epg, "Z" ); - - vlc_epg_Delete( p_epg ); - vlc_epg_Delete( p_epg2 ); - return 0; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
