vlc | branch: master | Rafaël Carré <[email protected]> | Mon Jul 4 01:18:05 2011 -0400| [da2c15aed3eed6939eda8fad82056a40367fbfed] | committer: Rafaël Carré
xspf.c: reorder, remove static declarations > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=da2c15aed3eed6939eda8fad82056a40367fbfed --- modules/misc/playlist/xspf.c | 115 +++++++++++++++++++++--------------------- 1 files changed, 57 insertions(+), 58 deletions(-) diff --git a/modules/misc/playlist/xspf.c b/modules/misc/playlist/xspf.c index 4f9ff9d..d6aab12 100644 --- a/modules/misc/playlist/xspf.c +++ b/modules/misc/playlist/xspf.c @@ -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; +} _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
