]> git.sesse.net Git - vlc/commitdiff
src/input/item.c: if we don't have an item name and item is a file, then only use...
authorAntoine Cellerier <dionoea@videolan.org>
Sun, 1 Oct 2006 19:07:48 +0000 (19:07 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sun, 1 Oct 2006 19:07:48 +0000 (19:07 +0000)
others: if we only have a path and no interesting name, let the core decide what name to use

14 files changed:
modules/control/http/rpn.c
modules/control/rc.c
modules/demux/playlist/gvp.c
modules/demux/playlist/qtl.c
modules/gui/beos/InterfaceWindow.cpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/skins2/commands/cmd_add_item.cpp
modules/gui/wxwidgets/dialogs.cpp
modules/gui/wxwidgets/dialogs/open.cpp
modules/gui/wxwidgets/interface.cpp
src/input/item.c
src/libvlc-common.c
src/libvlc.c
src/misc/win32_specific.c

index ee9291bd23ca88f6f8529e4da67729f0d7b6231a..598b874c5973bd4678b91f80eebf5ff0d9bf6fd9 100644 (file)
@@ -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 )
             {
index b6fab5e45ff71f39725a0d4d126a62ee31e99d97..6e89bf2644dcd7afbbc9a3c2f733cc7a0449e57a 100644 (file)
@@ -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] );
index fe3033a0fd761d489f9b760d0d0cd310ea2fd18b..e88dce2293061f9d3927465c42abba1fb02649e5 100644 (file)
@@ -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 ) )
     {
index 841d07450864906b746379c57af5284898793970..eabd67464b20a1a9b179ad1814eef7d246294695 100644 (file)
@@ -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,
index 84b1db98813001b4288f1b69ac9189a1aae1ccea..b883bfb486e013cc8c293619c5fd9c8277510b5f 100644 (file)
@@ -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 );
                 }
             }
index 83cf198b3cbd24ef69ef2d5433c47ccd64fbe31d..d35805a3d068948aaa491efa408745afe17833a0 100644 (file)
@@ -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 );
index 771ec13c913dea5f16c145468f851b2e2e83b1be..dbfdea032a835d9d045361e4475c865cb5147c98 100644 (file)
@@ -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 );
     }
 }
index 23ac8f78da93891a0b14c1c57de976eacc55dbd4..34a1fe485811a9e9dc9cd6c595ca42d578ce837c 100644 (file)
@@ -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 );
index 375c8d52eea9e10e90ee4ab2b27ae7276f3727ad..b30fe5044b76bdc82c21ef4d9faa75e114c7dc82 100644 (file)
@@ -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 */
index 83c9325d8213d2e6e824bd8b129c0714885fe0dd..608f065f8dc387b8568c0cfd08bd1567c640db4b 100644 (file)
@@ -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 );
 
index c47aba83c6a91843fe462a29b5c11db3aa1b8a8b..f07b1aae462cffc81b27dd4c8531a660cbab19e3 100644 (file)
@@ -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;
 
index f7d5029b9bd0a73286d6381120f1174f620cd395..a997b2e89653b76720b91cc2461cd24748364156 100644 (file)
@@ -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 )
index 72e96f9c4621b4b8621e47b69227b648574230af..469c3ad42f0c43489ad3191ba5c4949b39679b4c 100644 (file)
@@ -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;
index 3d816322d2f0ef5c1d6ec61eb26d4e846a3d54d5..a01f10ebd1016069d897c61ce1acd448204420c1 100644 (file)
@@ -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 );