-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
command: make playlist writable #14990
base: master
Are you sure you want to change the base?
Conversation
Can av_dict be used instead of adding khash? |
av_dict is O(n) and uses string comparison. |
#endif | ||
#ifndef kfree | ||
#define kfree(P) free(P) | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bundling khash seems hefty. Either way this should be defined to use talloc_
as everything else in mpv.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not sure if we should include whole khash implementation just for a single property use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The obvious advantage of playlist_entry_id
over index is that it's unique so if parallel modifications happen it will not mess up the playlist. Users could be thankful for the extra safety and khash basically requires no maintenance on the developer's end.
However (AFAIK) no other mpv API supports this kind of ID addressing so even though it sounds great, maybe it's useless to be too smart here.
The only thing I'm not sure about whether a simple set_property("playlist", get_property("playlist"))
should work. If ID lookup gets removed users have to manually hack an index for each entry (that may or may not be an issue since they already transform the playlist by some code).
An attempt to improve #14939. It enhances the playlist property by making it writable: it allows reordering, removing and loading new playlist entries in one go. Thanks na-na-hi for the idea.
Compared to my previous approach it adds much more code but I hope the added functionality justifies it (though most of it is just copy-pasted hash map implementation).
I couldn't find too much prior work on tests so I came up with a custom script. Not sure whether this was the correct way to do it.