I want to add a new virtual field.
And, such logic was written.
CODE
class myclass : public metadb_display_field_provider{
public:
virtual t_uint32 get_field_count(){
return 1;
};
virtual void get_field_name(t_uint32 index, pfc::string_base & out){
out = "TEST";
};
virtual bool process_field(t_uint32 index, metadb_handle * handle, titleformat_text_out * out){
// test (Time-consuming processing)
file_info_impl info;
if(p_handle->get_info(info)){
pfc::string8 temp;
if(info.meta_exists("ARTIST")){
temp.add_string(info.meta_get("ARTIST"));
}
if(info.meta_exists("TITLE")){
temp.add_string(info.meta_get("TITLE"));
}
out->write( titleformat_inputtypes::meta, temp);
return true;
}
return false;
}
};
static service_factory_single_t<myclass> foo;
public:
virtual t_uint32 get_field_count(){
return 1;
};
virtual void get_field_name(t_uint32 index, pfc::string_base & out){
out = "TEST";
};
virtual bool process_field(t_uint32 index, metadb_handle * handle, titleformat_text_out * out){
// test (Time-consuming processing)
file_info_impl info;
if(p_handle->get_info(info)){
pfc::string8 temp;
if(info.meta_exists("ARTIST")){
temp.add_string(info.meta_get("ARTIST"));
}
if(info.meta_exists("TITLE")){
temp.add_string(info.meta_get("TITLE"));
}
out->write( titleformat_inputtypes::meta, temp);
return true;
}
return false;
}
};
static service_factory_single_t<myclass> foo;
However, trouble is found.
Default UI:
First of all, 300 items are added to the playlist.
Next, the %TEST% field is added to Playlist view.
It sorts it with %TEST%.
sorted broken or freezing foobar2000.
Have it made a mistake in any ways?