Skip to content
Snippets Groups Projects
Commit ac41d462 authored by Pierre Lamot's avatar Pierre Lamot Committed by Jean-Baptiste Kempf
Browse files

media_tree: send notification when preparse is complete


Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent df3ca174
No related branches found
No related tags found
No related merge requests found
......@@ -111,6 +111,19 @@ struct vlc_media_tree_callbacks
(*on_children_removed)(vlc_media_tree_t *tree, input_item_node_t *node,
input_item_node_t *const children[], size_t count,
void *userdata);
/**
* Called when the preparsing of a node is complete
*
* \param tree the media tree
* \param node the node being parsed
* \param status the reason for the preparsing termination
* \param userdata userdata provided to AddListener()
*/
void
(*on_preparse_end)(vlc_media_tree_t *tree, input_item_node_t * node,
enum input_item_preparse_status status,
void *userdata);
};
/**
......
......@@ -168,6 +168,27 @@ media_subtree_changed(input_item_t *media, input_item_node_t *node,
vlc_media_tree_Unlock(tree);
}
static void
media_subtree_preparse_ended(input_item_t *media,
enum input_item_preparse_status status,
void *user_data)
{
vlc_media_tree_t *tree = user_data;
vlc_media_tree_Lock(tree);
input_item_node_t *subtree_root;
/* TODO retrieve the node without traversing the tree */
bool found = vlc_media_tree_FindNodeByMedia(&tree->root, media,
&subtree_root, NULL);
if (!found) {
/* the node probably failed to be allocated */
vlc_media_tree_Unlock(tree);
return;
}
vlc_media_tree_Notify(tree, on_preparse_end, subtree_root, status);
vlc_media_tree_Unlock(tree);
}
static inline void
vlc_media_tree_DestroyRootNode(vlc_media_tree_t *tree)
{
......@@ -316,6 +337,7 @@ vlc_media_tree_Remove(vlc_media_tree_t *tree, input_item_t *media)
static const input_preparser_callbacks_t input_preparser_callbacks = {
.on_subtree_added = media_subtree_changed,
.on_preparse_ended = media_subtree_preparse_ended
};
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment