Skip to content

Commit

Permalink
ffmpeg Update: Replace deprecated channels with ch_layout.nb_channels
Browse files Browse the repository at this point in the history
```
    /**
     * Audio only. The number of audio channels.
     * @deprecated use ch_layout.nb_channels
     */
    attribute_deprecated
    int      channels;
```
  • Loading branch information
hashworks committed May 25, 2024
1 parent 48bb062 commit 776a674
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/projects/modules/ffmpeg/ffmpeg_conv.h
Original file line number Diff line number Diff line change
Expand Up @@ -685,11 +685,10 @@ namespace ffmpeg
else
{
char channel_layout_buf[16]{};

::av_channel_layout_describe(&parameters->ch_layout, channel_layout_buf, OV_COUNTOF(channel_layout_buf));

// 48000 Hz, stereo, fltp,
message.AppendFormat("%d Hz, %s(%d), %s, ", parameters->sample_rate, channel_layout_buf, parameters->channels, ::av_get_sample_fmt_name(static_cast<AVSampleFormat>(parameters->format)));
message.AppendFormat("%d Hz, %s(%d), %s, ", parameters->sample_rate, channel_layout_buf, parameters->ch_layout.nb_channels, ::av_get_sample_fmt_name(static_cast<AVSampleFormat>(parameters->format)));
}

message.AppendFormat("%d kbps, ", (parameters->bit_rate / 1024));
Expand Down Expand Up @@ -773,7 +772,7 @@ namespace ffmpeg
break;

case cmn::MediaType::Audio: {
codecpar->channels = static_cast<int>(media_track->GetChannel().GetCounts());
codecpar->ch_layout.nb_channels = static_cast<int>(media_track->GetChannel().GetCounts());
codecpar->channel_layout = ToAVChannelLayout(media_track->GetChannel().GetLayout());
codecpar->sample_rate = media_track->GetSample().GetRateNum();
codecpar->frame_size = (media_track->GetAudioSamplesPerFrame()!=0)?media_track->GetAudioSamplesPerFrame():1024;
Expand Down

0 comments on commit 776a674

Please sign in to comment.