Show / Hide Table of Contents

Interface IPacket

Managed wrapper for the FFmpeg FFmpeg.AutoGen._AVPacket structure. Provides managed access to packet data, timestamps, and operations for video and audio streaming.

Inherited Members
IAVPointer<_AVPacket>.Pointer
Namespace: FFmpeg.Utils
Assembly: FFmpeg.dll
Syntax
public interface IPacket : IAVPointer<_AVPacket>

Properties

View Source

Data

Gets the raw data contained in the packet as a Span<T> of byte.

Declaration
Span<byte> Data { get; }
Property Value
Type Description
Span<byte>
View Source

DecompressionTime

Gets or sets the decompression timestamp (DTS) as a TimeSpan. The DecompressionTimestamp is calculated using the TimeBase.

Declaration
TimeSpan DecompressionTime { get; set; }
Property Value
Type Description
TimeSpan
View Source

DecompressionTimestamp

Gets or sets the decompression timestamp (DTS) of the packet, in stream time base units. This timestamp indicates when the packet should be decompressed.

Declaration
long DecompressionTimestamp { get; set; }
Property Value
Type Description
long
View Source

Duration

Gets or sets the duration of the packet in stream time base units.

Declaration
long Duration { get; set; }
Property Value
Type Description
long
View Source

Flags

Gets or sets the packet flags, which are a combination of PacketFlags values. These flags indicate specific characteristics of the packet (e.g., key frame, corrupted data).

Declaration
PacketFlags Flags { get; set; }
Property Value
Type Description
PacketFlags
View Source

Position

Gets or sets the byte position of the packet in the stream.

Declaration
long Position { get; set; }
Property Value
Type Description
long
View Source

PresentationTime

Gets or sets the presentation timestamp (PTS) as a TimeSpan. The PresentationTimestamp is calculated using the TimeBase.

Declaration
TimeSpan PresentationTime { get; set; }
Property Value
Type Description
TimeSpan
View Source

PresentationTimestamp

Gets or sets the presentation timestamp (PTS) of the packet, in stream time base units. This timestamp indicates when the packet should be presented to the user.

Declaration
long PresentationTimestamp { get; set; }
Property Value
Type Description
long
View Source

Size

Gets or sets the size of the packet's data in bytes.

Declaration
int Size { get; set; }
Property Value
Type Description
int
View Source

StreamIndex

Gets or sets the index of the stream this packet belongs to.

Declaration
int StreamIndex { get; set; }
Property Value
Type Description
int
View Source

TimeBase

Gets or sets the time base used for the packet's timestamps, represented as a Rational value. This value defines the unit of time for the PresentationTimestamp and DecompressionTimestamp.

Declaration
Rational TimeBase { get; set; }
Property Value
Type Description
Rational

Methods

View Source

Clone()

Creates a new AVPacket that references the same data as this packet. This creates a shallow copy, meaning the new packet will point to the same underlying data buffer.

Declaration
AVPacket Clone()
Returns
Type Description
AVPacket

A new AVPacket instance that references the same data.

Exceptions
Type Condition
OutOfMemoryException

Thrown when the clone operation fails due to insufficient memory allocation.

View Source

CloneTo(IPacket)

Clones the contents of this packet to the specified IPacket destination. This creates a deep copy of the packet, including its data and properties.

Declaration
void CloneTo(IPacket dst)
Parameters
Type Name Description
IPacket dst

The destination packet to clone the data to.

View Source

CopyProperties(IPacket)

Copies the properties of this packet, such as stream index and timestamps, to the specified IPacket destination without copying the actual data.

Declaration
void CopyProperties(IPacket dst)
Parameters
Type Name Description
IPacket dst

The destination packet to copy the properties to.

View Source

MoveTo(IPacket)

Moves the contents of this packet to the specified IPacket destination, effectively transferring ownership of the data without copying it.

Declaration
void MoveTo(IPacket dst)
Parameters
Type Name Description
IPacket dst

The destination packet to move the data to.

View Source

Resize(int)

Resizes the packet's data buffer to the specified size, either growing or shrinking it.

Declaration
void Resize(int size)
Parameters
Type Name Description
int size

The new size of the packet's data buffer in bytes.

Exceptions
Type Condition
OutOfMemoryException

Thrown if the packet cannot be resized due to insufficient memory during growth.

View Source

Unreference()

Unreferences the packet, decrementing the reference count and releasing associated resources if no references remain. This should be called when the packet is no longer needed.

Declaration
void Unreference()
  • View Source
In this article
Back to top Generated by DocFX