foobar2000 SDK  2015-08-03
playlist.h
Go to the documentation of this file.
1 class NOVTABLE playlist_lock : public service_base {
4 public:
5  enum {
6  filter_add = 1 << 0,
7  filter_remove = 1 << 1,
8  filter_reorder = 1 << 2,
9  filter_replace = 1 << 3,
10  filter_rename = 1 << 4,
11  filter_remove_playlist = 1 << 5,
12  filter_default_action = 1 << 6,
13  };
14 
20  virtual bool query_items_add(t_size p_base, const pfc::list_base_const_t<metadb_handle_ptr> & p_data,const bit_array & p_selection) = 0;
25  virtual bool query_items_reorder(const t_size * p_order,t_size p_count) = 0;
30  virtual bool query_items_remove(const bit_array & p_mask,bool p_force) = 0;
36  virtual bool query_item_replace(t_size p_index,const metadb_handle_ptr & p_old,const metadb_handle_ptr & p_new)=0;
41  virtual bool query_playlist_rename(const char * p_new_name,t_size p_new_name_len) = 0;
44  virtual bool query_playlist_remove() = 0;
47  virtual bool execute_default_action(t_size p_item) = 0;
49  virtual void on_playlist_index_change(t_size p_new_index) = 0;
51  virtual void on_playlist_remove() = 0;
53  virtual void get_lock_name(pfc::string_base & p_out) = 0;
55  virtual void show_ui() = 0;
57  virtual t_uint32 get_filter_mask() = 0;
58 
59  FB2K_MAKE_SERVICE_INTERFACE(playlist_lock,service_base);
60 };
61 
65 
66  bool operator==(const t_playback_queue_item & p_item) const;
67  bool operator!=(const t_playback_queue_item & p_item) const;
68 };
69 
70 
74 class NOVTABLE playlist_manager : public service_base
75 {
76 public:
77 
79  class NOVTABLE enum_items_callback {
80  public:
82  virtual bool on_item(t_size p_index,const metadb_handle_ptr & p_location,bool b_selected) = 0;//return false to stop
83  };
84 
86  virtual t_size get_playlist_count() = 0;
88  virtual t_size get_active_playlist() = 0;
90  virtual void set_active_playlist(t_size p_index) = 0;
92  virtual t_size get_playing_playlist() = 0;
94  virtual void set_playing_playlist(t_size p_index) = 0;
96  virtual bool remove_playlists(const bit_array & p_mask) = 0;
102  virtual t_size create_playlist(const char * p_name,t_size p_name_length,t_size p_index) = 0;
105  virtual bool reorder(const t_size * p_order,t_size p_count) = 0;
106 
107 
109  virtual t_size playlist_get_item_count(t_size p_playlist) = 0;
111  virtual void playlist_enum_items(t_size p_playlist,enum_items_callback & p_callback,const bit_array & p_mask) = 0;
113  virtual t_size playlist_get_focus_item(t_size p_playlist) = 0;
115  virtual bool playlist_get_name(t_size p_playlist,pfc::string_base & p_out) = 0;
116 
118  virtual bool playlist_reorder_items(t_size p_playlist,const t_size * p_order,t_size p_count) = 0;
123  virtual void playlist_set_selection(t_size p_playlist,const bit_array & p_affected,const bit_array & p_status) = 0;
125  virtual bool playlist_remove_items(t_size p_playlist,const bit_array & mask)=0;
127  virtual bool playlist_replace_item(t_size p_playlist,t_size p_item,const metadb_handle_ptr & p_new_item) = 0;
129  virtual void playlist_set_focus_item(t_size p_playlist,t_size p_item) = 0;
131  virtual t_size playlist_insert_items(t_size p_playlist,t_size p_base,const pfc::list_base_const_t<metadb_handle_ptr> & data,const bit_array & p_selection) = 0;
133  virtual void playlist_ensure_visible(t_size p_playlist,t_size p_item) = 0;
138  virtual bool playlist_rename(t_size p_index,const char * p_name,t_size p_name_length) = 0;
139 
140 
142  virtual void playlist_undo_backup(t_size p_playlist) = 0;
145  virtual bool playlist_undo_restore(t_size p_playlist) = 0;
148  virtual bool playlist_redo_restore(t_size p_playlist) = 0;
150  virtual bool playlist_is_undo_available(t_size p_playlist) = 0;
152  virtual bool playlist_is_redo_available(t_size p_playlist) = 0;
153 
162  virtual void playlist_item_format_title(t_size p_playlist,t_size p_item,titleformat_hook * p_hook,pfc::string_base & p_out,const service_ptr_t<titleformat_object> & p_script,titleformat_text_filter * p_filter,playback_control::t_display_level p_playback_info_level)=0;
163 
164 
169  virtual bool get_playing_item_location(t_size * p_playlist,t_size * p_index) = 0;
170 
176  virtual bool playlist_sort_by_format(t_size p_playlist,const char * p_pattern,bool p_sel_only) = 0;
177 
179  virtual void on_files_deleted_sorted(const pfc::list_base_const_t<const char *> & p_items) = 0;
181  virtual void on_files_moved_sorted(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to) = 0;
182 
183  virtual bool playlist_lock_install(t_size p_playlist,const service_ptr_t<playlist_lock> & p_lock) = 0;//returns false when invalid playlist or already locked
184  virtual bool playlist_lock_uninstall(t_size p_playlist,const service_ptr_t<playlist_lock> & p_lock) = 0;
185  virtual bool playlist_lock_is_present(t_size p_playlist) = 0;
186  virtual bool playlist_lock_query_name(t_size p_playlist,pfc::string_base & p_out) = 0;
187  virtual bool playlist_lock_show_ui(t_size p_playlist) = 0;
188  virtual t_uint32 playlist_lock_get_filter_mask(t_size p_playlist) = 0;
189 
190 
192  virtual t_size playback_order_get_count() = 0;
196  virtual const char * playback_order_get_name(t_size p_index) = 0;
199  virtual GUID playback_order_get_guid(t_size p_index) = 0;
201  virtual t_size playback_order_get_active() = 0;
203  virtual void playback_order_set_active(t_size p_index) = 0;
204 
205  virtual void queue_remove_mask(bit_array const & p_mask) = 0;
206  virtual void queue_add_item_playlist(t_size p_playlist,t_size p_item) = 0;
207  virtual void queue_add_item(metadb_handle_ptr p_item) = 0;
208  virtual t_size queue_get_count() = 0;
209  virtual void queue_get_contents(pfc::list_base_t<t_playback_queue_item> & p_out) = 0;
211  virtual t_size queue_find_index(t_playback_queue_item const & p_item) = 0;
212 
216  virtual void register_callback(class playlist_callback * p_callback,unsigned p_flags) = 0;
220  virtual void register_callback(class playlist_callback_single * p_callback,unsigned p_flags) = 0;
222  virtual void unregister_callback(class playlist_callback * p_callback) = 0;
224  virtual void unregister_callback(class playlist_callback_single * p_callback) = 0;
226  virtual void modify_callback(class playlist_callback * p_callback,unsigned p_flags) = 0;
228  virtual void modify_callback(class playlist_callback_single * p_callback,unsigned p_flags) = 0;
229 
231  virtual bool playlist_execute_default_action(t_size p_playlist,t_size p_item) = 0;
232 
233 
235  void queue_flush() {queue_remove_mask(bit_array_true());}
237  bool queue_is_active() {return queue_get_count() > 0;}
238 
240  bool highlight_playing_item();
242  bool remove_playlist(t_size p_playlist);
244  bool remove_playlist_switch(t_size p_playlist);
245 
247  bool playlist_is_item_selected(t_size p_playlist,t_size p_item);
249  bool playlist_get_item_handle(metadb_handle_ptr & p_out,t_size p_playlist,t_size p_item);
251  metadb_handle_ptr playlist_get_item_handle(t_size playlist, t_size item);
252 
257  bool playlist_move_selection(t_size p_playlist,int p_delta);
259  void playlist_get_selection_mask(t_size p_playlist,bit_array_var & out);
260  void playlist_get_items(t_size p_playlist,pfc::list_base_t<metadb_handle_ptr> & out,const bit_array & p_mask);
261  void playlist_get_all_items(t_size p_playlist,pfc::list_base_t<metadb_handle_ptr> & out);
262  void playlist_get_selected_items(t_size p_playlist,pfc::list_base_t<metadb_handle_ptr> & out);
263 
265  void playlist_clear(t_size p_playlist);
266  bool playlist_add_items(t_size playlist,const pfc::list_base_const_t<metadb_handle_ptr> & data,const bit_array & p_selection);
267  void playlist_clear_selection(t_size p_playlist);
268  void playlist_remove_selection(t_size p_playlist,bool p_crop = false);
269 
270 
273  bool playlist_update_content(t_size playlist, metadb_handle_list_cref content, bool bUndoBackup);
274 
275  //retrieving status
276  t_size activeplaylist_get_item_count();
277  void activeplaylist_enum_items(enum_items_callback & p_callback,const bit_array & p_mask);
278  t_size activeplaylist_get_focus_item();//focus may be infinite if no item is focused
279  bool activeplaylist_get_name(pfc::string_base & p_out);
280 
281  //modifying playlist
282  bool activeplaylist_reorder_items(const t_size * order,t_size count);
283  void activeplaylist_set_selection(const bit_array & affected,const bit_array & status);
284  bool activeplaylist_remove_items(const bit_array & mask);
285  bool activeplaylist_replace_item(t_size p_item,const metadb_handle_ptr & p_new_item);
286  void activeplaylist_set_focus_item(t_size p_item);
287  t_size activeplaylist_insert_items(t_size p_base,const pfc::list_base_const_t<metadb_handle_ptr> & data,const bit_array & p_selection);
288  void activeplaylist_ensure_visible(t_size p_item);
289  bool activeplaylist_rename(const char * p_name,t_size p_name_len);
290 
291  void activeplaylist_undo_backup();
292  bool activeplaylist_undo_restore();
293  bool activeplaylist_redo_restore();
294 
295  bool activeplaylist_is_item_selected(t_size p_item);
296  bool activeplaylist_get_item_handle(metadb_handle_ptr & item,t_size p_item);
297  metadb_handle_ptr activeplaylist_get_item_handle(t_size p_item);
298  void activeplaylist_move_selection(int p_delta);
299  void activeplaylist_get_selection_mask(bit_array_var & out);
300  void activeplaylist_get_items(pfc::list_base_t<metadb_handle_ptr> & out,const bit_array & p_mask);
301  void activeplaylist_get_all_items(pfc::list_base_t<metadb_handle_ptr> & out);
302  void activeplaylist_get_selected_items(pfc::list_base_t<metadb_handle_ptr> & out);
303  void activeplaylist_clear();
304 
305  bool activeplaylist_add_items(const pfc::list_base_const_t<metadb_handle_ptr> & data,const bit_array & p_selection);
306 
307  bool playlist_insert_items_filter(t_size p_playlist,t_size p_base,const pfc::list_base_const_t<metadb_handle_ptr> & p_data,bool p_select);
308  bool activeplaylist_insert_items_filter(t_size p_base,const pfc::list_base_const_t<metadb_handle_ptr> & p_data,bool p_select);
309 
311  bool playlist_insert_locations(t_size p_playlist,t_size p_base,const pfc::list_base_const_t<const char*> & p_urls,bool p_select,HWND p_parentwnd);
313  bool activeplaylist_insert_locations(t_size p_base,const pfc::list_base_const_t<const char*> & p_urls,bool p_select,HWND p_parentwnd);
314 
315  bool playlist_add_items_filter(t_size p_playlist,const pfc::list_base_const_t<metadb_handle_ptr> & p_data,bool p_select);
316  bool activeplaylist_add_items_filter(const pfc::list_base_const_t<metadb_handle_ptr> & p_data,bool p_select);
317 
318  bool playlist_add_locations(t_size p_playlist,const pfc::list_base_const_t<const char*> & p_urls,bool p_select,HWND p_parentwnd);
319  bool activeplaylist_add_locations(const pfc::list_base_const_t<const char*> & p_urls,bool p_select,HWND p_parentwnd);
320 
321  void reset_playing_playlist();
322 
323  void activeplaylist_clear_selection();
324  void activeplaylist_remove_selection(bool p_crop = false);
325 
326  void activeplaylist_item_format_title(t_size p_item,titleformat_hook * p_hook,pfc::string_base & out,const service_ptr_t<titleformat_object> & p_script,titleformat_text_filter * p_filter,play_control::t_display_level p_playback_info_level);
327 
328  void playlist_set_selection_single(t_size p_playlist,t_size p_item,bool p_state);
329  void activeplaylist_set_selection_single(t_size p_item,bool p_state);
330 
331  t_size playlist_get_selection_count(t_size p_playlist,t_size p_max);
332  t_size activeplaylist_get_selection_count(t_size p_max);
333 
334  bool playlist_get_focus_item_handle(metadb_handle_ptr & p_item,t_size p_playlist);
335  bool activeplaylist_get_focus_item_handle(metadb_handle_ptr & item);
336 
337  t_size find_playlist(const char * p_name,t_size p_name_length = ~0);
338  t_size find_or_create_playlist(const char * p_name,t_size p_name_length = ~0);
339  t_size find_or_create_playlist_unlocked(const char * p_name,t_size p_name_length = ~0);
340 
341  t_size create_playlist_autoname(t_size p_index = ~0);
342 
343  bool activeplaylist_sort_by_format(const char * spec,bool p_sel_only);
344 
345  t_uint32 activeplaylist_lock_get_filter_mask();
346  bool activeplaylist_is_undo_available();
347  bool activeplaylist_is_redo_available();
348 
349  bool activeplaylist_execute_default_action(t_size p_item);
350 
351  void remove_items_from_all_playlists(const pfc::list_base_const_t<metadb_handle_ptr> & p_data);
352 
353  void active_playlist_fix();
354 
355  bool get_all_items(pfc::list_base_t<metadb_handle_ptr> & out);
356 
357  void playlist_activate_delta(int p_delta);
358  void playlist_activate_next() {playlist_activate_delta(1);}
359  void playlist_activate_previous() {playlist_activate_delta(-1);}
360 
361 
362  t_size playlist_get_selected_count(t_size p_playlist,bit_array const & p_mask);
363  t_size activeplaylist_get_selected_count(bit_array const & p_mask) {return playlist_get_selected_count(get_active_playlist(),p_mask);}
364 
365  bool playlist_find_item(t_size p_playlist,metadb_handle_ptr p_item,t_size & p_result);//inefficient, walks entire playlist
366  bool playlist_find_item_selected(t_size p_playlist,metadb_handle_ptr p_item,t_size & p_result);//inefficient, walks entire playlist
367  t_size playlist_set_focus_by_handle(t_size p_playlist,metadb_handle_ptr p_item);
368  bool activeplaylist_find_item(metadb_handle_ptr p_item,t_size & p_result);//inefficient, walks entire playlist
369  t_size activeplaylist_set_focus_by_handle(metadb_handle_ptr p_item);
370 
371  static void g_make_selection_move_permutation(t_size * p_output,t_size p_count,const bit_array & p_selection,int p_delta);
372 
373  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playlist_manager);
374 };
375 
381 class NOVTABLE playlist_manager_v2 : public playlist_manager {
382 public:
388  virtual void playlist_set_property(t_size p_playlist,const GUID & p_property,stream_reader * p_stream,t_size p_size_hint,abort_callback & p_abort) = 0;
395  virtual bool playlist_get_property(t_size p_playlist,const GUID & p_property,stream_writer * p_stream,abort_callback & p_abort) = 0;
400  virtual bool playlist_have_property(t_size p_playlist,const GUID & p_property) = 0;
405  virtual bool playlist_remove_property(t_size p_playlist,const GUID & p_property) = 0;
406 
411  virtual void playlist_set_runtime_property(t_size p_playlist,const GUID & p_property,service_ptr_t<service_base> p_data) = 0;
417  virtual bool playlist_get_runtime_property(t_size p_playlist,const GUID & p_property,service_ptr_t<service_base> & p_data) = 0;
422  virtual bool playlist_have_runtime_property(t_size p_playlist,const GUID & p_property) = 0;
427  virtual bool playlist_remove_runtime_property(t_size p_playlist,const GUID & p_property) = 0;
428 
433  template<typename t_array> void playlist_set_property(t_size p_playlist,const GUID & p_property,const t_array & p_data) {
434  PFC_STATIC_ASSERT( sizeof(p_data[0]) == 1 );
435  playlist_set_property(p_playlist,p_property,&stream_reader_memblock_ref(p_data),p_data.get_size(),abort_callback_dummy());
436  }
442  template<typename t_array> bool playlist_get_property(t_size p_playlist,const GUID & p_property,t_array & p_data) {
443  PFC_STATIC_ASSERT( sizeof(p_data[0]) == 1 );
445  t_temp temp;
446  if (!playlist_get_property(p_playlist,p_property,&stream_writer_buffer_append_ref_t<t_temp>(temp),abort_callback_dummy())) return false;
447  p_data = temp;
448  return true;
449  }
455  template<typename _t_interface> bool playlist_get_runtime_property(t_size p_playlist,const GUID & p_property,service_ptr_t<_t_interface> & p_data) {
457  if (!playlist_get_runtime_property(p_playlist,p_property,ptr)) return false;
458  return ptr->service_query_t(p_data);
459  }
460 
465  template<typename _t_int>
466  void playlist_set_property_int(t_size p_playlist,const GUID & p_property,_t_int p_value) {
467  pfc::array_t<t_uint8> temp; temp.set_size(sizeof(_t_int));
468  pfc::encode_little_endian(temp.get_ptr(),p_value);
469  playlist_set_property(p_playlist,p_property,temp);
470  }
476  template<typename _t_int>
477  bool playlist_get_property_int(t_size p_playlist,const GUID & p_property,_t_int & p_value) {
479  if (!playlist_get_property(p_playlist,p_property,temp)) return false;
480  if (temp.get_size() != sizeof(_t_int)) return false;
481  pfc::decode_little_endian(p_value,temp.get_ptr());
482  return true;
483  }
484 
485  FB2K_MAKE_SERVICE_INTERFACE(playlist_manager_v2,playlist_manager)
486 };
487 
489 class NOVTABLE playlist_manager_v3 : public playlist_manager_v2 {
490  FB2K_MAKE_SERVICE_INTERFACE(playlist_manager_v3,playlist_manager_v2)
491 public:
492  virtual t_size recycler_get_count() = 0;
493  virtual void recycler_get_content(t_size which, metadb_handle_list_ref out) = 0;
494  virtual void recycler_get_name(t_size which, pfc::string_base & out) = 0;
495  virtual t_uint32 recycler_get_id(t_size which) = 0;
496  virtual void recycler_purge(const bit_array & mask) = 0;
497  virtual void recycler_restore(t_size which) = 0;
498 
499  void recycler_restore_by_id(t_uint32 id);
500  t_size recycler_find_by_id(t_uint32 id);
501 };
502 
504 class NOVTABLE playlist_manager_v4 : public playlist_manager_v3 {
505  FB2K_MAKE_SERVICE_INTERFACE(playlist_manager_v4, playlist_manager_v3)
506 public:
507  virtual void playlist_get_sideinfo(t_size which, stream_writer * stream, abort_callback & abort) = 0;
508  virtual t_size create_playlist_ex(const char * p_name,t_size p_name_length,t_size p_index, metadb_handle_list_cref content, stream_reader * sideInfo, abort_callback & abort) = 0;
509 };
510 
511 class NOVTABLE playlist_callback
512 {
513 public:
514  virtual void on_items_added(t_size p_playlist,t_size p_start, const pfc::list_base_const_t<metadb_handle_ptr> & p_data,const bit_array & p_selection)=0;//inside any of these methods, you can call playlist APIs to get exact info about what happened (but only methods that read playlist state, not those that modify it)
515  virtual void on_items_reordered(t_size p_playlist,const t_size * p_order,t_size p_count)=0;//changes selection too; doesnt actually change set of items that are selected or item having focus, just changes their order
516  virtual void on_items_removing(t_size p_playlist,const bit_array & p_mask,t_size p_old_count,t_size p_new_count)=0;//called before actually removing them
517  virtual void on_items_removed(t_size p_playlist,const bit_array & p_mask,t_size p_old_count,t_size p_new_count)=0;
518  virtual void on_items_selection_change(t_size p_playlist,const bit_array & p_affected,const bit_array & p_state) = 0;
519  virtual void on_item_focus_change(t_size p_playlist,t_size p_from,t_size p_to)=0;//focus may be -1 when no item has focus; reminder: focus may also change on other callbacks
520 
521  virtual void on_items_modified(t_size p_playlist,const bit_array & p_mask)=0;
522  virtual void on_items_modified_fromplayback(t_size p_playlist,const bit_array & p_mask,play_control::t_display_level p_level)=0;
523 
525  {
528  };
529 
530  virtual void on_items_replaced(t_size p_playlist,const bit_array & p_mask,const pfc::list_base_const_t<t_on_items_replaced_entry> & p_data)=0;
531 
532  virtual void on_item_ensure_visible(t_size p_playlist,t_size p_idx)=0;
533 
534  virtual void on_playlist_activate(t_size p_old,t_size p_new) = 0;
535  virtual void on_playlist_created(t_size p_index,const char * p_name,t_size p_name_len) = 0;
536  virtual void on_playlists_reorder(const t_size * p_order,t_size p_count) = 0;
537  virtual void on_playlists_removing(const bit_array & p_mask,t_size p_old_count,t_size p_new_count) = 0;
538  virtual void on_playlists_removed(const bit_array & p_mask,t_size p_old_count,t_size p_new_count) = 0;
539  virtual void on_playlist_renamed(t_size p_index,const char * p_new_name,t_size p_new_name_len) = 0;
540 
541  virtual void on_default_format_changed() = 0;
542  virtual void on_playback_order_changed(t_size p_new_index) = 0;
543  virtual void on_playlist_locked(t_size p_playlist,bool p_locked) = 0;
544 
545  enum {
546  flag_on_items_added = 1 << 0,
547  flag_on_items_reordered = 1 << 1,
548  flag_on_items_removing = 1 << 2,
549  flag_on_items_removed = 1 << 3,
550  flag_on_items_selection_change = 1 << 4,
551  flag_on_item_focus_change = 1 << 5,
552  flag_on_items_modified = 1 << 6,
553  flag_on_items_modified_fromplayback = 1 << 7,
554  flag_on_items_replaced = 1 << 8,
555  flag_on_item_ensure_visible = 1 << 9,
556  flag_on_playlist_activate = 1 << 10,
557  flag_on_playlist_created = 1 << 11,
558  flag_on_playlists_reorder = 1 << 12,
559  flag_on_playlists_removing = 1 << 13,
560  flag_on_playlists_removed = 1 << 14,
561  flag_on_playlist_renamed = 1 << 15,
562  flag_on_default_format_changed = 1 << 16,
563  flag_on_playback_order_changed = 1 << 17,
564  flag_on_playlist_locked = 1 << 18,
565 
566  flag_all = ~0,
567  flag_item_ops = flag_on_items_added | flag_on_items_reordered | flag_on_items_removing | flag_on_items_removed | flag_on_items_selection_change | flag_on_item_focus_change | flag_on_items_modified | flag_on_items_modified_fromplayback | flag_on_items_replaced | flag_on_item_ensure_visible,
568  flag_playlist_ops = flag_on_playlist_activate | flag_on_playlist_created | flag_on_playlists_reorder | flag_on_playlists_removing | flag_on_playlists_removed | flag_on_playlist_renamed | flag_on_playlist_locked,
569  };
570 protected:
573 };
574 
576 {
577 public:
578  virtual unsigned get_flags() = 0;
579 
580  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playlist_callback_static);
581 };
582 
584 {
585 public:
586  virtual void on_items_added(t_size p_base, const pfc::list_base_const_t<metadb_handle_ptr> & p_data,const bit_array & p_selection)=0;//inside any of these methods, you can call playlist APIs to get exact info about what happened (but only methods that read playlist state, not those that modify it)
587  virtual void on_items_reordered(const t_size * p_order,t_size p_count)=0;//changes selection too; doesnt actually change set of items that are selected or item having focus, just changes their order
588  virtual void on_items_removing(const bit_array & p_mask,t_size p_old_count,t_size p_new_count)=0;//called before actually removing them
589  virtual void on_items_removed(const bit_array & p_mask,t_size p_old_count,t_size p_new_count)=0;
590  virtual void on_items_selection_change(const bit_array & p_affected,const bit_array & p_state) = 0;
591  virtual void on_item_focus_change(t_size p_from,t_size p_to)=0;//focus may be -1 when no item has focus; reminder: focus may also change on other callbacks
592  virtual void on_items_modified(const bit_array & p_mask)=0;
593  virtual void on_items_modified_fromplayback(const bit_array & p_mask,play_control::t_display_level p_level)=0;
594  virtual void on_items_replaced(const bit_array & p_mask,const pfc::list_base_const_t<playlist_callback::t_on_items_replaced_entry> & p_data)=0;
595  virtual void on_item_ensure_visible(t_size p_idx)=0;
596 
597  virtual void on_playlist_switch() = 0;
598  virtual void on_playlist_renamed(const char * p_new_name,t_size p_new_name_len) = 0;
599  virtual void on_playlist_locked(bool p_locked) = 0;
600 
601  virtual void on_default_format_changed() = 0;
602  virtual void on_playback_order_changed(t_size p_new_index) = 0;
603 
604  enum {
605  flag_on_items_added = 1 << 0,
606  flag_on_items_reordered = 1 << 1,
607  flag_on_items_removing = 1 << 2,
608  flag_on_items_removed = 1 << 3,
609  flag_on_items_selection_change = 1 << 4,
610  flag_on_item_focus_change = 1 << 5,
611  flag_on_items_modified = 1 << 6,
612  flag_on_items_modified_fromplayback = 1 << 7,
613  flag_on_items_replaced = 1 << 8,
614  flag_on_item_ensure_visible = 1 << 9,
615  flag_on_playlist_switch = 1 << 10,
616  flag_on_playlist_renamed = 1 << 11,
617  flag_on_playlist_locked = 1 << 12,
618  flag_on_default_format_changed = 1 << 13,
619  flag_on_playback_order_changed = 1 << 14,
620  flag_all = ~0,
621  };
622 protected:
625 };
626 
629 public:
631  static_api_ptr_t<playlist_manager>()->register_callback(this,p_flags);
632  }
634  static_api_ptr_t<playlist_manager>()->unregister_callback(this);
635  }
636  void set_callback_flags(t_uint32 p_flags) {
637  static_api_ptr_t<playlist_manager>()->modify_callback(this,p_flags);
638  }
639  //dummy implementations - avoid possible pure virtual function calls!
640  void on_items_added(t_size p_playlist,t_size p_start, const pfc::list_base_const_t<metadb_handle_ptr> & p_data,const bit_array & p_selection) {}
641  void on_items_reordered(t_size p_playlist,const t_size * p_order,t_size p_count) {}
642  void on_items_removing(t_size p_playlist,const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {}
643  void on_items_removed(t_size p_playlist,const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {}
644  void on_items_selection_change(t_size p_playlist,const bit_array & p_affected,const bit_array & p_state) {}
645  void on_item_focus_change(t_size p_playlist,t_size p_from,t_size p_to) {}
646 
647  void on_items_modified(t_size p_playlist,const bit_array & p_mask) {}
649 
651 
652  void on_item_ensure_visible(t_size p_playlist,t_size p_idx) {}
653 
654  void on_playlist_activate(t_size p_old,t_size p_new) {}
655  void on_playlist_created(t_size p_index,const char * p_name,t_size p_name_len) {}
656  void on_playlists_reorder(const t_size * p_order,t_size p_count) {}
657  void on_playlists_removing(const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {}
658  void on_playlists_removed(const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {}
659  void on_playlist_renamed(t_size p_index,const char * p_new_name,t_size p_new_name_len) {}
660 
662  void on_playback_order_changed(t_size p_new_index) {}
663  void on_playlist_locked(t_size p_playlist,bool p_locked) {}
664 };
665 
668 protected:
670  static_api_ptr_t<playlist_manager>()->register_callback(this,p_flags);
671  }
672  void set_callback_flags(t_uint32 p_flags) {
673  static_api_ptr_t<playlist_manager>()->modify_callback(this,p_flags);
674  }
676  static_api_ptr_t<playlist_manager>()->unregister_callback(this);
677  }
678 
679  //dummy implementations - avoid possible pure virtual function calls!
680  void on_items_added(t_size p_base, const pfc::list_base_const_t<metadb_handle_ptr> & p_data,const bit_array & p_selection) {}
681  void on_items_reordered(const t_size * p_order,t_size p_count) {}
682  void on_items_removing(const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {}
683  void on_items_removed(const bit_array & p_mask,t_size p_old_count,t_size p_new_count) {}
684  void on_items_selection_change(const bit_array & p_affected,const bit_array & p_state) {}
685  void on_item_focus_change(t_size p_from,t_size p_to) {}
686  void on_items_modified(const bit_array & p_mask) {}
690 
692  void on_playlist_renamed(const char * p_new_name,t_size p_new_name_len) {}
693  void on_playlist_locked(bool p_locked) {}
694 
696  void on_playback_order_changed(t_size p_new_index) {}
697 
699 };
700 
702 {
703 public:
704  virtual unsigned get_flags() = 0;
705 
706  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playlist_callback_single_static);
707 };
708 
709 
712 class NOVTABLE dropped_files_data {
713 public:
714  virtual void set_paths(pfc::string_list_const const & p_paths) = 0;
715  virtual void set_handles(const pfc::list_base_const_t<metadb_handle_ptr> & p_handles) = 0;
716 protected:
719 };
720 
721 
723 public:
729  virtual bool filter_items(metadb_handle_list_cref in,metadb_handle_list_ref out) = 0;
730 
735  virtual bool process_locations(const pfc::list_base_const_t<const char*> & p_urls,pfc::list_base_t<metadb_handle_ptr> & p_out,bool p_filter,const char * p_restrict_mask_override, const char * p_exclude_mask_override,HWND p_parentwnd) = 0;
736 
741  virtual bool process_dropped_files(interface IDataObject * pDataObject,pfc::list_base_t<metadb_handle_ptr> & p_out,bool p_filter,HWND p_parentwnd) = 0;
742 
744  virtual bool process_dropped_files_check(interface IDataObject * pDataObject) = 0;
745 
747  virtual bool process_dropped_files_check_if_native(interface IDataObject * pDataObject) = 0;
748 
750  virtual interface IDataObject * create_dataobject(const pfc::list_base_const_t<metadb_handle_ptr> & p_data) = 0;
751 
754  virtual bool process_dropped_files_check_ex(interface IDataObject * pDataObject, DWORD * p_effect) = 0;
755 
760  virtual bool process_dropped_files_delayed(dropped_files_data & p_out,interface IDataObject * pDataObject) = 0;
761 
763  bool process_location(const char * url,pfc::list_base_t<metadb_handle_ptr> & out,bool filter,const char * p_mask,const char * p_exclude,HWND p_parentwnd);
766 
767  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playlist_incoming_item_filter);
768 };
769 
772 class NOVTABLE process_locations_notify : public service_base {
773 public:
774  virtual void on_completion(const pfc::list_base_const_t<metadb_handle_ptr> & p_items) = 0;
775  virtual void on_aborted() = 0;
776 
777  FB2K_MAKE_SERVICE_INTERFACE(process_locations_notify,service_base);
778 };
779 
781 
784 public:
785  enum {
787  op_flag_no_filter = 1 << 0,
789  op_flag_background = 1 << 1,
791  op_flag_delay_ui = 1 << 2,
792  };
793 
801  virtual void process_locations_async(const pfc::list_base_const_t<const char*> & p_urls,t_uint32 p_op_flags,const char * p_restrict_mask_override, const char * p_exclude_mask_override,HWND p_parentwnd,process_locations_notify_ptr p_notify) = 0;
802 
808  virtual void process_dropped_files_async(interface IDataObject * p_dataobject,t_uint32 p_op_flags,HWND p_parentwnd,process_locations_notify_ptr p_notify) = 0;
809 
811 };
812 
815 public:
816  virtual bool auto_playlist_name(metadb_handle_list_cref data,pfc::string_base & out) = 0;
817 
819 };
820 
823 public:
824  dropped_files_data_impl() : m_is_paths(false) {}
825  void set_paths(pfc::string_list_const const & p_paths) {
826  m_is_paths = true;
827  m_paths = p_paths;
828  }
830  m_is_paths = false;
831  m_handles = p_handles;
832  }
833 
834  void to_handles_async(bool p_filter,HWND p_parentwnd,service_ptr_t<process_locations_notify> p_notify);
836  void to_handles_async_ex(t_uint32 p_op_flags,HWND p_parentwnd,service_ptr_t<process_locations_notify> p_notify);
837  bool to_handles(pfc::list_base_t<metadb_handle_ptr> & p_out,bool p_filter,HWND p_parentwnd);
838 private:
842 };
843 
844 
845 class NOVTABLE playback_queue_callback : public service_base
846 {
847 public:
852  };
853  virtual void on_changed(t_change_origin p_origin) = 0;
854 
855  FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(playback_queue_callback);
856 };
857 
858 
860 public:
861  playlist_lock_change_notify() : playlist_callback_single_impl_base(flag_on_playlist_switch|flag_on_playlist_locked) {}
862 protected:
863  virtual void on_lock_state_change() {}
866  const t_size active = api->get_active_playlist();
867  if (active == ~0) return false;
868  return (api->playlist_lock_get_filter_mask(active) & what) == 0;
869  }
870 private:
871  void on_playlist_switch() {on_lock_state_change();}
872  void on_playlist_locked(bool p_locked) {on_lock_state_change();}
873 };
void playlist_activate_next()
Definition: playlist.h:358
void on_items_removing(t_size p_playlist, const bit_array &p_mask, t_size p_old_count, t_size p_new_count)
Definition: playlist.h:642
metadb_handle_ptr m_handle
Definition: playlist.h:63
const t_item * get_ptr() const
Definition: array.h:213
void reorder(reorder_callback &p_callback, const t_size *p_order, t_size p_count)
Definition: sort.cpp:25
void on_playlist_locked(t_size p_playlist, bool p_locked)
Definition: playlist.h:663
This interface allows filtering of playlist modification operations. Implemented by components "locki...
Definition: playlist.h:3
void on_items_modified_fromplayback(const bit_array &p_mask, play_control::t_display_level p_level)
Definition: playlist.h:687
void encode_little_endian(t_uint8 *p_buffer, TInt p_value)
Definition: pfc.h:71
metadb_handle_list m_handles
Definition: playlist.h:840
virtual void on_lock_state_change()
Definition: playlist.h:863
playlist_callback_single implementation helper - registers itself on creation / unregisters on destru...
Definition: playlist.h:667
void on_items_modified(const bit_array &p_mask)
Definition: playlist.h:686
void on_playlist_renamed(const char *p_new_name, t_size p_new_name_len)
Definition: playlist.h:692
abort_callback_impl abort_callback_dummy
bool queue_is_active()
Helper; returns whether there are items in the playback queue.
Definition: playlist.h:237
Bit array interface class, constant version (you can only retrieve values). Range of valid indexes d...
Definition: bit_array.h:6
bool playlist_get_runtime_property(t_size p_playlist, const GUID &p_property, service_ptr_t< _t_interface > &p_data)
Read a runtime playlist property.
Definition: playlist.h:455
void playlist_set_property(t_size p_playlist, const GUID &p_property, const t_array &p_data)
Write a persistent playlist property.
Definition: playlist.h:433
void on_playlists_removing(const bit_array &p_mask, t_size p_old_count, t_size p_new_count)
Definition: playlist.h:657
void set_handles(const pfc::list_base_const_t< metadb_handle_ptr > &p_handles)
Definition: playlist.h:829
void on_playlists_reorder(const t_size *p_order, t_size p_count)
Definition: playlist.h:656
void set_paths(pfc::string_list_const const &p_paths)
Definition: playlist.h:825
void on_item_ensure_visible(t_size p_playlist, t_size p_idx)
Definition: playlist.h:652
playlist_callback implementation helper - registers itself on creation / unregisters on destruction...
Definition: playlist.h:628
void decode_little_endian(TInt &p_out, const t_uint8 *p_buffer)
void queue_flush()
Helper; removes all items from the playback queue.
Definition: playlist.h:235
Class used for async processing of IDataObject. Content of IDataObject can be dumped into dropped_fil...
Definition: playlist.h:712
void on_playlist_created(t_size p_index, const char *p_name, t_size p_name_len)
Definition: playlist.h:655
void on_items_added(t_size p_playlist, t_size p_start, const pfc::list_base_const_t< metadb_handle_ptr > &p_data, const bit_array &p_selection)
Definition: playlist.h:640
bool playlist_get_property_int(t_size p_playlist, const GUID &p_property, _t_int &p_value)
Read a persistent playlist property.
Definition: playlist.h:477
void on_items_added(t_size p_base, const pfc::list_base_const_t< metadb_handle_ptr > &p_data, const bit_array &p_selection)
Definition: playlist.h:680
playlist_callback_impl_base(t_uint32 p_flags=0)
Definition: playlist.h:630
void on_items_replaced(t_size p_playlist, const bit_array &p_mask, const pfc::list_base_const_t< t_on_items_replaced_entry > &p_data)
Definition: playlist.h:650
void on_items_reordered(t_size p_playlist, const t_size *p_order, t_size p_count)
Definition: playlist.h:641
bool playlist_get_property(t_size p_playlist, const GUID &p_property, t_array &p_data)
Read a persistent playlist property.
Definition: playlist.h:442
void on_items_modified(t_size p_playlist, const bit_array &p_mask)
Definition: playlist.h:647
void on_items_removed(t_size p_playlist, const bit_array &p_mask, t_size p_old_count, t_size p_new_count)
Definition: playlist.h:643
void on_items_replaced(const bit_array &p_mask, const pfc::list_base_const_t< playlist_callback::t_on_items_replaced_entry > &p_data)
Definition: playlist.h:688
size_t t_size
Definition: int_types.h:48
void on_playlist_activate(t_size p_old, t_size p_new)
Definition: playlist.h:654
void set_size(t_size p_size)
Definition: array.h:104
This service provides methods for all sorts of playlist interaction. All playlist_manager methods are...
Definition: playlist.h:74
void on_items_selection_change(const bit_array &p_affected, const bit_array &p_state)
Definition: playlist.h:684
void set_callback_flags(t_uint32 p_flags)
Definition: playlist.h:672
void on_items_removed(const bit_array &p_mask, t_size p_old_count, t_size p_new_count)
Definition: playlist.h:683
void playlist_set_property_int(t_size p_playlist, const GUID &p_property, _t_int p_value)
Write a persistent playlist property.
Definition: playlist.h:466
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
Definition: service.h:333
Implementation of dropped_files_data.
Definition: playlist.h:822
Extension of the playlist_manager service that manages playlist properties. Playlist properties come ...
Definition: playlist.h:381
Bit array interface class, variable version (you can both set and retrieve values). As with the constant version, valid index range depends on the context.
Definition: bit_array.h:40
void on_playlist_renamed(t_size p_index, const char *p_new_name, t_size p_new_name_len)
Definition: playlist.h:659
void on_items_removing(const bit_array &p_mask, t_size p_old_count, t_size p_new_count)
Definition: playlist.h:682
void on_playlist_locked(bool p_locked)
Definition: playlist.h:872
bool operator==(const replaygain_info &item1, const replaygain_info &item2)
Definition: file_info.h:66
void on_playlists_removed(const bit_array &p_mask, t_size p_old_count, t_size p_new_count)
Definition: playlist.h:658
t_display_level
Type used to indicate level of dynamic playback-related info displayed. Safe to use with <> opereator...
playlist_callback_single_impl_base(t_uint32 p_flags=0)
Definition: playlist.h:669
void on_playback_order_changed(t_size p_new_index)
Definition: playlist.h:696
Callback interface for playlist enumeration methods.
Definition: playlist.h:79
t_size activeplaylist_get_selected_count(bit_array const &p_mask)
Definition: playlist.h:363
Definition: playlist.h:524
void on_items_modified_fromplayback(t_size p_playlist, const bit_array &p_mask, play_control::t_display_level p_level)
Definition: playlist.h:648
void set_callback_flags(t_uint32 p_flags)
Definition: playlist.h:636
void playlist_activate_previous()
Definition: playlist.h:359
void on_item_focus_change(t_size p_from, t_size p_to)
Definition: playlist.h:685
bool operator!=(const replaygain_info &item1, const replaygain_info &item2)
Definition: file_info.h:67
void on_items_selection_change(t_size p_playlist, const bit_array &p_affected, const bit_array &p_state)
Definition: playlist.h:644
void on_item_focus_change(t_size p_playlist, t_size p_from, t_size p_to)
Definition: playlist.h:645
Helper template used to easily access core services. Usage: static_api_ptr_t<myclass> api; api->doso...
Definition: service.h:533
bool is_playlist_command_available(t_uint32 what) const
Definition: playlist.h:864
void on_item_ensure_visible(t_size p_idx)
Definition: playlist.h:689
pfc::string_list_impl m_paths
Definition: playlist.h:839
t_size get_size() const
Definition: array.h:130
void on_playlist_locked(bool p_locked)
Definition: playlist.h:693
For use with playlist_incoming_item_filter_v2::process_locations_async().
Definition: playlist.h:772
void on_playback_order_changed(t_size p_new_index)
Definition: playlist.h:662
service_ptr_t< process_locations_notify > process_locations_notify_ptr
Definition: playlist.h:780
void on_items_reordered(const t_size *p_order, t_size p_count)
Definition: playlist.h:681
uint32_t t_uint32
Definition: int_types.h:5