FFmpeg
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  */
32 typedef struct FFFramePool {
33 
35  union {
38  };
39 
40  /* video */
41  int width;
42  int height;
43 
44  /* audio */
45  int planes;
46  int channels;
48 
49  /* common */
50  int align;
51  int linesize[4];
52  AVBufferPool *pools[4]; /* for audio, only pools[0] is used */
53 
54 } FFFramePool;
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,
71  enum AVPixelFormat format,
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 */
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
AVBufferPool
The buffer pool.
Definition: buffer_internal.h:88
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:434
FFFramePool::nb_samples
int nb_samples
Definition: framepool.h:47
ff_frame_pool_video_reinit
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
FFFramePool::planes
int planes
Definition: framepool.h:45
FFFramePool
Frame pool.
Definition: framepool.h:32
FFFramePool::sample_fmt
enum AVSampleFormat sample_fmt
Definition: framepool.h:37
channels
channels
Definition: aptx.h:31
FFFramePool::pools
AVBufferPool * pools[4]
Definition: framepool.h:52
ff_frame_pool_uninit
void ff_frame_pool_uninit(FFFramePool *pool)
Deallocate the frame pool.
Definition: framepool.c:215
FFFramePool::pix_fmt
enum AVPixelFormat pix_fmt
Definition: framepool.h:36
ff_frame_pool_get
AVFrame * ff_frame_pool_get(FFFramePool *pool)
Allocate a new AVFrame, reusing old buffers from the pool when available.
Definition: framepool.c:128
format
New swscale design to change SwsGraph is what coordinates multiple passes These can include cascaded scaling error diffusion and so on Or we could have separate passes for the vertical and horizontal scaling In between each SwsPass lies a fully allocated image buffer Graph passes may have different levels of e g we can have a single threaded error diffusion pass following a multi threaded scaling pass SwsGraph is internally recreated whenever the image format
Definition: swscale-v2.txt:14
AVMediaType
AVMediaType
Definition: avutil.h:198
height
#define height
Definition: dsp.h:89
frame.h
buffer.h
align
static const uint8_t *BS_FUNC() align(BSCTX *bc)
Skip bits to a byte boundary.
Definition: bitstream_template.h:419
FFFramePool::width
int width
Definition: framepool.h:41
FFFramePool::height
int height
Definition: framepool.h:42
internal.h
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
FFFramePool::align
int align
Definition: framepool.h:50
ff_frame_pool_audio_reinit
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
FFFramePool::linesize
int linesize[4]
Definition: framepool.h:51
width
#define width
Definition: dsp.h:89
FFFramePool::type
enum AVMediaType type
Definition: framepool.h:34
FFFramePool::channels
int channels
Definition: framepool.h:46