Пример #1
0
void CPlayerSubresyncBar::SaveSubtitle()
{
	CMainFrame* pFrame = ((CMainFrame*)AfxGetMainWnd());
	if (!pFrame) {
		return;
	}

	CLSID clsid;
	m_pSubStream->GetClassID(&clsid);

	if (clsid == __uuidof(CVobSubFile) && m_mode == VOBSUB) {
		CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)m_pSubStream;

		CAutoLock cAutoLock(m_pSubLock);

		ASSERT(pVSF->m_iLang >= 0);
		CAtlArray<CVobSubFile::SubPos>& sp = pVSF->m_langs[pVSF->m_iLang].subpos;

		for (size_t i = 0, j = sp.GetCount(); i < j; i++) {
			sp[i].fValid = false;
		}

		for (int i = 0, j = (int)m_sts.GetCount(); i < j; i++) {
			int vobid, cellid, forced, spnum;
			TCHAR c;
			if (_stscanf_s(m_sts.GetStrW(i), _T("%d%c%d%c%d%c%d"), &vobid,
						   &c, 1, &cellid, &c, 1, &forced, &c, 1, &spnum) != 7) {
				continue;
			}
			sp[spnum].start = m_sts[i].start;
			sp[spnum].stop = m_sts[i].end;
			sp[spnum].fValid = true;
		}
	} else if (clsid == __uuidof(CRenderedTextSubtitle) && m_mode == TEXTSUB) {
		CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;

		CAutoLock cAutoLock(m_pSubLock);

		pRTS->Copy(m_sts);
	} else {
		return;
	}

	pFrame->InvalidateSubtitle();
}
Пример #2
0
void CPlayerSubresyncBar::SaveSubtitle()
{
    CMainFrame* pFrame = ((CMainFrame*)AfxGetMainWnd());
    if (!pFrame) {
        return;
    }

    CLSID clsid;
    m_pSubStream->GetClassID(&clsid);

    if (clsid == __uuidof(CVobSubFile) && m_mode == VOBSUB) {
        CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)m_pSubStream;

        CAutoLock cAutoLock(m_pSubLock);

        ASSERT(pVSF->m_iLang >= 0);
        CAtlArray<CVobSubFile::SubPos>& sp = pVSF->m_langs[pVSF->m_iLang].subpos;

        for (size_t i = 0, j = sp.GetCount(); i < j; i++) {
            sp[i].fValid = false;
        }

        for (size_t i = 0, j = m_sts.GetCount(); i < j; i++) {
            int spnum = m_sts[i].readorder;

            sp[spnum].start  = m_sts[i].start;
            sp[spnum].stop   = m_sts[i].end;
            sp[spnum].fValid = true;
        }
    } else if (clsid == __uuidof(CRenderedTextSubtitle) && m_mode == TEXTSUB) {
        CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;

        CAutoLock cAutoLock(m_pSubLock);

        pRTS->Copy(m_sts);
    } else {
        return;
    }

    pFrame->InvalidateSubtitle();
}