Example #1
0
uint64 EbmlUInteger::UpdateSize(bool bKeepIntact, bool bForceRender)
{
	if (!bKeepIntact && IsDefaultValue())
		return 0;

	if (Value <= 0xFF) {
		Size = 1;
	} else if (Value <= 0xFFFF) {
		Size = 2;
	} else if (Value <= 0xFFFFFF) {
		Size = 3;
	} else if (Value <= 0xFFFFFFFF) {
		Size = 4;
	} else if (Value <= EBML_PRETTYLONGINT(0xFFFFFFFFFF)) {
		Size = 5;
	} else if (Value <= EBML_PRETTYLONGINT(0xFFFFFFFFFFFF)) {
		Size = 6;
	} else if (Value <= EBML_PRETTYLONGINT(0xFFFFFFFFFFFFFF)) {
		Size = 7;
	} else {
		Size = 8;
	}

	if (DefaultSize > Size) {
		Size = DefaultSize;
	}

	return Size;
}
uint64 EbmlUInteger::UpdateSize(bool bWithDefault, bool /* bForceRender */)
{
	if (!bWithDefault && IsDefaultValue())
		return 0;

	if (Value <= 0xFF) {
		SetSize_(1);
	} else if (Value <= 0xFFFF) {
		SetSize_(2);
	} else if (Value <= 0xFFFFFF) {
		SetSize_(3);
	} else if (Value <= 0xFFFFFFFF) {
		SetSize_(4);
	} else if (Value <= EBML_PRETTYLONGINT(0xFFFFFFFFFF)) {
		SetSize_(5);
	} else if (Value <= EBML_PRETTYLONGINT(0xFFFFFFFFFFFF)) {
		SetSize_(6);
	} else if (Value <= EBML_PRETTYLONGINT(0xFFFFFFFFFFFFFF)) {
		SetSize_(7);
	} else {
		SetSize_(8);
	}

	if (GetDefaultSize() > GetSize()) {
		SetSize_(GetDefaultSize());
	}

	return GetSize();
}
Example #3
0
/*!
	\warning Assume that the list has been sorted (Sort())
*/
const KaxCuePoint * KaxCues::GetTimecodePoint(uint64 aTimecode) const
{
	uint64 TimecodeToLocate = aTimecode / GlobalTimecodeScale();
	const KaxCuePoint * aPointPrev = NULL;
	uint64 aPrevTime = 0;
	uint64 aNextTime = EBML_PRETTYLONGINT(0xFFFFFFFFFFFF);

    EBML_MASTER_CONST_ITERATOR Itr;
	for (Itr = begin(); Itr != end(); ++Itr)
    {
		if (EbmlId(*(*Itr)) == EBML_ID(KaxCuePoint)) {
			const KaxCuePoint *tmp = static_cast<const KaxCuePoint *>(*Itr);
			// check the tile
			const KaxCueTime *aTime = static_cast<const KaxCueTime *>(tmp->FindFirstElt(EBML_INFO(KaxCueTime)));
			if (aTime != NULL)
			{
				uint64 _Time = uint64(*aTime);
				if (_Time > aPrevTime && _Time < TimecodeToLocate) {
					aPrevTime = _Time;
					aPointPrev = tmp;
				}
				if (_Time < aNextTime && _Time > TimecodeToLocate) {
					aNextTime= _Time;
				}
			}
		}
	}

	return aPointPrev;
}
Example #4
0
uint64 EbmlSInteger::UpdateSize(bool bWithDefault, bool bForceRender)
{
	if (!bWithDefault && IsDefaultValue())
		return 0;

	if (Value <= 0x7F && Value >= (-0x80)) {
		SetSize_(1);
	} else if (Value <= 0x7FFF && Value >= (-0x8000)) {
		SetSize_(2);
	} else if (Value <= 0x7FFFFF && Value >= (-0x800000)) {
		SetSize_(3);
	} else if (Value <= 0x7FFFFFFF && Value >= (-0x80000000)) {
		SetSize_(4);
	} else if (Value <= EBML_PRETTYLONGINT(0x7FFFFFFFFF) &&
		   Value >= EBML_PRETTYLONGINT(-0x8000000000)) {
		SetSize_(5);
	} else if (Value <= EBML_PRETTYLONGINT(0x7FFFFFFFFFFF) &&
		   Value >= EBML_PRETTYLONGINT(-0x800000000000)) {
		SetSize_(6);
	} else if (Value <= EBML_PRETTYLONGINT(0x7FFFFFFFFFFFFF) &&
		   Value >= EBML_PRETTYLONGINT(-0x80000000000000)) {
		SetSize_(7);
	} else {
		SetSize_(8);
	}

	if (GetDefaultSize() > GetSize()) {
		SetSize_(GetDefaultSize());
	}

	return GetSize();
}
Example #5
0
/*!
  \brief return the position of the Cluster to load
*/
const KaxCueTrackPositions * KaxCuePoint::GetSeekPosition() const
{
  const KaxCueTrackPositions * result = NULL;
  uint64 aPosition = EBML_PRETTYLONGINT(0xFFFFFFFFFFFFFFF);
  // find the position of the "earlier" Cluster
  const KaxCueTrackPositions *aPoss = static_cast<const KaxCueTrackPositions *>(FindFirstElt(EBML_INFO(KaxCueTrackPositions)));
  while (aPoss != NULL) {
    const KaxCueClusterPosition *aPos = static_cast<const KaxCueClusterPosition *>(aPoss->FindFirstElt(EBML_INFO(KaxCueClusterPosition)));
    if (aPos != NULL && uint64(*aPos) < aPosition) {
      aPosition = uint64(*aPos);
      result = aPoss;
    }

    aPoss = static_cast<const KaxCueTrackPositions *>(FindNextElt(*aPoss));
  }
  return result;
}