diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 8410a327..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-sudo: true
-dist: focal
-language: csharp
-mono: none
-dotnet: 6.0.7
-script:
- - sudo apt-get install ffmpeg -y
- - dotnet build -c Release
- - dotnet test -c Release
diff --git a/Directory.Build.props b/Directory.Build.props
index b13586ba..25ef4344 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -16,7 +16,6 @@
-
true
true
false
@@ -30,9 +29,5 @@
-
-
-
-
-
+
diff --git a/Directory.Packages.props b/Directory.Packages.props
new file mode 100644
index 00000000..bba73271
--- /dev/null
+++ b/Directory.Packages.props
@@ -0,0 +1,18 @@
+
+
+ true
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FFmpeg.AutoGen.Abstractions/FFmpeg.AutoGen.Abstractions.csproj b/FFmpeg.AutoGen.Abstractions/FFmpeg.AutoGen.Abstractions.csproj
index 3c9c597f..eeb9e459 100644
--- a/FFmpeg.AutoGen.Abstractions/FFmpeg.AutoGen.Abstractions.csproj
+++ b/FFmpeg.AutoGen.Abstractions/FFmpeg.AutoGen.Abstractions.csproj
@@ -24,11 +24,7 @@
-
-
-
-
-
+
diff --git a/FFmpeg.AutoGen.Bindings.DynamicallyLinked/FFmpeg.AutoGen.Bindings.DynamicallyLinked.csproj b/FFmpeg.AutoGen.Bindings.DynamicallyLinked/FFmpeg.AutoGen.Bindings.DynamicallyLinked.csproj
index dea5c817..748e7580 100644
--- a/FFmpeg.AutoGen.Bindings.DynamicallyLinked/FFmpeg.AutoGen.Bindings.DynamicallyLinked.csproj
+++ b/FFmpeg.AutoGen.Bindings.DynamicallyLinked/FFmpeg.AutoGen.Bindings.DynamicallyLinked.csproj
@@ -24,15 +24,11 @@
-
+
-
-
-
-
-
+
diff --git a/FFmpeg.AutoGen.Bindings.DynamicallyLoaded/FFmpeg.AutoGen.Bindings.DynamicallyLoaded.csproj b/FFmpeg.AutoGen.Bindings.DynamicallyLoaded/FFmpeg.AutoGen.Bindings.DynamicallyLoaded.csproj
index 57706460..5ca6879e 100644
--- a/FFmpeg.AutoGen.Bindings.DynamicallyLoaded/FFmpeg.AutoGen.Bindings.DynamicallyLoaded.csproj
+++ b/FFmpeg.AutoGen.Bindings.DynamicallyLoaded/FFmpeg.AutoGen.Bindings.DynamicallyLoaded.csproj
@@ -24,15 +24,11 @@
-
+
-
-
-
-
diff --git a/FFmpeg.AutoGen.Bindings.StaticallyLinked/FFmpeg.AutoGen.Bindings.StaticallyLinked.csproj b/FFmpeg.AutoGen.Bindings.StaticallyLinked/FFmpeg.AutoGen.Bindings.StaticallyLinked.csproj
index bb36f9dc..912eb488 100644
--- a/FFmpeg.AutoGen.Bindings.StaticallyLinked/FFmpeg.AutoGen.Bindings.StaticallyLinked.csproj
+++ b/FFmpeg.AutoGen.Bindings.StaticallyLinked/FFmpeg.AutoGen.Bindings.StaticallyLinked.csproj
@@ -24,12 +24,9 @@
-
-
-
-
-
+
+
diff --git a/FFmpeg.AutoGen.ClangMacroParser.Test/FFmpeg.AutoGen.ClangMacroParser.Test.csproj b/FFmpeg.AutoGen.ClangMacroParser.Test/FFmpeg.AutoGen.ClangMacroParser.Test.csproj
index facc239c..7c029ab3 100644
--- a/FFmpeg.AutoGen.ClangMacroParser.Test/FFmpeg.AutoGen.ClangMacroParser.Test.csproj
+++ b/FFmpeg.AutoGen.ClangMacroParser.Test/FFmpeg.AutoGen.ClangMacroParser.Test.csproj
@@ -9,18 +9,17 @@
-
-
-
-
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
-
-
-
-
-
+
\ No newline at end of file
diff --git a/FFmpeg.AutoGen.ClangMacroParser/FFmpeg.AutoGen.ClangMacroParser.csproj b/FFmpeg.AutoGen.ClangMacroParser/FFmpeg.AutoGen.ClangMacroParser.csproj
index 895aa17f..f1657b48 100644
--- a/FFmpeg.AutoGen.ClangMacroParser/FFmpeg.AutoGen.ClangMacroParser.csproj
+++ b/FFmpeg.AutoGen.ClangMacroParser/FFmpeg.AutoGen.ClangMacroParser.csproj
@@ -1,12 +1,8 @@
-
+
netstandard2.1
enable
-
-
-
-
\ No newline at end of file
diff --git a/FFmpeg.AutoGen.CppSharpUnsafeGenerator/FFmpeg.AutoGen.CppSharpUnsafeGenerator.csproj b/FFmpeg.AutoGen.CppSharpUnsafeGenerator/FFmpeg.AutoGen.CppSharpUnsafeGenerator.csproj
index fd8b7e2f..b69e8639 100644
--- a/FFmpeg.AutoGen.CppSharpUnsafeGenerator/FFmpeg.AutoGen.CppSharpUnsafeGenerator.csproj
+++ b/FFmpeg.AutoGen.CppSharpUnsafeGenerator/FFmpeg.AutoGen.CppSharpUnsafeGenerator.csproj
@@ -1,22 +1,19 @@
-
+
Exe
net6.0
x64
+ 8002
-
-
+
+
-
-
-
-
diff --git a/FFmpeg.AutoGen.Example/FFmpeg.AutoGen.Example.csproj b/FFmpeg.AutoGen.Example/FFmpeg.AutoGen.Example.csproj
index 8b61bf26..26cec647 100644
--- a/FFmpeg.AutoGen.Example/FFmpeg.AutoGen.Example.csproj
+++ b/FFmpeg.AutoGen.Example/FFmpeg.AutoGen.Example.csproj
@@ -1,26 +1,29 @@
-
+
Exe
net6.0
True
x64
+ 1416
+
+
+
+
+
-
+
+
-
-
-
-
diff --git a/FFmpeg.AutoGen.Example/Program.cs b/FFmpeg.AutoGen.Example/Program.cs
index 3a26525a..92d6e51f 100644
--- a/FFmpeg.AutoGen.Example/Program.cs
+++ b/FFmpeg.AutoGen.Example/Program.cs
@@ -4,9 +4,11 @@
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
+using System.Reflection.Metadata;
using System.Runtime.InteropServices;
using FFmpeg.AutoGen.Abstractions;
using FFmpeg.AutoGen.Bindings.DynamicallyLoaded;
+using SkiaSharp;
namespace FFmpeg.AutoGen.Example;
@@ -111,7 +113,7 @@ private static unsafe void DecodeAllFramesToImages(AVHWDeviceType HWDevice)
? vsd.PixelFormat
: GetHWPixelFormat(HWDevice);
var destinationSize = sourceSize;
- var destinationPixelFormat = AVPixelFormat.AV_PIX_FMT_BGR24;
+ var destinationPixelFormat = AVPixelFormat.@AV_PIX_FMT_BGRA;
using var vfc = new VideoFrameConverter(sourceSize, sourcePixelFormat, destinationSize, destinationPixelFormat);
var frameNumber = 0;
@@ -119,13 +121,7 @@ private static unsafe void DecodeAllFramesToImages(AVHWDeviceType HWDevice)
while (vsd.TryDecodeNextFrame(out var frame))
{
var convertedFrame = vfc.Convert(frame);
-
- using (var bitmap = new Bitmap(convertedFrame.width,
- convertedFrame.height,
- convertedFrame.linesize[0],
- PixelFormat.Format24bppRgb,
- (IntPtr)convertedFrame.data[0]))
- bitmap.Save($"frames/frame.{frameNumber:D8}.jpg", ImageFormat.Jpeg);
+ WriteFrame(convertedFrame, frameNumber);
Console.WriteLine($"frame: {frameNumber}");
frameNumber++;
@@ -154,12 +150,12 @@ private static AVPixelFormat GetHWPixelFormat(AVHWDeviceType hWDevice)
private static unsafe void EncodeImagesToH264()
{
var frameFiles = Directory.GetFiles("./frames", "frame.*.jpg").OrderBy(x => x).ToArray();
- var fistFrameImage = Image.FromFile(frameFiles.First());
+ using var fistFrameImage = ReadFrame(frameFiles.First());
var outputFileName = "frames/out.h264";
var fps = 25;
- var sourceSize = fistFrameImage.Size;
- var sourcePixelFormat = AVPixelFormat.AV_PIX_FMT_BGR24;
+ var sourceSize = new Size(fistFrameImage.Width, fistFrameImage.Height);
+ var sourcePixelFormat = AVPixelFormat.@AV_PIX_FMT_BGRA;
var destinationSize = sourceSize;
var destinationPixelFormat = AVPixelFormat.AV_PIX_FMT_YUV420P;
using var vfc = new VideoFrameConverter(sourceSize, sourcePixelFormat, destinationSize, destinationPixelFormat);
@@ -172,12 +168,8 @@ private static unsafe void EncodeImagesToH264()
foreach (var frameFile in frameFiles)
{
- byte[] bitmapData;
-
- using (var frameImage = Image.FromFile(frameFile))
- using (var frameBitmap = frameImage is Bitmap bitmap ? bitmap : new Bitmap(frameImage))
- bitmapData = GetBitmapData(frameBitmap);
-
+ using var bitmap = ReadFrame(frameFile);
+ var bitmapData = bitmap.Bytes;
fixed (byte* pBitmapData = bitmapData)
{
var data = new byte_ptr8 { [0] = pBitmapData };
@@ -200,22 +192,18 @@ private static unsafe void EncodeImagesToH264()
vse.Drain();
}
- private static byte[] GetBitmapData(Bitmap frameBitmap)
+ private static unsafe void WriteFrame(AVFrame convertedFrame, int frameNumber)
{
- var bitmapData = frameBitmap.LockBits(new Rectangle(Point.Empty, frameBitmap.Size),
- ImageLockMode.ReadOnly,
- PixelFormat.Format24bppRgb);
+ var imageInfo = new SKImageInfo(convertedFrame.width, convertedFrame.height, SKColorType.Bgra8888, SKAlphaType.Opaque);
+ using var bitmap = new SKBitmap();
+ bitmap.InstallPixels(imageInfo, (IntPtr)convertedFrame.data[0]);
+ using var stream = File.Create($"frames/frame.{frameNumber:D8}.jpg");
+ bitmap.Encode(stream, SKEncodedImageFormat.Jpeg, 90);
+ }
- try
- {
- var length = bitmapData.Stride * bitmapData.Height;
- var data = new byte[length];
- Marshal.Copy(bitmapData.Scan0, data, 0, length);
- return data;
- }
- finally
- {
- frameBitmap.UnlockBits(bitmapData);
- }
+ private static unsafe SKBitmap ReadFrame(string frameFile)
+ {
+ using var codec = SKCodec.Create(frameFile);
+ return SKBitmap.Decode(codec);
}
}
diff --git a/FFmpeg.AutoGen.Examples.Encode/FFmpeg.AutoGen.Examples.Encode.csproj b/FFmpeg.AutoGen.Examples.Encode/FFmpeg.AutoGen.Examples.Encode.csproj
index e4e5c1dc..1dc89c2b 100644
--- a/FFmpeg.AutoGen.Examples.Encode/FFmpeg.AutoGen.Examples.Encode.csproj
+++ b/FFmpeg.AutoGen.Examples.Encode/FFmpeg.AutoGen.Examples.Encode.csproj
@@ -11,8 +11,4 @@
-
-
-
-
diff --git a/FFmpeg.AutoGen.Examples.ResamplingAudio/FFmpeg.AutoGen.Examples.ResamplingAudio.csproj b/FFmpeg.AutoGen.Examples.ResamplingAudio/FFmpeg.AutoGen.Examples.ResamplingAudio.csproj
index e4e5c1dc..1dc89c2b 100644
--- a/FFmpeg.AutoGen.Examples.ResamplingAudio/FFmpeg.AutoGen.Examples.ResamplingAudio.csproj
+++ b/FFmpeg.AutoGen.Examples.ResamplingAudio/FFmpeg.AutoGen.Examples.ResamplingAudio.csproj
@@ -11,8 +11,4 @@
-
-
-
-
diff --git a/FFmpeg.AutoGen.sln b/FFmpeg.AutoGen.sln
index 678b8e5a..f0822d64 100644
--- a/FFmpeg.AutoGen.sln
+++ b/FFmpeg.AutoGen.sln
@@ -9,8 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FFmpeg.AutoGen.Example", "F
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0. Solution Items", "0. Solution Items", "{CF48D45D-979F-4574-9E33-A3AC1CB542B5}"
ProjectSection(SolutionItems) = preProject
- .travis.yml = .travis.yml
Directory.Build.props = Directory.Build.props
+ Directory.Packages.props = Directory.Packages.props
README.md = README.md
EndProjectSection
EndProject
diff --git a/FFmpeg.AutoGen/FFmpeg.AutoGen.csproj b/FFmpeg.AutoGen/FFmpeg.AutoGen.csproj
index 4d9333f9..587e2e5d 100644
--- a/FFmpeg.AutoGen/FFmpeg.AutoGen.csproj
+++ b/FFmpeg.AutoGen/FFmpeg.AutoGen.csproj
@@ -1,4 +1,4 @@
-
+
netstandard2.1;netstandard2.0
@@ -21,11 +21,7 @@
-
+
-
-
-
-