Libav
|
00001 /* 00002 * This file is part of FFmpeg. 00003 * 00004 * FFmpeg is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * FFmpeg is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with FFmpeg; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00017 */ 00018 00024 #include "avfilter.h" 00025 00026 typedef struct { 00027 int w, h; 00028 } NullContext; 00029 00030 static int init(AVFilterContext *ctx, const char *args, void *opaque) 00031 { 00032 NullContext *priv = ctx->priv; 00033 00034 priv->w = 352; 00035 priv->h = 288; 00036 00037 if (args) 00038 sscanf(args, "%d:%d", &priv->w, &priv->h); 00039 00040 if (priv->w <= 0 || priv->h <= 0) { 00041 av_log(ctx, AV_LOG_ERROR, "Non-positive size values are not acceptable.\n"); 00042 return -1; 00043 } 00044 00045 return 0; 00046 } 00047 00048 static int config_props(AVFilterLink *outlink) 00049 { 00050 NullContext *priv = outlink->src->priv; 00051 00052 outlink->w = priv->w; 00053 outlink->h = priv->h; 00054 00055 av_log(outlink->src, AV_LOG_INFO, "w:%d h:%d\n", priv->w, priv->h); 00056 00057 return 0; 00058 } 00059 00060 static int request_frame(AVFilterLink *link) 00061 { 00062 return -1; 00063 } 00064 00065 AVFilter avfilter_vsrc_nullsrc = { 00066 .name = "nullsrc", 00067 .description = "Null video source, never return images.", 00068 00069 .init = init, 00070 .priv_size = sizeof(NullContext), 00071 00072 .inputs = (AVFilterPad[]) {{ .name = NULL}}, 00073 00074 .outputs = (AVFilterPad[]) { 00075 { 00076 .name = "default", 00077 .type = AVMEDIA_TYPE_VIDEO, 00078 .config_props = config_props, 00079 .request_frame = request_frame, 00080 }, 00081 { .name = NULL} 00082 }, 00083 };