1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

scd: convert to new channel layout API

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2021-12-03 20:36:30 -03:00
parent 5bcf9029c8
commit 4a0bd4393c

View File

@ -194,7 +194,7 @@ static int scd_read_track(AVFormatContext *s, SCDTrackHeader *track, int index)
par = st->codecpar; par = st->codecpar;
par->codec_type = AVMEDIA_TYPE_AUDIO; par->codec_type = AVMEDIA_TYPE_AUDIO;
par->channels = (int)track->num_channels; par->ch_layout.nb_channels = (int)track->num_channels;
par->sample_rate = (int)track->sample_rate; par->sample_rate = (int)track->sample_rate;
st->index = index; st->index = index;
st->start_time = 0; st->start_time = 0;
@ -218,7 +218,7 @@ static int scd_read_track(AVFormatContext *s, SCDTrackHeader *track, int index)
case SCD_TRACK_ID_PCM: case SCD_TRACK_ID_PCM:
par->codec_id = AV_CODEC_ID_PCM_S16BE; par->codec_id = AV_CODEC_ID_PCM_S16BE;
par->bits_per_coded_sample = 16; 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; break;
case SCD_TRACK_ID_MP3: case SCD_TRACK_ID_MP3:
par->codec_id = AV_CODEC_ID_MP3; par->codec_id = AV_CODEC_ID_MP3;
@ -325,8 +325,8 @@ static int scd_read_packet(AVFormatContext *s, AVPacket *pkt)
} }
if (trk->data_type == SCD_TRACK_ID_PCM) { if (trk->data_type == SCD_TRACK_ID_PCM) {
pkt->pts = trk->bytes_read / (par->channels * sizeof(uint16_t)); pkt->pts = trk->bytes_read / (par->ch_layout.nb_channels * sizeof(uint16_t));
pkt->duration = size / (par->channels * sizeof(int16_t)); pkt->duration = size / (par->ch_layout.nb_channels * sizeof(int16_t));
} }
trk->bytes_read += ret; trk->bytes_read += ret;