1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

voc: convert to new channel layout API

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Vittorio Giovara 2017-03-31 18:49:12 +02:00 committed by James Almer
parent 7591de37e6
commit a3129027eb
2 changed files with 9 additions and 7 deletions

View File

@ -72,7 +72,7 @@ ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
if (sample_rate)
par->sample_rate = sample_rate;
avpriv_set_pts_info(st, 64, 1, par->sample_rate);
par->channels = channels;
par->ch_layout.nb_channels = channels;
par->bits_per_coded_sample = av_get_bits_per_sample(par->codec_id);
} else
avio_skip(pb, 1);
@ -103,7 +103,8 @@ ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
par->sample_rate = avio_rl32(pb);
avpriv_set_pts_info(st, 64, 1, par->sample_rate);
par->bits_per_coded_sample = avio_r8(pb);
par->channels = avio_r8(pb);
channels = avio_r8(pb);
par->ch_layout.nb_channels = channels;
} else
avio_skip(pb, 6);
tmp_codec = avio_rl16(pb);
@ -140,7 +141,7 @@ ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
}
}
par->bit_rate = (int64_t)par->sample_rate * par->channels * par->bits_per_coded_sample;
par->bit_rate = (int64_t)par->sample_rate * par->ch_layout.nb_channels * par->bits_per_coded_sample;
if (max_size <= 0)
max_size = 2048;

View File

@ -63,16 +63,17 @@ static int voc_write_packet(AVFormatContext *s, AVPacket *pkt)
avio_wl24(pb, pkt->size + 12);
avio_wl32(pb, par->sample_rate);
avio_w8(pb, par->bits_per_coded_sample);
avio_w8(pb, par->channels);
avio_w8(pb, par->ch_layout.nb_channels);
avio_wl16(pb, par->codec_tag);
avio_wl32(pb, 0);
} else {
if (s->streams[0]->codecpar->channels > 1) {
if (s->streams[0]->codecpar->ch_layout.nb_channels > 1) {
avio_w8(pb, VOC_TYPE_EXTENDED);
avio_wl24(pb, 4);
avio_wl16(pb, 65536-(256000000 + par->sample_rate*par->channels/2)/(par->sample_rate*par->channels));
avio_wl16(pb, 65536 - (256000000 + par->sample_rate * par->ch_layout.nb_channels / 2) /
(par->sample_rate * par->ch_layout.nb_channels));
avio_w8(pb, par->codec_tag);
avio_w8(pb, par->channels - 1);
avio_w8(pb, par->ch_layout.nb_channels - 1);
}
avio_w8(pb, VOC_TYPE_VOICE_DATA);
avio_wl24(pb, pkt->size + 2);