[FFmpeg-devel] [PATCH 137/281] scd: convert to new channel layout API
James Almer
jamrial at gmail.com
Thu Jan 13 03:57:54 EET 2022
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavformat/scd.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libavformat/scd.c b/libavformat/scd.c
index 0ed5322a14..d59d72e1d9 100644
--- a/libavformat/scd.c
+++ b/libavformat/scd.c
@@ -194,7 +194,8 @@ static int scd_read_track(AVFormatContext *s, SCDTrackHeader *track, int index)
par = st->codecpar;
par->codec_type = AVMEDIA_TYPE_AUDIO;
- par->channels = (int)track->num_channels;
+ par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
+ par->ch_layout.nb_channels = (int)track->num_channels;
par->sample_rate = (int)track->sample_rate;
st->index = index;
st->start_time = 0;
@@ -218,7 +219,7 @@ static int scd_read_track(AVFormatContext *s, SCDTrackHeader *track, int index)
case SCD_TRACK_ID_PCM:
par->codec_id = AV_CODEC_ID_PCM_S16BE;
par->bits_per_coded_sample = 16;
- par->block_align = par->bits_per_coded_sample * par->channels / 8;
+ par->block_align = par->bits_per_coded_sample * par->ch_layout.nb_channels / 8;
break;
case SCD_TRACK_ID_MP3:
par->codec_id = AV_CODEC_ID_MP3;
@@ -325,8 +326,8 @@ static int scd_read_packet(AVFormatContext *s, AVPacket *pkt)
}
if (trk->data_type == SCD_TRACK_ID_PCM) {
- pkt->pts = trk->bytes_read / (par->channels * sizeof(uint16_t));
- pkt->duration = size / (par->channels * sizeof(int16_t));
+ pkt->pts = trk->bytes_read / (par->ch_layout.nb_channels * sizeof(uint16_t));
+ pkt->duration = size / (par->ch_layout.nb_channels * sizeof(int16_t));
}
trk->bytes_read += ret;
--
2.34.1
More information about the ffmpeg-devel
mailing list