Skip to content

Commit

Permalink
All Codec in FormatContext nullable.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdcb committed Sep 22, 2022
1 parent d4f4d2f commit 100669c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/Sdcb.FFmpeg.AutoGen/Gen2/G2Center.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ private static string FormatEscape(string src)
{
FieldDef.CreateRename("iformat", "InputFormat") with { Nullable = true },
FieldDef.CreateRename("oformat", "OutputFormat") with { Nullable = true },
FieldDef.CreateNullable("video_codec"),
FieldDef.CreateNullable("audio_codec"),
FieldDef.CreateNullable("subtitle_codec"),
FieldDef.CreateNullable("data_codec"),
FieldDef.CreateNullable("pb"),
FieldDef.CreateTypeCast("flags", TypeCastDef.Force("int", "AVFMT_FLAG")),
FieldDef.CreateTypeCast("streams", TypeCastDef.ReadonlyPtrList("AVStream", "MediaStream", "nb_streams", "FromNative")) with { ReadOnly = true },
Expand Down
16 changes: 8 additions & 8 deletions src/Sdcb.FFmpeg/Formats/FormatContext.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,9 @@ public int IoRepositioned
/// <para>Forced video codec. This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user</para>
/// <see cref="AVFormatContext.video_codec" />
/// </summary>
public Codec VideoCodec
public Codec? VideoCodec
{
get => Codec.FromNative(_ptr->video_codec);
get => Codec.FromNativeOrNull(_ptr->video_codec);
set => _ptr->video_codec = (AVCodec*)value;
}

Expand All @@ -561,9 +561,9 @@ public Codec VideoCodec
/// <para>Forced audio codec. This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user</para>
/// <see cref="AVFormatContext.audio_codec" />
/// </summary>
public Codec AudioCodec
public Codec? AudioCodec
{
get => Codec.FromNative(_ptr->audio_codec);
get => Codec.FromNativeOrNull(_ptr->audio_codec);
set => _ptr->audio_codec = (AVCodec*)value;
}

Expand All @@ -572,9 +572,9 @@ public Codec AudioCodec
/// <para>Forced subtitle codec. This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user</para>
/// <see cref="AVFormatContext.subtitle_codec" />
/// </summary>
public Codec SubtitleCodec
public Codec? SubtitleCodec
{
get => Codec.FromNative(_ptr->subtitle_codec);
get => Codec.FromNativeOrNull(_ptr->subtitle_codec);
set => _ptr->subtitle_codec = (AVCodec*)value;
}

Expand All @@ -583,9 +583,9 @@ public Codec SubtitleCodec
/// <para>Forced data codec. This allows forcing a specific decoder, even when there are multiple with the same codec_id. Demuxing: Set by user</para>
/// <see cref="AVFormatContext.data_codec" />
/// </summary>
public Codec DataCodec
public Codec? DataCodec
{
get => Codec.FromNative(_ptr->data_codec);
get => Codec.FromNativeOrNull(_ptr->data_codec);
set => _ptr->data_codec = (AVCodec*)value;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Sdcb.FFmpeg/Sdcb.FFmpeg.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<PackageId>Sdcb.FFmpeg</PackageId>
<VersionPrefix>5.1.1</VersionPrefix>
<VersionSuffix>preview.11</VersionSuffix>
<VersionSuffix>preview.12</VersionSuffix>
<LangVersion>latest</LangVersion>
<!-- Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
<IncludeSymbols>true</IncludeSymbols>
Expand Down

0 comments on commit 100669c

Please sign in to comment.