Show / Hide Table of Contents

Struct AVPacket_ref

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

Implements
IPacket
IAVPointer<_AVPacket>
IReference<AVPacket>
Inherited Members
ValueType.Equals(object)
ValueType.GetHashCode()
ValueType.ToString()
object.GetType()
object.Equals(object, object)
object.ReferenceEquals(object, object)
Namespace: FFmpeg.Utils
Assembly: FFmpeg.dll
Syntax
public readonly struct AVPacket_ref : IPacket, IAVPointer<_AVPacket>, IReference<AVPacket>

Properties

View Source

Data

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

Declaration
public 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
public 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
public 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
public 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
public 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
public 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
public 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
public 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
public 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
public 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
public 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
public 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
public 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
public void CopyProperties(IPacket dst)
Parameters
Type Name Description
IPacket dst

The destination packet to copy the properties to.

View Source

GetReferencedObject()

Gets the object currently being referenced. Or a copy if the type is nor reference counted.

Declaration
public AVPacket? GetReferencedObject()
Returns
Type Description
AVPacket

The referenced object of type AVPacket if available, or null if not.

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
public 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
public 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

SetReferencedObject(AVPacket?)

Sets the reference to a new object of type AVPacket or creates a copy if the type is not reference counted or unlinks the current reference.

Declaration
public void SetReferencedObject(AVPacket? packet)
Parameters
Type Name Description
AVPacket packet
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
public void Unreference()

Implements

IPacket
IAVPointer<T>
IReference<T>
  • View Source
In this article
Back to top Generated by DocFX