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
da2c15ae
Commit
da2c15ae
authored
Jul 04, 2011
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xspf.c: reorder, remove static declarations
parent
eb97b24d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
58 deletions
+57
-58
modules/misc/playlist/xspf.c
modules/misc/playlist/xspf.c
+57
-58
No files found.
modules/misc/playlist/xspf.c
View file @
da2c15ae
...
...
@@ -38,66 +38,8 @@
#include <assert.h>
static
void
xspf_export_item
(
playlist_item_t
*
,
FILE
*
,
int
*
);
static
void
xspf_extension_item
(
playlist_item_t
*
,
FILE
*
,
int
*
);
int
xspf_export_playlist
(
vlc_object_t
*
p_this
);
/**
* \brief Prints the XSPF header to file, writes each item by xspf_export_item()
* and closes the open xml elements
* \param p_this the VLC playlist object
* \return VLC_SUCCESS if some memory is available, otherwise VLC_ENONMEM
*/
int
xspf_export_playlist
(
vlc_object_t
*
p_this
)
{
const
playlist_export_t
*
p_export
=
(
playlist_export_t
*
)
p_this
;
int
i
,
i_count
;
char
*
psz_temp
;
playlist_item_t
*
p_node
=
p_export
->
p_root
;
/* write XSPF XML header */
fprintf
(
p_export
->
p_file
,
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>
\n
"
);
fprintf
(
p_export
->
p_file
,
"<playlist version=
\"
1
\"
xmlns=
\"
http://xspf.org/ns/0/
\"
"
\
"xmlns:vlc=
\"
http://www.videolan.org/vlc/playlist/ns/0/
\"
>
\n
"
);
if
(
!
p_node
)
return
VLC_SUCCESS
;
/* save name of the playlist node */
psz_temp
=
convert_xml_special_chars
(
p_node
->
p_input
->
psz_name
);
if
(
*
psz_temp
)
{
fprintf
(
p_export
->
p_file
,
"
\t
<title>%s</title>
\n
"
,
psz_temp
);
}
free
(
psz_temp
);
/* export all items in a flat format */
fprintf
(
p_export
->
p_file
,
"
\t
<trackList>
\n
"
);
i_count
=
0
;
for
(
i
=
0
;
i
<
p_node
->
i_children
;
i
++
)
{
xspf_export_item
(
p_node
->
pp_children
[
i
],
p_export
->
p_file
,
&
i_count
);
}
fprintf
(
p_export
->
p_file
,
"
\t
</trackList>
\n
"
);
/* export the tree structure in <extension> */
fprintf
(
p_export
->
p_file
,
"
\t
<extension application=
\"
"
\
"http://www.videolan.org/vlc/playlist/0
\"
>
\n
"
);
i_count
=
0
;
for
(
i
=
0
;
i
<
p_node
->
i_children
;
i
++
)
{
xspf_extension_item
(
p_node
->
pp_children
[
i
],
p_export
->
p_file
,
&
i_count
);
}
fprintf
(
p_export
->
p_file
,
"
\t
</extension>
\n
"
);
/* close the header elements */
fprintf
(
p_export
->
p_file
,
"</playlist>
\n
"
);
return
VLC_SUCCESS
;
}
static
char
*
input_xml
(
input_item_t
*
p_item
,
char
*
(
*
func
)(
input_item_t
*
)
)
{
char
*
tmp
=
func
(
p_item
);
...
...
@@ -263,3 +205,60 @@ static void xspf_extension_item( playlist_item_t *p_item, FILE *p_file,
return
;
}
/**
* \brief Prints the XSPF header to file, writes each item by xspf_export_item()
* and closes the open xml elements
* \param p_this the VLC playlist object
* \return VLC_SUCCESS if some memory is available, otherwise VLC_ENONMEM
*/
int
xspf_export_playlist
(
vlc_object_t
*
p_this
)
{
const
playlist_export_t
*
p_export
=
(
playlist_export_t
*
)
p_this
;
int
i
,
i_count
;
char
*
psz_temp
;
playlist_item_t
*
p_node
=
p_export
->
p_root
;
/* write XSPF XML header */
fprintf
(
p_export
->
p_file
,
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>
\n
"
);
fprintf
(
p_export
->
p_file
,
"<playlist xmlns=
\"
http://xspf.org/ns/0/
\"
"
\
"xmlns:vlc=
\"
http://www.videolan.org/vlc/playlist/ns/0/
\"
> "
\
"version=
\"
1
\"\n
"
);
if
(
!
p_node
)
return
VLC_SUCCESS
;
/* save name of the playlist node */
psz_temp
=
convert_xml_special_chars
(
p_node
->
p_input
->
psz_name
);
if
(
*
psz_temp
)
{
fprintf
(
p_export
->
p_file
,
"
\t
<title>%s</title>
\n
"
,
psz_temp
);
}
free
(
psz_temp
);
/* export all items in a flat format */
fprintf
(
p_export
->
p_file
,
"
\t
<trackList>
\n
"
);
i_count
=
0
;
for
(
i
=
0
;
i
<
p_node
->
i_children
;
i
++
)
{
xspf_export_item
(
p_node
->
pp_children
[
i
],
p_export
->
p_file
,
&
i_count
);
}
fprintf
(
p_export
->
p_file
,
"
\t
</trackList>
\n
"
);
/* export the tree structure in <extension> */
fprintf
(
p_export
->
p_file
,
"
\t
<extension application=
\"
"
\
"http://www.videolan.org/vlc/playlist/0
\"
>
\n
"
);
i_count
=
0
;
for
(
i
=
0
;
i
<
p_node
->
i_children
;
i
++
)
{
xspf_extension_item
(
p_node
->
pp_children
[
i
],
p_export
->
p_file
,
&
i_count
);
}
fprintf
(
p_export
->
p_file
,
"
\t
</extension>
\n
"
);
/* close the header elements */
fprintf
(
p_export
->
p_file
,
"</playlist>
\n
"
);
return
VLC_SUCCESS
;
}
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