mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
videoio/MSMF: fixed audio stream handling
This commit is contained in:
parent
fef6192bca
commit
2d11edd103
@ -487,12 +487,14 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
std::pair<MediaID, MediaType> findBest(const MediaType& newType)
|
||||
std::pair<MediaID, MediaType> findBestVideoFormat(const MediaType& newType)
|
||||
{
|
||||
std::pair<MediaID, MediaType> best;
|
||||
std::map<MediaID, MediaType>::const_iterator i = formats.begin();
|
||||
for (; i != formats.end(); ++i)
|
||||
{
|
||||
if (i->second.majorType != MFMediaType_Video)
|
||||
continue;
|
||||
if (newType.isEmpty()) // file input - choose first returned media type
|
||||
{
|
||||
best = *i;
|
||||
@ -770,7 +772,12 @@ bool CvCapture_MSMF::configureOutput(MediaType newType, cv::uint32_t outFormat)
|
||||
{
|
||||
FormatStorage formats;
|
||||
formats.read(videoFileSource.Get());
|
||||
std::pair<FormatStorage::MediaID, MediaType> bestMatch = formats.findBest(newType);
|
||||
std::pair<FormatStorage::MediaID, MediaType> bestMatch = formats.findBestVideoFormat(newType);
|
||||
if (bestMatch.second.isEmpty())
|
||||
{
|
||||
CV_LOG_DEBUG(NULL, "Can not find video stream with requested parameters");
|
||||
return false;
|
||||
}
|
||||
dwStreamIndex = bestMatch.first.stream;
|
||||
nativeFormat = bestMatch.second;
|
||||
MediaType newFormat = nativeFormat;
|
||||
|
Loading…
Reference in New Issue
Block a user