Пример #1
0
int _seek_func(void *datasource, ogg_int64_t offset, int whence)
{
	MkInterfaceForDataReading* drInterface = reinterpret_cast<MkInterfaceForDataReading*>(datasource);
	switch (whence)
	{
	case SEEK_SET:
		drInterface->SetCurrentPosition(static_cast<unsigned int>(offset));
		break;
	case SEEK_CUR:
		drInterface->SetCurrentPosition(static_cast<unsigned int>(offset) + drInterface->GetCurrentPosition());
		break;
	case SEEK_END:
		drInterface->SetCurrentPosition(drInterface->GetEndPosition() - static_cast<unsigned int>(offset));
		break;
	}
	return 0;
}
Пример #2
0
long _tell_func(void *datasource)
{
	MkInterfaceForDataReading* drInterface = reinterpret_cast<MkInterfaceForDataReading*>(datasource);
	return drInterface->GetCurrentPosition();
}
Пример #3
0
// vorbis call back
size_t _read_func(void *ptr, size_t size, size_t nmemb, void *datasource)
{
	MkInterfaceForDataReading* drInterface = reinterpret_cast<MkInterfaceForDataReading*>(datasource);
	size_t copySize = GetMin<size_t>(size * nmemb, drInterface->GetEndPosition() - drInterface->GetCurrentPosition());
	return drInterface->Read(reinterpret_cast<unsigned char*>(ptr), copySize) ? copySize : 0;
}