FFmpegfs Fuse Multi Media Filesystem 2.16
ffmpeg_frame.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017-2024 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 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17 *
18 * On Debian systems, the complete text of the GNU General Public License
19 * Version 3 can be found in `/usr/share/common-licenses/GPL-3'.
20 */
21
32#ifndef FFMPEG_FRAME_H
33#define FFMPEG_FRAME_H
34
35#pragma once
36
37struct AVFrame;
38
43{
44public:
49 explicit FFmpeg_Frame(int stream_index = INVALID_STREAM);
55 FFmpeg_Frame(const FFmpeg_Frame & frame);
61 FFmpeg_Frame(const AVFrame * frame); // cppcheck-suppress noExplicitConstructor
65 virtual ~FFmpeg_Frame();
70 int res() const;
75 AVFrame* clone();
79 void unref();
83 void free();
88 AVFrame* get();
89
93 operator AVFrame*();
97 operator const AVFrame*() const;
102 AVFrame* operator->();
108 FFmpeg_Frame& operator=(const FFmpeg_Frame & frame) noexcept;
114 FFmpeg_Frame& operator=(const AVFrame * frame) noexcept;
115
116protected:
117 AVFrame * m_frame;
118 int m_res;
120public:
122};
123
124#endif // FFMPEG_FRAME_H
The FFmpeg_Frame class.
Definition: ffmpeg_frame.h:43
int m_stream_idx
Stream index frame belongs to, or -1 (INVALID_STREAM)
Definition: ffmpeg_frame.h:121
FFmpeg_Frame & operator=(const FFmpeg_Frame &frame) noexcept
Make copy from other FFmpeg_Frame object.
virtual ~FFmpeg_Frame()
Destruct FFmpeg_Frame object.
Definition: ffmpeg_frame.cc:90
AVFrame * operator->()
operator ->: Do as if we were a pointer to AVFrame
void unref()
Unreference underlying frame.
AVFrame * m_frame
Pointer to underlying AVFrame struct.
Definition: ffmpeg_frame.h:117
AVFrame * clone()
Clone frame to a new AVFrame * struct. Needs to be freed by a av_frame_free() call.
Definition: ffmpeg_frame.cc:95
AVFrame * get()
Access the underlying frame.
FFmpeg_Frame(int stream_index=INVALID_STREAM)
Construct FFmpeg_Frame object.
Definition: ffmpeg_frame.cc:48
void free()
Free underlying frame.
int m_res
0 if last operation was successful, or negative AVERROR value
Definition: ffmpeg_frame.h:118
int res() const
Get result of last operation.
#define INVALID_STREAM
Denote an invalid stream.
Definition: ffmpeg_utils.h:77