summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2017-03-31 17:45:53 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:35 -0300
commit28fdd7c6cb2ba98934aa2e2ed66d0d396268a1e0 (patch)
tree42a17b991283bf8f2996261787679e4be11c2fe7
parent6bc5485c077f9b48c9cec5562ebbafd08f6f8255 (diff)
mvdec: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavformat/mvdec.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index 4f233aff5f..b37fe2ce69 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -111,9 +111,7 @@ static int set_channels(AVFormatContext *avctx, AVStream *st, int channels)
av_log(avctx, AV_LOG_ERROR, "Channel count %d invalid.\n", channels);
return AVERROR_INVALIDDATA;
}
- st->codecpar->channels = channels;
- st->codecpar->channel_layout = (st->codecpar->channels == 1) ? AV_CH_LAYOUT_MONO
- : AV_CH_LAYOUT_STEREO;
+ av_channel_layout_default(&st->codecpar->ch_layout, channels);
return 0;
}
@@ -283,7 +281,7 @@ static void read_index(AVIOContext *pb, AVStream *st)
return ;
av_add_index_entry(st, pos, timestamp, size, 0, AVINDEX_KEYFRAME);
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
- timestamp += size / (st->codecpar->channels * 2LL);
+ timestamp += size / (st->codecpar->ch_layout.nb_channels * 2LL);
} else {
timestamp++;
}
@@ -402,7 +400,7 @@ static int mv_read_header(AVFormatContext *avctx)
avio_skip(pb, 8);
if (ast) {
av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME);
- timestamp += asize / (ast->codecpar->channels * (uint64_t)bytes_per_sample);
+ timestamp += asize / (ast->codecpar->ch_layout.nb_channels * (uint64_t)bytes_per_sample);
}
av_add_index_entry(vst, pos + asize, i, vsize, 0, AVINDEX_KEYFRAME);
}
@@ -439,7 +437,7 @@ static int mv_read_header(AVFormatContext *avctx)
ast->codecpar->bits_per_coded_sample);
ast->codecpar->codec_id = AV_CODEC_ID_NONE;
}
- if (ast->codecpar->channels <= 0) {
+ if (ast->codecpar->ch_layout.nb_channels <= 0) {
av_log(avctx, AV_LOG_ERROR, "No valid channel count found.\n");
return AVERROR_INVALIDDATA;
}