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

Revert "directory: Add XSPF node-extension support to our directory module."

This reverts commit 8f7056b5.
This broke the XML parser (fixes #2500).

Conflicts:

	modules/access/directory.c
parent 45d4420f
...@@ -125,8 +125,6 @@ struct access_sys_t ...@@ -125,8 +125,6 @@ struct access_sys_t
DIR *handle; DIR *handle;
char *ignored_exts; char *ignored_exts;
int mode; int mode;
int i_item_count;
char *psz_xspf_extension;
}; };
static block_t *Block( access_t * ); static block_t *Block( access_t * );
...@@ -173,8 +171,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -173,8 +171,6 @@ static int Open( vlc_object_t *p_this )
p_sys->current = NULL; p_sys->current = NULL;
p_sys->handle = handle; p_sys->handle = handle;
p_sys->ignored_exts = var_CreateGetString (p_access, "ignore-filetypes"); p_sys->ignored_exts = var_CreateGetString (p_access, "ignore-filetypes");
p_sys->i_item_count = 0;
p_sys->psz_xspf_extension = strdup( "" );
/* Handle mode */ /* Handle mode */
char *psz = var_CreateGetString( p_access, "recursive" ); char *psz = var_CreateGetString( p_access, "recursive" );
...@@ -215,7 +211,6 @@ static void Close( vlc_object_t * p_this ) ...@@ -215,7 +211,6 @@ static void Close( vlc_object_t * p_this )
} }
if (p_sys->handle != NULL) if (p_sys->handle != NULL)
closedir (p_sys->handle); /* corner case,:Block() not called ever */ closedir (p_sys->handle); /* corner case,:Block() not called ever */
free (p_sys->psz_xspf_extension);
free (p_sys->ignored_exts); free (p_sys->ignored_exts);
free (p_sys); free (p_sys);
} }
...@@ -269,7 +264,7 @@ static block_t *Block (access_t *p_access) ...@@ -269,7 +264,7 @@ static block_t *Block (access_t *p_access)
{ /* Startup: send the XSPF header */ { /* Startup: send the XSPF header */
static const char header[] = static const char header[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\" xmlns:vlc=\"http://www.videolan.org/vlc/playlist/ns/0/\">\n" "<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\">\n"
" <trackList>\n"; " <trackList>\n";
block_t *block = block_Alloc (sizeof (header) - 1); block_t *block = block_Alloc (sizeof (header) - 1);
if (!block) if (!block)
...@@ -310,36 +305,17 @@ static block_t *Block (access_t *p_access) ...@@ -310,36 +305,17 @@ static block_t *Block (access_t *p_access)
if (p_sys->current == NULL) if (p_sys->current == NULL)
{ /* End of XSPF playlist */ { /* End of XSPF playlist */
char *footer; static const char footer[] =
int len = asprintf( &footer, " </trackList>\n" \ " </trackList>\n"
" <extension application=\"http://www.videolan.org/vlc/playlist/0\">\n" \ "</playlist>\n";
"%s" \
" </extension>\n" \
"</playlist>\n", p_sys->psz_xspf_extension );
if( len < 0 )
goto fatal;
block_t *block = block_Alloc ( len ); block_t *block = block_Alloc (sizeof (footer) - 1);
if (!block) if (!block)
goto fatal; goto fatal;
memcpy (block->p_buffer, footer, len); memcpy (block->p_buffer, footer, sizeof (footer) - 1);
free( footer );
p_access->info.b_eof = true; p_access->info.b_eof = true;
return block; return block;
} }
else
{
/* This was the end of a "subnode" */
/* Write the ID to the extension */
char *old_xspf_extension = p_sys->psz_xspf_extension;
if (old_xspf_extension == NULL)
goto fatal;
int len2 = asprintf( &p_sys->psz_xspf_extension, "%s </vlc:node>\n", old_xspf_extension );
if (len2 == -1)
goto fatal;
free( old_xspf_extension );
}
return NULL; return NULL;
} }
...@@ -377,17 +353,6 @@ static block_t *Block (access_t *p_access) ...@@ -377,17 +353,6 @@ static block_t *Block (access_t *p_access)
return NULL; return NULL;
} }
p_sys->current = sub; p_sys->current = sub;
/* Add node to xspf extension */
char *old_xspf_extension = p_sys->psz_xspf_extension;
if (old_xspf_extension == NULL)
goto fatal;
int len2 = asprintf( &p_sys->psz_xspf_extension, "%s <vlc:node title=\"%s\">\n", old_xspf_extension, entry );
if (len2 == -1)
goto fatal;
free( old_xspf_extension );
return NULL; return NULL;
} }
else else
...@@ -423,27 +388,12 @@ static block_t *Block (access_t *p_access) ...@@ -423,27 +388,12 @@ static block_t *Block (access_t *p_access)
if (encoded == NULL) if (encoded == NULL)
goto fatal; goto fatal;
int len = asprintf (&entry, int len = asprintf (&entry,
" <track><location>file://%s/%s</location>\n" \ " <track><location>file://%s/%s</location></track>\n",
" <extension application=\"http://www.videolan.org/vlc/playlist/0\">\n" \ current->uri, encoded);
" <vlc:id>%d</vlc:id>\n" \
" </extension>\n" \
" </track>\n",
current->uri, encoded, p_sys->i_item_count++);
free (encoded); free (encoded);
if (len == -1) if (len == -1)
goto fatal; goto fatal;
/* Write the ID to the extension */
char *old_xspf_extension = p_sys->psz_xspf_extension;
if (old_xspf_extension == NULL)
goto fatal;
int len2 = asprintf( &p_sys->psz_xspf_extension, "%s <vlc:item tid=\"%i\" />\n",
old_xspf_extension, p_sys->i_item_count-1 );
if (len2 == -1)
goto fatal;
free( old_xspf_extension );
/* TODO: new block allocator for malloc()ated data */ /* TODO: new block allocator for malloc()ated data */
block_t *block = block_Alloc (len); block_t *block = block_Alloc (len);
if (!block) if (!block)
......
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