foobar2000 SDK  2015-08-03
metadb.cpp
Go to the documentation of this file.
1 #include "foobar2000.h"
2 
3 
4 void metadb::handle_create_replace_path_canonical(metadb_handle_ptr & p_out,const metadb_handle_ptr & p_source,const char * p_new_path) {
5  handle_create(p_out,make_playable_location(p_new_path,p_source->get_subsong_index()));
6 }
7 
8 void metadb::handle_create_replace_path(metadb_handle_ptr & p_out,const metadb_handle_ptr & p_source,const char * p_new_path) {
9  pfc::string8 path;
10  filesystem::g_get_canonical_path(p_new_path,path);
11  handle_create_replace_path_canonical(p_out,p_source,path);
12 }
13 
14 void metadb::handle_replace_path_canonical(metadb_handle_ptr & p_out,const char * p_new_path) {
15  metadb_handle_ptr temp;
16  handle_create_replace_path_canonical(temp,p_out,p_new_path);
17  p_out = temp;
18 }
19 
20 
21 metadb_io::t_load_info_state metadb_io::load_info(metadb_handle_ptr p_item,t_load_info_type p_type,HWND p_parent_window,bool p_show_errors) {
22  return load_info_multi(pfc::list_single_ref_t<metadb_handle_ptr>(p_item),p_type,p_parent_window,p_show_errors);
23 }
24 
25 metadb_io::t_update_info_state metadb_io::update_info(metadb_handle_ptr p_item,file_info & p_info,HWND p_parent_window,bool p_show_errors)
26 {
27  file_info * blah = &p_info;
28  return update_info_multi(pfc::list_single_ref_t<metadb_handle_ptr>(p_item),pfc::list_single_ref_t<file_info*>(blah),p_parent_window,p_show_errors);
29 }
30 
31 
32 void metadb_io::hint_async(metadb_handle_ptr p_item,const file_info & p_info,const t_filestats & p_stats,bool p_fresh)
33 {
34  const file_info * blargh = &p_info;
36 }
37 
38 
40  if (static_api_ptr_t<playback_control>()->get_now_playing(p_out)) return true;
41 
42  {
44 
45  t_size playlist_count = api->get_playlist_count();
46  t_size active_playlist = api->get_active_playlist();
47  if (active_playlist != ~0) {
48  if (api->playlist_get_focus_item_handle(p_out,active_playlist)) return true;
49  }
50 
51  for(t_size n = 0; n < playlist_count; n++) {
52  if (api->playlist_get_focus_item_handle(p_out,n)) return true;
53  }
54 
55  if (active_playlist != ~0) {
56  t_size item_count = api->playlist_get_item_count(active_playlist);
57  if (item_count > 0) {
58  if (api->playlist_get_item_handle(p_out,active_playlist,0)) return true;
59  }
60  }
61 
62  for(t_size n = 0; n < playlist_count; n++) {
63  t_size item_count = api->playlist_get_item_count(n);
64  if (item_count > 0) {
65  if (api->playlist_get_item_handle(p_out,n,0)) return true;
66  }
67  }
68  }
69 
70  return false;
71 }
72 
73 
75  update_info_async(p_list,new service_impl_t<file_info_filter_impl>(p_list,p_new_info),p_parent_window,p_op_flags,p_notify);
76 }
static bool g_get_random_handle(metadb_handle_ptr &p_out)
Helper function; attempts to retrieve a handle to any known playable location to be used for e...
Definition: metadb.cpp:39
void handle_create_replace_path_canonical(metadb_handle_ptr &p_out, const metadb_handle_ptr &p_source, const char *p_new_path)
Definition: metadb.cpp:4
Template implementing reference-counting features of service_base. Intended for dynamic instantiation...
Definition: service_impl.h:4
void update_info_async_simple(metadb_handle_list_cref p_list, const pfc::list_base_const_t< const file_info * > &p_new_info, HWND p_parent_window, t_uint32 p_op_flags, completion_notify_ptr p_notify)
Updates tags of the specified tracks. Helper; uses update_info_async internally.
Definition: metadb.cpp:74
void handle_create_replace_path(metadb_handle_ptr &p_out, const metadb_handle_ptr &p_source, const char *p_new_path)
Definition: metadb.cpp:8
t_update_info_state
Definition: metadb.h:14
Main interface class for information about some playable object.
Definition: file_info.h:73
size_t t_size
Definition: int_types.h:48
t_load_info_state
Definition: metadb.h:20
virtual void handle_create(metadb_handle_ptr &p_out, const playable_location &p_location)=0
Returns a metadb_handle object referencing the specified location. If one doesn&#39;t exist yet a new one...
void hint_async(metadb_handle_ptr p_item, const file_info &p_info, const t_filestats &p_stats, bool p_fresh)
Definition: metadb.cpp:32
void handle_replace_path_canonical(metadb_handle_ptr &p_out, const char *p_new_path)
Definition: metadb.cpp:14
uint32_t t_uint32
Definition: int_types.h:5