本文整理汇总了C++中file_info类的典型用法代码示例。如果您正苦于以下问题:C++ file_info类的具体用法?C++ file_info怎么用?C++ file_info使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了file_info类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: retag_set_info
void retag_set_info(t_uint32 p_subsong, const file_info &p_info, abort_callback &p_abort)
{
ASAPInfo *info = const_cast<ASAPInfo *>(ASAP_GetInfo(asap));
ASAPInfo_SetAuthor(info, empty_if_null(p_info.meta_get("composer", 0)));
ASAPInfo_SetTitle(info, empty_if_null(p_info.meta_get("title", 0)));
ASAPInfo_SetDate(info, empty_if_null(p_info.meta_get("date", 0)));
}
示例2: update_metadata
void stream_encoders::update_metadata(const file_info&p_info){
metadata.remove_all();
pfc::string artist,title;
for (unsigned i=0;i<p_info.meta_get_count();i++) {
pfc::string name = p_info.meta_enum_name(i);
for (unsigned j=0;j<p_info.meta_enum_value_count(i);j++){
pfc::string value = p_info.meta_enum_value(i,j);
pfc::string buffer=name+"="+value;
metadata.add_item(buffer);
if(pfc::string::g_equalsCaseInsensitive(name,"artist"))
artist=value;
if(pfc::string::g_equalsCaseInsensitive(name,"title"))
title=value;
}
}
pfc::string meta=artist+" - "+title;
for(unsigned i=0;i<enc_list.get_count();++i){
strcpy(enc_list[i]->config->gSongTitle,(char*)meta.ptr());
enc_list[i]->config->ice2songChange=true;
updateSongTitle(enc_list[i]->config,0);
}
}
示例3: merge_tags_calc_rating_by_index
static t_size merge_tags_calc_rating_by_index(const file_info & p_info,t_size p_index) {
t_size n,m = p_info.meta_enum_value_count(p_index);
t_size ret = 0;
for(n=0;n<m;n++)
ret += strlen(p_info.meta_enum_value(p_index,n)) + 10;//yes, strlen on utf8 data, plus a slight bump to prefer multivalue over singlevalue w/ separator
return ret;
}
示例4: copy
void file_info::copy(const file_info & p_source)
{
if (&p_source != this) {
copy_meta(p_source);
copy_info(p_source);
set_length(p_source.get_length());
set_replaygain(p_source.get_replaygain());
}
}
示例5: info_meta_add
static void info_meta_add(file_info & info, const char * tag, pfc::ptr_list_t< const char > const& values)
{
t_size count = info.meta_get_count_by_name( tag );
if ( count )
{
// append as another line
pfc::string8 final = info.meta_get(tag, count - 1);
final += "\r\n";
final += values[0];
示例6: copy_meta_single_rename_ex
void file_info::copy_meta_single_rename_ex(const file_info & p_source,t_size p_index,const char * p_new_name,t_size p_new_name_length)
{
t_size n, m = p_source.meta_enum_value_count(p_index);
t_size new_index = pfc_infinite;
for(n=0; n<m; n++)
{
const char * value = p_source.meta_enum_value(p_index,n);
if (n == 0) new_index = meta_set_ex(p_new_name,p_new_name_length,value,pfc_infinite);
else meta_add_value(new_index,value);
}
}
示例7: g_print_field
void selection_properties_t::g_print_field(const char * field, const file_info & p_info, pfc::string_base & p_out)
{
t_size meta_index = p_info.meta_find(field);
if (meta_index != pfc_infinite)
{
t_size i, count = p_info.meta_enum_value_count(meta_index);
for (i = 0; i < count; i++)
p_out << p_info.meta_enum_value(meta_index, i) << (i + 1 < count ? "; " : "");
}
}
示例8: copy_meta_single_nocheck
void file_info::copy_meta_single_nocheck(const file_info & p_source,t_size p_index)
{
const char * name = p_source.meta_enum_name(p_index);
t_size n, m = p_source.meta_enum_value_count(p_index);
t_size new_index = pfc_infinite;
for(n=0; n<m; n++)
{
const char * value = p_source.meta_enum_value(p_index,n);
if (n == 0) new_index = meta_set_nocheck(name,value);
else meta_add_value(new_index,value);
}
}
示例9: get_info
void get_info(t_uint32 p_subsong, file_info &p_info, abort_callback &p_abort)
{
int duration = get_song_duration(p_subsong, false);
if (duration >= 0)
p_info.set_length(duration / 1000.0);
const ASAPInfo *info = ASAP_GetInfo(asap);
p_info.info_set_int("channels", ASAPInfo_GetChannels(info));
p_info.info_set_int("subsongs", ASAPInfo_GetSongs(info));
meta_set(p_info, "composer", ASAPInfo_GetAuthor(info));
meta_set(p_info, "title", ASAPInfo_GetTitle(info));
meta_set(p_info, "date", ASAPInfo_GetDate(info));
}
示例10: get_info
void get_info( file_info & p_info, abort_callback & p_abort )
{
ModPlugFile* m_info = ModPlug_Load(file_buffer.get_ptr(), file_buffer.get_size());
p_info.info_set( "encoding", "synthesized" );
int type_module = ModPlug_GetModuleType(m_info);
p_info.info_set( "codec", "Module file" );
p_info.info_set_int( "channels", 2 );
p_info.meta_set( "title", pfc::stringcvt::string_utf8_from_ansi( ModPlug_GetName(m_info) ));
int len = ModPlug_GetLength(m_info);
len /= 1000;
p_info.set_length( len );
if(m_info)ModPlug_Unload(m_info);
}
示例11: get_info
void get_info(file_info & p_info,abort_callback & p_abort) {
p_info.set_length( mod->get_duration_seconds() );
p_info.info_set_int( "samplerate", settings.samplerate );
p_info.info_set_int( "channels", settings.channels );
p_info.info_set_int( "bitspersample", 32 );
std::vector<std::string> keys = mod->get_metadata_keys();
for ( std::vector<std::string>::iterator key = keys.begin(); key != keys.end(); ++key ) {
if ( *key == "message_raw" ) {
continue;
}
p_info.meta_set( (*key).c_str(), mod->get_metadata( *key ).c_str() );
}
}
示例12: g_is_meta_equal
bool file_info::g_is_meta_equal(const file_info & p_item1,const file_info & p_item2) {
const t_size count = p_item1.meta_get_count();
if (count != p_item2.meta_get_count()) {
//uDebugLog() << "meta count mismatch";
return false;
}
pfc::map_t<const char*,t_size,field_name_comparator> item2_meta_map;
for(t_size n=0; n<count; n++) {
item2_meta_map.set(p_item2.meta_enum_name(n),n);
}
for(t_size n1=0; n1<count; n1++) {
t_size n2;
if (!item2_meta_map.query(p_item1.meta_enum_name(n1),n2)) {
//uDebugLog() << "item2 doesn't have " << p_item1.meta_enum_name(n1);
return false;
}
t_size value_count = p_item1.meta_enum_value_count(n1);
if (value_count != p_item2.meta_enum_value_count(n2)) {
//uDebugLog() << "meta value count mismatch: " << p_item1.meta_enum_name(n1) << " : " << value_count << " vs " << p_item2.meta_enum_value_count(n2);
return false;
}
for(t_size v = 0; v < value_count; v++) {
if (strcmp(p_item1.meta_enum_value(n1,v),p_item2.meta_enum_value(n2,v)) != 0) {
//uDebugLog() << "meta mismatch: " << p_item1.meta_enum_name(n1) << " : " << p_item1.meta_enum_value(n1,v) << " vs " << p_item2.meta_enum_value(n2,v);
return false;
}
}
}
return true;
}
示例13:
void IMA4Decoder::get_info(file_info &info)
{
info.info_set("codec", "IMA 4:1");
info.info_set("encoding", "lossy");
info.info_set_int("samplerate", m_format.asbd.mSampleRate);
uint32_t channel_mask = m_format.channel_mask;
std::string channels;
if (channel_mask) {
channels = Helpers::describe_channels(channel_mask);
info.info_set("channels", channels.c_str());
} else {
info.info_set_int("channels", m_format.asbd.mChannelsPerFrame);
}
}
示例14: _add_tag
void file_info::_add_tag(const file_info & otherTag) {
this->set_replaygain( replaygain_info::g_merge( this->get_replaygain(), otherTag.get_replaygain() ) );
const char * tt1 = this->info_get(_tagtype);
const char * tt2 = otherTag.info_get(_tagtype);
if (tt2) {
if (tt1) {
this->info_set(_tagtype, PFC_string_formatter() << tt1 << "|" << tt2);
} else {
this->info_set(_tagtype, tt2);
}
}
}
示例15: merge_tags_calc_rating
static t_size merge_tags_calc_rating(const file_info & p_info,const char * p_field) {
t_size field_index = p_info.meta_find(p_field);
if (field_index != ~0) {
return merge_tags_calc_rating_by_index(p_info,field_index);
} else {
return 0;
}
}