Skip to content

Commit 83ceade

Browse files
committed
upgrade to 6.1
1 parent 7da6295 commit 83ceade

20 files changed

+557
-240
lines changed
Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
1-
using static FParsec.CharParsers;
1+
using System.Text;
2+
using static FParsec.CharParsers;
23

34
namespace Sdcb.FFmpeg.AutoGen.ClangMarcroParsers.Units
45
{
56
public record NumberExpression(NumberLiteral Number) : IExpression
67
{
7-
public string Serialize() => Number.String;
8+
public string Serialize()
9+
{
10+
StringBuilder suffixSb = new(4);
11+
12+
if (Number.SuffixChar1 != EOS) suffixSb.Append(Number.SuffixChar1);
13+
if (Number.SuffixChar2 != EOS) suffixSb.Append(Number.SuffixChar2);
14+
if (Number.SuffixChar3 != EOS) suffixSb.Append(Number.SuffixChar3);
15+
if (Number.SuffixChar4 != EOS) suffixSb.Append(Number.SuffixChar4);
16+
17+
string suffix = suffixSb.ToString() switch
18+
{
19+
"ULL" => "UL",
20+
var x => x,
21+
};
22+
23+
return Number.String + suffix;
24+
}
825
}
926
}

src/Sdcb.FFmpeg.AutoGen/Processors/MacroEnumPostProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static (IReadOnlyList<MacroDefinitionBase>, IReadOnlyList<EnumerationDefi
1717
MacroEnumDef.MakeFlags("AV_CODEC_FLAG_"),
1818
MacroEnumDef.MakeFlags("AV_CODEC_FLAG2_"),
1919
//new ("SLICE_FLAG_", "SLICE_FLAG"),
20-
MacroEnumDef.MakeFlagsExcept("AV_CH_", HashSet("AV_CH_LAYOUT_NATIVE")),
20+
MacroEnumDef.MakeFlags("AV_CH_"),
2121
MacroEnumDef.MakeFlags("AV_CODEC_CAP_"),
2222
//new ("FF_MB_DECISION_", "FFMacroblockDecision"),
2323
//new ("FF_CMP_", "FFComparison"),

src/Sdcb.FFmpeg.AutoGen/Processors/MacroPostProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ var x when x.Contains("_VERSION_") => "uint",
152152
{ Op: ">" or "<" or "==" or "!=" or "&&" or "||" } => "bool",
153153
_ => (DeduceType(e.Left), DeduceType(e.Right)) switch
154154
{
155-
(string left, string right) => TypeHelper.CalculatePrecedence(left) < TypeHelper.CalculatePrecedence(left) ? left : right,
155+
(string left, string right) => TypeHelper.CalculatePrecedence(left) < TypeHelper.CalculatePrecedence(right) ? left : right,
156156
}
157157
},
158158
CharExpression => "char",

src/Sdcb.FFmpeg.NuGetBuilder/PackageInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public static class PackageInfo
44
{
5-
public const string Version = "6.0.26";
5+
public const string Version = "6.1.0";
66

7-
public const string Url = $"https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2023-07-03-13-08/ffmpeg-n6.0-26-g3f345ebf21-win64-gpl-shared-6.0.zip";
7+
public const string Url = $"https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z";
88
}

src/Sdcb.FFmpeg.NuGetBuilder/Program.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// See https://aka.ms/new-console-template for more information
22
using Sdcb.FFmpeg.NuGetBuilder;
3+
using SharpCompress.Archives;
34
using System.Diagnostics;
45
using System.IO.Compression;
56
using System.Xml;
@@ -113,19 +114,20 @@ async Task SetupFFmpegBinaries(string solutionDir, string ffmpegBinaryUrl)
113114

114115
Console.WriteLine($"(3 of 4) Extracting {destinationCacheFile}...");
115116
{
116-
using ZipArchive zip = ZipFile.OpenRead(destinationCacheFile);
117-
ExtractPrefixToDest(zip, "/bin/", FFmpegBinDir);
118-
ExtractPrefixToDest(zip, "/include/", FFmpegIncludeDir);
117+
using IArchive archive = ArchiveFactory.Open(destinationCacheFile);
118+
ExtractPrefixToDest(archive.Entries, "/bin", FFmpegBinDir);
119+
ExtractPrefixToDest(archive.Entries, "/include", FFmpegIncludeDir);
119120

120-
static void ExtractPrefixToDest(ZipArchive zip, string prefix, string dest)
121+
static void ExtractPrefixToDest(IEnumerable<IArchiveEntry> entries, string prefix, string dest)
121122
{
122-
string zipPrefix = zip.Entries.Single(x => x.FullName.EndsWith(prefix) && x.Length == 0).FullName;
123+
IArchiveEntry zipPrefixEntry = entries.Single(x => x.Key.EndsWith(prefix) && x.IsDirectory);
124+
string zipPrefix = zipPrefixEntry.Key + "/";
123125
Directory.CreateDirectory(dest);
124126

125-
foreach (ZipArchiveEntry entry in zip.Entries.Where(x => x.FullName.StartsWith(zipPrefix) && x.FullName != zipPrefix))
127+
foreach (IArchiveEntry entry in entries.Where(x => x.Key.StartsWith(zipPrefix) && x.Key != zipPrefix))
126128
{
127-
string path = Path.Combine(dest, entry.FullName.Replace(zipPrefix, ""));
128-
if (entry.Length == 0 && entry.FullName.EndsWith("/"))
129+
string path = Path.Combine(dest, entry.Key.Replace(zipPrefix, ""));
130+
if (entry.IsDirectory)
129131
{
130132
// folder
131133
Console.WriteLine($"Creating folder {path}...");
@@ -135,7 +137,13 @@ static void ExtractPrefixToDest(ZipArchive zip, string prefix, string dest)
135137
{
136138
// file
137139
Console.WriteLine($"Extract file {path}...");
138-
entry.ExtractToFile(path);
140+
using (var entryStream = entry.OpenEntryStream())
141+
{
142+
using (var fileStream = File.Create(path))
143+
{
144+
entryStream.CopyTo(fileStream);
145+
}
146+
}
139147
}
140148
}
141149
}

src/Sdcb.FFmpeg.NuGetBuilder/Sdcb.FFmpeg.NuGetBuilder.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@
2121
</Content>
2222
</ItemGroup>
2323

24+
<ItemGroup>
25+
<PackageReference Include="SharpCompress" Version="0.34.1" />
26+
</ItemGroup>
27+
2428
</Project>

src/Sdcb.FFmpeg/Codecs/Codec.g.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ private Codec(AVCodec* ptr)
137137

138138
/// <summary>
139139
/// <para>original type: AVProfile*</para>
140-
/// <para>array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}</para>
140+
/// <para>array of recognized profiles, or NULL if unknown, array is terminated by {AV_PROFILE_UNKNOWN}</para>
141141
/// <see cref="AVCodec.profiles" />
142142
/// </summary>
143143
public IEnumerable<MediaProfile> Profiles => NativeUtils.ReadSequence(

src/Sdcb.FFmpeg/Codecs/CodecContext.g.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ public AVRational TimeBase
217217
/// <para>For some codecs, the time base is closer to the field rate than the frame rate. Most notably, H.264 and MPEG-2 specify time_base as half of frame duration if no telecine is used ...</para>
218218
/// <see cref="AVCodecContext.ticks_per_frame" />
219219
/// </summary>
220+
[Obsolete("- decoding: Use AVCodecDescriptor.props & AV_CODEC_PROP_FIELDS - encoding: Set AVCodecContext.framerate instead")]
220221
public int TicksPerFrame
221222
{
222223
get => _ptr->ticks_per_frame;
@@ -694,7 +695,7 @@ public AVColorSpace Colorspace
694695
}
695696

696697
/// <summary>
697-
/// <para>MPEG vs JPEG YUV range. - encoding: Set by user - decoding: Set by libavcodec</para>
698+
/// <para>MPEG vs JPEG YUV range. - encoding: Set by user to override the default output color range value, If not specified, libavcodec sets the color range depending on the output format. - decoding: Set by libavcodec, can be set by the user to propagate the color range to components reading from the decoder context.</para>
698699
/// <see cref="AVCodecContext.color_range" />
699700
/// </summary>
700701
public AVColorRange ColorRange
@@ -898,7 +899,7 @@ public int MaxQdiff
898899
}
899900

900901
/// <summary>
901-
/// <para>decoder bitstream buffer size - encoding: Set by user. - decoding: unused</para>
902+
/// <para>decoder bitstream buffer size - encoding: Set by user. - decoding: May be set by libavcodec.</para>
902903
/// <see cref="AVCodecContext.rc_buffer_size" />
903904
/// </summary>
904905
public int RcBufferSize
@@ -1190,7 +1191,7 @@ public int NsseWeight
11901191
}
11911192

11921193
/// <summary>
1193-
/// <para>profile - encoding: Set by user. - decoding: Set by libavcodec.</para>
1194+
/// <para>profile - encoding: Set by user. - decoding: Set by libavcodec. See the AV_PROFILE_* defines in defs.h.</para>
11941195
/// <see cref="AVCodecContext.profile" />
11951196
/// </summary>
11961197
public int Profile
@@ -1200,7 +1201,7 @@ public int Profile
12001201
}
12011202

12021203
/// <summary>
1203-
/// <para>level - encoding: Set by user. - decoding: Set by libavcodec.</para>
1204+
/// <para>Encoding level descriptor. - encoding: Set by user, corresponds to a specific level defined by the codec, usually corresponding to the profile level, if not specified it is set to FF_LEVEL_UNKNOWN. - decoding: Set by libavcodec. See AV_LEVEL_* in defs.h.</para>
12041205
/// <see cref="AVCodecContext.level" />
12051206
/// </summary>
12061207
public int Level
@@ -1290,7 +1291,7 @@ public AVPixelFormat SwPixelFormat
12901291
}
12911292

12921293
/// <summary>
1293-
/// <para>Timebase in which pkt_dts/pts and AVPacket.dts/pts are. - encoding unused. - decoding set by user.</para>
1294+
/// <para>Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed. - encoding: unused. - decoding: set by user.</para>
12941295
/// <see cref="AVCodecContext.pkt_timebase" />
12951296
/// </summary>
12961297
public AVRational PktTimebase

src/Sdcb.FFmpeg/Codecs/CodecParameters.g.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,4 +329,35 @@ public AVChannelLayout ChLayout
329329
get => _ptr->ch_layout;
330330
set => _ptr->ch_layout = value;
331331
}
332+
333+
/// <summary>
334+
/// <para>Video only. Number of frames per second, for streams with constant frame durations. Should be set to { 0, 1 } when some frames have differing durations or if the value is not known.</para>
335+
/// <see cref="AVCodecParameters.framerate" />
336+
/// </summary>
337+
public AVRational Framerate
338+
{
339+
get => _ptr->framerate;
340+
set => _ptr->framerate = value;
341+
}
342+
343+
/// <summary>
344+
/// <para>original type: AVPacketSideData*</para>
345+
/// <para>Additional data associated with the entire stream.</para>
346+
/// <see cref="AVCodecParameters.coded_side_data" />
347+
/// </summary>
348+
public PacketSideData CodedSideData
349+
{
350+
get => PacketSideData.FromNative(_ptr->coded_side_data);
351+
set => _ptr->coded_side_data = (AVPacketSideData*)value;
352+
}
353+
354+
/// <summary>
355+
/// <para>Amount of entries in coded_side_data.</para>
356+
/// <see cref="AVCodecParameters.nb_coded_side_data" />
357+
/// </summary>
358+
public int NbCodedSideData
359+
{
360+
get => _ptr->nb_coded_side_data;
361+
set => _ptr->nb_coded_side_data = value;
362+
}
332363
}

src/Sdcb.FFmpeg/Codecs/PacketSideData.g.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Sdcb.FFmpeg.Codecs;
1313

1414
/// <summary>
15+
/// <para>This structure stores auxiliary information for decoding, presenting, or otherwise processing the coded stream. It is typically exported by demuxers and encoders and can be fed to decoders and muxers either in a per packet basis, or as global side data (applying to the entire coded stream).</para>
1516
/// <see cref="AVPacketSideData" />
1617
/// </summary>
1718
public unsafe partial struct PacketSideData

0 commit comments

Comments
 (0)