1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/af_headphone: Avoid duplicating string needlessly

The string given by an AVOption that contains the channel assignment
is used only once; ergo it doesn't matter that parsing the string via
av_strtok() is destructive. There is no need to make a copy.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-08-24 23:03:45 +02:00
parent 71daaafa3a
commit bff1d0c658

View File

@ -100,16 +100,13 @@ static int parse_channel_name(const char *arg, uint64_t *rchannel)
static void parse_map(AVFilterContext *ctx) static void parse_map(AVFilterContext *ctx)
{ {
HeadphoneContext *s = ctx->priv; HeadphoneContext *s = ctx->priv;
char *arg, *tokenizer, *p, *args = av_strdup(s->map); char *arg, *tokenizer, *p;
uint64_t used_channels = 0; uint64_t used_channels = 0;
if (!args)
return;
p = args;
s->lfe_channel = -1; s->lfe_channel = -1;
s->nb_inputs = 1; s->nb_inputs = 1;
p = s->map;
while ((arg = av_strtok(p, "|", &tokenizer))) { while ((arg = av_strtok(p, "|", &tokenizer))) {
uint64_t out_channel; uint64_t out_channel;
@ -133,8 +130,6 @@ static void parse_map(AVFilterContext *ctx)
s->nb_inputs = 2; s->nb_inputs = 2;
else else
s->nb_inputs = s->nb_irs + 1; s->nb_inputs = s->nb_irs + 1;
av_free(args);
} }
typedef struct ThreadData { typedef struct ThreadData {