public void UpdateSettings( bool startFilesFromTheStart, bool playNextFileAutomatically, bool forceVideoTranscode, bool forceAudioTranscode, VideoScaleType videoScale, bool enableHardwareAcceleration) { Messenger.Publish(new SettingsExternallyUpdatedMessage( this, startFilesFromTheStart, playNextFileAutomatically, forceVideoTranscode, forceAudioTranscode, videoScale, enableHardwareAcceleration)); //TODO: IMPROVE THIS. The settings subscription sometimes gets lost... thats why i do this _settingsService.StartFilesFromTheStart = startFilesFromTheStart; _settingsService.PlayNextFileAutomatically = playNextFileAutomatically; _settingsService.ForceAudioTranscode = forceAudioTranscode; _settingsService.ForceVideoTranscode = forceVideoTranscode; _settingsService.VideoScale = videoScale; _settingsService.EnableHardwareAcceleration = enableHardwareAcceleration; _appWebServer.OnAppSettingsChanged?.Invoke(); }
public TranscodeVideoFileBuilder WithDefaults( HwAccelDeviceType hwAccelDeviceType = HwAccelDeviceType.None, VideoScaleType scaleType = VideoScaleType.Original, string withXHeight = null) { File.HwAccelDeviceType = hwAccelDeviceType; File.VideoScaleType = scaleType; File.VideoWidthAndHeight = withXHeight; return(this); }
public SettingsExternallyUpdatedMessage( object sender, bool startFilesFromTheStart, bool playNextFileAutomatically, bool forceVideoTranscode, bool forceAudioTranscode, VideoScaleType videoScale, bool enableHardwareAcceleration) : base(sender) { StartFilesFromTheStart = startFilesFromTheStart; PlayNextFileAutomatically = playNextFileAutomatically; ForceVideoTranscode = forceVideoTranscode; ForceAudioTranscode = forceAudioTranscode; VideoScale = videoScale; EnableHardwareAcceleration = enableHardwareAcceleration; }
public string GetMediaUrl( string filePath, int videoStreamIndex, int audioStreamIndex, double seconds, bool videoNeedsTranscode, bool audioNeedsTranscode, HwAccelDeviceType hwAccelToUse, VideoScaleType videoScale, string videoWidthAndHeight = null) { var baseUrl = GetBaseUrl(); return($"{baseUrl}{AppWebServerConstants.MediaPath}?" + $"{AppWebServerConstants.VideoStreamIndexParameter}={videoStreamIndex}" + $"&{AppWebServerConstants.AudioStreamIndexParameter}={audioStreamIndex}" + $"&{AppWebServerConstants.SecondsQueryParameter}={seconds}" + $"&{AppWebServerConstants.FileQueryParameter}={Uri.EscapeDataString(filePath)}" + $"&{AppWebServerConstants.VideoNeedsTranscode}={videoNeedsTranscode}" + $"&{AppWebServerConstants.AudioNeedsTranscode}={audioNeedsTranscode}" + $"&{AppWebServerConstants.HwAccelTypeToUse}={hwAccelToUse}" + $"&{AppWebServerConstants.VideoWidthAndHeight}={videoWidthAndHeight}" + $"&{AppWebServerConstants.VideoScaleParameter}={videoScale}"); }
public bool VideoNeedsTranscode(int videoStreamIndex, bool forceVideoTranscode, VideoScaleType selectedScale, FFProbeFileInfo fileInfo) { if (fileInfo == null) { throw new ArgumentNullException(nameof(fileInfo), "The provided file info can't be null"); } var videoInfo = fileInfo.Videos.FirstOrDefault(f => f.Index == videoStreamIndex && f.IsVideo); if (videoInfo is null) { throw new NullReferenceException("The file does not have a valid video stream"); } bool videoCodecIsValid = videoInfo.VideoCodecIsValid(AllowedVideoCodecs); bool videoLevelIsValid = videoInfo.VideoLevelIsValid(MaxVideoLevel); bool videoProfileIsValid = videoInfo.VideoProfileIsValid(AllowedVideoProfiles); return(!videoCodecIsValid || !videoProfileIsValid || !videoLevelIsValid || forceVideoTranscode || selectedScale != VideoScaleType.Original); }