blob: 72890269db8f2eb957ec82727fa4fbf2c7089f95 [file] [log] [blame]
agsantosc9181b42020-11-26 12:03:04 -05001/**
Sébastien Blincb783e32021-02-12 11:34:10 -05002 * Copyright (C) 2020-2021 Savoir-faire Linux Inc.
agsantosc9181b42020-11-26 12:03:04 -05003 *
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
23extern "C" {
24#include <libavutil/avutil.h>
25}
26
agsantosc9181b42020-11-26 12:03:04 -050027void
28moveFrom(AVFrame* dst, AVFrame* src)
29{
30 if (dst && src) {
agsantos4bb4bc52021-03-08 14:21:45 -050031 av_frame_copy_props(src, dst);
agsantosc9181b42020-11-26 12:03:04 -050032 av_frame_unref(dst);
33 av_frame_move_ref(dst, src);
34 }
35}
agsantos4bb4bc52021-03-08 14:21:45 -050036
37void
38frameFree(AVFrame* frame)
39{
40 av_frame_unref(frame);
41 av_frame_free(&frame);
42}
Aline Gondim Santosbd75c212022-10-03 12:28:26 -030043
44uniqueFramePtr
45getUniqueFrame() {
46 uniqueFramePtr frame = {av_frame_alloc(), frameFree};
47 return frame;
48}