Commit 525ccbe8 authored by Vittorio Giovara's avatar Vittorio Giovara Committed by James Almer

segafilm: convert to new channel layout API

Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 81b3ebba
...@@ -177,20 +177,20 @@ static int film_read_header(AVFormatContext *s) ...@@ -177,20 +177,20 @@ static int film_read_header(AVFormatContext *s)
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = film->audio_type; st->codecpar->codec_id = film->audio_type;
st->codecpar->codec_tag = 1; st->codecpar->codec_tag = 1;
st->codecpar->channels = film->audio_channels; st->codecpar->ch_layout.nb_channels = film->audio_channels;
st->codecpar->sample_rate = film->audio_samplerate; st->codecpar->sample_rate = film->audio_samplerate;
if (film->audio_type == AV_CODEC_ID_ADPCM_ADX) { if (film->audio_type == AV_CODEC_ID_ADPCM_ADX) {
st->codecpar->bits_per_coded_sample = 18 * 8 / 32; st->codecpar->bits_per_coded_sample = 18 * 8 / 32;
st->codecpar->block_align = st->codecpar->channels * 18; st->codecpar->block_align = film->audio_channels * 18;
ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL; ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL;
} else { } else {
st->codecpar->bits_per_coded_sample = film->audio_bits; st->codecpar->bits_per_coded_sample = film->audio_bits;
st->codecpar->block_align = st->codecpar->channels * st->codecpar->block_align = film->audio_channels *
st->codecpar->bits_per_coded_sample / 8; st->codecpar->bits_per_coded_sample / 8;
} }
st->codecpar->bit_rate = st->codecpar->channels * st->codecpar->sample_rate * st->codecpar->bit_rate = film->audio_channels * st->codecpar->sample_rate *
st->codecpar->bits_per_coded_sample; st->codecpar->bits_per_coded_sample;
} }
......
...@@ -236,7 +236,7 @@ static int film_write_header(AVFormatContext *format_context) ...@@ -236,7 +236,7 @@ static int film_write_header(AVFormatContext *format_context)
AVStream *audio = format_context->streams[film->audio_index]; AVStream *audio = format_context->streams[film->audio_index];
int audio_codec = get_audio_codec_id(audio->codecpar->codec_id); int audio_codec = get_audio_codec_id(audio->codecpar->codec_id);
bytestream_put_byte(&ptr, audio->codecpar->channels); /* Audio channels */ bytestream_put_byte(&ptr, audio->codecpar->ch_layout.nb_channels); /* Audio channels */
bytestream_put_byte(&ptr, audio->codecpar->bits_per_coded_sample); /* Audio bit depth */ bytestream_put_byte(&ptr, audio->codecpar->bits_per_coded_sample); /* Audio bit depth */
bytestream_put_byte(&ptr, audio_codec); /* Compression - 0 is PCM, 2 is ADX */ bytestream_put_byte(&ptr, audio_codec); /* Compression - 0 is PCM, 2 is ADX */
bytestream_put_be16(&ptr, audio->codecpar->sample_rate); /* Audio sampling rate */ bytestream_put_be16(&ptr, audio->codecpar->sample_rate); /* Audio sampling rate */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment