#endif
#include "input_manager.hpp"
-#include <vlc_keys.h>
-#include <vlc_url.h>
-#include <vlc_strings.h>
-#include <vlc_aout.h>
+#include "recents.hpp"
+
+#include <vlc_keys.h> /* ACTION_ID */
+#include <vlc_url.h> /* decode_URI */
+#include <vlc_strings.h> /* str_format_meta */
+#include <vlc_aout.h> /* audio_output_t */
#include <QApplication>
#include <QFile>
#include <QDir>
#include <QSignalMapper>
+#include <QMessageBox>
#include <assert.h>
msg_Dbg( p_intf, "IM: Setting an input" );
vlc_object_hold( p_input );
addCallbacks();
+
UpdateStatus();
UpdateName();
UpdateArt();
p_item = input_GetItem( p_input );
emit rateChanged( var_GetFloat( p_input, "rate" ) );
+
+ /* Get Saved Time */
+ int i_time = RecentsMRL::getInstance( p_intf )->time( p_item->psz_uri );
+ if( i_time > 0 )
+ {
+ THEMIM->togglePlayPause();
+
+ if( QMessageBox::question( NULL,
+ _("Continue playback?"),
+ _("Do you want to restart the playback where left off?"),
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes )
+ == QMessageBox::Yes )
+ var_SetTime( p_input, "time", (int64_t)i_time * 1000 );
+
+ THEMIM->togglePlayPause();
+ }
}
else
{
if( !p_input ) return;
msg_Dbg( p_intf, "IM: Deleting the input" );
+ /* Save time / position */
+ float f_pos = var_GetFloat( p_input , "position" );
+ int64_t i_time = var_GetTime( p_input, "time");
+ int i_length = var_GetTime( p_input , "length" ) / CLOCK_FREQ;
+ if( f_pos < 0.05 || f_pos > 0.95 || i_length < 60) {
+ i_time = -1;
+ }
+ RecentsMRL::getInstance( p_intf )->setTime( p_item->psz_uri, i_time );
+
delCallbacks();
i_old_playing_status = END_S;
p_item = NULL;
/* Reset all InfoPanels but stats */
emit artChanged( NULL );
+ emit artChanged( "" );
emit infoChanged( NULL );
emit currentMetaChanged( (input_item_t *)NULL );
/* Try to get the nowplaying */
char *format = var_InheritString( p_intf, "input-title-format" );
- char *formated = str_format_meta( THEPL, format );
+ char *formated = str_format_meta( p_input, format );
free( format );
name = qfu(formated);
free( formated );
}
}
-void InputManager::requestArtUpdate( input_item_t *p_item )
+void InputManager::requestArtUpdate( input_item_t *p_item, bool b_forced )
{
bool b_current_item = false;
if ( !p_item && hasInput() )
if ( p_item )
{
/* check if it has already been enqueued */
- if ( p_item->p_meta )
+ if ( p_item->p_meta && !b_forced )
{
int status = vlc_meta_GetStatus( p_item->p_meta );
if ( status & ( ITEM_ART_NOTFOUND|ITEM_ART_FETCHED ) )
return;
}
- playlist_AskForArtEnqueue( pl_Get(p_intf), p_item );
+ libvlc_ArtRequest( p_intf->p_libvlc, p_item,
+ (b_forced) ? META_REQUEST_OPTION_SCOPE_ANY
+ : META_REQUEST_OPTION_NONE );
/* No input will signal the cover art to update,
* let's do it ourself */
if ( b_current_item )
/* Function called regularly when in an AtoB loop */
void InputManager::AtoBLoop( float, int64_t i_time, int )
{
- if( timeB )
- {
- if( i_time >= timeB || i_time < timeA )
- var_SetTime( THEMIM->getInput(), "time" , timeA );
- }
+ if( timeB && i_time >= timeB )
+ var_SetTime( THEMIM->getInput(), "time" , timeA );
}
/**********************************************************************
im, setInput( input_thread_t * ) );
/* initialize p_input (an input can already be running) */
- p_input = playlist_CurrentInput( pl_Get(p_intf) );
+ p_input = playlist_CurrentInput( THEPL );
if( p_input )
emit inputChanged( p_input );
if( p_input != NULL )
vlc_object_release( p_input );
- p_input = playlist_CurrentInput( pl_Get(p_intf) );
+ p_input = playlist_CurrentInput( THEPL );
emit inputChanged( p_input );
}
void MainInputManager::activatePlayQuit( bool b_exit )
{
var_SetBool( THEPL, "play-and-exit", b_exit );
+ config_PutInt( p_intf, "play-and-exit", b_exit );
}
bool MainInputManager::getPlayExitState()
{
- return var_GetBool( THEPL, "play-and-exit" );
+ return var_InheritBool( THEPL, "play-and-exit" );
}
bool MainInputManager::hasEmptyPlaylist()
vlc_value_t oldval, vlc_value_t val, void *param )
{
VLC_UNUSED( p_this ); VLC_UNUSED( psz_var ); VLC_UNUSED( oldval );
+ VLC_UNUSED( val );
MainInputManager *mim = (MainInputManager*)param;