mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
mvdec: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
6bc5485c07
commit
28fdd7c6cb
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user