Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
1644d683
Commit
1644d683
authored
Jul 07, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make_URI: add scheme parameter
parent
a0112f4b
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
57 additions
and
59 deletions
+57
-59
include/vlc_url.h
include/vlc_url.h
+1
-1
modules/access/directory.c
modules/access/directory.c
+1
-1
modules/demux/playlist/playlist.c
modules/demux/playlist/playlist.c
+1
-1
modules/gui/qt4/dialogs/open.cpp
modules/gui/qt4/dialogs/open.cpp
+1
-1
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.cpp
+2
-2
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+2
-2
modules/gui/skins2/commands/cmd_add_item.cpp
modules/gui/skins2/commands/cmd_add_item.cpp
+1
-1
modules/gui/skins2/parser/xmlparser.cpp
modules/gui/skins2/parser/xmlparser.cpp
+1
-1
modules/gui/skins2/src/file_bitmap.cpp
modules/gui/skins2/src/file_bitmap.cpp
+1
-1
modules/meta_engine/folder.c
modules/meta_engine/folder.c
+1
-1
modules/services_discovery/mediadirs.c
modules/services_discovery/mediadirs.c
+2
-2
modules/video_filter/alphamask.c
modules/video_filter/alphamask.c
+1
-1
modules/video_filter/erase.c
modules/video_filter/erase.c
+1
-1
modules/video_filter/logo.c
modules/video_filter/logo.c
+1
-1
src/control/media.c
src/control/media.c
+1
-1
src/input/input.c
src/input/input.c
+1
-1
src/libvlc.c
src/libvlc.c
+1
-3
src/playlist/art.c
src/playlist/art.c
+2
-2
src/playlist/loadsave.c
src/playlist/loadsave.c
+15
-25
src/test/url.c
src/test/url.c
+7
-2
src/text/strings.c
src/text/strings.c
+12
-7
src/win32/specific.c
src/win32/specific.c
+1
-1
No files found.
include/vlc_url.h
View file @
1644d683
...
@@ -48,7 +48,7 @@ struct vlc_url_t
...
@@ -48,7 +48,7 @@ struct vlc_url_t
VLC_EXPORT
(
char
*
,
decode_URI_duplicate
,
(
const
char
*
psz
)
);
VLC_EXPORT
(
char
*
,
decode_URI_duplicate
,
(
const
char
*
psz
)
);
VLC_EXPORT
(
char
*
,
decode_URI
,
(
char
*
psz
)
);
VLC_EXPORT
(
char
*
,
decode_URI
,
(
char
*
psz
)
);
VLC_EXPORT
(
char
*
,
encode_URI_component
,
(
const
char
*
psz
)
);
VLC_EXPORT
(
char
*
,
encode_URI_component
,
(
const
char
*
psz
)
);
VLC_EXPORT
(
char
*
,
make_URI
,
(
const
char
*
path
)
);
VLC_EXPORT
(
char
*
,
make_URI
,
(
const
char
*
path
,
const
char
*
scheme
)
);
VLC_EXPORT
(
char
*
,
make_path
,
(
const
char
*
url
)
);
VLC_EXPORT
(
char
*
,
make_path
,
(
const
char
*
url
)
);
/*****************************************************************************
/*****************************************************************************
...
...
modules/access/directory.c
View file @
1644d683
...
@@ -122,7 +122,7 @@ int DirInit (access_t *p_access, DIR *handle)
...
@@ -122,7 +122,7 @@ int DirInit (access_t *p_access, DIR *handle)
uri
=
NULL
;
uri
=
NULL
;
}
}
else
else
uri
=
make_URI
(
p_access
->
psz_filepath
);
uri
=
make_URI
(
p_access
->
psz_filepath
,
"file"
);
if
(
unlikely
(
uri
==
NULL
))
if
(
unlikely
(
uri
==
NULL
))
goto
error
;
goto
error
;
...
...
modules/demux/playlist/playlist.c
View file @
1644d683
...
@@ -238,5 +238,5 @@ char *ProcessMRL( const char *psz_mrl, const char *psz_prefix )
...
@@ -238,5 +238,5 @@ char *ProcessMRL( const char *psz_mrl, const char *psz_prefix )
return
ret
;
return
ret
;
uri:
uri:
return
make_URI
(
psz_mrl
);
return
make_URI
(
psz_mrl
,
NULL
);
}
}
modules/gui/qt4/dialogs/open.cpp
View file @
1644d683
...
@@ -338,7 +338,7 @@ void OpenDialog::finish( bool b_enqueue = false )
...
@@ -338,7 +338,7 @@ void OpenDialog::finish( bool b_enqueue = false )
bool
b_start
=
!
i
&&
!
b_enqueue
;
bool
b_start
=
!
i
&&
!
b_enqueue
;
input_item_t
*
p_input
;
input_item_t
*
p_input
;
char
*
psz_uri
=
make_URI
(
qtu
(
itemsMRL
[
i
]
)
);
char
*
psz_uri
=
make_URI
(
qtu
(
itemsMRL
[
i
]
)
,
"file"
);
p_input
=
input_item_New
(
p_intf
,
psz_uri
,
NULL
);
p_input
=
input_item_New
(
p_intf
,
psz_uri
,
NULL
);
free
(
psz_uri
);
free
(
psz_uri
);
...
...
modules/gui/qt4/dialogs_provider.cpp
View file @
1644d683
...
@@ -436,7 +436,7 @@ void DialogsProvider::addFromSimple( bool pl, bool go)
...
@@ -436,7 +436,7 @@ void DialogsProvider::addFromSimple( bool pl, bool go)
files
.
sort
();
files
.
sort
();
foreach
(
const
QString
&
file
,
files
)
foreach
(
const
QString
&
file
,
files
)
{
{
char
*
psz_uri
=
make_URI
(
qtu
(
toNativeSeparators
(
file
)
)
);
char
*
psz_uri
=
make_URI
(
qtu
(
toNativeSeparators
(
file
)
)
,
NULL
);
playlist_Add
(
THEPL
,
psz_uri
,
NULL
,
playlist_Add
(
THEPL
,
psz_uri
,
NULL
,
go
?
(
PLAYLIST_APPEND
|
(
i
?
PLAYLIST_PREPARSE
:
PLAYLIST_GO
)
)
go
?
(
PLAYLIST_APPEND
|
(
i
?
PLAYLIST_PREPARSE
:
PLAYLIST_GO
)
)
:
(
PLAYLIST_APPEND
|
PLAYLIST_PREPARSE
),
:
(
PLAYLIST_APPEND
|
PLAYLIST_PREPARSE
),
...
@@ -719,7 +719,7 @@ void DialogsProvider::SDMenuAction( const QString& data )
...
@@ -719,7 +719,7 @@ void DialogsProvider::SDMenuAction( const QString& data )
**/
**/
void
DialogsProvider
::
playMRL
(
const
QString
&
mrl
)
void
DialogsProvider
::
playMRL
(
const
QString
&
mrl
)
{
{
char
*
psz_uri
=
make_URI
(
qtu
(
mrl
)
);
char
*
psz_uri
=
make_URI
(
qtu
(
mrl
)
,
NULL
);
playlist_Add
(
THEPL
,
psz_uri
,
NULL
,
playlist_Add
(
THEPL
,
psz_uri
,
NULL
,
PLAYLIST_APPEND
|
PLAYLIST_GO
,
PLAYLIST_END
,
true
,
false
);
PLAYLIST_APPEND
|
PLAYLIST_GO
,
PLAYLIST_END
,
true
,
false
);
free
(
psz_uri
);
free
(
psz_uri
);
...
...
modules/gui/qt4/main_interface.cpp
View file @
1644d683
...
@@ -1059,7 +1059,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
...
@@ -1059,7 +1059,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
{
{
if
(
url
.
isValid
()
)
if
(
url
.
isValid
()
)
{
{
char
*
psz_uri
=
make_URI
(
qtu
(
url
.
toString
()
)
);
char
*
psz_uri
=
make_URI
(
qtu
(
url
.
toString
()
)
,
NULL
);
playlist_Add
(
THEPL
,
psz_uri
,
NULL
,
playlist_Add
(
THEPL
,
psz_uri
,
NULL
,
PLAYLIST_APPEND
|
(
first
?
PLAYLIST_GO
:
PLAYLIST_PREPARSE
),
PLAYLIST_APPEND
|
(
first
?
PLAYLIST_GO
:
PLAYLIST_PREPARSE
),
PLAYLIST_END
,
true
,
pl_Unlocked
);
PLAYLIST_END
,
true
,
pl_Unlocked
);
...
@@ -1075,7 +1075,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
...
@@ -1075,7 +1075,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
if
(
!
mimeData
->
hasUrls
()
&&
mimeData
->
hasText
()
&&
if
(
!
mimeData
->
hasUrls
()
&&
mimeData
->
hasText
()
&&
QUrl
(
mimeData
->
text
()).
isValid
()
)
QUrl
(
mimeData
->
text
()).
isValid
()
)
{
{
char
*
psz_uri
=
make_URI
(
qtu
(
mimeData
->
text
()
)
);
char
*
psz_uri
=
make_URI
(
qtu
(
mimeData
->
text
()
)
,
NULL
);
playlist_Add
(
THEPL
,
psz_uri
,
NULL
,
playlist_Add
(
THEPL
,
psz_uri
,
NULL
,
PLAYLIST_APPEND
|
(
first
?
PLAYLIST_GO
:
PLAYLIST_PREPARSE
),
PLAYLIST_APPEND
|
(
first
?
PLAYLIST_GO
:
PLAYLIST_PREPARSE
),
PLAYLIST_END
,
true
,
pl_Unlocked
);
PLAYLIST_END
,
true
,
pl_Unlocked
);
...
...
modules/gui/skins2/commands/cmd_add_item.cpp
View file @
1644d683
...
@@ -37,7 +37,7 @@ void CmdAddItem::execute()
...
@@ -37,7 +37,7 @@ void CmdAddItem::execute()
if
(
!
pPlaylist
)
if
(
!
pPlaylist
)
return
;
return
;
char
*
psz_uri
=
make_URI
(
m_name
.
c_str
()
);
char
*
psz_uri
=
make_URI
(
m_name
.
c_str
()
,
NULL
);
if
(
!
psz_uri
)
if
(
!
psz_uri
)
return
;
return
;
...
...
modules/gui/skins2/parser/xmlparser.cpp
View file @
1644d683
...
@@ -55,7 +55,7 @@ XMLParser::XMLParser( intf_thread_t *pIntf, const string &rFileName,
...
@@ -55,7 +55,7 @@ XMLParser::XMLParser( intf_thread_t *pIntf, const string &rFileName,
// }
// }
LoadCatalog
();
LoadCatalog
();
char
*
psz_uri
=
make_URI
(
rFileName
.
c_str
()
);
char
*
psz_uri
=
make_URI
(
rFileName
.
c_str
()
,
NULL
);
m_pStream
=
stream_UrlNew
(
pIntf
,
psz_uri
);
m_pStream
=
stream_UrlNew
(
pIntf
,
psz_uri
);
free
(
psz_uri
);
free
(
psz_uri
);
...
...
modules/gui/skins2/src/file_bitmap.cpp
View file @
1644d683
...
@@ -42,7 +42,7 @@ FileBitmap::FileBitmap( intf_thread_t *pIntf, image_handler_t *pImageHandler,
...
@@ -42,7 +42,7 @@ FileBitmap::FileBitmap( intf_thread_t *pIntf, image_handler_t *pImageHandler,
fmt_out
.
i_chroma
=
VLC_CODEC_RGBA
;
fmt_out
.
i_chroma
=
VLC_CODEC_RGBA
;
char
*
psz_uri
=
make_URI
(
fileName
.
c_str
()
);
char
*
psz_uri
=
make_URI
(
fileName
.
c_str
()
,
NULL
);
pPic
=
image_ReadUrl
(
pImageHandler
,
psz_uri
,
&
fmt_in
,
&
fmt_out
);
pPic
=
image_ReadUrl
(
pImageHandler
,
psz_uri
,
&
fmt_in
,
&
fmt_out
);
free
(
psz_uri
);
free
(
psz_uri
);
...
...
modules/meta_engine/folder.c
View file @
1644d683
...
@@ -116,7 +116,7 @@ static int FindMeta( vlc_object_t *p_this )
...
@@ -116,7 +116,7 @@ static int FindMeta( vlc_object_t *p_this )
if
(
vlc_stat
(
psz_filename
,
&
a
)
!=
-
1
)
if
(
vlc_stat
(
psz_filename
,
&
a
)
!=
-
1
)
{
{
char
*
psz_uri
=
make_URI
(
psz_filename
);
char
*
psz_uri
=
make_URI
(
psz_filename
,
"file"
);
if
(
psz_uri
)
if
(
psz_uri
)
{
{
input_item_SetArtURL
(
p_item
,
psz_uri
);
input_item_SetArtURL
(
p_item
,
psz_uri
);
...
...
modules/services_discovery/mediadirs.c
View file @
1644d683
...
@@ -190,7 +190,7 @@ static void *Run( void *data )
...
@@ -190,7 +190,7 @@ static void *Run( void *data )
!
S_ISDIR
(
st
.
st_mode
)
)
!
S_ISDIR
(
st
.
st_mode
)
)
continue
;
continue
;
char
*
psz_uri
=
make_URI
(
psz_dir
);
char
*
psz_uri
=
make_URI
(
psz_dir
,
"file"
);
input_item_t
*
p_root
=
input_item_New
(
p_sd
,
psz_uri
,
NULL
);
input_item_t
*
p_root
=
input_item_New
(
p_sd
,
psz_uri
,
NULL
);
if
(
p_sys
->
i_type
==
Picture
)
if
(
p_sys
->
i_type
==
Picture
)
...
@@ -268,7 +268,7 @@ static int onNewFileAdded( vlc_object_t *p_this, char const *psz_var,
...
@@ -268,7 +268,7 @@ static int onNewFileAdded( vlc_object_t *p_this, char const *psz_var,
if
(
!
psz_file
||
!*
psz_file
)
if
(
!
psz_file
||
!*
psz_file
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
char
*
psz_uri
=
make_URI
(
psz_file
);
char
*
psz_uri
=
make_URI
(
psz_file
,
"file"
);
input_item_t
*
p_item
=
input_item_New
(
p_sd
,
psz_uri
,
NULL
);
input_item_t
*
p_item
=
input_item_New
(
p_sd
,
psz_uri
,
NULL
);
if
(
p_sys
->
i_type
==
Picture
)
if
(
p_sys
->
i_type
==
Picture
)
...
...
modules/video_filter/alphamask.c
View file @
1644d683
...
@@ -182,7 +182,7 @@ static void LoadMask( filter_t *p_filter, const char *psz_filename )
...
@@ -182,7 +182,7 @@ static void LoadMask( filter_t *p_filter, const char *psz_filename )
if
(
p_filter
->
p_sys
->
p_mask
)
if
(
p_filter
->
p_sys
->
p_mask
)
picture_Release
(
p_filter
->
p_sys
->
p_mask
);
picture_Release
(
p_filter
->
p_sys
->
p_mask
);
p_image
=
image_HandlerCreate
(
p_filter
);
p_image
=
image_HandlerCreate
(
p_filter
);
char
*
psz_url
=
make_URI
(
psz_filename
);
char
*
psz_url
=
make_URI
(
psz_filename
,
NULL
);
p_filter
->
p_sys
->
p_mask
=
p_filter
->
p_sys
->
p_mask
=
image_ReadUrl
(
p_image
,
psz_url
,
&
fmt_in
,
&
fmt_out
);
image_ReadUrl
(
p_image
,
psz_url
,
&
fmt_in
,
&
fmt_out
);
free
(
psz_url
);
free
(
psz_url
);
...
...
modules/video_filter/erase.c
View file @
1644d683
...
@@ -105,7 +105,7 @@ static void LoadMask( filter_t *p_filter, const char *psz_filename )
...
@@ -105,7 +105,7 @@ static void LoadMask( filter_t *p_filter, const char *psz_filename )
memset
(
&
fmt_out
,
0
,
sizeof
(
video_format_t
)
);
memset
(
&
fmt_out
,
0
,
sizeof
(
video_format_t
)
);
fmt_out
.
i_chroma
=
VLC_CODEC_YUVA
;
fmt_out
.
i_chroma
=
VLC_CODEC_YUVA
;
p_image
=
image_HandlerCreate
(
p_filter
);
p_image
=
image_HandlerCreate
(
p_filter
);
char
*
psz_url
=
make_URI
(
psz_filename
);
char
*
psz_url
=
make_URI
(
psz_filename
,
NULL
);
p_filter
->
p_sys
->
p_mask
=
p_filter
->
p_sys
->
p_mask
=
image_ReadUrl
(
p_image
,
psz_url
,
&
fmt_in
,
&
fmt_out
);
image_ReadUrl
(
p_image
,
psz_url
,
&
fmt_in
,
&
fmt_out
);
free
(
psz_url
);
free
(
psz_url
);
...
...
modules/video_filter/logo.c
View file @
1644d683
...
@@ -615,7 +615,7 @@ static picture_t *LoadImage( vlc_object_t *p_this, const char *psz_filename )
...
@@ -615,7 +615,7 @@ static picture_t *LoadImage( vlc_object_t *p_this, const char *psz_filename )
if
(
!
p_image
)
if
(
!
p_image
)
return
NULL
;
return
NULL
;
char
*
psz_url
=
make_URI
(
psz_filename
);
char
*
psz_url
=
make_URI
(
psz_filename
,
NULL
);
picture_t
*
p_pic
=
image_ReadUrl
(
p_image
,
psz_url
,
&
fmt_in
,
&
fmt_out
);
picture_t
*
p_pic
=
image_ReadUrl
(
p_image
,
psz_url
,
&
fmt_in
,
&
fmt_out
);
free
(
psz_url
);
free
(
psz_url
);
image_HandlerDelete
(
p_image
);
image_HandlerDelete
(
p_image
);
...
...
src/control/media.c
View file @
1644d683
...
@@ -328,7 +328,7 @@ libvlc_media_t *libvlc_media_new_location( libvlc_instance_t *p_instance,
...
@@ -328,7 +328,7 @@ libvlc_media_t *libvlc_media_new_location( libvlc_instance_t *p_instance,
libvlc_media_t
*
libvlc_media_new_path
(
libvlc_instance_t
*
p_instance
,
libvlc_media_t
*
libvlc_media_new_path
(
libvlc_instance_t
*
p_instance
,
const
char
*
path
)
const
char
*
path
)
{
{
char
*
mrl
=
make_URI
(
path
);
char
*
mrl
=
make_URI
(
path
,
"file"
);
if
(
unlikely
(
mrl
==
NULL
)
)
if
(
unlikely
(
mrl
==
NULL
)
)
{
{
libvlc_printerr
(
"Not enough memory"
);
libvlc_printerr
(
"Not enough memory"
);
...
...
src/input/input.c
View file @
1644d683
...
@@ -3167,7 +3167,7 @@ static void SubtitleAdd( input_thread_t *p_input, char *psz_subtitle, bool b_for
...
@@ -3167,7 +3167,7 @@ static void SubtitleAdd( input_thread_t *p_input, char *psz_subtitle, bool b_for
free
(
psz_path
);
free
(
psz_path
);
}
}
char
*
url
=
make_URI
(
psz_subtitle
);
char
*
url
=
make_URI
(
psz_subtitle
,
"file"
);
var_Change
(
p_input
,
"spu-es"
,
VLC_VAR_CHOICESCOUNT
,
&
count
,
NULL
);
var_Change
(
p_input
,
"spu-es"
,
VLC_VAR_CHOICESCOUNT
,
&
count
,
NULL
);
...
...
src/libvlc.c
View file @
1644d683
...
@@ -1163,9 +1163,7 @@ static void GetFilenames( libvlc_int_t *p_vlc, unsigned n,
...
@@ -1163,9 +1163,7 @@ static void GetFilenames( libvlc_int_t *p_vlc, unsigned n,
}
}
}
}
/* TODO: write an internal function of this one, to avoid
char
*
mrl
=
make_URI
(
args
[
n
],
NULL
);
* unnecessary lookups. */
char
*
mrl
=
make_URI
(
args
[
n
]
);
if
(
!
mrl
)
if
(
!
mrl
)
continue
;
continue
;
...
...
src/playlist/art.c
View file @
1644d683
...
@@ -178,7 +178,7 @@ int playlist_FindArtInCache( input_item_t *p_item )
...
@@ -178,7 +178,7 @@ int playlist_FindArtInCache( input_item_t *p_item )
if
(
asprintf
(
&
psz_file
,
"%s"
DIR_SEP
"%s"
,
if
(
asprintf
(
&
psz_file
,
"%s"
DIR_SEP
"%s"
,
psz_path
,
psz_filename
)
!=
-
1
)
psz_path
,
psz_filename
)
!=
-
1
)
{
{
char
*
psz_uri
=
make_URI
(
psz_file
);
char
*
psz_uri
=
make_URI
(
psz_file
,
"file"
);
if
(
psz_uri
)
if
(
psz_uri
)
{
{
input_item_SetArtURL
(
p_item
,
psz_uri
);
input_item_SetArtURL
(
p_item
,
psz_uri
);
...
@@ -208,7 +208,7 @@ int playlist_SaveArt( playlist_t *p_playlist, input_item_t *p_item,
...
@@ -208,7 +208,7 @@ int playlist_SaveArt( playlist_t *p_playlist, input_item_t *p_item,
if
(
!
psz_filename
)
if
(
!
psz_filename
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
char
*
psz_uri
=
make_URI
(
psz_filename
);
char
*
psz_uri
=
make_URI
(
psz_filename
,
"file"
);
if
(
!
psz_uri
)
if
(
!
psz_uri
)
{
{
free
(
psz_filename
);
free
(
psz_filename
);
...
...
src/playlist/loadsave.c
View file @
1644d683
...
@@ -86,7 +86,7 @@ int playlist_Import( playlist_t *p_playlist, const char *psz_file )
...
@@ -86,7 +86,7 @@ int playlist_Import( playlist_t *p_playlist, const char *psz_file )
{
{
input_item_t
*
p_input
;
input_item_t
*
p_input
;
const
char
*
const
psz_option
=
"meta-file"
;
const
char
*
const
psz_option
=
"meta-file"
;
char
*
psz_uri
=
make_URI
(
psz_file
);
char
*
psz_uri
=
make_URI
(
psz_file
,
NULL
);
if
(
psz_uri
==
NULL
)
if
(
psz_uri
==
NULL
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -118,41 +118,31 @@ static void input_item_subitem_tree_added( const vlc_event_t * p_event,
...
@@ -118,41 +118,31 @@ static void input_item_subitem_tree_added( const vlc_event_t * p_event,
int
playlist_MLLoad
(
playlist_t
*
p_playlist
)
int
playlist_MLLoad
(
playlist_t
*
p_playlist
)
{
{
char
*
psz_datadir
;
char
*
psz_uri
=
NULL
;
input_item_t
*
p_input
;
input_item_t
*
p_input
;
psz_datadir
=
config_GetUserDir
(
VLC_DATA_DIR
);
char
*
psz_datadir
=
config_GetUserDir
(
VLC_DATA_DIR
);
if
(
!
psz_datadir
)
/* XXX: This should never happen */
if
(
!
psz_datadir
)
/* XXX: This should never happen */
{
{
msg_Err
(
p_playlist
,
"no data directory, cannot load media library"
)
;
msg_Err
(
p_playlist
,
"no data directory, cannot load media library"
)
;
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
if
(
asprintf
(
&
psz_uri
,
"%s"
DIR_SEP
"ml.xspf"
,
psz_datadir
)
!=
-
1
)
char
*
psz_file
;
{
/* loosy check for media library file */
if
(
asprintf
(
&
psz_file
,
"%s"
DIR_SEP
"ml.xspf"
,
psz_datadir
)
!=
-
1
)
struct
stat
st
;
psz_file
=
NULL
;
int
ret
=
vlc_stat
(
psz_uri
,
&
st
);
free
(
psz_uri
);
if
(
ret
)
{
free
(
psz_datadir
);
return
VLC_EGENERIC
;
}
}
psz_uri
=
make_URI
(
psz_datadir
);
free
(
psz_datadir
);
free
(
psz_datadir
);
psz_datadir
=
psz_uri
;
if
(
psz_file
==
NULL
)
if
(
psz_datadir
==
NULL
)
return
VLC_ENOMEM
;
/* loosy check for media library file */
struct
stat
st
;
int
ret
=
vlc_stat
(
psz_file
,
&
st
);
free
(
psz_file
);
if
(
ret
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
/* Force XSPF demux (psz_datadir was a path, now it is a file URI) */
char
*
psz_uri
=
make_URI
(
psz_file
,
"file/xspf-open"
);
if
(
asprintf
(
&
psz_uri
,
"file/xspf-open%s/ml.xspf"
,
psz_datadir
+
4
)
==
-
1
)
free
(
psz_file
);
psz_uri
=
NULL
;
free
(
psz_datadir
);
psz_datadir
=
NULL
;
if
(
psz_uri
==
NULL
)
if
(
psz_uri
==
NULL
)
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
...
...
src/test/url.c
View file @
1644d683
...
@@ -68,9 +68,14 @@ static inline void test_b64 (const char *in, const char *out)
...
@@ -68,9 +68,14 @@ static inline void test_b64 (const char *in, const char *out)
test
(
vlc_b64_encode
,
in
,
out
);
test
(
vlc_b64_encode
,
in
,
out
);
}
}
static
char
*
make_URI_def
(
const
char
*
in
)
{
return
make_URI
(
in
,
NULL
);
}
static
inline
void
test_path
(
const
char
*
in
,
const
char
*
out
)
static
inline
void
test_path
(
const
char
*
in
,
const
char
*
out
)
{
{
test
(
make_URI
,
in
,
out
);
test
(
make_URI
_def
,
in
,
out
);
}
}
static
inline
void
test_current_directory_path
(
const
char
*
in
,
const
char
*
cwd
,
const
char
*
out
)
static
inline
void
test_current_directory_path
(
const
char
*
in
,
const
char
*
cwd
,
const
char
*
out
)
...
@@ -79,7 +84,7 @@ static inline void test_current_directory_path (const char *in, const char *cwd,
...
@@ -79,7 +84,7 @@ static inline void test_current_directory_path (const char *in, const char *cwd,
int
val
=
asprintf
(
&
expected_result
,
"file://%s/%s"
,
cwd
,
out
);
int
val
=
asprintf
(
&
expected_result
,
"file://%s/%s"
,
cwd
,
out
);
assert
(
val
!=
-
1
);
assert
(
val
!=
-
1
);
test
(
make_URI
,
in
,
expected_result
);
test
(
make_URI
_def
,
in
,
expected_result
);
}
}
int
main
(
void
)
int
main
(
void
)
...
...
src/text/strings.c
View file @
1644d683
...
@@ -1034,15 +1034,16 @@ void path_sanitize( char *str )
...
@@ -1034,15 +1034,16 @@ void path_sanitize( char *str )
/**
/**
* Convert a file path to an URI.
* Convert a file path to an URI.
* If already an URI, return a copy of the string.
* If already an URI, return a copy of the string.
* @path path path to convert (or URI to copy)
* @param path path to convert (or URI to copy)
* @param scheme URI scheme to use (default is auto: "file", "fd" or "smb")
* @return a nul-terminated URI string (use free() to release it),
* @return a nul-terminated URI string (use free() to release it),
* or NULL in case of error
* or NULL in case of error
*/
*/
char
*
make_URI
(
const
char
*
path
)
char
*
make_URI
(
const
char
*
path
,
const
char
*
scheme
)
{
{
if
(
path
==
NULL
)
if
(
path
==
NULL
)
return
NULL
;
return
NULL
;
if
(
!
strcmp
(
path
,
"-"
))
if
(
scheme
==
NULL
&&
!
strcmp
(
path
,
"-"
))
return
strdup
(
"fd://0"
);
// standard input
return
strdup
(
"fd://0"
);
// standard input
if
(
strstr
(
path
,
"://"
)
!=
NULL
)
if
(
strstr
(
path
,
"://"
)
!=
NULL
)
return
strdup
(
path
);
/* Already an URI */
return
strdup
(
path
);
/* Already an URI */
...
@@ -1053,7 +1054,7 @@ char *make_URI (const char *path)
...
@@ -1053,7 +1054,7 @@ char *make_URI (const char *path)
#ifdef WIN32
#ifdef WIN32
if
(
isalpha
(
path
[
0
])
&&
(
path
[
1
]
==
':'
))
if
(
isalpha
(
path
[
0
])
&&
(
path
[
1
]
==
':'
))
{
{
if
(
asprintf
(
&
buf
,
"
file:///%c:"
,
path
[
0
])
==
-
1
)
if
(
asprintf
(
&
buf
,
"
%s:///%c:"
,
scheme
,
path
[
0
])
==
-
1
)
buf
=
NULL
;
buf
=
NULL
;
path
+=
2
;
path
+=
2
;
}
}
...
@@ -1062,6 +1063,9 @@ char *make_URI (const char *path)
...
@@ -1062,6 +1063,9 @@ char *make_URI (const char *path)
if
(
!
strncmp
(
path
,
"
\\\\
"
,
2
))
if
(
!
strncmp
(
path
,
"
\\\\
"
,
2
))
{
/* Windows UNC paths */
{
/* Windows UNC paths */
#ifndef WIN32
#ifndef WIN32
if
(
scheme
!=
NULL
)
return
NULL
;
/* remote files not supported */
/* \\host\share\path -> smb://host/share/path */
/* \\host\share\path -> smb://host/share/path */
if
(
strchr
(
path
+
2
,
'\\'
)
!=
NULL
)
if
(
strchr
(
path
+
2
,
'\\'
)
!=
NULL
)
{
/* Convert backslashes to slashes */
{
/* Convert backslashes to slashes */
...
@@ -1072,7 +1076,7 @@ char *make_URI (const char *path)
...
@@ -1072,7 +1076,7 @@ char *make_URI (const char *path)
if
(
dup
[
i
]
==
'\\'
)
if
(
dup
[
i
]
==
'\\'
)
dup
[
i
]
=
DIR_SEP_CHAR
;
dup
[
i
]
=
DIR_SEP_CHAR
;
char
*
ret
=
make_URI
(
dup
);
char
*
ret
=
make_URI
(
dup
,
scheme
);
free
(
dup
);
free
(
dup
);
return
ret
;
return
ret
;
}
}
...
@@ -1098,12 +1102,13 @@ char *make_URI (const char *path)
...
@@ -1098,12 +1102,13 @@ char *make_URI (const char *path)
return
NULL
;
return
NULL
;
if
(
asprintf
(
&
buf
,
"%s/%s"
,
cwd
,
path
)
==
-
1
)
if
(
asprintf
(
&
buf
,
"%s/%s"
,
cwd
,
path
)
==
-
1
)
return
NULL
;
return
NULL
;
char
*
ret
=
make_URI
(
buf
);
char
*
ret
=
make_URI
(
buf
,
scheme
);
free
(
buf
);
free
(
buf
);
return
ret
;
return
ret
;
}
}
else
else
buf
=
strdup
(
"file://"
);
if
(
asprintf
(
&
buf
,
"%s://"
,
scheme
?
scheme
:
"file"
)
==
-
1
)
buf
=
NULL
;
if
(
buf
==
NULL
)
if
(
buf
==
NULL
)
return
NULL
;
return
NULL
;
...
...
src/win32/specific.c
View file @
1644d683
...
@@ -350,7 +350,7 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
...
@@ -350,7 +350,7 @@ LRESULT CALLBACK WMCOPYWNDPROC( HWND hwnd, UINT uMsg, WPARAM wParam,
i_options
++
;
i_options
++
;
}
}
char
*
psz_URI
=
make_URI
(
ppsz_argv
[
i_opt
]
);
char
*
psz_URI
=
make_URI
(
ppsz_argv
[
i_opt
]
,
NULL
);
playlist_AddExt
(
p_playlist
,
psz_URI
,
playlist_AddExt
(
p_playlist
,
psz_URI
,
NULL
,
PLAYLIST_APPEND
|
NULL
,
PLAYLIST_APPEND
|
(
(
i_opt
||
p_data
->
enqueue
)
?
0
:
PLAYLIST_GO
),
(
(
i_opt
||
p_data
->
enqueue
)
?
0
:
PLAYLIST_GO
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment