Statistics
| Branch: | Revision:

ffmpeg / libavfilter / vsrc_nullsrc.c @ 72415b2a

History | View | Annotate | Download (2.05 KB)

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
/**
20
 * @file libavfilter/vsrc_nullsrc.c
21
 * null video source
22
 */
23

    
24
#include "avfilter.h"
25

    
26
typedef struct {
27
    int w, h;
28
} NullContext;
29

    
30
static int init(AVFilterContext *ctx, const char *args, void *opaque)
31
{
32
    NullContext *priv = ctx->priv;
33

    
34
    priv->w = 352;
35
    priv->h = 288;
36

    
37
    if (args)
38
        sscanf(args, "%d:%d", &priv->w, &priv->h);
39

    
40
    if (priv->w <= 0 || priv->h <= 0) {
41
        av_log(ctx, AV_LOG_ERROR, "Non-positive size values are not acceptable.\n");
42
        return -1;
43
    }
44

    
45
    return 0;
46
}
47

    
48
static int config_props(AVFilterLink *outlink)
49
{
50
    NullContext *priv = outlink->src->priv;
51

    
52
    outlink->w = priv->w;
53
    outlink->h = priv->h;
54

    
55
    av_log(outlink->src, AV_LOG_INFO, "w:%d h:%d\n", priv->w, priv->h);
56

    
57
    return 0;
58
}
59

    
60
static int request_frame(AVFilterLink *link)
61
{
62
    return -1;
63
}
64

    
65
AVFilter avfilter_vsrc_nullsrc = {
66
    .name        = "nullsrc",
67
    .description = "Null video source, never return images.",
68

    
69
    .init       = init,
70
    .priv_size = sizeof(NullContext),
71

    
72
    .inputs    = (AVFilterPad[]) {{ .name = NULL}},
73

    
74
    .outputs   = (AVFilterPad[]) {
75
        {
76
            .name            = "default",
77
            .type            = AVMEDIA_TYPE_VIDEO,
78
            .config_props    = config_props,
79
            .request_frame   = request_frame,
80
        },
81
        { .name = NULL}
82
    },
83
};