本文整理汇总了C++中CDVDInputStream::Seek方法的典型用法代码示例。如果您正苦于以下问题:C++ CDVDInputStream::Seek方法的具体用法?C++ CDVDInputStream::Seek怎么用?C++ CDVDInputStream::Seek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDVDInputStream
的用法示例。
在下文中一共展示了CDVDInputStream::Seek方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dvd_file_write
/*
static int dvd_file_write(URLContext *h, BYTE* buf, int size)
{
return -1;
}
*/
static offset_t dvd_file_seek(URLContext *h, offset_t pos, int whence)
{
//if (g_urltimeout && GetTickCount() > g_urltimeout)
// return -1;
CDVDInputStream* pInputStream = (CDVDInputStream*)h->priv_data;
if(whence == AVSEEK_SIZE)
return pInputStream->GetLength();
else
return pInputStream->Seek(pos, whence);
}
示例2: Open
bool CDVDSubtitleStream::Open(const string& strFile)
{
CDVDInputStream* pInputStream;
pInputStream = CDVDFactoryInputStream::CreateInputStream(NULL, strFile, "");
if (pInputStream && pInputStream->Open(strFile.c_str(), ""))
{
unsigned char buffer[16384];
int size_read = 0;
size_read = pInputStream->Read(buffer,3);
bool isUTF8 = false;
bool isUTF16 = false;
if (buffer[0] == 0xEF && buffer[1] == 0xBB && buffer[2] == 0xBF)
isUTF8 = true;
else if (buffer[0] == 0xFF && buffer[1] == 0xFE)
{
isUTF16 = true;
pInputStream->Seek(2, SEEK_SET);
}
else
pInputStream->Seek(0, SEEK_SET);
if (isUTF16)
{
std::wstringstream wstringstream;
while( (size_read = pInputStream->Read(buffer, sizeof(buffer)-2) ) > 0 )
{
buffer[size_read] = buffer[size_read + 1] = '\0';
CStdStringW temp;
g_charsetConverter.utf16LEtoW(std::u16string((char16_t*)buffer),temp);
wstringstream << temp;
}
delete pInputStream;
CStdString strUTF8;
g_charsetConverter.wToUTF8(CStdStringW(wstringstream.str()),strUTF8);
m_stringstream.str("");
m_stringstream << strUTF8;
}
else
{
while( (size_read = pInputStream->Read(buffer, sizeof(buffer)-1) ) > 0 )
{
buffer[size_read] = '\0';
m_stringstream << buffer;
}
delete pInputStream;
if (!isUTF8)
isUTF8 = CUtf8Utils::isValidUtf8(m_stringstream.str());
if (!isUTF8)
{
CStdStringW strUTF16;
CStdString strUTF8;
g_charsetConverter.subtitleCharsetToW(m_stringstream.str(), strUTF16);
g_charsetConverter.wToUTF8(strUTF16,strUTF8);
m_stringstream.str("");
m_stringstream << strUTF8;
}
}
return true;
}
delete pInputStream;
return false;
}