mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-14 02:04:14 +01:00
Updated PixelFormat namespace
This commit is contained in:
parent
bbc9305e2b
commit
17fa6aafee
7 changed files with 23 additions and 31 deletions
|
@ -212,7 +212,7 @@ public void Convert(ContainerFormat type, params IArgument[] inputArguments)
|
||||||
Convert(type, null, 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);
|
var output = Input.OutputLocation(type);
|
||||||
|
|
||||||
|
@ -280,10 +280,10 @@ public void Video_ToMP4_Args()
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(PixelFormat.Format24bppRgb)]
|
[DataRow(System.Drawing.Imaging.PixelFormat.Format24bppRgb)]
|
||||||
[DataRow(PixelFormat.Format32bppArgb)]
|
[DataRow(System.Drawing.Imaging.PixelFormat.Format32bppArgb)]
|
||||||
// [DataRow(PixelFormat.Format48bppRgb)]
|
// [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));
|
ConvertFromPipe(VideoType.Mp4, pixelFormat, new VideoCodecArgument(VideoCodec.LibX264));
|
||||||
}
|
}
|
||||||
|
@ -358,10 +358,10 @@ public void Video_ToTS_Args()
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(PixelFormat.Format24bppRgb)]
|
[DataRow(System.Drawing.Imaging.PixelFormat.Format24bppRgb)]
|
||||||
[DataRow(PixelFormat.Format32bppArgb)]
|
[DataRow(System.Drawing.Imaging.PixelFormat.Format32bppArgb)]
|
||||||
// [DataRow(PixelFormat.Format48bppRgb)]
|
// [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));
|
ConvertFromPipe(VideoType.Ts, pixelFormat, new ForceFormatArgument(VideoType.Ts));
|
||||||
}
|
}
|
||||||
|
@ -379,10 +379,10 @@ public void Video_ToOGV_Resize_Args()
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(PixelFormat.Format24bppRgb)]
|
[DataRow(System.Drawing.Imaging.PixelFormat.Format24bppRgb)]
|
||||||
[DataRow(PixelFormat.Format32bppArgb)]
|
[DataRow(System.Drawing.Imaging.PixelFormat.Format32bppArgb)]
|
||||||
// [DataRow(PixelFormat.Format48bppRgb)]
|
// [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));
|
ConvertFromPipe(VideoType.Ogv, pixelFormat, new ScaleArgument(VideoSize.Ed), new VideoCodecArgument(VideoCodec.LibTheora));
|
||||||
}
|
}
|
||||||
|
@ -400,10 +400,10 @@ public void Video_ToMP4_Resize_Args()
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataTestMethod]
|
[DataTestMethod]
|
||||||
[DataRow(PixelFormat.Format24bppRgb)]
|
[DataRow(System.Drawing.Imaging.PixelFormat.Format24bppRgb)]
|
||||||
[DataRow(PixelFormat.Format32bppArgb)]
|
[DataRow(System.Drawing.Imaging.PixelFormat.Format32bppArgb)]
|
||||||
// [DataRow(PixelFormat.Format48bppRgb)]
|
// [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));
|
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();
|
using var resStream = new MemoryStream();
|
||||||
var reader = new StreamPipeDataReader(resStream);
|
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
|
FFMpegArguments
|
||||||
.FromPipe(writer)
|
.FromPipe(writer)
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
using FFMpegCore.Models;
|
using FFMpegCore.Enums;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace FFMpegCore.Arguments
|
namespace FFMpegCore.Arguments
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace FFMpegCore.Models
|
namespace FFMpegCore.Enums
|
||||||
{
|
{
|
||||||
public class PixelFormat
|
public class PixelFormat
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
using FFMpegCore.Enums;
|
using FFMpegCore.Enums;
|
||||||
using FFMpegCore.Exceptions;
|
using FFMpegCore.Exceptions;
|
||||||
using FFMpegCore.Helpers;
|
using FFMpegCore.Helpers;
|
||||||
using FFMpegCore.Models;
|
|
||||||
|
|
||||||
namespace FFMpegCore
|
namespace FFMpegCore
|
||||||
{
|
{
|
||||||
|
@ -326,15 +325,15 @@ public static bool ReplaceAudio(string input, string inputAudio, string output,
|
||||||
}
|
}
|
||||||
|
|
||||||
#region PixelFormats
|
#region PixelFormats
|
||||||
internal static IReadOnlyList<Models.PixelFormat> GetPixelFormatsInternal()
|
internal static IReadOnlyList<Enums.PixelFormat> GetPixelFormatsInternal()
|
||||||
{
|
{
|
||||||
FFMpegHelper.RootExceptionCheck(FFMpegOptions.Options.RootDirectory);
|
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");
|
using var instance = new Instances.Instance(FFMpegOptions.Options.FFmpegBinary, "-pix_fmts");
|
||||||
instance.DataReceived += (e, args) =>
|
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);
|
list.Add(fmt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -344,14 +343,14 @@ public static bool ReplaceAudio(string input, string inputAudio, string output,
|
||||||
return list.AsReadOnly();
|
return list.AsReadOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IReadOnlyList<Models.PixelFormat> GetPixelFormats()
|
public static IReadOnlyList<Enums.PixelFormat> GetPixelFormats()
|
||||||
{
|
{
|
||||||
if (!FFMpegOptions.Options.UseCache)
|
if (!FFMpegOptions.Options.UseCache)
|
||||||
return GetPixelFormatsInternal();
|
return GetPixelFormatsInternal();
|
||||||
return FFMpegCache.PixelFormats.Values.ToList().AsReadOnly();
|
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)
|
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);
|
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))
|
if (TryGetPixelFormat(name, out var fmt))
|
||||||
return fmt;
|
return fmt;
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using FFMpegCore.Arguments;
|
using FFMpegCore.Arguments;
|
||||||
using FFMpegCore.Enums;
|
using FFMpegCore.Enums;
|
||||||
using FFMpegCore.Models;
|
|
||||||
using FFMpegCore.Pipes;
|
using FFMpegCore.Pipes;
|
||||||
|
|
||||||
namespace FFMpegCore
|
namespace FFMpegCore
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
using FFMpegCore.Enums;
|
using FFMpegCore.Enums;
|
||||||
using FFMpegCore.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace FFMpegCore
|
namespace FFMpegCore
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using FFMpegCore.Models;
|
using FFMpegCore.Enums;
|
||||||
|
|
||||||
namespace FFMpegCore
|
namespace FFMpegCore
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue