change param of grow_array to pointer

dev
xufuji456 3 years ago
parent e6481c7012
commit dd091f28aa
  1. 14
      app/src/main/cpp/ffmpeg/ffmpeg_filter.cpp
  2. 20
      app/src/main/cpp/ffmpeg/ffmpeg_opt.cpp

@ -226,7 +226,7 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
fg->index = nb_filtergraphs;
// GROW_ARRAY(fg->outputs, fg->nb_outputs);
fg->outputs = (OutputFilter **) grow_array(fg->outputs, sizeof(fg->outputs), &fg->nb_outputs, fg->nb_outputs + 1);
fg->outputs = (OutputFilter **) grow_array(fg->outputs, sizeof(*fg->outputs), &fg->nb_outputs, fg->nb_outputs + 1);
if (!(fg->outputs[0] = (OutputFilter *)av_mallocz(sizeof(*fg->outputs[0]))))
exit_program(1);
fg->outputs[0]->ost = ost;
@ -236,7 +236,7 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
ost->filter = fg->outputs[0];
// GROW_ARRAY(fg->inputs, fg->nb_inputs);
fg->inputs = (InputFilter **) grow_array(fg->inputs, sizeof(fg->inputs), &fg->nb_inputs, fg->nb_inputs + 1);
fg->inputs = (InputFilter **) grow_array(fg->inputs, sizeof(*fg->inputs), &fg->nb_inputs, fg->nb_inputs + 1);
if (!(fg->inputs[0] = (InputFilter *)av_mallocz(sizeof(*fg->inputs[0]))))
exit_program(1);
fg->inputs[0]->ist = ist;
@ -248,11 +248,11 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost)
exit_program(1);
// GROW_ARRAY(ist->filters, ist->nb_filters);
ist->filters = (InputFilter **) grow_array(ist->filters, sizeof(ist->filters), &ist->nb_filters, ist->nb_filters + 1);
ist->filters = (InputFilter **) grow_array(ist->filters, sizeof(*ist->filters), &ist->nb_filters, ist->nb_filters + 1);
ist->filters[ist->nb_filters - 1] = fg->inputs[0];
// GROW_ARRAY(filtergraphs, nb_filtergraphs);
filtergraphs = (FilterGraph **) grow_array(filtergraphs, sizeof(filtergraphs), &nb_filtergraphs, nb_filtergraphs + 1);
filtergraphs = (FilterGraph **) grow_array(filtergraphs, sizeof(*filtergraphs), &nb_filtergraphs, nb_filtergraphs + 1);
filtergraphs[nb_filtergraphs - 1] = fg;
return 0;
@ -347,7 +347,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
ist->decoding_needed |= DECODING_FOR_FILTER;
ist->st->discard = AVDISCARD_NONE;
fg->inputs = (InputFilter **) grow_array(fg->inputs, sizeof(fg->inputs), &fg->nb_inputs, fg->nb_inputs + 1);
fg->inputs = (InputFilter **) grow_array(fg->inputs, sizeof(*fg->inputs), &fg->nb_inputs, fg->nb_inputs + 1);
// GROW_ARRAY(fg->inputs, fg->nb_inputs);
if (!(fg->inputs[fg->nb_inputs - 1] = (InputFilter *) av_mallocz(sizeof(*fg->inputs[0]))))
exit_program(1);
@ -362,7 +362,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in)
exit_program(1);
// GROW_ARRAY(ist->filters, ist->nb_filters);
ist->filters = (InputFilter **) grow_array(ist->filters, sizeof(ist->filters), &ist->nb_filters, ist->nb_filters + 1);
ist->filters = (InputFilter **) grow_array(ist->filters, sizeof(*ist->filters), &ist->nb_filters, ist->nb_filters + 1);
ist->filters[ist->nb_filters - 1] = fg->inputs[fg->nb_inputs - 1];
}
@ -387,7 +387,7 @@ int init_complex_filtergraph(FilterGraph *fg)
init_input_filter(fg, cur);
for (cur = outputs; cur;) {
fg->outputs = (OutputFilter **) grow_array(fg->outputs, sizeof(fg->outputs), &fg->nb_outputs, fg->nb_outputs + 1);
fg->outputs = (OutputFilter **) grow_array(fg->outputs, sizeof(*fg->outputs), &fg->nb_outputs, fg->nb_outputs + 1);
// GROW_ARRAY(fg->outputs, fg->nb_outputs);
fg->outputs[fg->nb_outputs - 1] = (OutputFilter *) av_mallocz(sizeof(*fg->outputs[0]));
if (!fg->outputs[fg->nb_outputs - 1])

@ -315,7 +315,7 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
/* this mapping refers to lavfi output */
const char *c = map + 1;
// GROW_ARRAY(o->stream_maps, o->nb_stream_maps);
o->stream_maps = (StreamMap *)(grow_array(o->stream_maps, sizeof(o->stream_maps),
o->stream_maps = (StreamMap *)(grow_array(o->stream_maps, sizeof(*o->stream_maps),
&o->nb_stream_maps, o->nb_stream_maps + 1));
m = &o->stream_maps[o->nb_stream_maps - 1];
m->linklabel = av_get_token(&c, "]");
@ -351,7 +351,7 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
continue;
}
// GROW_ARRAY(o->stream_maps, o->nb_stream_maps);
o->stream_maps = (StreamMap *)(grow_array(o->stream_maps, sizeof(o->stream_maps),
o->stream_maps = (StreamMap *)(grow_array(o->stream_maps, sizeof(*o->stream_maps),
&o->nb_stream_maps, o->nb_stream_maps + 1));
m = &o->stream_maps[o->nb_stream_maps - 1];
@ -390,7 +390,7 @@ static int opt_attach(void *optctx, const char *opt, const char *arg)
{
OptionsContext *o = static_cast<OptionsContext *>(optctx);
// GROW_ARRAY(o->attachments, o->nb_attachments);
o->attachments = (const char **)(grow_array(o->attachments, sizeof(o->attachments),
o->attachments = (const char **)(grow_array(o->attachments, sizeof(*o->attachments),
&o->nb_attachments, o->nb_attachments + 1));
o->attachments[o->nb_attachments - 1] = arg;
return 0;
@ -409,7 +409,7 @@ static int opt_map_channel(void *optctx, const char *opt, const char *arg)
return AVERROR(ENOMEM);
// GROW_ARRAY(o->audio_channel_maps, o->nb_audio_channel_maps);
o->audio_channel_maps = (AudioChannelMap *)(grow_array(o->audio_channel_maps, sizeof(o->audio_channel_maps),
o->audio_channel_maps = (AudioChannelMap *)(grow_array(o->audio_channel_maps, sizeof(*o->audio_channel_maps),
&o->nb_audio_channel_maps, o->nb_audio_channel_maps + 1));
m = &o->audio_channel_maps[o->nb_audio_channel_maps - 1];
@ -736,7 +736,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
exit_program(1);
// GROW_ARRAY(input_streams, nb_input_streams);
input_streams = (InputStream **)(grow_array(input_streams, sizeof(input_streams),
input_streams = (InputStream **)(grow_array(input_streams, sizeof(*input_streams),
&nb_input_streams, nb_input_streams + 1));
input_streams[nb_input_streams - 1] = ist;
@ -1206,7 +1206,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
av_dump_format(ic, nb_input_files, filename, 0);
// GROW_ARRAY(input_files, nb_input_files);
input_files = (InputFile **) (grow_array(input_files, sizeof(input_files), &nb_input_files, nb_input_files + 1));
input_files = (InputFile **) (grow_array(input_files, sizeof(*input_files), &nb_input_files, nb_input_files + 1));
f = static_cast<InputFile *>(av_mallocz(sizeof(*f)));
if (!f)
exit_program(1);
@ -1383,7 +1383,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
st->id = o->streamid_map[oc->nb_streams - 1];
// GROW_ARRAY(output_streams, nb_output_streams);
output_streams = (OutputStream **) (grow_array(output_streams, sizeof(output_streams), &nb_output_streams, nb_output_streams + 1));
output_streams = (OutputStream **) (grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, nb_output_streams + 1));
if (!(ost = static_cast<OutputStream *>(av_mallocz(sizeof(*ost)))))
exit_program(1);
output_streams[nb_output_streams - 1] = ost;
@ -2212,7 +2212,7 @@ static int open_output_file(OptionsContext *o, const char *filename)
}
// GROW_ARRAY(output_files, nb_output_files);
output_files = (OutputFile **) (grow_array(output_files, sizeof(output_files), &nb_output_files, nb_output_files + 1));
output_files = (OutputFile **) (grow_array(output_files, sizeof(*output_files), &nb_output_files, nb_output_files + 1));
of = static_cast<OutputFile *>(av_mallocz(sizeof(*of)));
if (!of)
exit_program(1);
@ -3220,7 +3220,7 @@ static int opt_audio_qscale(void *optctx, const char *opt, const char *arg)
static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
{
// GROW_ARRAY(filtergraphs, nb_filtergraphs);
filtergraphs = (FilterGraph **) (grow_array(filtergraphs, sizeof(filtergraphs), &nb_filtergraphs, nb_filtergraphs + 1));
filtergraphs = (FilterGraph **) (grow_array(filtergraphs, sizeof(*filtergraphs), &nb_filtergraphs, nb_filtergraphs + 1));
if (!(filtergraphs[nb_filtergraphs - 1] = static_cast<FilterGraph *>(av_mallocz(
sizeof(*filtergraphs[0])))))
return AVERROR(ENOMEM);
@ -3241,7 +3241,7 @@ static int opt_filter_complex_script(void *optctx, const char *opt, const char *
return AVERROR(EINVAL);
// GROW_ARRAY(filtergraphs, nb_filtergraphs);
filtergraphs = (FilterGraph **) (grow_array(filtergraphs, sizeof(filtergraphs), &nb_filtergraphs, nb_filtergraphs + 1));
filtergraphs = (FilterGraph **) (grow_array(filtergraphs, sizeof(*filtergraphs), &nb_filtergraphs, nb_filtergraphs + 1));
if (!(filtergraphs[nb_filtergraphs - 1] = static_cast<FilterGraph *>(av_mallocz(
sizeof(*filtergraphs[0])))))
return AVERROR(ENOMEM);

Loading…
Cancel
Save