agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 1 | /** |
Sébastien Blin | cb783e3 | 2021-02-12 11:34:10 -0500 | [diff] [blame] | 2 | * Copyright (C) 2020-2021 Savoir-faire Linux Inc. |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 3 | * |
| 4 | * Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | */ |
| 20 | |
| 21 | #include "frameUtils.h" |
| 22 | |
| 23 | extern "C" { |
| 24 | #include <libavutil/avutil.h> |
| 25 | } |
| 26 | |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 27 | void |
| 28 | moveFrom(AVFrame* dst, AVFrame* src) |
| 29 | { |
| 30 | if (dst && src) { |
Aline Gondim Santos | f912220 | 2023-06-09 11:44:49 -0300 | [diff] [blame] | 31 | av_frame_copy_props(src, dst); |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 32 | av_frame_unref(dst); |
| 33 | av_frame_move_ref(dst, src); |
| 34 | } |
| 35 | } |
agsantos | 4bb4bc5 | 2021-03-08 14:21:45 -0500 | [diff] [blame] | 36 | |
| 37 | void |
| 38 | frameFree(AVFrame* frame) |
| 39 | { |
Adrien Beraud | 087d559 | 2023-03-06 11:22:33 -0500 | [diff] [blame] | 40 | if (frame) |
| 41 | av_frame_unref(frame); |
agsantos | 4bb4bc5 | 2021-03-08 14:21:45 -0500 | [diff] [blame] | 42 | av_frame_free(&frame); |
| 43 | } |
Aline Gondim Santos | bd75c21 | 2022-10-03 12:28:26 -0300 | [diff] [blame] | 44 | |
| 45 | uniqueFramePtr |
| 46 | getUniqueFrame() { |
| 47 | uniqueFramePtr frame = {av_frame_alloc(), frameFree}; |
| 48 | return frame; |
| 49 | } |