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

M3U export: small code factorization

parent bf472b10
...@@ -50,10 +50,11 @@ int Export_M3U8( vlc_object_t * ); ...@@ -50,10 +50,11 @@ int Export_M3U8( vlc_object_t * );
static void DoChildren( playlist_export_t *p_export, playlist_item_t *p_root, static void DoChildren( playlist_export_t *p_export, playlist_item_t *p_root,
int (*pf_fprintf) (FILE *, const char *, ...) ) int (*pf_fprintf) (FILE *, const char *, ...) )
{ {
int i, j; /* Write header */
fputs( "#EXTM3U\n", p_export->p_file );
/* Go through the playlist and add items */ /* Go through the playlist and add items */
for( i = 0; i< p_root->i_children ; i++) for( int i = 0; i< p_root->i_children ; i++)
{ {
playlist_item_t *p_current = p_root->pp_children[i]; playlist_item_t *p_current = p_root->pp_children[i];
assert( p_current ); assert( p_current );
...@@ -97,7 +98,7 @@ static void DoChildren( playlist_export_t *p_export, playlist_item_t *p_root, ...@@ -97,7 +98,7 @@ static void DoChildren( playlist_export_t *p_export, playlist_item_t *p_root,
/* VLC specific options */ /* VLC specific options */
vlc_mutex_lock( &p_current->p_input->lock ); vlc_mutex_lock( &p_current->p_input->lock );
for( j = 0; j < p_current->p_input->i_options; j++ ) for( int j = 0; j < p_current->p_input->i_options; j++ )
{ {
pf_fprintf( p_export->p_file, "#EXTVLCOPT:%s\n", pf_fprintf( p_export->p_file, "#EXTVLCOPT:%s\n",
p_current->p_input->ppsz_options[j][0] == ':' ? p_current->p_input->ppsz_options[j][0] == ':' ?
...@@ -124,9 +125,6 @@ int Export_M3U( vlc_object_t *p_this ) ...@@ -124,9 +125,6 @@ int Export_M3U( vlc_object_t *p_this )
msg_Dbg( p_export, "saving using M3U format"); msg_Dbg( p_export, "saving using M3U format");
/* Write header */
fputs( "#EXTM3U\n", p_export->p_file );
DoChildren( p_export, p_export->p_root, utf8_fprintf ); DoChildren( p_export, p_export->p_root, utf8_fprintf );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -137,9 +135,6 @@ int Export_M3U8( vlc_object_t *p_this ) ...@@ -137,9 +135,6 @@ int Export_M3U8( vlc_object_t *p_this )
msg_Dbg( p_export, "saving using M3U8 format"); msg_Dbg( p_export, "saving using M3U8 format");
/* Write header */
fputs( "#EXTM3U\n", p_export->p_file );
DoChildren( p_export, p_export->p_root, fprintf ); DoChildren( p_export, p_export->p_root, fprintf );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
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