15 p_file->ensure_seekable();
19 len = p_file->get_size(p_abort);
23 p_file->seek(0,p_abort);
28 if (offset>0 && offset<len)
33 file::g_transfer_object(p_file,temp,len,p_abort);
35 if (len > 16*1024*1024) filesystem::g_open_temp(temp,p_abort);
36 else filesystem::g_open_tempmem(temp,p_abort);
37 file::g_transfer_object(p_file,temp,len,p_abort);
38 p_file->seek(0,p_abort);
39 p_file->set_eof(p_abort);
40 temp->seek(0,p_abort);
41 file::g_transfer_object(temp,p_file,len,p_abort);
44 p_size_removed = offset;
52 g_skip_at(p_file, offset, delta, p_abort);
53 if (delta == 0)
break;
57 p_size_skipped = offset;
61 g_skip_at(p_file, 0, p_size_skipped, p_abort);
66 unsigned char tmp[10];
68 p_file->seek ( p_base, p_abort );
70 if (p_file->read( tmp,
sizeof(tmp), p_abort) !=
sizeof(tmp)) {
71 p_file->seek ( p_base, p_abort );
77 0 != memcmp ( tmp,
"ID3", 3) ||
78 ( tmp[5] & 0x0F ) != 0 ||
79 ((tmp[6] | tmp[7] | tmp[8] | tmp[9]) & 0x80) != 0
81 p_file->seek ( p_base, p_abort );
86 int FooterPresent = tmp[5] & 0x10;
94 if ( FooterPresent ) ret += 10;
97 p_file->seek ( p_base + ret, p_abort );
98 }
catch(exception_io_seek_out_of_range) {
99 p_file->seek( p_base, p_abort );
104 p_size_skipped = ret;
static void g_remove(const service_ptr_t< file > &p_file, t_filesize &p_size_removed, abort_callback &p_abort)
static t_size g_multiskip(const service_ptr_t< file > &p_file, t_filesize &p_size_skipped, abort_callback &p_abort)
Callback interface for write-tags-to-temp-file-and-swap scheme, used for ID3v2 tag updates and such w...
static const t_filesize filesize_invalid
Invalid/unknown file size constant. Also see: t_filesize.
static void g_skip(const service_ptr_t< file > &p_file, t_filesize &p_size_skipped, abort_callback &p_abort)
virtual bool open_temp_file(service_ptr_t< file > &p_out, abort_callback &p_abort)=0
Called only once per operation (or not called at all when operation being performed can be done in-pl...
static void g_skip_at(const service_ptr_t< file > &p_file, t_filesize p_base, t_filesize &p_size_skipped, abort_callback &p_abort)
static void g_remove_ex(tag_write_callback &p_callback, const service_ptr_t< file > &p_file, t_filesize &p_size_removed, abort_callback &p_abort)
static bool g_get(service_ptr_t< tag_processor_id3v2 > &p_out)
t_uint64 t_filesize
Type used for file size related variables.
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.