Skip to content
Snippets Groups Projects
Commit 524daf8d authored by Philippe Gorley's avatar Philippe Gorley Committed by Sébastien Blin
Browse files

media: use av_find_best_stream


Change-Id: I6ab8a0078f7b67b2342859e216ab4ff02d721736
Reviewed-by: default avatarSebastien Blin <sebastien.blin@savoirfairelinux.com>
parent ebd3e4b8
No related branches found
No related tags found
No related merge requests found
......@@ -174,19 +174,14 @@ MediaDecoder::setupStream(AVMediaType mediaType)
}
}
for (size_t i = 0; streamIndex_ == -1 && i < inputCtx_->nb_streams; ++i) {
if (inputCtx_->streams[i]->codecpar->codec_type == mediaType) {
streamIndex_ = i;
}
}
// find the first video stream from the input
streamIndex_ = av_find_best_stream(inputCtx_, mediaType, -1, -1, &inputDecoder_, 0);
if (streamIndex_ < 0) {
RING_ERR() << "No " << streamType << " stream found";
return -1;
}
avStream_ = inputCtx_->streams[streamIndex_];
inputDecoder_ = findDecoder(avStream_->codecpar->codec_id);
if (!inputDecoder_) {
RING_ERR() << "Unsupported codec";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment