packets

This module provides the transport layer Packet support code. For internal usage only: do not use nor import directly.

class pyrana.packet.Packet(stream_id=None, data=None, pts=-9223372036854775808, dts=-9223372036854775808, is_key=False)

a Packet object represents an immutable, encoded packet of a multimedia stream.

blob()

returns the bytes() dump of the object

data

the raw data (bytes) this packet carries.

dts

the Decoding TimeStamp of this packet.

classmethod from_cdata(cpkt)

builds a pyrana Packet from (around) a (cffi-wrapped) libav* packet object. The libav object must be already initialized and ready to go. WARNING: raw access. Use with care.

is_key

boolean flag. Is this packet a key frame? (provided by libav*)

pts

the Presentation TimeStamp of this packet.

raw_pkt(*args, **kwds)

raw access to the underlying FFmpeg packet. used by decoders in some corner but important cases. For internal usage only. TODO: ensure R/O and (thus) simplify

size

Size of the packet data (bytes)

stream_id

the identifier of the logical stream which this packet belongs to.

class pyrana.packet.PacketFlags

wrapper for the (wannabe)enum of AVPktFlag in libavcodec/avcodec.h

pyrana.packet.bind_packet(*args, **kwds)

allocates an AVPacket and cleans it up on exception.

pyrana.packet.raw_packet(*args, **kwds)

context manager for a raw ffmpeg packet of the given size.