aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2017-03-31 18:49:12 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:38 -0300
commita3129027eb833cf2483301f2b98704acf8274915 (patch)
tree4c110a926ea73b33791c827c8125ba36d064c989
parent7591de37e6b38189396d0dec43549e029847bf48 (diff)
downloadffmpeg-a3129027eb833cf2483301f2b98704acf8274915.tar.gz
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>
-rw-r--r--libavformat/voc_packet.c7
-rw-r--r--libavformat/vocenc.c9
2 files changed, 9 insertions, 7 deletions
diff --git a/libavformat/voc_packet.c b/libavformat/voc_packet.c
index e5ae0be1de..32f8b29aa7 100644
--- a/libavformat/voc_packet.c
+++ b/libavformat/voc_packet.c
@@ -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;
diff --git a/libavformat/vocenc.c b/libavformat/vocenc.c
index 798b463a82..59c2bbba7b 100644
--- a/libavformat/vocenc.c
+++ b/libavformat/vocenc.c
@@ -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);