fix: practice defense driving...seal it all

This commit is contained in:
Stevan Freeborn
2025-07-29 18:26:22 -05:00
parent 07190acb65
commit f6773cb64e
9 changed files with 30 additions and 9 deletions
@@ -4,7 +4,7 @@ namespace StreamShorts.Library.Media.Audio;
/// Extracts audio from video files.
/// </summary>
/// <inheritdoc/>
public class AudioExtractor : IAudioExtractor
public sealed class AudioExtractor : IAudioExtractor
{
private readonly IVideoService _videoService = new FFMpegService();
@@ -1,15 +1,30 @@
namespace StreamShorts.Library.Media.Audio;
public class FailedAudioExtractionException : Exception
/// <summary>
/// Represents an error that occurs when audio extraction fails.
/// </summary>
public sealed class FailedAudioExtractionException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="FailedAudioExtractionException"/> class.
/// </summary>
public FailedAudioExtractionException() : base()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FailedAudioExtractionException"/> class with a specified error message.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
public FailedAudioExtractionException(string message) : base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FailedAudioExtractionException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception.</param>
public FailedAudioExtractionException(string message, Exception innerException) : base(message, innerException)
{
}
@@ -10,7 +10,7 @@ namespace StreamShorts.Library.Media;
/// Represents a service for processing video files using FFMpeg.
/// </summary>
/// <inheritdoc/>
internal class FFMpegService : IVideoService
internal sealed class FFMpegService : IVideoService
{
public async Task<bool> ExtractAudioFromVideoAsync(Stream video, Stream audio)
{
@@ -7,7 +7,7 @@ namespace StreamShorts.Library.Media;
/// Represents a service for processing audio files using NAudio.
/// </summary>
/// <inheritdoc/>
internal class NAudioService : IAudioService
internal sealed class NAudioService : IAudioService
{
public Stream ConvertMp3ToWav16(Stream mp3)
{