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

add xml_ReaderReset()

parent d4e41e64
......@@ -73,6 +73,7 @@ struct xml_reader_t
VLC_EXPORT( xml_reader_t *, xml_ReaderCreate, (vlc_object_t *, stream_t *) LIBVLC_USED );
#define xml_ReaderCreate( a, s ) xml_ReaderCreate(VLC_OBJECT(a), s)
VLC_EXPORT( void, xml_ReaderDelete, (xml_reader_t *) );
VLC_EXPORT( xml_reader_t *, xml_ReaderReset, (xml_reader_t *, stream_t *) LIBVLC_USED );
#define xml_ReaderRead( a ) a->pf_read( a )
#define xml_ReaderNodeType( a ) a->pf_node_type( a )
......
......@@ -673,5 +673,6 @@ text_style_New
xml_Delete
xml_ReaderCreate
xml_ReaderDelete
xml_ReaderReset
KeyToString
StringToKey
......@@ -101,3 +101,26 @@ void xml_ReaderDelete(xml_reader_t *reader)
module_unneed(reader, reader->p_module);
vlc_object_release(reader);
}
/**
* Resets an existing XML reader.
* If you need to parse several XML files, this function is much faster than
* xml_ReaderCreate() and xml_ReaderDelete() combined.
* @param reader XML reader to reinitialize
* @param stream new stream to read XML data from
* @return reader on success, NULL on error (in that case, the reader is
* destroyed).
*/
xml_reader_t *xml_ReaderReset(xml_reader_t *reader, stream_t *stream)
{
module_stop(reader, reader->p_module);
reader->p_stream = stream;
if (module_start(reader, reader->p_module))
{
vlc_object_release(reader);
return NULL;
}
return reader;
}
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