示例#1
0
	virtual bool				IsSeekable() const
	{
		if (IsMedia())
			return fMedia->IsSeekable();

		return fPosition != NULL;
	}
示例#2
0
	BMediaIOWrapper(BDataIO* source)
		:
		fData(NULL),
		fPosition(NULL),
		fMedia(NULL),
		fBufferIO(NULL),
		fDataIOAdapter(NULL),
		fErr(B_NO_ERROR)
	{
		CALLED();

		fPosition = dynamic_cast<BPositionIO*>(source);
		fMedia = dynamic_cast<BMediaIO*>(source);
		fBufferIO = dynamic_cast<BBufferIO *>(source);
		fData = source;

		// No need to do additional buffering if we have
		// a BBufferIO or a BMediaIO.
		if (!IsMedia() && fBufferIO == NULL) {
			// Source needs to be at least a BPositionIO to wrap with a BBufferIO
			if (IsPosition()) {
				fBufferIO = new(std::nothrow) BBufferIO(fPosition, 65536, false);
				if (fBufferIO == NULL) {
					fErr = B_NO_MEMORY;
					return;
				}
				// We have to reset our parents reference too
				fPosition = dynamic_cast<BPositionIO*>(fBufferIO);
				fData = dynamic_cast<BDataIO*>(fPosition);
			} else {
				// In this case we have to supply our own form
				// of pseudo-seekable object from a non-seekable
				// BDataIO.
				fDataIOAdapter = new DataIOAdapter(source);
				fMedia = dynamic_cast<BMediaIO*>(fDataIOAdapter);
				fPosition = dynamic_cast<BPositionIO*>(fDataIOAdapter);
				fData = dynamic_cast<BDataIO*>(fDataIOAdapter);
				TRACE("Unable to improve performance with a BufferIO\n");
			}
		}

		if (IsMedia())
			fMedia->GetFlags(&fFlags);
		else if (IsPosition())
			fFlags = B_MEDIA_SEEKABLE;
	}
示例#3
0
	virtual	bool				IsEndless() const
	{
		if (IsMedia())
			return fMedia->IsEndless();

		if (IsSeekable())
			return false;

		return true;
	}