* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
#include <assert.h>
#include <vlc_common.h>
+#include <vlc_url.h>
#include "vlc_playlist.h"
#include "vlc_interface.h"
if( !p_item->p_meta )
{
+ psz_ret = p_item->psz_name ? strdup( p_item->psz_name ) : NULL;
vlc_mutex_unlock( &p_item->lock );
- return NULL;
+ return psz_ret;
}
- const char *psz_meta = vlc_meta_Get( p_item->p_meta, vlc_meta_Title );
- if( !EMPTY_STR( psz_meta ) )
- psz_ret = strdup( psz_meta );
+ const char *psz_title = vlc_meta_Get( p_item->p_meta, vlc_meta_Title );
+ if( !EMPTY_STR( psz_title ) )
+ psz_ret = strdup( psz_title );
else
psz_ret = p_item->psz_name ? strdup( p_item->psz_name ) : NULL;
p_i->psz_name = strdup( psz_filename );
}
+ /* The name is NULL: fill it with everything except login and password */
if( !p_i->psz_name )
- p_i->psz_name = strdup( p_i->psz_uri );
+ {
+ int r;
+ vlc_url_t url;
+ vlc_UrlParse( &url, psz_uri, 0 );
+ if( url.psz_protocol )
+ {
+ if( url.i_port > 0 )
+ r=asprintf( &p_i->psz_name, "%s://%s:%d%s", url.psz_protocol,
+ url.psz_host, url.i_port,
+ url.psz_path ? url.psz_path : "" );
+ else
+ r=asprintf( &p_i->psz_name, "%s://%s%s", url.psz_protocol,
+ url.psz_host ? url.psz_host : "",
+ url.psz_path ? url.psz_path : "" );
+ }
+ else
+ {
+ if( url.i_port > 0 )
+ r=asprintf( &p_i->psz_name, "%s:%d%s", url.psz_host, url.i_port,
+ url.psz_path ? url.psz_path : "" );
+ else
+ r=asprintf( &p_i->psz_name, "%s%s", url.psz_host,
+ url.psz_path ? url.psz_path : "" );
+ }
+ vlc_UrlClean( &url );
+ if( -1==r )
+ p_i->psz_name=NULL; /* recover from undefined value */
+ }
vlc_mutex_unlock( &p_i->lock );
}
{ "dvb", ITEM_TYPE_CARD },
{ "qpsk", ITEM_TYPE_CARD },
{ "sdp", ITEM_TYPE_NET },
+ { "ftp", ITEM_TYPE_NET },
+ { "smb", ITEM_TYPE_NET },
{ NULL, 0 }
};
- if( !p_item->psz_uri )
+ if( !p_item->psz_uri || !strstr( p_item->psz_uri, "://" ) )
{
p_item->i_type = ITEM_TYPE_FILE;
return;