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,
free( mrl );
mrl = tmp;
if( !*psz_name )
{
p_input = E_(MRLParse)( p_intf, mrl, mrl );
}
else
{
p_input = E_(MRLParse)( p_intf, mrl, psz_name );
}
p_input = E_(MRLParse)( p_intf, mrl, psz_name );
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 )
/* Now create a playlist item */
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++ )
{
input_ItemAddOption( p_item, ppsz_options[i] );
......
......@@ -68,6 +68,7 @@ int E_(Import_GVP)( vlc_object_t *p_this )
demux_t *p_demux = (demux_t *)p_this;
byte_t *p_peek;
/* FIXME: we need to skip comment lines !!!! */
CHECK_PEEK( p_peek, 12 );
if( !POKE( p_peek, "gvp_version:", 12 ) )
{
......
......@@ -369,7 +369,7 @@ static int Demux( demux_t *p_demux )
if( psz_qtnext )
{
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,
p_sys->p_current, p_sys->p_item_in_category,
(p_sys->i_parent_id > 0 ) ? VLC_TRUE: VLC_FALSE,
......
......@@ -749,7 +749,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
if( p_playlist )
{
playlist_PlaylistAdd( p_playlist, path.Path(), path.Path(),
playlist_PlaylistAdd( p_playlist, path.Path(), NULL,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
}
}
......
......@@ -207,7 +207,7 @@ void DialogsProvider::simplePLAppendDialog()
foreach( file, files )
{
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 );
}
}
......@@ -232,7 +232,7 @@ void DialogsProvider::simpleOpenDialog()
{
const char * psz_utf8 = qtu( files[i] );
/* 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) |
( i ? PLAYLIST_PREPARSE : 0 ),
PLAYLIST_END );
......@@ -256,7 +256,7 @@ void DialogsProvider::openDirectory()
QString dir = QFileDialog::getExistingDirectory ( 0,
_("Open directory") );
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 );
playlist_PlaylistAddInput( THEPL, p_input,
PLAYLIST_APPEND, PLAYLIST_END );
......@@ -267,7 +267,7 @@ void DialogsProvider::openMLDirectory()
QString dir = QFileDialog::getExistingDirectory ( 0,
_("Open directory") );
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 );
playlist_MLAddInput( THEPL, p_input, PLAYLIST_APPEND, PLAYLIST_END );
input_Read( THEPL, p_input, VLC_FALSE );
......
......@@ -37,13 +37,13 @@ void CmdAddItem::execute()
if( m_playNow )
{
// 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 );
}
else
{
// 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 );
}
}
......@@ -446,12 +446,12 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
{
char *psz_utf8 = wxFromLocale( paths[i] );
if( event.GetInt() )
playlist_PlaylistAdd( p_playlist, psz_utf8, psz_utf8,
playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
(i ? PLAYLIST_PREPARSE : 0 ),
PLAYLIST_END );
else
playlist_PlaylistAdd( p_playlist, psz_utf8, psz_utf8,
playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
PLAYLIST_APPEND | PLAYLIST_PREPARSE , PLAYLIST_END );
wxLocaleFree( psz_utf8 );
}
......@@ -477,7 +477,7 @@ void DialogsProvider::OnOpenDirectory( wxCommandEvent& event )
{
wxString path = p_dir_dialog->GetPath();
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_END );
wxLocaleFree( psz_utf8 );
......
......@@ -1169,7 +1169,7 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
char *psz_utf8;
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 );
/* Insert options */
......
......@@ -1304,7 +1304,7 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
{
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_END );
......
......@@ -241,17 +241,26 @@ input_item_t *input_ItemNewWithType( vlc_object_t *p_obj, const char *psz_uri,
else
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->b_prefers_tree = VLC_FALSE;
if( p_input->i_type == ITEM_TYPE_UNKNOWN )
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->ppsz_options = NULL;
......
......@@ -162,8 +162,6 @@ libvlc_int_t * libvlc_InternalCreate( void )
var_Get( p_libvlc_global, "libvlc", &lockval );
vlc_mutex_lock( lockval.p_address );
i_instances++;
if( !libvlc_global.b_ready )
......
......@@ -315,7 +315,7 @@ int VLC_AddTarget( int i_object, char const *psz_target,
int i_err;
LIBVLC_PLAYLIST_FUNC;
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 );
LIBVLC_PLAYLIST_FUNC_END;
return i_err;
......
......@@ -322,13 +322,13 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
if( i_opt || config_GetInt( p_this, "playlist-enqueue" ) )
{
playlist_PlaylistAddExt( p_playlist, ppsz_argv[i_opt],
ppsz_argv[i_opt], PLAYLIST_APPEND ,
NULL, PLAYLIST_APPEND ,
PLAYLIST_END, -1,
(char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ),
i_options );
} else {
playlist_PlaylistAddExt( p_playlist, ppsz_argv[i_opt],
ppsz_argv[i_opt], PLAYLIST_APPEND | PLAYLIST_GO,
NULL, PLAYLIST_APPEND | PLAYLIST_GO,
PLAYLIST_END, -1,
(char const **)( i_options ? &ppsz_argv[i_opt+1] : NULL ),
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