private MergeWith ( NVorbis continuation ) : void | ||
continuation | NVorbis | |
return | void |
internal void MergeWith(NVorbis.DataPacket continuation)
{
var op = continuation as Packet;
if (op == null) throw new ArgumentException("Incorrect packet type!");
Length += continuation.Length;
if (_mergedPacket == null)
{
_mergedPacket = op;
}
else
{
_mergedPacket.MergeWith(continuation);
}
// per the spec, a partial packet goes with the next page's granulepos. we'll go ahead and assign it to the next page as well
PageGranulePosition = continuation.PageGranulePosition;
PageSequenceNumber = continuation.PageSequenceNumber;
}
internal void AddPacket(Packet packet) { lock (_packetLock) { if (!_eosFound) { if (packet.IsResync) { packet.IsContinuation = false; if (_last != null) { _last.IsContinued = false; } } if (packet.IsContinuation) { if (_last == null) { throw new InvalidDataException(); } if (!_last.IsContinued) { throw new InvalidDataException(); } _last.MergeWith(packet); _last.IsContinued = packet.IsContinued; } else { if (packet == null) { throw new ArgumentException("Wrong packet datatype", "packet"); } if (_first == null) { _first = packet; _last = packet; } else { Packet packet2 = packet.Prev = _last; Packet packet4 = _last = (packet2.Next = packet); } } if (packet.IsEndOfStream) { SetEndOfStream(); } } } }