Go to the documentation of this file.
36 #define LINE_DATA_SIZE 9
53 #define OFFSET(x) offsetof(ReadVitcContext, x)
54 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
57 {
"scan_max",
"maximum line numbers to scan for VITC data",
OFFSET(scan_max),
AV_OPT_TYPE_INT, {.i64 = 45 }, -1, INT_MAX,
FLAGS },
68 crc = 0x01 | (
line[0] << 2);
69 crc ^= (
line[0] >> 6) | 0x04 | (
line[1] << 4);
70 crc ^= (
line[1] >> 4) | 0x10 | (
line[2] << 6);
71 crc ^= (
line[2] >> 2) | 0x40;
73 crc ^= 0x01 | (
line[4] << 2);
74 crc ^= (
line[4] >> 6) | 0x04 | (
line[5] << 4);
75 crc ^= (
line[5] >> 4) | 0x10 | (
line[6] << 6);
76 crc ^= (
line[6] >> 2) | 0x40;
79 crc = (crc >> 2) | (crc << 6);
90 int grp_index, pit_index;
95 if (
ctx->scan_max >= 0)
99 for (y = 0; y <
height; y++) {
104 while ((x <
width) && (grp_index < 9)) {
106 while ((x <
width) && (scan_line[x] <
ctx->threshold_white))
108 while ((x <
width) && (scan_line[x] >
ctx->threshold_black))
110 x =
FFMAX(x - ((
ctx->grp_width+10) / 20), 1);
112 if ((grp_start_pos +
ctx->grp_width) >
width)
115 if (pit_value < ctx->threshold_white)
117 x = grp_start_pos + ((
ctx->grp_width) / 10);
119 if (pit_value >
ctx->threshold_black )
121 for (pit_index = 0; pit_index <= 7; pit_index++) {
122 x = grp_start_pos + (((pit_index+2)*
ctx->grp_width) / 10);
124 if (pit_value >
ctx->threshold_gray)
125 ctx->line_data[grp_index] |= (1 << pit_index);
141 if (high > 9 || low > 9)
143 return 10*high + low;
152 unsigned drop = (
line[1] & 0x04);
154 hh, mm,
ss, drop ?
';' :
':', ff);
162 s->threshold_black =
s->thr_b * UINT8_MAX;
163 s->threshold_white =
s->thr_w * UINT8_MAX;
164 if (
s->threshold_black >
s->threshold_white) {
169 s->threshold_gray =
s->threshold_white - ((
s->threshold_white -
s->threshold_black) / 2);
171 s->threshold_black,
s->threshold_white,
s->threshold_gray);
181 s->grp_width =
inlink->w * 5 / 48;
224 av_dict_set(&
frame->metadata,
"lavfi.readvitc.found", (found ?
"1" :
"0"), 0);
251 .description =
NULL_IF_CONFIG_SMALL(
"Read vertical interval timecode and write it to frame metadata."),
253 .priv_class = &readvitc_class,
static uint8_t get_vitc_crc(uint8_t *line)
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_TIMECODE_STR_SIZE
AVPixelFormat
Pixel format.
static int config_props(AVFilterLink *inlink)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static av_cold int init(AVFilterContext *ctx)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static char * make_vitc_tc_string(char *buf, uint8_t *line)
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
This structure describes decoded (raw) audio or video data.
static const AVFilterPad inputs[]
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
const char * name
Filter name.
A link between two filters.
static const AVFilterPad outputs[]
#define ss(width, name, subs,...)
A filter pad used for either input or output.
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static int read_vitc_line(ReadVitcContext *ctx, uint8_t *src, int line_size, int width, int height)
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Describe the class of an AVClass context structure.
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_PIX_FMT_NV16
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
AVFILTER_DEFINE_CLASS(readvitc)
uint8_t line_data[LINE_DATA_SIZE]
#define i(width, name, range_min, range_max)
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
static unsigned bcd2uint(uint8_t high, uint8_t low)
const char * name
Pad name.
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
static const AVOption readvitc_options[]
static uint8_t get_pit_avg3(uint8_t *line, int i)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
static int query_formats(AVFilterContext *ctx)
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
char tcbuf[AV_TIMECODE_STR_SIZE]
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)