[FFmpeg-devel] [PATCH] avfilter/f_sendcmd: use the name 's' for the pointer to the private context
Ganesh Ajjanagadde
gajjanagadde at gmail.com
Tue Sep 15 18:59:54 CEST 2015
On Wed, Sep 9, 2015 at 2:30 PM, Ganesh Ajjanagadde
<gajjanagadde at gmail.com> wrote:
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
> libavfilter/f_sendcmd.c | 36 ++++++++++++++++++------------------
> 1 file changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c
> index 7cb958b..37aedc5 100644
> --- a/libavfilter/f_sendcmd.c
> +++ b/libavfilter/f_sendcmd.c
> @@ -373,19 +373,19 @@ static int cmp_intervals(const void *a, const void *b)
>
> static av_cold int init(AVFilterContext *ctx)
> {
> - SendCmdContext *sendcmd = ctx->priv;
> + SendCmdContext *s = ctx->priv;
> int ret, i, j;
>
> - if ((!!sendcmd->commands_filename + !!sendcmd->commands_str) != 1) {
> + if ((!!s->commands_filename + !!s->commands_str) != 1) {
> av_log(ctx, AV_LOG_ERROR,
> "One and only one of the filename or commands options must be specified\n");
> return AVERROR(EINVAL);
> }
>
> - if (sendcmd->commands_filename) {
> + if (s->commands_filename) {
> uint8_t *file_buf, *buf;
> size_t file_bufsize;
> - ret = av_file_map(sendcmd->commands_filename,
> + ret = av_file_map(s->commands_filename,
> &file_buf, &file_bufsize, 0, ctx);
> if (ret < 0)
> return ret;
> @@ -399,24 +399,24 @@ static av_cold int init(AVFilterContext *ctx)
> memcpy(buf, file_buf, file_bufsize);
> buf[file_bufsize] = 0;
> av_file_unmap(file_buf, file_bufsize);
> - sendcmd->commands_str = buf;
> + s->commands_str = buf;
> }
>
> - if ((ret = parse_intervals(&sendcmd->intervals, &sendcmd->nb_intervals,
> - sendcmd->commands_str, ctx)) < 0)
> + if ((ret = parse_intervals(&s->intervals, &s->nb_intervals,
> + s->commands_str, ctx)) < 0)
> return ret;
>
> - if (sendcmd->nb_intervals == 0) {
> + if (s->nb_intervals == 0) {
> av_log(ctx, AV_LOG_ERROR, "No commands were specified\n");
> return AVERROR(EINVAL);
> }
>
> - qsort(sendcmd->intervals, sendcmd->nb_intervals, sizeof(Interval), cmp_intervals);
> + qsort(s->intervals, s->nb_intervals, sizeof(Interval), cmp_intervals);
>
> av_log(ctx, AV_LOG_DEBUG, "Parsed commands:\n");
> - for (i = 0; i < sendcmd->nb_intervals; i++) {
> + for (i = 0; i < s->nb_intervals; i++) {
> AVBPrint pbuf;
> - Interval *interval = &sendcmd->intervals[i];
> + Interval *interval = &s->intervals[i];
> av_log(ctx, AV_LOG_VERBOSE, "start_time:%f end_time:%f index:%d\n",
> (double)interval->start_ts/1000000, (double)interval->end_ts/1000000, interval->index);
> for (j = 0; j < interval->nb_commands; j++) {
> @@ -432,11 +432,11 @@ static av_cold int init(AVFilterContext *ctx)
>
> static av_cold void uninit(AVFilterContext *ctx)
> {
> - SendCmdContext *sendcmd = ctx->priv;
> + SendCmdContext *s = ctx->priv;
> int i, j;
>
> - for (i = 0; i < sendcmd->nb_intervals; i++) {
> - Interval *interval = &sendcmd->intervals[i];
> + for (i = 0; i < s->nb_intervals; i++) {
> + Interval *interval = &s->intervals[i];
> for (j = 0; j < interval->nb_commands; j++) {
> Command *cmd = &interval->commands[j];
> av_freep(&cmd->target);
> @@ -445,13 +445,13 @@ static av_cold void uninit(AVFilterContext *ctx)
> }
> av_freep(&interval->commands);
> }
> - av_freep(&sendcmd->intervals);
> + av_freep(&s->intervals);
> }
>
> static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
> {
> AVFilterContext *ctx = inlink->dst;
> - SendCmdContext *sendcmd = ctx->priv;
> + SendCmdContext *s = ctx->priv;
> int64_t ts;
> int i, j, ret;
>
> @@ -462,8 +462,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
>
> #define WITHIN_INTERVAL(ts, start_ts, end_ts) ((ts) >= (start_ts) && (ts) < (end_ts))
>
> - for (i = 0; i < sendcmd->nb_intervals; i++) {
> - Interval *interval = &sendcmd->intervals[i];
> + for (i = 0; i < s->nb_intervals; i++) {
> + Interval *interval = &s->intervals[i];
> int flags = 0;
>
> if (!interval->enabled && WITHIN_INTERVAL(ts, interval->start_ts, interval->end_ts)) {
> --
> 2.5.1
>
ping
More information about the ffmpeg-devel
mailing list