From fa7850b135cd7c52479d30d46c808c9e1d3037aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=91=D0=B0=D0=B3?= =?UTF-8?q?=D1=80=D1=8F=D0=BD=D1=86=D0=B5=D0=B2?= Date: Tue, 12 May 2020 17:53:52 +0300 Subject: [PATCH] Updated PixelFormat namespace Former-commit-id: 17fa6aafee0bca998a9987d23addc72a3148e8b4 --- FFMpegCore.Test/VideoTest.cs | 28 +++++++++---------- .../FFMpeg/Arguments/ForcePixelFormat.cs | 5 +--- FFMpegCore/FFMpeg/Enums/PixelFormat.cs | 2 +- FFMpegCore/FFMpeg/FFMpeg.cs | 13 ++++----- FFMpegCore/FFMpeg/FFMpegArguments.cs | 1 - FFMpegCore/FFMpeg/FFMpegCache.cs | 3 -- FFMpegCore/FFProbe/VideoStream.cs | 2 +- 7 files changed, 23 insertions(+), 31 deletions(-) diff --git a/FFMpegCore.Test/VideoTest.cs b/FFMpegCore.Test/VideoTest.cs index 358634d..6bffa89 100644 --- a/FFMpegCore.Test/VideoTest.cs +++ b/FFMpegCore.Test/VideoTest.cs @@ -212,7 +212,7 @@ public void Convert(ContainerFormat type, params IArgument[] inputArguments) Convert(type, null, inputArguments); } - public void ConvertFromPipe(ContainerFormat type, PixelFormat fmt, params IArgument[] inputArguments) + public void ConvertFromPipe(ContainerFormat type, System.Drawing.Imaging.PixelFormat fmt, params IArgument[] inputArguments) { var output = Input.OutputLocation(type); @@ -280,10 +280,10 @@ public void Video_ToMP4_Args() } [DataTestMethod] - [DataRow(PixelFormat.Format24bppRgb)] - [DataRow(PixelFormat.Format32bppArgb)] + [DataRow(System.Drawing.Imaging.PixelFormat.Format24bppRgb)] + [DataRow(System.Drawing.Imaging.PixelFormat.Format32bppArgb)] // [DataRow(PixelFormat.Format48bppRgb)] - public void Video_ToMP4_Args_Pipe(PixelFormat pixelFormat) + public void Video_ToMP4_Args_Pipe(System.Drawing.Imaging.PixelFormat pixelFormat) { ConvertFromPipe(VideoType.Mp4, pixelFormat, new VideoCodecArgument(VideoCodec.LibX264)); } @@ -358,10 +358,10 @@ public void Video_ToTS_Args() } [DataTestMethod] - [DataRow(PixelFormat.Format24bppRgb)] - [DataRow(PixelFormat.Format32bppArgb)] + [DataRow(System.Drawing.Imaging.PixelFormat.Format24bppRgb)] + [DataRow(System.Drawing.Imaging.PixelFormat.Format32bppArgb)] // [DataRow(PixelFormat.Format48bppRgb)] - public void Video_ToTS_Args_Pipe(PixelFormat pixelFormat) + public void Video_ToTS_Args_Pipe(System.Drawing.Imaging.PixelFormat pixelFormat) { ConvertFromPipe(VideoType.Ts, pixelFormat, new ForceFormatArgument(VideoType.Ts)); } @@ -379,10 +379,10 @@ public void Video_ToOGV_Resize_Args() } [DataTestMethod] - [DataRow(PixelFormat.Format24bppRgb)] - [DataRow(PixelFormat.Format32bppArgb)] + [DataRow(System.Drawing.Imaging.PixelFormat.Format24bppRgb)] + [DataRow(System.Drawing.Imaging.PixelFormat.Format32bppArgb)] // [DataRow(PixelFormat.Format48bppRgb)] - public void Video_ToOGV_Resize_Args_Pipe(PixelFormat pixelFormat) + public void Video_ToOGV_Resize_Args_Pipe(System.Drawing.Imaging.PixelFormat pixelFormat) { ConvertFromPipe(VideoType.Ogv, pixelFormat, new ScaleArgument(VideoSize.Ed), new VideoCodecArgument(VideoCodec.LibTheora)); } @@ -400,10 +400,10 @@ public void Video_ToMP4_Resize_Args() } [DataTestMethod] - [DataRow(PixelFormat.Format24bppRgb)] - [DataRow(PixelFormat.Format32bppArgb)] + [DataRow(System.Drawing.Imaging.PixelFormat.Format24bppRgb)] + [DataRow(System.Drawing.Imaging.PixelFormat.Format32bppArgb)] // [DataRow(PixelFormat.Format48bppRgb)] - public void Video_ToMP4_Resize_Args_Pipe(PixelFormat pixelFormat) + public void Video_ToMP4_Resize_Args_Pipe(System.Drawing.Imaging.PixelFormat pixelFormat) { ConvertFromPipe(VideoType.Mp4, pixelFormat, new ScaleArgument(VideoSize.Ld), new VideoCodecArgument(VideoCodec.LibX264)); } @@ -625,7 +625,7 @@ public void Video_TranscodeInMemory() { using var resStream = new MemoryStream(); var reader = new StreamPipeDataReader(resStream); - var writer = new RawVideoPipeDataWriter(BitmapSource.CreateBitmaps(128, PixelFormat.Format24bppRgb, 128, 128)); + var writer = new RawVideoPipeDataWriter(BitmapSource.CreateBitmaps(128, System.Drawing.Imaging.PixelFormat.Format24bppRgb, 128, 128)); FFMpegArguments .FromPipe(writer) diff --git a/FFMpegCore/FFMpeg/Arguments/ForcePixelFormat.cs b/FFMpegCore/FFMpeg/Arguments/ForcePixelFormat.cs index 04b84ad..7614ae3 100644 --- a/FFMpegCore/FFMpeg/Arguments/ForcePixelFormat.cs +++ b/FFMpegCore/FFMpeg/Arguments/ForcePixelFormat.cs @@ -1,7 +1,4 @@ -using FFMpegCore.Models; -using System; -using System.Collections.Generic; -using System.Text; +using FFMpegCore.Enums; namespace FFMpegCore.Arguments { diff --git a/FFMpegCore/FFMpeg/Enums/PixelFormat.cs b/FFMpegCore/FFMpeg/Enums/PixelFormat.cs index dad0a6e..4262a74 100644 --- a/FFMpegCore/FFMpeg/Enums/PixelFormat.cs +++ b/FFMpegCore/FFMpeg/Enums/PixelFormat.cs @@ -3,7 +3,7 @@ using System.Text; using System.Text.RegularExpressions; -namespace FFMpegCore.Models +namespace FFMpegCore.Enums { public class PixelFormat { diff --git a/FFMpegCore/FFMpeg/FFMpeg.cs b/FFMpegCore/FFMpeg/FFMpeg.cs index 8bc235c..bfc7509 100644 --- a/FFMpegCore/FFMpeg/FFMpeg.cs +++ b/FFMpegCore/FFMpeg/FFMpeg.cs @@ -7,7 +7,6 @@ using FFMpegCore.Enums; using FFMpegCore.Exceptions; using FFMpegCore.Helpers; -using FFMpegCore.Models; namespace FFMpegCore { @@ -326,15 +325,15 @@ public static bool ReplaceAudio(string input, string inputAudio, string output, } #region PixelFormats - internal static IReadOnlyList GetPixelFormatsInternal() + internal static IReadOnlyList GetPixelFormatsInternal() { FFMpegHelper.RootExceptionCheck(FFMpegOptions.Options.RootDirectory); - var list = new List(); + var list = new List(); using var instance = new Instances.Instance(FFMpegOptions.Options.FFmpegBinary, "-pix_fmts"); instance.DataReceived += (e, args) => { - if (Models.PixelFormat.TryParse(args.Data, out var fmt)) + if (Enums.PixelFormat.TryParse(args.Data, out var fmt)) list.Add(fmt); }; @@ -344,14 +343,14 @@ public static bool ReplaceAudio(string input, string inputAudio, string output, return list.AsReadOnly(); } - public static IReadOnlyList GetPixelFormats() + public static IReadOnlyList GetPixelFormats() { if (!FFMpegOptions.Options.UseCache) return GetPixelFormatsInternal(); return FFMpegCache.PixelFormats.Values.ToList().AsReadOnly(); } - public static bool TryGetPixelFormat(string name, out Models.PixelFormat fmt) + public static bool TryGetPixelFormat(string name, out Enums.PixelFormat fmt) { if (!FFMpegOptions.Options.UseCache) { @@ -362,7 +361,7 @@ public static bool TryGetPixelFormat(string name, out Models.PixelFormat fmt) return FFMpegCache.PixelFormats.TryGetValue(name, out fmt); } - public static Models.PixelFormat GetPixelFormat(string name) + public static Enums.PixelFormat GetPixelFormat(string name) { if (TryGetPixelFormat(name, out var fmt)) return fmt; diff --git a/FFMpegCore/FFMpeg/FFMpegArguments.cs b/FFMpegCore/FFMpeg/FFMpegArguments.cs index 4cef99d..bcfe28c 100644 --- a/FFMpegCore/FFMpeg/FFMpegArguments.cs +++ b/FFMpegCore/FFMpeg/FFMpegArguments.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using FFMpegCore.Arguments; using FFMpegCore.Enums; -using FFMpegCore.Models; using FFMpegCore.Pipes; namespace FFMpegCore diff --git a/FFMpegCore/FFMpeg/FFMpegCache.cs b/FFMpegCore/FFMpeg/FFMpegCache.cs index 4c54271..0847202 100644 --- a/FFMpegCore/FFMpeg/FFMpegCache.cs +++ b/FFMpegCore/FFMpeg/FFMpegCache.cs @@ -1,9 +1,6 @@ using FFMpegCore.Enums; -using FFMpegCore.Models; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; namespace FFMpegCore { diff --git a/FFMpegCore/FFProbe/VideoStream.cs b/FFMpegCore/FFProbe/VideoStream.cs index 1bf1ebd..18533bd 100644 --- a/FFMpegCore/FFProbe/VideoStream.cs +++ b/FFMpegCore/FFProbe/VideoStream.cs @@ -1,4 +1,4 @@ -using FFMpegCore.Models; +using FFMpegCore.Enums; namespace FFMpegCore {