예제 #1
0
파일: cuesheet.cpp 프로젝트: 315234/m4acut
void CueSheet::parse_index(const std::string *args)
{
    if (!m_tracks.size())
        die("INDEX command before TRACK");
    if (m_cur_file.empty())
        die("INDEX command before FILE");
    unsigned no, mm, ss, ff, nframes;
    if (std::sscanf(args[1].c_str(), "%u", &no) != 1)
        die("Invalid INDEX number");
    if (std::sscanf(args[2].c_str(), "%u:%u:%u", &mm, &ss, &ff) != 3)
        die("Invalid INDEX time format");
    if (ss > 59 || ff > 74)
        die("Invalid INDEX time format");
    nframes = msf2frames(mm, ss, ff);
    CueSegment *lastseg = last_segment();
    if (lastseg && lastseg->m_filename == m_cur_file) {
        lastseg->m_end = nframes;
        if (lastseg->m_begin >= nframes)
            die("INDEX time must be in ascending order");
    }
    CueSegment segment(m_cur_file, no);
    segment.m_begin = nframes;
    if (no > 0)
        m_tracks.back().add_segment(segment);
    else {
        if (m_tracks.size() == 1) {
            /* HTOA */
            m_tracks.insert(m_tracks.begin(), CueTrack(this, 0));
            m_tracks[0].set_meta("title", "(HTOA)");
            segment.m_index = 1;
        } else
            segment.m_index = 0x7fffffff;
        m_tracks[m_tracks.size() - 2].add_segment(segment);
    }
}
예제 #2
0
void CueSheet::parsePregap(const std::wstring *args)
{
    if (!m_tracks.size())
	die("PREGAP command before TRACK");
    unsigned mm, ss, ff;
    if (std::swscanf(args[1].c_str(), L"%u:%u:%u", &mm, &ss, &ff) != 3)
	die("Invalid PREGAP time format");
    CueSegment segment(std::wstring(L"__GAP__"), 0);
    segment.m_end = msf2frames(mm, ss, ff);
    m_tracks.back().m_segments.push_back(segment);
}
예제 #3
0
파일: cuesheet.cpp 프로젝트: 315234/m4acut
void CueSheet::parse_postgap(const std::string *args)
{
    if (!m_tracks.size())
        die("POSTGAP command before TRACK");
    unsigned mm, ss, ff;
    if (std::sscanf(args[1].c_str(), "%u:%u:%u", &mm, &ss, &ff) != 3)
        die("Invalid POSTGAP time format");
    CueSegment segment(std::string("__GAP__"), 0x7ffffffe);
    segment.m_end = msf2frames(mm, ss, ff);
    m_tracks.back().add_segment(segment);
}
예제 #4
0
void CueSheet::parseIndex(const std::wstring *args)
{
    if (!m_tracks.size())
	die("INDEX command before TRACK");
    unsigned no, mm, ss, ff, nframes;
    if (std::swscanf(args[1].c_str(), L"%u", &no) != 1)
	die("Invalid INDEX number");
    if (std::swscanf(args[2].c_str(), L"%u:%u:%u", &mm, &ss, &ff) != 3)
	die("Invalid INDEX time format");
    nframes = msf2frames(mm, ss, ff);
    CueSegment *lastseg = lastSegment();
    if (lastseg && lastseg->m_filename == m_cur_file)
	lastseg->m_end = nframes;
    CueSegment segment(m_cur_file, no);
    segment.m_begin = nframes;
    m_tracks.back().m_segments.push_back(segment);
}