void CClip::SetOut(LPCTSTR strVal)
{
    m_rtOut = StringToReftime(strVal);
}
HRESULT CXSUBSubtitle::ParseSample (IMediaSample* pSample)
{
	CAutoLock cAutoLock(&m_csCritSec);
	HRESULT		hr = E_FAIL;

	CheckPointer (pSample, E_POINTER);
	BYTE*	pData = NULL;
	int		lSampleLen;

	hr = pSample->GetPointer(&pData);
	if (FAILED(hr) || pData == NULL) {
		return hr;
	}
	lSampleLen = pSample->GetActualDataLength();
	if (lSampleLen < (27 + 7 * 2 + 4 * 3)) {
		return E_FAIL;
	}

	if (pData[0] != '[' || pData[13] != '-' || pData[26] != ']') {
		return E_FAIL;
	}

	REFERENCE_TIME rtStart = INVALID_TIME, rtStop = INVALID_TIME;
	CString tmp((char*)pData, 26);
	rtStart	= StringToReftime(tmp.Mid(1, 12));
	rtStop	= StringToReftime(tmp.Mid(14, 12));

	if (rtStop <= rtStart) {
		return E_FAIL;
	}

	CompositionObject*	pSub = DNew CompositionObject;
	pSub->m_rtStart	= rtStart;
	pSub->m_rtStop	= rtStop;

	CGolombBuffer gb(pData + 27, lSampleLen - 27);
	pSub->m_width				= gb.ReadShortLE();
	pSub->m_height				= gb.ReadShortLE();
	pSub->m_horizontal_position	= gb.ReadShortLE();
	pSub->m_vertical_position	= gb.ReadShortLE();
	// skip bottom right position
	gb.ReadShortLE();
	gb.ReadShortLE();
	// length of the RLE data
	gb.ReadShortLE();
	// Palette, 4 color entries
	HDMV_PALETTE Palette[4];
	for (int entry=0; entry < 4; entry++) {
		Palette[entry].entry_id	= entry;
		Palette[entry].Y	= gb.ReadByte();	// red
		Palette[entry].Cr	= gb.ReadByte();	// green
		Palette[entry].Cb	= gb.ReadByte();	// blue
		if (entry) {
			Palette[entry].T = 0xFF; // first entry - background, fully transparent
		}
	}

	pSub->SetPalette(4, Palette, false, true);

	int RLESize = gb.GetSize() - gb.GetPos();
	pSub->SetRLEData(gb.GetBufferPos(), RLESize, RLESize);

	m_pObjects.AddTail(pSub);

	hr = S_OK;

	return hr;
}
void CClip::SetIn(LPCTSTR strVal)
{
    m_rtIn = StringToReftime(strVal);
}