Libav
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
libavutil
buffer_internal.h
Go to the documentation of this file.
1
/*
2
* This file is part of Libav.
3
*
4
* Libav is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
8
*
9
* Libav 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 GNU
12
* Lesser General Public License for more details.
13
*
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with Libav; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
19
#ifndef AVUTIL_BUFFER_INTERNAL_H
20
#define AVUTIL_BUFFER_INTERNAL_H
21
22
#include <stdint.h>
23
24
#include "
buffer.h
"
25
#include "
thread.h
"
26
30
#define BUFFER_FLAG_READONLY (1 << 0)
31
34
#define BUFFER_FLAG_REALLOCATABLE (1 << 1)
35
36
struct
AVBuffer
{
37
uint8_t
*
data
;
38
int
size
;
43
volatile
int
refcount
;
44
48
void
(*
free
)(
void
*
opaque
,
uint8_t
*
data
);
49
53
void
*
opaque
;
54
58
int
flags
;
59
};
60
61
typedef
struct
BufferPoolEntry
{
62
uint8_t
*
data
;
63
64
/*
65
* Backups of the original opaque/free of the AVBuffer corresponding to
66
* data. They will be used to free the buffer when the pool is freed.
67
*/
68
void
*
opaque
;
69
void
(*
free
)(
void
*
opaque
,
uint8_t
*
data
);
70
71
AVBufferPool
*
pool
;
72
struct
BufferPoolEntry
*
next
;
73
}
BufferPoolEntry
;
74
75
struct
AVBufferPool
{
76
AVMutex
mutex
;
77
BufferPoolEntry
*
pool
;
78
79
/*
80
* This is used to track when the pool is to be freed.
81
* The pointer to the pool itself held by the caller is considered to
82
* be one reference. Each buffer requested by the caller increases refcount
83
* by one, returning the buffer to the pool decreases it by one.
84
* refcount reaches zero when the buffer has been uninited AND all the
85
* buffers have been released, then it's safe to free the pool and all
86
* the buffers in it.
87
*/
88
volatile
int
refcount
;
89
90
int
size
;
91
AVBufferRef
* (*alloc)(
int
size
);
92
};
93
94
#endif
/* AVUTIL_BUFFER_INTERNAL_H */
AVBuffer::free
void(* free)(void *opaque, uint8_t *data)
a callback for freeing the data
Definition:
buffer_internal.h:48
AVBufferPool::mutex
AVMutex mutex
Definition:
buffer_internal.h:76
BufferPoolEntry::opaque
void * opaque
Definition:
buffer_internal.h:68
BufferPoolEntry::next
struct BufferPoolEntry * next
Definition:
buffer_internal.h:72
AVBuffer::refcount
volatile int refcount
number of existing AVBufferRef instances referring to this buffer
Definition:
buffer_internal.h:43
AVBuffer::data
uint8_t * data
data described by this buffer
Definition:
buffer_internal.h:37
uint8_t
uint8_t
Definition:
audio_convert.c:194
AVBufferPool
The buffer pool.
Definition:
buffer_internal.h:75
AVMutex
#define AVMutex
Definition:
thread.h:44
BufferPoolEntry::free
void(* free)(void *opaque, uint8_t *data)
Definition:
buffer_internal.h:69
AVBuffer::flags
int flags
A combination of BUFFER_FLAG_*.
Definition:
buffer_internal.h:58
void
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
AVBuffer
A reference counted buffer type.
Definition:
buffer_internal.h:36
AVBufferPool::size
int size
Definition:
buffer_internal.h:90
buffer.h
refcounted data buffer API
BufferPoolEntry
Definition:
buffer_internal.h:61
AVBufferPool::refcount
volatile int refcount
Definition:
buffer_internal.h:88
AVBuffer::opaque
void * opaque
an opaque pointer, to be used by the freeing callback
Definition:
buffer_internal.h:53
BufferPoolEntry::data
uint8_t * data
Definition:
buffer_internal.h:62
AVBufferRef
A reference to a data buffer.
Definition:
buffer.h:81
BufferPoolEntry::pool
AVBufferPool * pool
Definition:
buffer_internal.h:71
AVBuffer::size
int size
size of data in bytes
Definition:
buffer_internal.h:38
AVBufferPool::pool
BufferPoolEntry * pool
Definition:
buffer_internal.h:77
thread.h
Generated on Tue Jun 16 2015 05:47:30 for Libav by
1.8.8