Commit 77207fe1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

playlist: rationalize playlist_Export() prototype

Passing a playlist item parameter to a locked playlist function cannot
make sense. This replaces the parameter with a boolean to select the
playlist or media lirary - like playlist_AddInput().

The prototype bug was introduced ed0b72e3 before the playlist tree
locking was defined/implemented, and somehow did not get corrected
until now.
parent ffaa3171
......@@ -299,13 +299,13 @@ VLC_API int playlist_Status( playlist_t * );
/**
* Export a node of the playlist to a certain type of playlistfile
* \param p_playlist the playlist to export
* \param b_playlist true for the playlist, false for the media library
* \param psz_filename the location where the exported file will be saved
* \param p_export_root the root node to export
* \param psz_type the type of playlist file to create (m3u, pls, ..)
* \return VLC_SUCCESS on success
*/
VLC_API int playlist_Export( playlist_t *p_playlist, const char *psz_name, playlist_item_t *p_export_root, const char *psz_type );
VLC_API int playlist_Export( playlist_t *p_playlist, const char *psz_name,
bool b_playlist, const char *psz_type );
/**
* Open a playlist file, add its content to the current playlist
......
......@@ -1133,7 +1133,7 @@
playlist_Export(p_playlist,
[actualFilename fileSystemRepresentation],
p_playlist->p_playing, "export-m3u");
true, "export-m3u");
} else if ([_playlistSaveAccessoryPopup indexOfSelectedItem] == 1) {
NSString *actualFilename;
NSRange range;
......@@ -1147,7 +1147,7 @@
playlist_Export(p_playlist,
[actualFilename fileSystemRepresentation],
p_playlist->p_playing, "export-xspf");
true, "export-xspf");
} else {
NSString *actualFilename;
NSRange range;
......@@ -1161,7 +1161,7 @@
playlist_Export(p_playlist,
[actualFilename fileSystemRepresentation],
p_playlist->p_playing, "export-html");
true, "export-html");
}
}
}
......
......@@ -660,7 +660,7 @@ void DialogsProvider::saveAPlaylist(playlist_t *p_playlist, playlist_item_t *p_n
if ( psz_selected_module )
{
playlist_Export( p_playlist, qtu( toNativeSeparators( file ) ),
p_node, psz_selected_module );
true, psz_selected_module );
getSettings()->setValue( "last-playlist-ext", psz_last_playlist_ext );
}
}
......
......@@ -98,8 +98,7 @@ void CmdPlaylistSave::execute()
return;
}
playlist_Export( pPlaylist, m_file.c_str(),
pPlaylist->p_playing, psz_module );
playlist_Export( pPlaylist, m_file.c_str(), true, psz_module );
}
}
......
......@@ -39,22 +39,19 @@
#include <vlc_modules.h>
int playlist_Export( playlist_t * p_playlist, const char *psz_filename,
playlist_item_t *p_export_root, const char *psz_type )
bool b_playlist, const char *psz_type )
{
if( p_export_root == NULL ) return VLC_EGENERIC;
playlist_export_t *p_export =
vlc_custom_create( p_playlist, sizeof( *p_export ), "playlist export" );
if( unlikely(p_export == NULL) )
return VLC_ENOMEM;
msg_Dbg( p_export, "saving %s to file %s",
p_export_root->p_input->psz_name, psz_filename );
b_playlist ? "playlist" : "media library", psz_filename );
int ret = VLC_EGENERIC;
/* Prepare the playlist_export_t structure */
p_export->p_root = p_export_root;
p_export->psz_filename = psz_filename;
p_export->p_file = vlc_fopen( psz_filename, "wt" );
if( p_export->p_file == NULL )
......@@ -68,6 +65,9 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename,
/* And call the module ! All work is done now */
playlist_Lock( p_playlist );
p_export->p_root = b_playlist ? p_playlist->p_playing
: p_playlist->p_media_library;
p_module = module_need( p_export, "playlist export", psz_type, true );
playlist_Unlock( p_playlist );
......@@ -209,8 +209,7 @@ int playlist_MLDump( playlist_t *p_playlist )
if ( asprintf( &psz_temp, "%s.tmp%"PRIu32, psz_dirname, (uint32_t)getpid() ) < 1 )
return VLC_EGENERIC;
int i_ret = playlist_Export( p_playlist, psz_temp, p_playlist->p_media_library,
"export-xspf" );
int i_ret = playlist_Export( p_playlist, psz_temp, false, "export-xspf" );
if ( i_ret != VLC_SUCCESS )
{
vlc_unlink( psz_temp );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment