1 /*****************************************************************************
2 * seekpoints.cpp : Chapters & Bookmarks (menu)
3 *****************************************************************************
4 * Copyright © 2011 the VideoLAN team
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * ( at your option ) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
23 #include "recents.hpp"
24 #include "dialogs_provider.hpp"
27 #include "seekpoints.hpp"
30 #include "input_manager.hpp"
32 SeekPoints::SeekPoints( QObject *parent, intf_thread_t *p_intf_ ) :
33 QObject( parent ), p_intf( p_intf_ )
36 void SeekPoints::update()
38 input_title_t *p_title = NULL;
39 input_thread_t *p_input_thread = playlist_CurrentInput( THEPL );
41 if( !p_input_thread ) { pointsList.clear(); return; }
43 if ( input_Control( p_input_thread, INPUT_GET_TITLE_INFO, &p_title, &i_title_id )
46 vlc_object_release( p_input_thread );
51 vlc_object_release( p_input_thread );
56 /* lock here too, as update event is triggered by an external thread */
57 if ( !access() ) return;
59 if ( p_title->i_seekpoint > 0 )
61 /* first check the last point to see if we have filled time offsets (> 0) */
62 if ( p_title->seekpoint[p_title->i_seekpoint - 1]->i_time_offset > 0 )
64 for ( int i=0; i<p_title->i_seekpoint ; i++ )
65 pointsList << SeekPoint( p_title->seekpoint[i] );
68 vlc_input_title_Delete( p_title );
72 QList<SeekPoint> const SeekPoints::getPoints()
74 QList<SeekPoint> copy;
83 bool SeekPoints::jumpTo( int i_chapterindex )
86 val.i_int = i_chapterindex;
87 input_thread_t *p_input_thread = playlist_CurrentInput( THEPL );
88 if( !p_input_thread ) return false;
89 bool b_succ = var_Set( p_input_thread, "chapter", val );
90 vlc_object_release( p_input_thread );
91 return ( b_succ == VLC_SUCCESS );