📄 idtag.cpp
字号:
#include "stdafx.h"StreamInfo::StreamInfo (){ memset ( &simple, 0, sizeof (simple) );}mpc_int64_t StreamInfo::GetLengthSamples(){ mpc_int64_t samples = (mpc_int64_t)simple.Frames * MPC_decoder::FrameLength; if ( simple.IsTrueGapless ) { samples -= (MPC_decoder::FrameLength - simple.LastFrameSamples); } else { samples -= MPC_decoder::SynthDelay; } return samples;}double StreamInfo::GetLength(){ return (double)GetLengthSamples() / (double)simple.SampleFreq;}// searches for a ID3v2-tag and reads the length (in bytes) of it// -1 on errors of any kindmpc_int32_tJumpID3v2 ( MPC_reader* fp ){ unsigned char tmp [10]; mpc_uint32_t Unsynchronisation; // ID3v2.4-flag mpc_uint32_t ExtHeaderPresent; // ID3v2.4-flag mpc_uint32_t ExperimentalFlag; // ID3v2.4-flag mpc_uint32_t FooterPresent; // ID3v2.4-flag mpc_int32_t ret; if ( !fp->seek ( 0) ) // seek to first byte of mpc data return 0; fp->read ( tmp, sizeof(tmp) ); // check id3-tag if ( 0 != memcmp ( tmp, "ID3", 3) ) return 0; // read flags Unsynchronisation = tmp[5] & 0x80; ExtHeaderPresent = tmp[5] & 0x40; ExperimentalFlag = tmp[5] & 0x20; FooterPresent = tmp[5] & 0x10; if ( tmp[5] & 0x0F ) return -1; // not (yet???) allowed if ( (tmp[6] | tmp[7] | tmp[8] | tmp[9]) & 0x80 ) return -1; // not allowed // read HeaderSize (syncsave: 4 * $0xxxxxxx = 28 significant bits) ret = tmp[6] << 21; ret += tmp[7] << 14; ret += tmp[8] << 7; ret += tmp[9] ; ret += 10; if ( FooterPresent ) ret += 10; return ret;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -