Ejemplo n.º 1
0
void file_info::merge(const pfc::list_base_const_t<const file_info*> & p_in)
{
	t_size in_count = p_in.get_count();
	if (in_count == 0)
	{
		meta_remove_all();
		return;
	}
	else if (in_count == 1)
	{
		const file_info * info = p_in[0];

		copy_meta(*info);

		set_replaygain(replaygain_info::g_merge(get_replaygain(),info->get_replaygain()));

		overwrite_info(*info);

		//copy_info_single_by_name(*info,"tagtype");
		
		return;
	}
	
	merge_meta(*this,p_in);

	{
		pfc::string8_fastalloc tagtype;
		replaygain_info rg = get_replaygain();
		t_size in_ptr;
		for(in_ptr = 0; in_ptr < in_count; in_ptr++ )
		{
			const file_info * info = p_in[in_ptr];
			rg = replaygain_info::g_merge(rg, info->get_replaygain());
			t_size field_ptr, field_max = info->info_get_count();
			for(field_ptr = 0; field_ptr < field_max; field_ptr++ )
			{
				const char * field_name = info->info_enum_name(field_ptr), * field_value = info->info_enum_value(field_ptr);
				if (*field_value)
				{
					if (!pfc::stricmp_ascii(field_name,"tagtype"))
					{
						if (!tagtype.is_empty()) tagtype += "|";
						tagtype += field_value;
					}
				}
			}
		}
		if (!tagtype.is_empty()) info_set("tagtype",tagtype);
		set_replaygain(rg);
	}
}
Ejemplo n.º 2
0
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());
    }
}
Ejemplo n.º 3
0
bool file_info::info_set_replaygain_ex(const char * p_name,t_size p_name_len,const char * p_value,t_size p_value_len)
{
    replaygain_info temp = get_replaygain();
    if (temp.set_from_meta_ex(p_name,p_name_len,p_value,p_value_len))
    {
        set_replaygain(temp);
        return true;
    }
    else return false;
}
Ejemplo n.º 4
0
void file_info::merge_fallback(const file_info & source) {
	set_replaygain( replaygain_info::g_merge(get_replaygain(), source.get_replaygain() ) );
	if (get_length() <= 0) set_length(source.get_length());
	t_size count = source.info_get_count();
	for(t_size infoWalk = 0; infoWalk < count; ++infoWalk) {
		const char * name = source.info_enum_name(infoWalk);
		if (!info_exists(name)) __info_add_unsafe(name, source.info_enum_value(infoWalk));
	}
	count = source.meta_get_count();
	for(t_size metaWalk = 0; metaWalk < count; ++metaWalk) {
		const char * name = source.meta_enum_name(metaWalk);
		if (!meta_exists(name)) _copy_meta_single_nocheck(source, metaWalk);
	}
}
Ejemplo n.º 5
0
void file_info::reset_replaygain()
{
    replaygain_info temp;
    temp.reset();
    set_replaygain(temp);
}
Ejemplo n.º 6
0
void file_info::info_set_replaygain_track_peak(float value)
{
    replaygain_info temp = get_replaygain();
    temp.m_track_peak = value;
    set_replaygain(temp);
}
Ejemplo n.º 7
0
void file_info::info_set_replaygain_album_gain(float value)
{
    replaygain_info temp = get_replaygain();
    temp.m_album_gain = value;
    set_replaygain(temp);
}