예제 #1
0
파일: spc.cpp 프로젝트: xomniversex/foo_gep
static void load_id666(service_ptr_t<file> & p_file, LPID666TAG lpTag, abort_callback & p_abort)//must be seeked to correct spot before calling
{
	t_uint8 szBuf[4];
	p_file->read_object( &szBuf, 4, p_abort );

	if( ! memcmp( szBuf, xid6_signature, 4 ) )
	{
		t_uint32 tag_size;
		p_file->read_lendian_t( tag_size, p_abort );

		t_filesize offset = p_file->get_position( p_abort );

		service_ptr_t< reader_limited > m_file = new service_impl_t< reader_limited >;
		m_file->init( p_file, offset, offset + tag_size, p_abort );

		service_ptr_t<file> p_file = m_file.get_ptr();

		try
		{
			parse_id666( p_file, lpTag, false, p_abort );
		}
		catch ( const exception_io_data & )
		{
			p_file->seek( 0, p_abort );

			memset( lpTag, 0, sizeof( *lpTag ) );

			parse_id666( p_file, lpTag, true, p_abort );
		}
	}
	else throw exception_tag_not_found();
}
예제 #2
0
void tag_processor::read_id3v2_trailing(const service_ptr_t<file> & p_file,file_info & p_info,abort_callback & p_abort)
{
	file_info_impl temp_infos[2];
	bool have_id3v2 = true, have_trailing = true;
	try {
		read_id3v2(p_file,temp_infos[0],p_abort);
	} catch(exception_io_data) {
		have_id3v2 = false;
	}
	try {
		read_trailing(p_file,temp_infos[1],p_abort);
	} catch(exception_io_data) {
		have_trailing = false;
	}

	if (!have_id3v2 && !have_trailing) throw exception_tag_not_found();
	else  {
		pfc::ptr_list_t<const file_info> blargh;
		if (have_id3v2) blargh.add_item(&temp_infos[0]);
		if (have_trailing) blargh.add_item(&temp_infos[1]);
		p_info.merge(blargh);
	}
}
void tag_processor::read_id3v2_trailing(const service_ptr_t<file> & p_file,file_info & p_info,abort_callback & p_abort)
{
    file_info_impl id3v2, trailing;
    bool have_id3v2 = true, have_trailing = true;
    try {
        read_id3v2(p_file,id3v2,p_abort);
    } catch(exception_io_data) {
        have_id3v2 = false;
    }
    if (!have_id3v2 || !p_file->is_remote()) try {
            read_trailing(p_file,trailing,p_abort);
        } catch(exception_io_data) {
            have_trailing = false;
        }

    if (!have_id3v2 && !have_trailing) throw exception_tag_not_found();

    if (have_id3v2) {
        p_info._set_tag(id3v2);
        if (have_trailing) p_info._add_tag(trailing);
    } else {
        p_info._set_tag(trailing);
    }
}