FFmpegfs Fuse Multi Media Filesystem 2.19
Loading...
Searching...
No Matches
ffmpeg_packet.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017-2026 by Norbert Schlia (nschlia@oblivion-software.de)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 */
9
17#ifndef FFMPEG_PACKET_H
18#define FFMPEG_PACKET_H
19
20#pragma once
21
22#include "ffmpeg_utils.h"
23
33{
34public:
38 explicit FFmpeg_Packet(int stream_index = INVALID_STREAM);
42 FFmpeg_Packet(const AVPacket *packet); // cppcheck-suppress noExplicitConstructor
46 FFmpeg_Packet(const FFmpeg_Packet &packet);
50 FFmpeg_Packet(FFmpeg_Packet &&packet) noexcept;
54 virtual ~FFmpeg_Packet();
55
59 FFmpeg_Packet& operator=(const FFmpeg_Packet &packet) noexcept;
63 FFmpeg_Packet& operator=(FFmpeg_Packet &&packet) noexcept;
67 FFmpeg_Packet& operator=(const AVPacket *packet) noexcept;
68
73 int res() const;
77 AVPacket* clone() const;
81 void unref();
85 void free();
89 AVPacket* get();
93 const AVPacket* get() const;
94
98 operator AVPacket*();
102 operator const AVPacket*() const;
106 AVPacket* operator->();
110 const AVPacket* operator->() const;
111
112protected:
113 AVPacket * m_packet;
114 int m_res;
115};
116
117#endif // FFMPEG_PACKET_H
RAII wrapper for AVPacket.
AVPacket * clone() const
Clone packet to a new AVPacket*. Caller owns the returned packet.
void unref()
Unreference packet payload, keep the AVPacket object allocated.
AVPacket * m_packet
Pointer to underlying AVPacket struct.
void free()
Free the underlying packet.
virtual ~FFmpeg_Packet()
Free the underlying packet.
AVPacket * operator->()
operator ->: behave like a packet pointer.
int res() const
Get result of last operation.
int m_res
0 if last operation was successful, or negative AVERROR value
AVPacket * get()
Access the underlying packet.
FFmpeg_Packet & operator=(const FFmpeg_Packet &packet) noexcept
Deep-copy assign from another wrapper.
Various FFmpegfs utility functions.
#define INVALID_STREAM
Denote an invalid stream.