Halyri - Udp-client  0.9.1
 All Classes Namespaces Functions Enumerations Properties
MediaPacket Class Reference

Class representing a user-level media packet. This packet is used when receiving and sending media using the UdpMediaClientSocket. Encapsulates the complete media data and media type information. Can provide a collection of NetworkPackets conforming to the network MTU for network transfer. Can later be reconstructed from such packets at the receiving end. More...

Public Member Functions

 MediaPacket (MediaInformation mediaInfo, byte[] mediaPayload, Int64 sequenceNumber, string guid)
 Instantializes a new MediaPacket with the specified media information, payload data, sender Guid and sequence number. More...
 
 MediaPacket (MediaInformation mediaInfo, byte[] mediaPayload, string guid, Int32 originatingLength, Int64 sequenceNumber)
 Instantializes a new MediaPacket with the specified media information, payload data, sender Guid, original data length and sequence number. More...
 
 MediaPacket (MediaInformation mediaInfo, byte[] mediaPayload, string guid, Int32 originatingLength)
 Instantializes a new MediaPacket with the specified media information, payload data, sender Guid and original data length. More...
 
 MediaPacket (MediaInformation mediaInfo, byte[] mediaPayload, string guid)
 Instantializes a new MediaPacket with the specified media information, payload data and sender Guid. More...
 
 MediaPacket (MediaHeaderPacket newHeaderPacket)
 Instantializes a new MediaPacket using the MediaHeaderPacket from a network transfer packet sequence. If MediaPacket from which the MediaHeaderPacket was derived had no more than one network MTU of payload data, this MediaPacket instance is now complete (HasAllContinuationPackets = true). More...
 
 MediaPacket (MediaContinuationPacket oneContinuationPacket)
 /// More...
 
bool AddHeaderPacket (MediaHeaderPacket newHeaderPacket)
 Adds a header packet to this MediaPacket. If there already is a header packet in this instance, returns the HasAllContinuationPackets indicating if some continuation packets are missing. More...
 
bool AddContinuationPacket (MediaContinuationPacket continuationPacket)
 Adds a MediaContinuationPacket to this MediaPacket. Returns a boolean indicaing if all MediaContinuationPackets necessary to complete this MediaPacket have now been added. More...
 
INetworkPacket[] GetAllTransmissionPackets (int mtu)
 Converts this MediaPacket into a collection of NetworkPackets for network transfer. All resulting networkPackets will have a byte representation with length no more that the specified MTU. More...
 

Properties

Int32 OriginatingDataLength [get]
 Original length of the data prior to encoding into the specified transfer format. More...
 
Int64 Sequence [get, set]
 Sequence number of this packet More...
 
bool HasAllContinuationPackets [get]
 True, if not reconstructed from a network packet sequence or hass all packets from the relevant sequence. False otherwise. More...
 
bool PayloadLengthMismatched [get]
 True, if reconstructed from a network packet sequence and one or more subpackets had an unexpected payload data length. Otherwise false. More...
 
string SenderGuid [get]
 String represenstation of the Guid identifying the sender More...
 
DateTime InitializationTime [get]
 DateTime of the instantialization time for this instance. More...
 
byte[] CompletePayloadData [get]
 Complete payload data for this instance More...
 
MediaInformation PacketMediaInformation [get]
 MediaInformation describing the media in this instance. Can be null on a packet constructed from a subpacket transfer sequence. More...
 

Detailed Description

Class representing a user-level media packet. This packet is used when receiving and sending media using the UdpMediaClientSocket. Encapsulates the complete media data and media type information. Can provide a collection of NetworkPackets conforming to the network MTU for network transfer. Can later be reconstructed from such packets at the receiving end.

<author>Veli-Mikko Puupponen</author>

Constructor & Destructor Documentation

MediaPacket ( MediaInformation  mediaInfo,
byte[]  mediaPayload,
Int64  sequenceNumber,
string  guid 
)

Instantializes a new MediaPacket with the specified media information, payload data, sender Guid and sequence number.

Throws an ArgumentException if any of the arguments is null or the payload data length is zero.

Parameters
mediaInfoMediaInformation instance describing the data contained in this instance
mediaPayloadMedia data
sequenceNumberSequence number for all subpackets generated from this packet during network transmission
guidString representation of the sender's Guid
MediaPacket ( MediaInformation  mediaInfo,
byte[]  mediaPayload,
string  guid,
Int32  originatingLength,
Int64  sequenceNumber 
)

Instantializes a new MediaPacket with the specified media information, payload data, sender Guid, original data length and sequence number.

Throws an ArgumentException if any of the arguments is null or the payload data length is zero.

Parameters
mediaInfoMediaInformation instance describing the data contained in this instance
mediaPayloadMedia data
guidString representation of the sender's Guid
originatingLengthOriginal length of the data prior to encoding into the specified transfer format.
sequenceNumberSequence number for all subpackets generated from this packet during network transmission
MediaPacket ( MediaInformation  mediaInfo,
byte[]  mediaPayload,
string  guid,
Int32  originatingLength 
)

Instantializes a new MediaPacket with the specified media information, payload data, sender Guid and original data length.

Throws an ArgumentException if any of the arguments is null or the payload data length is zero.

Parameters
mediaInfoMediaInformation instance describing the data contained in this instance
mediaPayloadMedia data
guidString representation of the sender's Guid
originatingLengthOriginal length of the data prior to encoding into the specified transfer format.
MediaPacket ( MediaInformation  mediaInfo,
byte[]  mediaPayload,
string  guid 
)

Instantializes a new MediaPacket with the specified media information, payload data and sender Guid.

Throws an ArgumentException if any of the arguments is null, the payload data length is zero or the Guid format is incorrect.

Parameters
mediaInfoMediaInformation instance describing the data contained in this instance
mediaPayloadMedia data
guidString representation of the sender's Guid
MediaPacket ( MediaHeaderPacket  newHeaderPacket)

Instantializes a new MediaPacket using the MediaHeaderPacket from a network transfer packet sequence. If MediaPacket from which the MediaHeaderPacket was derived had no more than one network MTU of payload data, this MediaPacket instance is now complete (HasAllContinuationPackets = true).

Otherwise the MediaContinuationPackets from the transfer sequence need to be added to this instace using the method AddContinuationPacket.

Throws an ArgumentException if the MediaHeaderPacket is not valid.

Parameters
newHeaderPacketMediaHeaderPacket instance
MediaPacket ( MediaContinuationPacket  oneContinuationPacket)

///

Instantializes a new MediaPacket using any MediaContinuationPacket from a network transfer packet sequence. All MediaPackets require at least the MediaHeaderPacket from the relevant packet sequence generated from the original MediaPacket. Therefore this MediaPacket will not be complete until at least the MediaHeaderPacket has been added using the method AddHeaderPacket.

Otherwise the MediaContinuationPackets from the transfer sequence need to be added to this instace using the method AddContinuationPacket.

Throws an ArgumentException if the MediaHeaderPacket is not valid.

Parameters
oneContinuationPacket

Member Function Documentation

bool AddContinuationPacket ( MediaContinuationPacket  continuationPacket)

Adds a MediaContinuationPacket to this MediaPacket. Returns a boolean indicaing if all MediaContinuationPackets necessary to complete this MediaPacket have now been added.

Throws an ArgumentException if the MediaContinuationPacket is not valid or has a mismatching sequence number or guid.

Parameters
continuationPacketMediaContinuationPacket that is a part of the related transfer packet sequence
Returns
true, if this MediaPacket now has all continuation packets
bool AddHeaderPacket ( MediaHeaderPacket  newHeaderPacket)

Adds a header packet to this MediaPacket. If there already is a header packet in this instance, returns the HasAllContinuationPackets indicating if some continuation packets are missing.

If the MediaHeaderPacket is valid for this instance and no MediaContinuationPackets are missing, returns true indicating that this instance is now complete.

Throws an ArgumentException if the MediaHeaderPacket is not valid or has a mismatching sequence number or guid.

Parameters
newHeaderPacketHeader packet for supplying first part of payload data and overall information to this instance.
Returns
True, if this instance now has all subpackets from the relevant transfer packet sequence, otherwise false
INetworkPacket [] GetAllTransmissionPackets ( int  mtu)

Converts this MediaPacket into a collection of NetworkPackets for network transfer. All resulting networkPackets will have a byte representation with length no more that the specified MTU.

The MTU has to be 100 bytes or more. Throws an ArgumentException if MTU < 100.

Parameters
mtuMaximal network transmission unit size used to limit the resulting NetworkPacket payload sizes
Returns

Property Documentation

byte [] CompletePayloadData
get

Complete payload data for this instance

bool HasAllContinuationPackets
get

True, if not reconstructed from a network packet sequence or hass all packets from the relevant sequence. False otherwise.

DateTime InitializationTime
get

DateTime of the instantialization time for this instance.

Int32 OriginatingDataLength
get

Original length of the data prior to encoding into the specified transfer format.

MediaInformation PacketMediaInformation
get

MediaInformation describing the media in this instance. Can be null on a packet constructed from a subpacket transfer sequence.

bool PayloadLengthMismatched
get

True, if reconstructed from a network packet sequence and one or more subpackets had an unexpected payload data length. Otherwise false.

string SenderGuid
get

String represenstation of the Guid identifying the sender

Int64 Sequence
getset

Sequence number of this packet


The documentation for this class was generated from the following file: