LCOV - code coverage report
Current view: top level - libavfilter - f_sendcmd.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 234 0.0 %
Date: 2017-12-10 21:22:29 Functions: 0 10 0.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2012 Stefano Sabatini
       3             :  *
       4             :  * This file is part of FFmpeg.
       5             :  *
       6             :  * FFmpeg is free software; you can redistribute it and/or
       7             :  * modify it under the terms of the GNU Lesser General Public
       8             :  * License as published by the Free Software Foundation; either
       9             :  * version 2.1 of the License, or (at your option) any later version.
      10             :  *
      11             :  * FFmpeg is distributed in the hope that it will be useful,
      12             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14             :  * Lesser General Public License for more details.
      15             :  *
      16             :  * You should have received a copy of the GNU Lesser General Public
      17             :  * License along with FFmpeg; if not, write to the Free Software
      18             :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
      19             :  */
      20             : 
      21             : /**
      22             :  * @file
      23             :  * send commands filter
      24             :  */
      25             : 
      26             : #include "libavutil/avstring.h"
      27             : #include "libavutil/bprint.h"
      28             : #include "libavutil/file.h"
      29             : #include "libavutil/opt.h"
      30             : #include "libavutil/parseutils.h"
      31             : #include "avfilter.h"
      32             : #include "internal.h"
      33             : #include "audio.h"
      34             : #include "video.h"
      35             : 
      36             : #define COMMAND_FLAG_ENTER 1
      37             : #define COMMAND_FLAG_LEAVE 2
      38             : 
      39           0 : static inline char *make_command_flags_str(AVBPrint *pbuf, int flags)
      40             : {
      41             :     static const char * const flag_strings[] = { "enter", "leave" };
      42           0 :     int i, is_first = 1;
      43             : 
      44           0 :     av_bprint_init(pbuf, 0, AV_BPRINT_SIZE_AUTOMATIC);
      45           0 :     for (i = 0; i < FF_ARRAY_ELEMS(flag_strings); i++) {
      46           0 :         if (flags & 1<<i) {
      47           0 :             if (!is_first)
      48           0 :                 av_bprint_chars(pbuf, '+', 1);
      49           0 :             av_bprintf(pbuf, "%s", flag_strings[i]);
      50           0 :             is_first = 0;
      51             :         }
      52             :     }
      53             : 
      54           0 :     return pbuf->str;
      55             : }
      56             : 
      57             : typedef struct Command {
      58             :     int flags;
      59             :     char *target, *command, *arg;
      60             :     int index;
      61             : } Command;
      62             : 
      63             : typedef struct Interval {
      64             :     int64_t start_ts;          ///< start timestamp expressed as microseconds units
      65             :     int64_t end_ts;            ///< end   timestamp expressed as microseconds units
      66             :     int index;                 ///< unique index for these interval commands
      67             :     Command *commands;
      68             :     int   nb_commands;
      69             :     int enabled;               ///< current time detected inside this interval
      70             : } Interval;
      71             : 
      72             : typedef struct SendCmdContext {
      73             :     const AVClass *class;
      74             :     Interval *intervals;
      75             :     int   nb_intervals;
      76             : 
      77             :     char *commands_filename;
      78             :     char *commands_str;
      79             : } SendCmdContext;
      80             : 
      81             : #define OFFSET(x) offsetof(SendCmdContext, x)
      82             : #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_VIDEO_PARAM
      83             : static const AVOption options[] = {
      84             :     { "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
      85             :     { "c",        "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
      86             :     { "filename", "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
      87             :     { "f",        "set commands file",  OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
      88             :     { NULL }
      89             : };
      90             : 
      91             : #define SPACES " \f\t\n\r"
      92             : 
      93           0 : static void skip_comments(const char **buf)
      94             : {
      95           0 :     while (**buf) {
      96             :         /* skip leading spaces */
      97           0 :         *buf += strspn(*buf, SPACES);
      98           0 :         if (**buf != '#')
      99           0 :             break;
     100             : 
     101           0 :         (*buf)++;
     102             : 
     103             :         /* skip comment until the end of line */
     104           0 :         *buf += strcspn(*buf, "\n");
     105           0 :         if (**buf)
     106           0 :             (*buf)++;
     107             :     }
     108           0 : }
     109             : 
     110             : #define COMMAND_DELIMS " \f\t\n\r,;"
     111             : 
     112           0 : static int parse_command(Command *cmd, int cmd_count, int interval_count,
     113             :                          const char **buf, void *log_ctx)
     114             : {
     115             :     int ret;
     116             : 
     117           0 :     memset(cmd, 0, sizeof(Command));
     118           0 :     cmd->index = cmd_count;
     119             : 
     120             :     /* format: [FLAGS] target command arg */
     121           0 :     *buf += strspn(*buf, SPACES);
     122             : 
     123             :     /* parse flags */
     124           0 :     if (**buf == '[') {
     125           0 :         (*buf)++; /* skip "[" */
     126             : 
     127           0 :         while (**buf) {
     128           0 :             int len = strcspn(*buf, "|+]");
     129             : 
     130           0 :             if      (!strncmp(*buf, "enter", strlen("enter"))) cmd->flags |= COMMAND_FLAG_ENTER;
     131           0 :             else if (!strncmp(*buf, "leave", strlen("leave"))) cmd->flags |= COMMAND_FLAG_LEAVE;
     132             :             else {
     133             :                 char flag_buf[64];
     134           0 :                 av_strlcpy(flag_buf, *buf, sizeof(flag_buf));
     135           0 :                 av_log(log_ctx, AV_LOG_ERROR,
     136             :                        "Unknown flag '%s' in interval #%d, command #%d\n",
     137             :                        flag_buf, interval_count, cmd_count);
     138           0 :                 return AVERROR(EINVAL);
     139             :             }
     140           0 :             *buf += len;
     141           0 :             if (**buf == ']')
     142           0 :                 break;
     143           0 :             if (!strspn(*buf, "+|")) {
     144           0 :                 av_log(log_ctx, AV_LOG_ERROR,
     145             :                        "Invalid flags char '%c' in interval #%d, command #%d\n",
     146           0 :                        **buf, interval_count, cmd_count);
     147           0 :                 return AVERROR(EINVAL);
     148             :             }
     149           0 :             if (**buf)
     150           0 :                 (*buf)++;
     151             :         }
     152             : 
     153           0 :         if (**buf != ']') {
     154           0 :             av_log(log_ctx, AV_LOG_ERROR,
     155             :                    "Missing flag terminator or extraneous data found at the end of flags "
     156             :                    "in interval #%d, command #%d\n", interval_count, cmd_count);
     157           0 :             return AVERROR(EINVAL);
     158             :         }
     159           0 :         (*buf)++; /* skip "]" */
     160             :     } else {
     161           0 :         cmd->flags = COMMAND_FLAG_ENTER;
     162             :     }
     163             : 
     164           0 :     *buf += strspn(*buf, SPACES);
     165           0 :     cmd->target = av_get_token(buf, COMMAND_DELIMS);
     166           0 :     if (!cmd->target || !cmd->target[0]) {
     167           0 :         av_log(log_ctx, AV_LOG_ERROR,
     168             :                "No target specified in interval #%d, command #%d\n",
     169             :                interval_count, cmd_count);
     170           0 :         ret = AVERROR(EINVAL);
     171           0 :         goto fail;
     172             :     }
     173             : 
     174           0 :     *buf += strspn(*buf, SPACES);
     175           0 :     cmd->command = av_get_token(buf, COMMAND_DELIMS);
     176           0 :     if (!cmd->command || !cmd->command[0]) {
     177           0 :         av_log(log_ctx, AV_LOG_ERROR,
     178             :                "No command specified in interval #%d, command #%d\n",
     179             :                interval_count, cmd_count);
     180           0 :         ret = AVERROR(EINVAL);
     181           0 :         goto fail;
     182             :     }
     183             : 
     184           0 :     *buf += strspn(*buf, SPACES);
     185           0 :     cmd->arg = av_get_token(buf, COMMAND_DELIMS);
     186             : 
     187           0 :     return 1;
     188             : 
     189           0 : fail:
     190           0 :     av_freep(&cmd->target);
     191           0 :     av_freep(&cmd->command);
     192           0 :     av_freep(&cmd->arg);
     193           0 :     return ret;
     194             : }
     195             : 
     196           0 : static int parse_commands(Command **cmds, int *nb_cmds, int interval_count,
     197             :                           const char **buf, void *log_ctx)
     198             : {
     199           0 :     int cmd_count = 0;
     200           0 :     int ret, n = 0;
     201             :     AVBPrint pbuf;
     202             : 
     203           0 :     *cmds = NULL;
     204           0 :     *nb_cmds = 0;
     205             : 
     206           0 :     while (**buf) {
     207             :         Command cmd;
     208             : 
     209           0 :         if ((ret = parse_command(&cmd, cmd_count, interval_count, buf, log_ctx)) < 0)
     210           0 :             return ret;
     211           0 :         cmd_count++;
     212             : 
     213             :         /* (re)allocate commands array if required */
     214           0 :         if (*nb_cmds == n) {
     215           0 :             n = FFMAX(16, 2*n); /* first allocation = 16, or double the number */
     216           0 :             *cmds = av_realloc_f(*cmds, n, 2*sizeof(Command));
     217           0 :             if (!*cmds) {
     218           0 :                 av_log(log_ctx, AV_LOG_ERROR,
     219             :                        "Could not (re)allocate command array\n");
     220           0 :                 return AVERROR(ENOMEM);
     221             :             }
     222             :         }
     223             : 
     224           0 :         (*cmds)[(*nb_cmds)++] = cmd;
     225             : 
     226           0 :         *buf += strspn(*buf, SPACES);
     227           0 :         if (**buf && **buf != ';' && **buf != ',') {
     228           0 :             av_log(log_ctx, AV_LOG_ERROR,
     229             :                    "Missing separator or extraneous data found at the end of "
     230             :                    "interval #%d, in command #%d\n",
     231             :                    interval_count, cmd_count);
     232           0 :             av_log(log_ctx, AV_LOG_ERROR,
     233             :                    "Command was parsed as: flags:[%s] target:%s command:%s arg:%s\n",
     234             :                    make_command_flags_str(&pbuf, cmd.flags), cmd.target, cmd.command, cmd.arg);
     235           0 :             return AVERROR(EINVAL);
     236             :         }
     237           0 :         if (**buf == ';')
     238           0 :             break;
     239           0 :         if (**buf == ',')
     240           0 :             (*buf)++;
     241             :     }
     242             : 
     243           0 :     return 0;
     244             : }
     245             : 
     246             : #define DELIMS " \f\t\n\r,;"
     247             : 
     248           0 : static int parse_interval(Interval *interval, int interval_count,
     249             :                           const char **buf, void *log_ctx)
     250             : {
     251             :     char *intervalstr;
     252             :     int ret;
     253             : 
     254           0 :     *buf += strspn(*buf, SPACES);
     255           0 :     if (!**buf)
     256           0 :         return 0;
     257             : 
     258             :     /* reset data */
     259           0 :     memset(interval, 0, sizeof(Interval));
     260           0 :     interval->index = interval_count;
     261             : 
     262             :     /* format: INTERVAL COMMANDS */
     263             : 
     264             :     /* parse interval */
     265           0 :     intervalstr = av_get_token(buf, DELIMS);
     266           0 :     if (intervalstr && intervalstr[0]) {
     267             :         char *start, *end;
     268             : 
     269           0 :         start = av_strtok(intervalstr, "-", &end);
     270           0 :         if (!start) {
     271           0 :             ret = AVERROR(EINVAL);
     272           0 :             av_log(log_ctx, AV_LOG_ERROR,
     273             :                    "Invalid interval specification '%s' in interval #%d\n",
     274             :                    intervalstr, interval_count);
     275           0 :             goto end;
     276             :         }
     277           0 :         if ((ret = av_parse_time(&interval->start_ts, start, 1)) < 0) {
     278           0 :             av_log(log_ctx, AV_LOG_ERROR,
     279             :                    "Invalid start time specification '%s' in interval #%d\n",
     280             :                    start, interval_count);
     281           0 :             goto end;
     282             :         }
     283             : 
     284           0 :         if (end) {
     285           0 :             if ((ret = av_parse_time(&interval->end_ts, end, 1)) < 0) {
     286           0 :                 av_log(log_ctx, AV_LOG_ERROR,
     287             :                        "Invalid end time specification '%s' in interval #%d\n",
     288             :                        end, interval_count);
     289           0 :                 goto end;
     290             :             }
     291             :         } else {
     292           0 :             interval->end_ts = INT64_MAX;
     293             :         }
     294           0 :         if (interval->end_ts < interval->start_ts) {
     295           0 :             av_log(log_ctx, AV_LOG_ERROR,
     296             :                    "Invalid end time '%s' in interval #%d: "
     297             :                    "cannot be lesser than start time '%s'\n",
     298             :                    end, interval_count, start);
     299           0 :             ret = AVERROR(EINVAL);
     300           0 :             goto end;
     301             :         }
     302             :     } else {
     303           0 :         av_log(log_ctx, AV_LOG_ERROR,
     304             :                "No interval specified for interval #%d\n", interval_count);
     305           0 :         ret = AVERROR(EINVAL);
     306           0 :         goto end;
     307             :     }
     308             : 
     309             :     /* parse commands */
     310           0 :     ret = parse_commands(&interval->commands, &interval->nb_commands,
     311             :                          interval_count, buf, log_ctx);
     312             : 
     313           0 : end:
     314           0 :     av_free(intervalstr);
     315           0 :     return ret;
     316             : }
     317             : 
     318           0 : static int parse_intervals(Interval **intervals, int *nb_intervals,
     319             :                            const char *buf, void *log_ctx)
     320             : {
     321           0 :     int interval_count = 0;
     322           0 :     int ret, n = 0;
     323             : 
     324           0 :     *intervals = NULL;
     325           0 :     *nb_intervals = 0;
     326             : 
     327           0 :     if (!buf)
     328           0 :         return 0;
     329             : 
     330           0 :     while (1) {
     331             :         Interval interval;
     332             : 
     333           0 :         skip_comments(&buf);
     334           0 :         if (!(*buf))
     335           0 :             break;
     336             : 
     337           0 :         if ((ret = parse_interval(&interval, interval_count, &buf, log_ctx)) < 0)
     338           0 :             return ret;
     339             : 
     340           0 :         buf += strspn(buf, SPACES);
     341           0 :         if (*buf) {
     342           0 :             if (*buf != ';') {
     343           0 :                 av_log(log_ctx, AV_LOG_ERROR,
     344             :                        "Missing terminator or extraneous data found at the end of interval #%d\n",
     345             :                        interval_count);
     346           0 :                 return AVERROR(EINVAL);
     347             :             }
     348           0 :             buf++; /* skip ';' */
     349             :         }
     350           0 :         interval_count++;
     351             : 
     352             :         /* (re)allocate commands array if required */
     353           0 :         if (*nb_intervals == n) {
     354           0 :             n = FFMAX(16, 2*n); /* first allocation = 16, or double the number */
     355           0 :             *intervals = av_realloc_f(*intervals, n, 2*sizeof(Interval));
     356           0 :             if (!*intervals) {
     357           0 :                 av_log(log_ctx, AV_LOG_ERROR,
     358             :                        "Could not (re)allocate intervals array\n");
     359           0 :                 return AVERROR(ENOMEM);
     360             :             }
     361             :         }
     362             : 
     363           0 :         (*intervals)[(*nb_intervals)++] = interval;
     364             :     }
     365             : 
     366           0 :     return 0;
     367             : }
     368             : 
     369           0 : static int cmp_intervals(const void *a, const void *b)
     370             : {
     371           0 :     const Interval *i1 = a;
     372           0 :     const Interval *i2 = b;
     373           0 :     return 2 * FFDIFFSIGN(i1->start_ts, i2->start_ts) + FFDIFFSIGN(i1->index, i2->index);
     374             : }
     375             : 
     376           0 : static av_cold int init(AVFilterContext *ctx)
     377             : {
     378           0 :     SendCmdContext *s = ctx->priv;
     379             :     int ret, i, j;
     380             : 
     381           0 :     if ((!!s->commands_filename + !!s->commands_str) != 1) {
     382           0 :         av_log(ctx, AV_LOG_ERROR,
     383             :                "One and only one of the filename or commands options must be specified\n");
     384           0 :         return AVERROR(EINVAL);
     385             :     }
     386             : 
     387           0 :     if (s->commands_filename) {
     388             :         uint8_t *file_buf, *buf;
     389             :         size_t file_bufsize;
     390           0 :         ret = av_file_map(s->commands_filename,
     391             :                           &file_buf, &file_bufsize, 0, ctx);
     392           0 :         if (ret < 0)
     393           0 :             return ret;
     394             : 
     395             :         /* create a 0-terminated string based on the read file */
     396           0 :         buf = av_malloc(file_bufsize + 1);
     397           0 :         if (!buf) {
     398           0 :             av_file_unmap(file_buf, file_bufsize);
     399           0 :             return AVERROR(ENOMEM);
     400             :         }
     401           0 :         memcpy(buf, file_buf, file_bufsize);
     402           0 :         buf[file_bufsize] = 0;
     403           0 :         av_file_unmap(file_buf, file_bufsize);
     404           0 :         s->commands_str = buf;
     405             :     }
     406             : 
     407           0 :     if ((ret = parse_intervals(&s->intervals, &s->nb_intervals,
     408           0 :                                s->commands_str, ctx)) < 0)
     409           0 :         return ret;
     410             : 
     411           0 :     if (s->nb_intervals == 0) {
     412           0 :         av_log(ctx, AV_LOG_ERROR, "No commands were specified\n");
     413           0 :         return AVERROR(EINVAL);
     414             :     }
     415             : 
     416           0 :     qsort(s->intervals, s->nb_intervals, sizeof(Interval), cmp_intervals);
     417             : 
     418           0 :     av_log(ctx, AV_LOG_DEBUG, "Parsed commands:\n");
     419           0 :     for (i = 0; i < s->nb_intervals; i++) {
     420             :         AVBPrint pbuf;
     421           0 :         Interval *interval = &s->intervals[i];
     422           0 :         av_log(ctx, AV_LOG_VERBOSE, "start_time:%f end_time:%f index:%d\n",
     423           0 :                (double)interval->start_ts/1000000, (double)interval->end_ts/1000000, interval->index);
     424           0 :         for (j = 0; j < interval->nb_commands; j++) {
     425           0 :             Command *cmd = &interval->commands[j];
     426           0 :             av_log(ctx, AV_LOG_VERBOSE,
     427             :                    "    [%s] target:%s command:%s arg:%s index:%d\n",
     428             :                    make_command_flags_str(&pbuf, cmd->flags), cmd->target, cmd->command, cmd->arg, cmd->index);
     429             :         }
     430             :     }
     431             : 
     432           0 :     return 0;
     433             : }
     434             : 
     435           0 : static av_cold void uninit(AVFilterContext *ctx)
     436             : {
     437           0 :     SendCmdContext *s = ctx->priv;
     438             :     int i, j;
     439             : 
     440           0 :     for (i = 0; i < s->nb_intervals; i++) {
     441           0 :         Interval *interval = &s->intervals[i];
     442           0 :         for (j = 0; j < interval->nb_commands; j++) {
     443           0 :             Command *cmd = &interval->commands[j];
     444           0 :             av_freep(&cmd->target);
     445           0 :             av_freep(&cmd->command);
     446           0 :             av_freep(&cmd->arg);
     447             :         }
     448           0 :         av_freep(&interval->commands);
     449             :     }
     450           0 :     av_freep(&s->intervals);
     451           0 : }
     452             : 
     453           0 : static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
     454             : {
     455           0 :     AVFilterContext *ctx = inlink->dst;
     456           0 :     SendCmdContext *s = ctx->priv;
     457             :     int64_t ts;
     458             :     int i, j, ret;
     459             : 
     460           0 :     if (ref->pts == AV_NOPTS_VALUE)
     461           0 :         goto end;
     462             : 
     463           0 :     ts = av_rescale_q(ref->pts, inlink->time_base, AV_TIME_BASE_Q);
     464             : 
     465             : #define WITHIN_INTERVAL(ts, start_ts, end_ts) ((ts) >= (start_ts) && (ts) < (end_ts))
     466             : 
     467           0 :     for (i = 0; i < s->nb_intervals; i++) {
     468           0 :         Interval *interval = &s->intervals[i];
     469           0 :         int flags = 0;
     470             : 
     471           0 :         if (!interval->enabled && WITHIN_INTERVAL(ts, interval->start_ts, interval->end_ts)) {
     472           0 :             flags += COMMAND_FLAG_ENTER;
     473           0 :             interval->enabled = 1;
     474             :         }
     475           0 :         if (interval->enabled && !WITHIN_INTERVAL(ts, interval->start_ts, interval->end_ts)) {
     476           0 :             flags += COMMAND_FLAG_LEAVE;
     477           0 :             interval->enabled = 0;
     478             :         }
     479             : 
     480           0 :         if (flags) {
     481             :             AVBPrint pbuf;
     482           0 :             av_log(ctx, AV_LOG_VERBOSE,
     483             :                    "[%s] interval #%d start_ts:%f end_ts:%f ts:%f\n",
     484             :                    make_command_flags_str(&pbuf, flags), interval->index,
     485           0 :                    (double)interval->start_ts/1000000, (double)interval->end_ts/1000000,
     486           0 :                    (double)ts/1000000);
     487             : 
     488           0 :             for (j = 0; flags && j < interval->nb_commands; j++) {
     489           0 :                 Command *cmd = &interval->commands[j];
     490             :                 char buf[1024];
     491             : 
     492           0 :                 if (cmd->flags & flags) {
     493           0 :                     av_log(ctx, AV_LOG_VERBOSE,
     494             :                            "Processing command #%d target:%s command:%s arg:%s\n",
     495             :                            cmd->index, cmd->target, cmd->command, cmd->arg);
     496           0 :                     ret = avfilter_graph_send_command(inlink->graph,
     497           0 :                                                       cmd->target, cmd->command, cmd->arg,
     498             :                                                       buf, sizeof(buf),
     499             :                                                       AVFILTER_CMD_FLAG_ONE);
     500           0 :                     av_log(ctx, AV_LOG_VERBOSE,
     501             :                            "Command reply for command #%d: ret:%s res:%s\n",
     502           0 :                            cmd->index, av_err2str(ret), buf);
     503             :                 }
     504             :             }
     505             :         }
     506             :     }
     507             : 
     508           0 : end:
     509           0 :     switch (inlink->type) {
     510           0 :     case AVMEDIA_TYPE_VIDEO:
     511             :     case AVMEDIA_TYPE_AUDIO:
     512           0 :         return ff_filter_frame(inlink->dst->outputs[0], ref);
     513             :     }
     514             : 
     515           0 :     return AVERROR(ENOSYS);
     516             : }
     517             : 
     518             : #if CONFIG_SENDCMD_FILTER
     519             : 
     520             : #define sendcmd_options options
     521             : AVFILTER_DEFINE_CLASS(sendcmd);
     522             : 
     523             : static const AVFilterPad sendcmd_inputs[] = {
     524             :     {
     525             :         .name         = "default",
     526             :         .type         = AVMEDIA_TYPE_VIDEO,
     527             :         .filter_frame = filter_frame,
     528             :     },
     529             :     { NULL }
     530             : };
     531             : 
     532             : static const AVFilterPad sendcmd_outputs[] = {
     533             :     {
     534             :         .name = "default",
     535             :         .type = AVMEDIA_TYPE_VIDEO,
     536             :     },
     537             :     { NULL }
     538             : };
     539             : 
     540             : AVFilter ff_vf_sendcmd = {
     541             :     .name        = "sendcmd",
     542             :     .description = NULL_IF_CONFIG_SMALL("Send commands to filters."),
     543             :     .init        = init,
     544             :     .uninit      = uninit,
     545             :     .priv_size   = sizeof(SendCmdContext),
     546             :     .inputs      = sendcmd_inputs,
     547             :     .outputs     = sendcmd_outputs,
     548             :     .priv_class  = &sendcmd_class,
     549             : };
     550             : 
     551             : #endif
     552             : 
     553             : #if CONFIG_ASENDCMD_FILTER
     554             : 
     555             : #define asendcmd_options options
     556             : AVFILTER_DEFINE_CLASS(asendcmd);
     557             : 
     558             : static const AVFilterPad asendcmd_inputs[] = {
     559             :     {
     560             :         .name         = "default",
     561             :         .type         = AVMEDIA_TYPE_AUDIO,
     562             :         .filter_frame = filter_frame,
     563             :     },
     564             :     { NULL }
     565             : };
     566             : 
     567             : static const AVFilterPad asendcmd_outputs[] = {
     568             :     {
     569             :         .name = "default",
     570             :         .type = AVMEDIA_TYPE_AUDIO,
     571             :     },
     572             :     { NULL }
     573             : };
     574             : 
     575             : AVFilter ff_af_asendcmd = {
     576             :     .name        = "asendcmd",
     577             :     .description = NULL_IF_CONFIG_SMALL("Send commands to filters."),
     578             :     .init        = init,
     579             :     .uninit      = uninit,
     580             :     .priv_size   = sizeof(SendCmdContext),
     581             :     .inputs      = asendcmd_inputs,
     582             :     .outputs     = asendcmd_outputs,
     583             :     .priv_class  = &asendcmd_class,
     584             : };
     585             : 
     586             : #endif

Generated by: LCOV version 1.13