Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
libavfilter
avfilter.h
Go to the documentation of this file.
1
/*
2
* filter layer
3
* Copyright (c) 2007 Bobby Bingham
4
*
5
* This file is part of Libav.
6
*
7
* Libav is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
11
*
12
* Libav is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
16
*
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with Libav; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
22
#ifndef AVFILTER_AVFILTER_H
23
#define AVFILTER_AVFILTER_H
24
25
#include "
libavutil/avutil.h
"
26
#include "
libavutil/log.h
"
27
#include "
libavutil/samplefmt.h
"
28
#include "
libavutil/pixfmt.h
"
29
#include "
libavutil/rational.h
"
30
#include "
libavcodec/avcodec.h
"
31
32
#include <stddef.h>
33
34
#include "
libavfilter/version.h
"
35
39
unsigned
avfilter_version
(
void
);
40
44
const
char
*
avfilter_configuration
(
void
);
45
49
const
char
*
avfilter_license
(
void
);
50
51
52
typedef
struct
AVFilterContext
AVFilterContext
;
53
typedef
struct
AVFilterLink
AVFilterLink
;
54
typedef
struct
AVFilterPad
AVFilterPad
;
55
typedef
struct
AVFilterFormats
AVFilterFormats
;
56
62
typedef
struct
AVFilterBuffer
{
63
uint8_t
*
data
[8];
64
79
uint8_t
**
extended_data
;
80
int
linesize
[8];
81
83
void
*
priv
;
90
void
(*
free
)(
struct
AVFilterBuffer
*buf);
91
92
int
format
;
93
int
w
,
h
;
94
unsigned
refcount
;
95
}
AVFilterBuffer
;
96
97
#define AV_PERM_READ 0x01
98
#define AV_PERM_WRITE 0x02
99
#define AV_PERM_PRESERVE 0x04
100
#define AV_PERM_REUSE 0x08
101
#define AV_PERM_REUSE2 0x10
102
#define AV_PERM_NEG_LINESIZES 0x20
103
104
109
typedef
struct
AVFilterBufferRefAudioProps
{
110
uint64_t
channel_layout
;
111
int
nb_samples
;
112
int
sample_rate
;
113
int
planar
;
114
}
AVFilterBufferRefAudioProps
;
115
121
typedef
struct
AVFilterBufferRefVideoProps
{
122
int
w
;
123
int
h
;
124
AVRational
pixel_aspect
;
125
int
interlaced
;
126
int
top_field_first
;
127
enum
AVPictureType
pict_type
;
128
int
key_frame
;
129
}
AVFilterBufferRefVideoProps
;
130
139
typedef
struct
AVFilterBufferRef
{
140
AVFilterBuffer
*
buf
;
141
uint8_t
*
data
[8];
142
156
uint8_t
**
extended_data
;
157
int
linesize
[8];
158
159
AVFilterBufferRefVideoProps
*
video
;
160
AVFilterBufferRefAudioProps
*
audio
;
161
167
int64_t
pts
;
168
int64_t
pos
;
169
170
int
format
;
171
172
int
perms
;
173
174
enum
AVMediaType
type
;
175
}
AVFilterBufferRef
;
176
180
void
avfilter_copy_buffer_ref_props
(
AVFilterBufferRef
*dst,
AVFilterBufferRef
*src);
181
191
AVFilterBufferRef
*
avfilter_ref_buffer
(
AVFilterBufferRef
*ref,
int
pmask);
192
202
void
avfilter_unref_buffer
(
AVFilterBufferRef
*ref);
203
211
void
avfilter_unref_bufferp
(
AVFilterBufferRef
**ref);
212
213
#if FF_API_AVFILTERPAD_PUBLIC
214
222
struct
AVFilterPad
{
228
const
char
*
name
;
229
233
enum
AVMediaType
type
;
234
242
int
min_perms
;
243
253
int
rej_perms
;
254
258
int (*
start_frame
)(
AVFilterLink
*link,
AVFilterBufferRef
*picref);
259
266
AVFilterBufferRef
*(*get_video_buffer)(
AVFilterLink
*link,
int
perms,
int
w,
int
h);
267
274
AVFilterBufferRef
*(*get_audio_buffer)(
AVFilterLink
*link,
int
perms,
275
int
nb_samples
);
276
280
int (*
end_frame
)(
AVFilterLink
*link);
281
285
int (*
draw_slice
)(
AVFilterLink
*link,
int
y,
int
height
,
int
slice_dir);
286
297
int (*
filter_frame
)(
AVFilterLink
*link,
AVFilterBufferRef
*frame);
298
308
int (*
poll_frame
)(
AVFilterLink
*link);
309
317
int (*
request_frame
)(
AVFilterLink
*link);
318
333
int (*
config_props
)(
AVFilterLink
*link);
334
341
int
needs_fifo
;
342
};
343
#endif
344
354
const
char
*
avfilter_pad_get_name
(
AVFilterPad
*pads,
int
pad_idx);
355
365
enum
AVMediaType
avfilter_pad_get_type
(
AVFilterPad
*pads,
int
pad_idx);
366
371
typedef
struct
AVFilter
{
372
const
char
*
name
;
373
378
const
char
*
description
;
379
380
const
AVFilterPad
*
inputs
;
381
const
AVFilterPad
*
outputs
;
382
383
/*****************************************************************
384
* All fields below this line are not part of the public API. They
385
* may not be used outside of libavfilter and can be changed and
386
* removed at will.
387
* New public fields should be added right above.
388
*****************************************************************
389
*/
390
395
int (*
init
)(
AVFilterContext
*ctx,
const
char
*args);
396
402
void
(*
uninit
)(
AVFilterContext
*ctx);
403
412
int (*
query_formats
)(
AVFilterContext
*);
413
414
int
priv_size
;
415
}
AVFilter
;
416
418
struct
AVFilterContext
{
419
const
AVClass
*
av_class
;
420
421
AVFilter
*
filter
;
422
423
char
*
name
;
424
425
AVFilterPad
*
input_pads
;
426
AVFilterLink
**
inputs
;
427
#if FF_API_FOO_COUNT
428
unsigned
input_count;
429
#endif
430
unsigned
nb_inputs
;
431
432
AVFilterPad
*
output_pads
;
433
AVFilterLink
**
outputs
;
434
#if FF_API_FOO_COUNT
435
unsigned
output_count;
436
#endif
437
unsigned
nb_outputs
;
438
439
void
*
priv
;
440
};
441
449
struct
AVFilterLink
{
450
AVFilterContext
*
src
;
451
AVFilterPad
*
srcpad
;
452
453
AVFilterContext
*
dst
;
454
AVFilterPad
*
dstpad
;
455
456
enum
AVMediaType
type
;
457
458
/* These parameters apply only to video */
459
int
w
;
460
int
h
;
461
AVRational
sample_aspect_ratio
;
462
/* These two parameters apply only to audio */
463
uint64_t
channel_layout
;
464
int
sample_rate
;
465
466
int
format
;
467
475
AVRational
time_base
;
476
477
/*****************************************************************
478
* All fields below this line are not part of the public API. They
479
* may not be used outside of libavfilter and can be changed and
480
* removed at will.
481
* New public fields should be added right above.
482
*****************************************************************
483
*/
489
AVFilterFormats
*
in_formats
;
490
AVFilterFormats
*
out_formats
;
491
496
AVFilterFormats
*
in_samplerates
;
497
AVFilterFormats
*
out_samplerates
;
498
struct
AVFilterChannelLayouts
*
in_channel_layouts
;
499
struct
AVFilterChannelLayouts
*
out_channel_layouts
;
500
508
int
request_samples
;
509
511
enum
{
512
AVLINK_UNINIT
= 0,
513
AVLINK_STARTINIT
,
514
AVLINK_INIT
515
}
init_state
;
516
};
517
527
int
avfilter_link
(
AVFilterContext
*src,
unsigned
srcpad,
528
AVFilterContext
*dst,
unsigned
dstpad);
529
536
int
avfilter_config_links
(
AVFilterContext
*
filter
);
537
549
AVFilterBufferRef
*
550
avfilter_get_video_buffer_ref_from_arrays
(
uint8_t
*
data
[4],
int
linesize[4],
int
perms,
551
int
w,
int
h,
enum
AVPixelFormat
format);
552
564
AVFilterBufferRef
*
avfilter_get_audio_buffer_ref_from_arrays
(
uint8_t
**
data
,
565
int
linesize,
566
int
perms,
567
int
nb_samples
,
568
enum
AVSampleFormat
sample_fmt
,
569
uint64_t channel_layout);
570
572
void
avfilter_register_all
(
void
);
573
575
void
avfilter_uninit
(
void
);
576
587
int
avfilter_register
(
AVFilter
*
filter
);
588
596
AVFilter
*
avfilter_get_by_name
(
const
char
*
name
);
597
604
AVFilter
**
av_filter_next
(
AVFilter
**
filter
);
605
615
int
avfilter_open
(
AVFilterContext
**filter_ctx,
AVFilter
*
filter
,
const
char
*inst_name);
616
627
int
avfilter_init_filter
(
AVFilterContext
*
filter
,
const
char
*args,
void
*opaque);
628
634
void
avfilter_free
(
AVFilterContext
*
filter
);
635
645
int
avfilter_insert_filter
(
AVFilterLink
*link,
AVFilterContext
*filt,
646
unsigned
filt_srcpad_idx,
unsigned
filt_dstpad_idx);
647
654
int
avfilter_copy_frame_props
(
AVFilterBufferRef
*dst,
const
AVFrame
*src);
655
662
int
avfilter_copy_buf_props
(
AVFrame
*dst,
const
AVFilterBufferRef
*src);
663
664
#endif
/* AVFILTER_AVFILTER_H */