FFmpeg
4.0
libavfilter
vf_setparams.c
Go to the documentation of this file.
1
/*
2
* This file is part of FFmpeg.
3
*
4
* FFmpeg 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
* FFmpeg 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 FFmpeg; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
19
#include "
libavutil/pixfmt.h
"
20
#include "
libavutil/opt.h
"
21
#include "
avfilter.h
"
22
#include "
internal.h
"
23
#include "
video.h
"
24
25
typedef
struct
SetParamsContext
{
26
const
AVClass
*
class
;
27
int
color_range
;
28
}
SetParamsContext
;
29
30
#define OFFSET(x) offsetof(SetParamsContext, x)
31
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
32
33
static
const
AVOption
setrange_options
[] = {
34
{
"range"
,
"select color range"
,
OFFSET
(
color_range
),
AV_OPT_TYPE_INT
, {.i64=-1},-1,
AVCOL_RANGE_NB
-1,
FLAGS
,
"range"
},
35
{
"auto"
,
"keep the same color range"
, 0,
AV_OPT_TYPE_CONST
, {.i64=-1}, 0, 0,
FLAGS
,
"range"
},
36
{
"unspecified"
,
NULL
, 0,
AV_OPT_TYPE_CONST
, {.i64=
AVCOL_RANGE_UNSPECIFIED
}, 0, 0,
FLAGS
,
"range"
},
37
{
"unknown"
,
NULL
, 0,
AV_OPT_TYPE_CONST
, {.i64=
AVCOL_RANGE_UNSPECIFIED
}, 0, 0,
FLAGS
,
"range"
},
38
{
"limited"
,
NULL
, 0,
AV_OPT_TYPE_CONST
, {.i64=
AVCOL_RANGE_MPEG
}, 0, 0,
FLAGS
,
"range"
},
39
{
"tv"
,
NULL
, 0,
AV_OPT_TYPE_CONST
, {.i64=
AVCOL_RANGE_MPEG
}, 0, 0,
FLAGS
,
"range"
},
40
{
"mpeg"
,
NULL
, 0,
AV_OPT_TYPE_CONST
, {.i64=
AVCOL_RANGE_MPEG
}, 0, 0,
FLAGS
,
"range"
},
41
{
"full"
,
NULL
, 0,
AV_OPT_TYPE_CONST
, {.i64=
AVCOL_RANGE_JPEG
}, 0, 0,
FLAGS
,
"range"
},
42
{
"pc"
,
NULL
, 0,
AV_OPT_TYPE_CONST
, {.i64=
AVCOL_RANGE_JPEG
}, 0, 0,
FLAGS
,
"range"
},
43
{
"jpeg"
,
NULL
, 0,
AV_OPT_TYPE_CONST
, {.i64=
AVCOL_RANGE_JPEG
}, 0, 0,
FLAGS
,
"range"
},
44
{
NULL
}
45
};
46
47
AVFILTER_DEFINE_CLASS
(setrange);
48
49
static
int
filter_frame
(
AVFilterLink
*inlink,
AVFrame
*
frame
)
50
{
51
AVFilterContext
*
ctx
= inlink->
dst
;
52
SetParamsContext
*
s
= ctx->
priv
;
53
54
if
(s->
color_range
>= 0)
55
frame->
color_range
= s->
color_range
;
56
return
ff_filter_frame
(ctx->
outputs
[0], frame);
57
}
58
59
static
const
AVFilterPad
inputs
[] = {
60
{
61
.
name
=
"default"
,
62
.type =
AVMEDIA_TYPE_VIDEO
,
63
.filter_frame =
filter_frame
,
64
},
65
{
NULL
}
66
};
67
68
static
const
AVFilterPad
outputs
[] = {
69
{
70
.
name
=
"default"
,
71
.type =
AVMEDIA_TYPE_VIDEO
,
72
},
73
{
NULL
}
74
};
75
76
AVFilter
ff_vf_setrange
= {
77
.
name
=
"setrange"
,
78
.description =
NULL_IF_CONFIG_SMALL
(
"Force color range for the output video frame."
),
79
.priv_size =
sizeof
(
SetParamsContext
),
80
.priv_class = &setrange_class,
81
.inputs = inputs,
82
.outputs = outputs,
83
};
NULL
#define NULL
Definition:
coverity.c:32
s
const char * s
Definition:
avisynth_c.h:768
AVFrame
This structure describes decoded (raw) audio or video data.
Definition:
frame.h:218
AVOption
AVOption.
Definition:
opt.h:246
avfilter.h
Main libavfilter public API header.
AV_OPT_TYPE_INT
Definition:
opt.h:223
setrange_options
static const AVOption setrange_options[]
Definition:
vf_setparams.c:33
OFFSET
#define OFFSET(x)
Definition:
vf_setparams.c:30
color_range
color_range
Definition:
vf_selectivecolor.c:44
SetParamsContext::color_range
int color_range
Definition:
vf_setparams.c:27
AVFilterPad::name
const char * name
Pad name.
Definition:
internal.h:60
AV_OPT_TYPE_CONST
Definition:
opt.h:232
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition:
avfilter.c:1080
opt.h
AVOptions.
frame
static AVFrame * frame
Definition:
demuxing_decoding.c:53
AVCOL_RANGE_NB
Not part of ABI.
Definition:
pixfmt.h:500
video.h
inputs
static const AVFilterPad inputs[]
Definition:
vf_setparams.c:59
AVFilterPad
A filter pad used for either input or output.
Definition:
internal.h:54
AVFilterLink
A link between two filters.
Definition:
avfilter.h:439
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition:
internal.h:186
AVFilterContext::priv
void * priv
private data for use by the filter
Definition:
avfilter.h:353
AVFrame::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition:
frame.h:463
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition:
vf_setparams.c:49
ctx
AVFormatContext * ctx
Definition:
movenc.c:48
outputs
static const AVFilterPad outputs[]
Definition:
vf_setparams.c:68
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(setrange)
AVCOL_RANGE_JPEG
the normal 2^n-1 "JPEG" YUV ranges
Definition:
pixfmt.h:499
AVClass
Describe the class of an AVClass context structure.
Definition:
log.h:67
AVFilter
Filter definition.
Definition:
avfilter.h:144
AVFilter::name
const char * name
Filter name.
Definition:
avfilter.h:148
AVFilterContext::outputs
AVFilterLink ** outputs
array of pointers to output links
Definition:
avfilter.h:350
AVCOL_RANGE_MPEG
the normal 219*2^(n-8) "MPEG" YUV ranges
Definition:
pixfmt.h:498
SetParamsContext
Definition:
vf_setparams.c:25
FLAGS
#define FLAGS
Definition:
vf_setparams.c:31
pixfmt.h
pixel format definitions
AVFilterLink::dst
AVFilterContext * dst
dest filter
Definition:
avfilter.h:443
AVFilterContext
An instance of a filter.
Definition:
avfilter.h:338
ff_vf_setrange
AVFilter ff_vf_setrange
Definition:
vf_setparams.c:76
AVMEDIA_TYPE_VIDEO
Definition:
avutil.h:201
internal.h
internal API functions
AVCOL_RANGE_UNSPECIFIED
Definition:
pixfmt.h:497
Generated on Tue May 22 2018 07:06:51 for FFmpeg by
1.8.13