Updated PixelFormat namespace

Former-commit-id: 17fa6aafee
This commit is contained in:
Максим Багрянцев 2020-05-12 17:53:52 +03:00
parent 6416cea390
commit fa7850b135
7 changed files with 23 additions and 31 deletions

View file

@ -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)

View file

@ -1,7 +1,4 @@
using FFMpegCore.Models;
using System;
using System.Collections.Generic;
using System.Text;
using FFMpegCore.Enums;
namespace FFMpegCore.Arguments
{

View file

@ -3,7 +3,7 @@
using System.Text;
using System.Text.RegularExpressions;
namespace FFMpegCore.Models
namespace FFMpegCore.Enums
{
public class PixelFormat
{

View file

@ -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<Models.PixelFormat> GetPixelFormatsInternal()
internal static IReadOnlyList<Enums.PixelFormat> GetPixelFormatsInternal()
{
FFMpegHelper.RootExceptionCheck(FFMpegOptions.Options.RootDirectory);
var list = new List<Models.PixelFormat>();
var list = new List<Enums.PixelFormat>();
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<Models.PixelFormat> GetPixelFormats()
public static IReadOnlyList<Enums.PixelFormat> 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;

View file

@ -7,7 +7,6 @@
using System.Threading.Tasks;
using FFMpegCore.Arguments;
using FFMpegCore.Enums;
using FFMpegCore.Models;
using FFMpegCore.Pipes;
namespace FFMpegCore

View file

@ -1,9 +1,6 @@
using FFMpegCore.Enums;
using FFMpegCore.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FFMpegCore
{

View file

@ -1,4 +1,4 @@
using FFMpegCore.Models;
using FFMpegCore.Enums;
namespace FFMpegCore
{