FFmpeg
Loading...
Searching...
No Matches
framepool.h
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * Copyright (c) 2015 Matthieu Bouron <matthieu.bouron stupeflix.com>
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg 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 GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef AVFILTER_FRAMEPOOL_H
22#define AVFILTER_FRAMEPOOL_H
23
24#include "libavutil/buffer.h"
25#include "libavutil/frame.h"
26#include "libavutil/internal.h"
27
28/**
29 * Frame pool. This structure must be initialized with
30 * ff_frame_pool_{video,audio}_reinit() and freed with ff_frame_pool_uninit().
31 */
32typedef struct FFFramePool {
33
35 union {
38 };
39
40 /* video */
41 int width;
42 int height;
43
44 /* audio */
45 int planes;
48
49 /* common */
50 int align;
51 int linesize[4];
52 AVBufferPool *pools[4]; /* for audio, only pools[0] is used */
53
55
56/**
57 * Recreate the video frame pool if its current configuration differs from the
58 * provided configuration. If initialization fails, the old pool is kept
59 * unchanged.
60 *
61 * @param pool pointer to the frame pool to be (re)initialized
62 * @param width width of each frame in this pool
63 * @param height height of each frame in this pool
64 * @param format format of each frame in this pool
65 * @param align buffers alignment of each frame in this pool
66 * @return 0 on success, a negative AVERROR otherwise.
67 */
69 int width,
70 int height,
72 int align);
73
74/**
75 * Recreate the audio frame pool if its current configuration differs from the
76 * provided configuration. If initialization fails, the old pool is kept
77 * unchanged.
78 *
79 * @param pool pointer to the frame pool to be (re)initialized
80 * @param channels channels of each frame in this pool
81 * @param nb_samples number of samples of each frame in this pool
82 * @param format format of each frame in this pool
83 * @param align buffers alignment of each frame in this pool
84 * @return 0 on success, a negative AVERROR otherwise.
85 */
87 int channels,
88 int nb_samples,
90 int align);
91
92/**
93 * Deallocate the frame pool. It is safe to call this function while
94 * some of the allocated frame are still in use.
95 *
96 * @param pool pointer to the frame pool to be uninitialized
97 */
99
100/**
101 * Allocate a new AVFrame, reusing old buffers from the pool when available.
102 * This function may be called simultaneously from multiple threads.
103 *
104 * @return a new AVFrame on success, NULL on error.
105 */
107
108
109#endif /* AVFILTER_FRAMEPOOL_H */
static const char *const format[]
Definition af_aiir.c:444
channels
Definition aptx.h:31
static const uint8_t *BS_FUNC align(BSCTX *bc)
Skip bits to a byte boundary.
refcounted data buffer API
reference-counted frame API
AVFrame * ff_frame_pool_get(FFFramePool *pool)
Allocate a new AVFrame, reusing old buffers from the pool when available.
Definition framepool.c:128
void ff_frame_pool_uninit(FFFramePool *pool)
Deallocate the frame pool.
Definition framepool.c:215
int ff_frame_pool_audio_reinit(FFFramePool *pool, int channels, int nb_samples, enum AVSampleFormat format, int align)
Recreate the audio frame pool if its current configuration differs from the provided configuration.
Definition framepool.c:244
int ff_frame_pool_video_reinit(FFFramePool *pool, int width, int height, enum AVPixelFormat format, int align)
Recreate the video frame pool if its current configuration differs from the provided configuration.
Definition framepool.c:223
AVMediaType
Definition avutil.h:198
AVSampleFormat
Audio sample formats.
Definition samplefmt.h:55
common internal API header
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
The buffer pool.
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
Frame pool.
Definition framepool.h:32
enum AVPixelFormat pix_fmt
Definition framepool.h:36
AVBufferPool * pools[4]
Definition framepool.h:52
enum AVSampleFormat sample_fmt
Definition framepool.h:37
int linesize[4]
Definition framepool.h:51
enum AVMediaType type
Definition framepool.h:34
int nb_samples
Definition framepool.h:47
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89