UniquePtr<TrackInfo> CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters( const nsACString& aCodecMIMEType, const MediaContainerType& aContainerType) { UniquePtr<TrackInfo> trackInfo = CreateTrackInfoWithMIMEType(aCodecMIMEType); if (trackInfo) { VideoInfo* videoInfo = trackInfo->GetAsVideoInfo(); if (videoInfo) { Maybe<int32_t> maybeWidth = aContainerType.ExtendedType().GetWidth(); if (maybeWidth && *maybeWidth > 0) { videoInfo->mImage.width = *maybeWidth; } Maybe<int32_t> maybeHeight = aContainerType.ExtendedType().GetHeight(); if (maybeHeight && *maybeHeight > 0) { videoInfo->mImage.height = *maybeHeight; } } else if (trackInfo->GetAsAudioInfo()) { AudioInfo* audioInfo = trackInfo->GetAsAudioInfo(); Maybe<int32_t> maybeChannels = aContainerType.ExtendedType().GetChannels(); if (maybeChannels && *maybeChannels > 0) { audioInfo->mChannels = *maybeChannels; } Maybe<int32_t> maybeSamplerate = aContainerType.ExtendedType().GetSamplerate(); if (maybeSamplerate && *maybeSamplerate > 0) { audioInfo->mRate = *maybeSamplerate; } } } return trackInfo; }
bool WMFDecoderModule::SupportsMimeType(const nsACString& aMimeType, DecoderDoctorDiagnostics* aDiagnostics) const { UniquePtr<TrackInfo> trackInfo = CreateTrackInfoWithMIMEType(aMimeType); if (!trackInfo) { return false; } return Supports(*trackInfo, aDiagnostics); }
UniquePtr<TrackInfo> CreateTrackInfoWithMIMETypeAndContainerTypeExtraParameters( const nsACString& aCodecMIMEType, const MediaContainerType& aContainerType) { UniquePtr<TrackInfo> trackInfo = CreateTrackInfoWithMIMEType(aCodecMIMEType); if (trackInfo) { VideoInfo* videoInfo = trackInfo->GetAsVideoInfo(); if (videoInfo) { Maybe<int32_t> maybeWidth = aContainerType.ExtendedType().GetWidth(); if (maybeWidth && *maybeWidth > 0) { videoInfo->mImage.width = *maybeWidth; } Maybe<int32_t> maybeHeight = aContainerType.ExtendedType().GetHeight(); if (maybeHeight && *maybeHeight > 0) { videoInfo->mImage.height = *maybeHeight; } } } return trackInfo; }