|
| | Packet (std::nullptr_t) |
| | Create an empty packet without allocating.
|
|
| Packet () |
| | Create an empty, valid packet with an allocated FFmpeg structure.
|
| | Packet (const Packet &packet, OptionalErrorCode ec) |
| | Copy a packet as a reference to the same data.
|
| | Packet (const Packet &packet) |
| | Copy a packet as a reference to the same data.
|
| | Packet (Packet &&packet) |
| | Move a packet.
|
| | Packet (const AVPacket *packet, OptionalErrorCode ec=throws()) |
| | Wrap an FFmpeg packet.
|
| | Packet (const std::vector< uint8_t > &data) |
| | Copy a byte vector into the packet payload.
|
| | Packet (const uint8_t *data, size_t size, bool doAllign=true) |
| | Copy a memory block into the packet payload.
|
| | Packet (uint8_t *data, size_t size, wrap_data, OptionalErrorCode ec=throws()) |
| | Take ownership of a buffer allocated with the FFmpeg allocator.
|
| | Packet (uint8_t *data, size_t size, wrap_data_static, OptionalErrorCode ec=throws()) |
| | Wrap static data without taking ownership.
|
| | Packet (std::span< const uint8_t > data, bool doAllign=true) |
| | Copy a span into the packet payload.
|
| | Packet (std::span< uint8_t > data, wrap_data, OptionalErrorCode ec=throws()) |
| | Take ownership of a span allocated with the FFmpeg allocator.
|
| | Packet (std::span< uint8_t > data, wrap_data_static, OptionalErrorCode ec=throws()) |
| | Wrap static data from a span without taking ownership.
|
| bool | setData (const std::vector< uint8_t > &newData, OptionalErrorCode ec=throws()) |
| | Replace the payload with a copy of a byte vector.
|
| bool | setData (const uint8_t *newData, size_t size, OptionalErrorCode ec=throws()) |
| | Replace the payload with a copy of a memory block.
|
| const uint8_t * | data () const |
| | Read access to the payload.
|
| uint8_t * | data () |
| | Write access to the payload.
|
| bool | setData (std::span< const uint8_t > newData, OptionalErrorCode ec=throws()) |
| | Replace the payload with a copy of a span.
|
| std::span< const uint8_t > | span () const |
| | Read-only view of the payload.
|
| std::span< uint8_t > | span () |
| | Mutable view of the payload.
|
| Timestamp | pts () const |
| | Presentation timestamp.
|
| Timestamp | dts () const |
| | Decoding timestamp.
|
| Timestamp | ts () const |
| | Timestamp FFmpeg would use for display, falling back to the decoding one.
|
| size_t | size () const |
| | Payload size.
|
| attribute_deprecated void | setPts (int64_t pts, const Rational &tsTimeBase=Rational(0, 0)) |
| | Set the presentation timestamp.
|
| attribute_deprecated void | setDts (int64_t dts, const Rational &tsTimeBase=Rational(0, 0)) |
| | Set the decoding timestamp.
|
| void | setPts (const Timestamp &pts) |
| | Set the presentation timestamp.
|
| void | setDts (const Timestamp &dts) |
| | Set the decoding timestamp.
|
| int | streamIndex () const |
| | Index of the stream the packet belongs to.
|
| bool | isKeyPacket () const |
| | Whether the packet is a key frame.
|
| int | duration () const |
| | Duration of the packet, in time base units.
|
| bool | isComplete () const |
| | Whether the packet is marked complete.
|
| bool | isNull () const |
| | Whether the packet has no payload.
|
| void | setStreamIndex (int idx) |
| | Set the stream index.
|
| void | setKeyPacket (bool keyPacket) |
| | Mark the packet as a key frame.
|
| void | setDuration (int duration, const Rational &durationTimeBase=Rational(0, 0)) |
| | Set the packet duration.
|
| void | setComplete (bool complete) |
| | Mark the packet as complete.
|
| int | flags () const |
| | Raw AV_PKT_FLAG_* mask.
|
| void | setFlags (int flags) |
| | Replace the AV_PKT_FLAG_* mask.
|
| void | addFlags (int flags) |
| | Add flags.
|
| void | clearFlags (int flags) |
| | Remove flags.
|
| void | dump (const Stream &st, bool dumpPayload=false) const |
| | Print the packet through the FFmpeg log system.
|
| const Rational & | timeBase () const |
| | Time base of pts() and dts().
|
| void | setTimeBase (const Rational &value) |
| | Set the time base used by pts() and dts().
|
| std::span< const uint8_t > | sideData (AVPacketSideDataType type) const |
| | Read-only access to the side data of the given type.
|
| std::span< uint8_t > | sideData (AVPacketSideDataType type) |
| | Mutable access to the side data of the given type.
|
| std::size_t | sideDataCount () const noexcept |
| | Return count of the side data elements.
|
| PacketSideData | sideDataIndex (std::size_t index) noexcept |
| | Get side data element by index.
|
| ArrayView< AVPacketSideData, PacketSideData, std::size_t > | sideData () noexcept |
| | Observe all packet side data via iterators.
|
| ArrayView< const AVPacketSideData, PacketSideData, std::size_t > | sideData () const noexcept |
| | Read-only iteration over all side data entries.
|
|
void | freeSideData () noexcept |
| | Remove and free all side data entries.
|
| void | addSideData (AVPacketSideDataType type, std::span< const uint8_t > data, OptionalErrorCode ec=throws()) |
| | Add side data of the given type into packet.
|
| void | addSideData (AVPacketSideDataType type, std::span< uint8_t > data, wrap_data, OptionalErrorCode ec=throws()) |
| | Add side data of the given type into packet.
|
| std::span< uint8_t > | allocateSideData (AVPacketSideDataType type, std::size_t size, OptionalErrorCode ec=throws()) |
| | Allocate storage for the packet side data of the given type and return reference to it.
|
| bool | isReferenced () const |
| | Whether the payload is reference counted.
|
| int | refCount () const |
| | Number of references to the payload.
|
| AVPacket * | makeRef (OptionalErrorCode ec) const |
| | Create an independent reference to the packet.
|
| Packet | clone (OptionalErrorCode ec=throws()) const |
| | Deep copy of the packet, payload included.
|
| Packet & | operator= (const Packet &rhs) |
| | Assign by referencing the other packet's payload.
|
| Packet & | operator= (Packet &&rhs) |
| | Move assignment.
|
| Packet & | operator= (const AVPacket *rhs) |
| | Assign from an FFmpeg packet.
|
| void | swap (Packet &other) |
| | Exchange the contents of two packets.
|
| | operator bool () const |
| | Whether the packet is complete.
|
|
| FFWrapperPtr ()=default |
| | Create an empty wrapper; isNull() is true.
|
| const AVPacket * | raw () const |
| | Read access to the wrapped object.
|
| void | reset (AVPacket *raw=nullptr) |
| | Replace the stored pointer.
|
| bool | isNull () const |
| | Whether the wrapper is empty.
|
| void | _log (int level, const char *fmt) const |
| | Log through the FFmpeg log system, using this wrapper as the context.
|
A packet belongs to exactly one stream: it carries the stream index, the presentation and decoding timestamps, the duration and the flags of one compressed unit. Reading gives packets, writing consumes them; decoding turns them into frames and encoding turns frames back into packets.
Buffers are allocated with the FFmpeg allocator and always carry the zeroed AV_INPUT_BUFFER_PADDING_SIZE bytes after the payload. This is not optional: some muxers and parsers read payloads as C strings, and the ASS muxer does exactly that.
- Examples
- api2-decode-audio.cpp, api2-decode-encode-audio.cpp, api2-decode-encode-video.cpp, api2-decode-filter-encode.cpp, api2-decode-overlay-encode.cpp, api2-decode-rasample-audio.cpp, api2-decode-raw-h264.cpp, api2-decode.cpp, api2-generate-subtitles.cpp, api2-hw-decode.cpp, api2-hw-encode.cpp, api2-hw-scale.cpp, api2-hw-transcode.cpp, api2-scale-video.cpp, api2-send-receive.cpp, and api2-subtitles.cpp.