Commit 2ffa2bd3 authored by Antoine Cellerier's avatar Antoine Cellerier

src/input/item.c: if we don't have an item name and item is a file, then only...

src/input/item.c: if we don't have an item name and item is a file, then only use the filename (and not the full path) as the item's name
others: if we only have a path and no interesting name, let the core decide what name to use
parent 19f542a3
...@@ -843,14 +843,7 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars, ...@@ -843,14 +843,7 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
free( mrl ); free( mrl );
mrl = tmp; mrl = tmp;
if( !*psz_name ) p_input = E_(MRLParse)( p_intf, mrl, psz_name );
{
p_input = E_(MRLParse)( p_intf, mrl, mrl );
}
else
{
p_input = E_(MRLParse)( p_intf, mrl, psz_name );
}
if( !p_input || !p_input->psz_uri || !*p_input->psz_uri ) if( !p_input || !p_input->psz_uri || !*p_input->psz_uri )
{ {
......
...@@ -2290,7 +2290,7 @@ static input_item_t *parse_MRL( intf_thread_t *p_intf, char *psz_mrl ) ...@@ -2290,7 +2290,7 @@ static input_item_t *parse_MRL( intf_thread_t *p_intf, char *psz_mrl )
/* Now create a playlist item */ /* Now create a playlist item */
if( psz_item_mrl ) if( psz_item_mrl )
{ {
p_item = input_ItemNew( p_intf, psz_item_mrl, psz_item_mrl ); p_item = input_ItemNew( p_intf, psz_item_mrl, NULL );
for( i = 0; i < i_options; i++ ) for( i = 0; i < i_options; i++ )
{ {
input_ItemAddOption( p_item, ppsz_options[i] ); input_ItemAddOption( p_item, ppsz_options[i] );
......
...@@ -68,6 +68,7 @@ int E_(Import_GVP)( vlc_object_t *p_this ) ...@@ -68,6 +68,7 @@ int E_(Import_GVP)( vlc_object_t *p_this )
demux_t *p_demux = (demux_t *)p_this; demux_t *p_demux = (demux_t *)p_this;
byte_t *p_peek; byte_t *p_peek;
/* FIXME: we need to skip comment lines !!!! */
CHECK_PEEK( p_peek, 12 ); CHECK_PEEK( p_peek, 12 );
if( !POKE( p_peek, "gvp_version:", 12 ) ) if( !POKE( p_peek, "gvp_version:", 12 ) )
{ {
......
...@@ -369,7 +369,7 @@ static int Demux( demux_t *p_demux ) ...@@ -369,7 +369,7 @@ static int Demux( demux_t *p_demux )
if( psz_qtnext ) if( psz_qtnext )
{ {
p_input = input_ItemNewExt( p_sys->p_playlist, p_input = input_ItemNewExt( p_sys->p_playlist,
psz_qtnext, psz_qtnext, 0, NULL, -1 ); psz_qtnext, NULL, 0, NULL, -1 );
playlist_AddWhereverNeeded( p_sys->p_playlist, p_input, playlist_AddWhereverNeeded( p_sys->p_playlist, p_input,
p_sys->p_current, p_sys->p_item_in_category, p_sys->p_current, p_sys->p_item_in_category,
(p_sys->i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE, (p_sys->i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE,
......
...@@ -749,7 +749,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -749,7 +749,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
if( p_playlist ) if( p_playlist )
{ {
playlist_PlaylistAdd( p_playlist, path.Path(), path.Path(), playlist_PlaylistAdd( p_playlist, path.Path(), NULL,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
} }
} }
......
...@@ -207,7 +207,7 @@ void DialogsProvider::simplePLAppendDialog() ...@@ -207,7 +207,7 @@ void DialogsProvider::simplePLAppendDialog()
foreach( file, files ) foreach( file, files )
{ {
const char * psz_utf8 = qtu( file ); const char * psz_utf8 = qtu( file );
playlist_PlaylistAdd( THEPL, psz_utf8, psz_utf8, playlist_PlaylistAdd( THEPL, psz_utf8, NULL,
PLAYLIST_APPEND | PLAYLIST_PREPARSE, PLAYLIST_END ); PLAYLIST_APPEND | PLAYLIST_PREPARSE, PLAYLIST_END );
} }
} }
...@@ -232,7 +232,7 @@ void DialogsProvider::simpleOpenDialog() ...@@ -232,7 +232,7 @@ void DialogsProvider::simpleOpenDialog()
{ {
const char * psz_utf8 = qtu( files[i] ); const char * psz_utf8 = qtu( files[i] );
/* Play the first one, parse and enqueue the other ones */ /* Play the first one, parse and enqueue the other ones */
playlist_PlaylistAdd( THEPL, psz_utf8, psz_utf8, playlist_PlaylistAdd( THEPL, psz_utf8, NULL,
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) | PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
( i ? PLAYLIST_PREPARSE : 0 ), ( i ? PLAYLIST_PREPARSE : 0 ),
PLAYLIST_END ); PLAYLIST_END );
...@@ -256,7 +256,7 @@ void DialogsProvider::openDirectory() ...@@ -256,7 +256,7 @@ void DialogsProvider::openDirectory()
QString dir = QFileDialog::getExistingDirectory ( 0, QString dir = QFileDialog::getExistingDirectory ( 0,
_("Open directory") ); _("Open directory") );
const char *psz_utf8 = qtu( dir ); const char *psz_utf8 = qtu( dir );
input_item_t *p_input = input_ItemNewExt( THEPL, psz_utf8, psz_utf8, input_item_t *p_input = input_ItemNewExt( THEPL, psz_utf8, NULL,
0, NULL, -1 ); 0, NULL, -1 );
playlist_PlaylistAddInput( THEPL, p_input, playlist_PlaylistAddInput( THEPL, p_input,
PLAYLIST_APPEND, PLAYLIST_END ); PLAYLIST_APPEND, PLAYLIST_END );
...@@ -267,7 +267,7 @@ void DialogsProvider::openMLDirectory() ...@@ -267,7 +267,7 @@ void DialogsProvider::openMLDirectory()
QString dir = QFileDialog::getExistingDirectory ( 0, QString dir = QFileDialog::getExistingDirectory ( 0,
_("Open directory") ); _("Open directory") );
const char *psz_utf8 = qtu( dir ); const char *psz_utf8 = qtu( dir );
input_item_t *p_input = input_ItemNewExt( THEPL, psz_utf8, psz_utf8, input_item_t *p_input = input_ItemNewExt( THEPL, psz_utf8, NULL,
0, NULL, -1 ); 0, NULL, -1 );
playlist_MLAddInput( THEPL, p_input, PLAYLIST_APPEND, PLAYLIST_END ); playlist_MLAddInput( THEPL, p_input, PLAYLIST_APPEND, PLAYLIST_END );
input_Read( THEPL, p_input, VLC_FALSE ); input_Read( THEPL, p_input, VLC_FALSE );
......
...@@ -37,13 +37,13 @@ void CmdAddItem::execute() ...@@ -37,13 +37,13 @@ void CmdAddItem::execute()
if( m_playNow ) if( m_playNow )
{ {
// Enqueue and play the item // Enqueue and play the item
playlist_PlaylistAdd( pPlaylist, m_name.c_str(),m_name.c_str(), playlist_PlaylistAdd( pPlaylist, m_name.c_str(), NULL,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
} }
else else
{ {
// Enqueue the item only // Enqueue the item only
playlist_PlaylistAdd( pPlaylist, m_name.c_str(), m_name.c_str(), playlist_PlaylistAdd( pPlaylist, m_name.c_str(), NULL,
PLAYLIST_APPEND, PLAYLIST_END ); PLAYLIST_APPEND, PLAYLIST_END );
} }
} }
...@@ -446,12 +446,12 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event ) ...@@ -446,12 +446,12 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
{ {
char *psz_utf8 = wxFromLocale( paths[i] ); char *psz_utf8 = wxFromLocale( paths[i] );
if( event.GetInt() ) if( event.GetInt() )
playlist_PlaylistAdd( p_playlist, psz_utf8, psz_utf8, playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) | PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
(i ? PLAYLIST_PREPARSE : 0 ), (i ? PLAYLIST_PREPARSE : 0 ),
PLAYLIST_END ); PLAYLIST_END );
else else
playlist_PlaylistAdd( p_playlist, psz_utf8, psz_utf8, playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
PLAYLIST_APPEND | PLAYLIST_PREPARSE , PLAYLIST_END ); PLAYLIST_APPEND | PLAYLIST_PREPARSE , PLAYLIST_END );
wxLocaleFree( psz_utf8 ); wxLocaleFree( psz_utf8 );
} }
...@@ -477,7 +477,7 @@ void DialogsProvider::OnOpenDirectory( wxCommandEvent& event ) ...@@ -477,7 +477,7 @@ void DialogsProvider::OnOpenDirectory( wxCommandEvent& event )
{ {
wxString path = p_dir_dialog->GetPath(); wxString path = p_dir_dialog->GetPath();
char *psz_utf8 = wxFromLocale( path ); char *psz_utf8 = wxFromLocale( path );
playlist_PlaylistAdd( p_playlist, psz_utf8, psz_utf8, playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
PLAYLIST_APPEND | (event.GetInt() ? PLAYLIST_GO : 0), PLAYLIST_APPEND | (event.GetInt() ? PLAYLIST_GO : 0),
PLAYLIST_END ); PLAYLIST_END );
wxLocaleFree( psz_utf8 ); wxLocaleFree( psz_utf8 );
......
...@@ -1169,7 +1169,7 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) ) ...@@ -1169,7 +1169,7 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
char *psz_utf8; char *psz_utf8;
psz_utf8 = wxFromLocale( mrl[i] ); psz_utf8 = wxFromLocale( mrl[i] );
p_input = input_ItemNew( p_intf, psz_utf8, psz_utf8 ); p_input = input_ItemNew( p_intf, psz_utf8, NULL );
wxLocaleFree( psz_utf8 ); wxLocaleFree( psz_utf8 );
/* Insert options */ /* Insert options */
......
...@@ -1304,7 +1304,7 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord, ...@@ -1304,7 +1304,7 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
{ {
char *psz_utf8 = wxDnDFromLocale( filenames[i] ); char *psz_utf8 = wxDnDFromLocale( filenames[i] );
playlist_PlaylistAdd( p_playlist, psz_utf8, psz_utf8, playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
PLAYLIST_APPEND | ((i | b_enqueue) ? 0 : PLAYLIST_GO), PLAYLIST_APPEND | ((i | b_enqueue) ? 0 : PLAYLIST_GO),
PLAYLIST_END ); PLAYLIST_END );
......
...@@ -241,17 +241,26 @@ input_item_t *input_ItemNewWithType( vlc_object_t *p_obj, const char *psz_uri, ...@@ -241,17 +241,26 @@ input_item_t *input_ItemNewWithType( vlc_object_t *p_obj, const char *psz_uri,
else else
p_input->psz_uri = NULL; p_input->psz_uri = NULL;
if( psz_name != NULL )
p_input->psz_name = strdup( psz_name );
else
p_input->psz_name = strdup ( p_input->psz_uri );
p_input->i_type = i_type; p_input->i_type = i_type;
p_input->b_prefers_tree = VLC_FALSE; p_input->b_prefers_tree = VLC_FALSE;
if( p_input->i_type == ITEM_TYPE_UNKNOWN ) if( p_input->i_type == ITEM_TYPE_UNKNOWN )
GuessType( p_input ); GuessType( p_input );
if( psz_name != NULL )
p_input->psz_name = strdup( psz_name );
else if( p_input->i_type == ITEM_TYPE_AFILE
|| p_input->i_type == ITEM_TYPE_VFILE )
{
char *psz_filename = strrchr( p_input->psz_uri, DIR_SEP_CHAR );
if( psz_filename && *psz_filename == DIR_SEP_CHAR )
psz_filename++;
p_input->psz_name = strdup( psz_filename && *psz_filename
? psz_filename : p_input->psz_uri );
}
else
p_input->psz_name = strdup( p_input->psz_uri );
p_input->i_duration = i_duration; p_input->i_duration = i_duration;
p_input->ppsz_options = NULL; p_input->ppsz_options = NULL;
......
...@@ -162,8 +162,6 @@ libvlc_int_t * libvlc_InternalCreate( void ) ...@@ -162,8 +162,6 @@ libvlc_int_t * libvlc_InternalCreate( void )
var_Get( p_libvlc_global, "libvlc", &lockval ); var_Get( p_libvlc_global, "libvlc", &lockval );
vlc_mutex_lock( lockval.p_address ); vlc_mutex_lock( lockval.p_address );
i_instances++; i_instances++;
if( !libvlc_global.b_ready ) if( !libvlc_global.b_ready )
......
...@@ -315,7 +315,7 @@ int VLC_AddTarget( int i_object, char const *psz_target, ...@@ -315,7 +315,7 @@ int VLC_AddTarget( int i_object, char const *psz_target,
int i_err; int i_err;
LIBVLC_PLAYLIST_FUNC; LIBVLC_PLAYLIST_FUNC;
i_err = playlist_PlaylistAddExt( p_libvlc->p_playlist, psz_target, i_err = playlist_PlaylistAddExt( p_libvlc->p_playlist, psz_target,
psz_target, i_mode, i_pos, -1, NULL, i_mode, i_pos, -1,
ppsz_options, i_options ); ppsz_options, i_options );
LIBVLC_PLAYLIST_FUNC_END; LIBVLC_PLAYLIST_FUNC_END;
return i_err; return i_err;
......
...@@ -322,13 +322,13 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam, ...@@ -322,13 +322,13 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
if( i_opt || config_GetInt( p_this, "playlist-enqueue" ) ) if( i_opt || config_GetInt( p_this, "playlist-enqueue" ) )
{ {
playlist_PlaylistAddExt( p_playlist, ppsz_argv[i_opt], playlist_PlaylistAddExt( p_playlist, ppsz_argv[i_opt],
ppsz_argv[i_opt], PLAYLIST_APPEND , NULL, PLAYLIST_APPEND ,
PLAYLIST_END, -1, PLAYLIST_END, -1,
(char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ), (char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ),
i_options ); i_options );
} else { } else {
playlist_PlaylistAddExt( p_playlist, ppsz_argv[i_opt], playlist_PlaylistAddExt( p_playlist, ppsz_argv[i_opt],
ppsz_argv[i_opt], PLAYLIST_APPEND | PLAYLIST_GO, NULL, PLAYLIST_APPEND | PLAYLIST_GO,
PLAYLIST_END, -1, PLAYLIST_END, -1,
(char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ), (char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ),
i_options ); i_options );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment