diff options
author | James Almer <jamrial@gmail.com> | 2021-08-31 11:03:14 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-15 09:42:46 -0300 |
commit | 1f96db959c1235bb7079d354e09914a0a2608f62 (patch) | |
tree | 21ac480d5b148c0524761853e6badb3a90a7ca3f /libavfilter/af_hdcd.c | |
parent | 8a5896ec1f635ccf0d726f7ba7a06649ebeebf25 (diff) | |
download | ffmpeg-1f96db959c1235bb7079d354e09914a0a2608f62.tar.gz |
avfilter: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavfilter/af_hdcd.c')
-rw-r--r-- | libavfilter/af_hdcd.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c index 494642106d..49bfa1bfa8 100644 --- a/libavfilter/af_hdcd.c +++ b/libavfilter/af_hdcd.c @@ -1554,27 +1554,27 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) switch (inlink->format) { case AV_SAMPLE_FMT_S16P: for (n = 0; n < in->nb_samples; n++) - for (c = 0; c < in->channels; c++) { + for (c = 0; c < in->ch_layout.nb_channels; c++) { in_data = (int16_t*)in->extended_data[c]; - out_data[(n * in->channels) + c] = in_data[n]; + out_data[(n * in->ch_layout.nb_channels) + c] = in_data[n]; } break; case AV_SAMPLE_FMT_S16: in_data = (int16_t*)in->data[0]; - for (n = 0; n < in->nb_samples * in->channels; n++) + for (n = 0; n < in->nb_samples * in->ch_layout.nb_channels; n++) out_data[n] = in_data[n]; break; case AV_SAMPLE_FMT_S32P: for (n = 0; n < in->nb_samples; n++) - for (c = 0; c < in->channels; c++) { + for (c = 0; c < in->ch_layout.nb_channels; c++) { in_data32 = (int32_t*)in->extended_data[c]; - out_data[(n * in->channels) + c] = in_data32[n] >> a; + out_data[(n * in->ch_layout.nb_channels) + c] = in_data32[n] >> a; } break; case AV_SAMPLE_FMT_S32: in_data32 = (int32_t*)in->data[0]; - for (n = 0; n < in->nb_samples * in->channels; n++) + for (n = 0; n < in->nb_samples * in->ch_layout.nb_channels; n++) out_data[n] = in_data32[n] >> a; break; } @@ -1587,14 +1587,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) hdcd_detect_end(&s->detect, 2); } else { hdcd_detect_start(&s->detect); - for (c = 0; c < in->channels; c++) { - hdcd_process(s, &s->state[c], out_data + c, in->nb_samples, in->channels); + for (c = 0; c < in->ch_layout.nb_channels; c++) { + hdcd_process(s, &s->state[c], out_data + c, in->nb_samples, in->ch_layout.nb_channels); hdcd_detect_onech(&s->state[c], &s->detect); } - hdcd_detect_end(&s->detect, in->channels); + hdcd_detect_end(&s->detect, in->ch_layout.nb_channels); } - s->sample_count += in->nb_samples * in->channels; + s->sample_count += in->nb_samples * in->ch_layout.nb_channels; av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -1627,10 +1627,10 @@ static int query_formats(AVFilterContext *ctx) }; int ret; - ret = ff_add_channel_layout(&layouts, AV_CH_LAYOUT_MONO); + ret = ff_add_channel_layout(&layouts, &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO); if (ret < 0) return ret; - ret = ff_add_channel_layout(&layouts, AV_CH_LAYOUT_STEREO); + ret = ff_add_channel_layout(&layouts, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO); if (ret < 0) return ret; @@ -1739,8 +1739,8 @@ static int config_input(AVFilterLink *inlink) { av_log(ctx, AV_LOG_VERBOSE, "CDT period: %dms (%u samples @44100Hz)\n", s->cdt_ms, s->state[0].sustain_reset ); - if (inlink->channels != 2 && s->process_stereo) { - av_log(ctx, AV_LOG_WARNING, "process_stereo disabled (channels = %d)\n", inlink->channels); + if (inlink->ch_layout.nb_channels != 2 && s->process_stereo) { + av_log(ctx, AV_LOG_WARNING, "process_stereo disabled (channels = %d)\n", inlink->ch_layout.nb_channels); s->process_stereo = 0; } av_log(ctx, AV_LOG_VERBOSE, "Process mode: %s\n", |