tools: convert to new channel layout-API

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2022-01-20 16:38:44 -03:00
parent 7d532f474d
commit 50e9e11316
4 changed files with 6 additions and 6 deletions

View File

@ -91,8 +91,7 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
link->time_base.num, link->time_base.den);
} else if (link->type == AVMEDIA_TYPE_AUDIO) {
char buf[255];
av_get_channel_layout_string(buf, sizeof(buf), -1,
link->channel_layout);
av_channel_layout_describe(&link->ch_layout, buf, sizeof(buf));
fprintf(outfile,
"fmt:%s sr:%d cl:%s tb:%d/%d",
av_get_sample_fmt_name(link->format),

View File

@ -574,7 +574,7 @@ static int handle_file(struct Tracks *tracks, const char *file, int split,
if (tracks->audio_track < 0)
tracks->audio_track = tracks->nb_tracks;
tracks->nb_audio_tracks++;
track->channels = st->codecpar->channels;
track->channels = st->codecpar->ch_layout.nb_channels;
track->sample_rate = st->codecpar->sample_rate;
if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
track->fourcc = "AACL";

View File

@ -191,7 +191,7 @@ static int handle_file(struct Tracks *tracks, const char *file)
track->timescale, AV_ROUND_UP));
if (track->is_audio) {
track->channels = st->codecpar->channels;
track->channels = st->codecpar->ch_layout.nb_channels;
track->sample_rate = st->codecpar->sample_rate;
}
if (track->is_video) {

View File

@ -173,8 +173,9 @@ int main(int argc, char **argv)
st->stream->codecpar->format = av_buffersink_get_format(st->sink);
break;
case AVMEDIA_TYPE_AUDIO:
st->stream->codecpar->channel_layout = av_buffersink_get_channel_layout(st->sink);
st->stream->codecpar->channels = av_buffersink_get_channels(st->sink);
ret = av_buffersink_get_ch_layout(st->sink, &st->stream->codecpar->ch_layout);
if (ret < 0)
goto fail;
st->stream->codecpar->sample_rate = av_buffersink_get_sample_rate(st->sink);
st->stream->codecpar->format = av_buffersink_get_format(st->sink);
st->stream->codecpar->codec_id = av_get_pcm_codec(st->stream->codecpar->format, -1);