avfilter/f_sendcmd: use the name 's' for the pointer to the private context

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
This commit is contained in:
Ganesh Ajjanagadde 2015-09-09 14:30:35 -04:00 committed by Ronald S. Bultje
parent aaf4e703f6
commit f7b53c9527

View File

@ -373,19 +373,19 @@ static int cmp_intervals(const void *a, const void *b)
static av_cold int init(AVFilterContext *ctx) static av_cold int init(AVFilterContext *ctx)
{ {
SendCmdContext *sendcmd = ctx->priv; SendCmdContext *s = ctx->priv;
int ret, i, j; 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, av_log(ctx, AV_LOG_ERROR,
"One and only one of the filename or commands options must be specified\n"); "One and only one of the filename or commands options must be specified\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
if (sendcmd->commands_filename) { if (s->commands_filename) {
uint8_t *file_buf, *buf; uint8_t *file_buf, *buf;
size_t file_bufsize; size_t file_bufsize;
ret = av_file_map(sendcmd->commands_filename, ret = av_file_map(s->commands_filename,
&file_buf, &file_bufsize, 0, ctx); &file_buf, &file_bufsize, 0, ctx);
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -399,24 +399,24 @@ static av_cold int init(AVFilterContext *ctx)
memcpy(buf, file_buf, file_bufsize); memcpy(buf, file_buf, file_bufsize);
buf[file_bufsize] = 0; buf[file_bufsize] = 0;
av_file_unmap(file_buf, file_bufsize); av_file_unmap(file_buf, file_bufsize);
sendcmd->commands_str = buf; s->commands_str = buf;
} }
if ((ret = parse_intervals(&sendcmd->intervals, &sendcmd->nb_intervals, if ((ret = parse_intervals(&s->intervals, &s->nb_intervals,
sendcmd->commands_str, ctx)) < 0) s->commands_str, ctx)) < 0)
return ret; return ret;
if (sendcmd->nb_intervals == 0) { if (s->nb_intervals == 0) {
av_log(ctx, AV_LOG_ERROR, "No commands were specified\n"); av_log(ctx, AV_LOG_ERROR, "No commands were specified\n");
return AVERROR(EINVAL); 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"); 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; 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", 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); (double)interval->start_ts/1000000, (double)interval->end_ts/1000000, interval->index);
for (j = 0; j < interval->nb_commands; j++) { 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) static av_cold void uninit(AVFilterContext *ctx)
{ {
SendCmdContext *sendcmd = ctx->priv; SendCmdContext *s = ctx->priv;
int i, j; int i, j;
for (i = 0; i < sendcmd->nb_intervals; i++) { for (i = 0; i < s->nb_intervals; i++) {
Interval *interval = &sendcmd->intervals[i]; Interval *interval = &s->intervals[i];
for (j = 0; j < interval->nb_commands; j++) { for (j = 0; j < interval->nb_commands; j++) {
Command *cmd = &interval->commands[j]; Command *cmd = &interval->commands[j];
av_freep(&cmd->target); av_freep(&cmd->target);
@ -445,13 +445,13 @@ static av_cold void uninit(AVFilterContext *ctx)
} }
av_freep(&interval->commands); av_freep(&interval->commands);
} }
av_freep(&sendcmd->intervals); av_freep(&s->intervals);
} }
static int filter_frame(AVFilterLink *inlink, AVFrame *ref) static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
{ {
AVFilterContext *ctx = inlink->dst; AVFilterContext *ctx = inlink->dst;
SendCmdContext *sendcmd = ctx->priv; SendCmdContext *s = ctx->priv;
int64_t ts; int64_t ts;
int i, j, ret; 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)) #define WITHIN_INTERVAL(ts, start_ts, end_ts) ((ts) >= (start_ts) && (ts) < (end_ts))
for (i = 0; i < sendcmd->nb_intervals; i++) { for (i = 0; i < s->nb_intervals; i++) {
Interval *interval = &sendcmd->intervals[i]; Interval *interval = &s->intervals[i];
int flags = 0; int flags = 0;
if (!interval->enabled && WITHIN_INTERVAL(ts, interval->start_ts, interval->end_ts)) { if (!interval->enabled && WITHIN_INTERVAL(ts, interval->start_ts, interval->end_ts)) {