repo creation with initial code after cloning public repo

This commit is contained in:
2026-02-19 07:36:25 -05:00
commit 460884fea3
2860 changed files with 650825 additions and 0 deletions
@@ -0,0 +1,32 @@
namespace MediaBrowser.MediaEncoding.Probing;
/// <summary>
/// FFmpeg Codec Type.
/// </summary>
public enum CodecType
{
/// <summary>
/// Video.
/// </summary>
Video,
/// <summary>
/// Audio.
/// </summary>
Audio,
/// <summary>
/// Opaque data information usually continuous.
/// </summary>
Data,
/// <summary>
/// Subtitles.
/// </summary>
Subtitle,
/// <summary>
/// Opaque data information usually sparse.
/// </summary>
Attachment
}
@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Globalization;
namespace MediaBrowser.MediaEncoding.Probing
{
/// <summary>
/// Class containing helper methods for working with FFprobe output.
/// </summary>
public static class FFProbeHelpers
{
/// <summary>
/// Normalizes the FF probe result.
/// </summary>
/// <param name="result">The result.</param>
public static void NormalizeFFProbeResult(InternalMediaInfoResult result)
{
ArgumentNullException.ThrowIfNull(result);
if (result.Format?.Tags is not null)
{
result.Format.Tags = ConvertDictionaryToCaseInsensitive(result.Format.Tags);
}
if (result.Streams is not null)
{
// Convert all dictionaries to case-insensitive
foreach (var stream in result.Streams)
{
if (stream.Tags is not null)
{
stream.Tags = ConvertDictionaryToCaseInsensitive(stream.Tags);
}
}
}
}
/// <summary>
/// Gets an int from an FFProbeResult tags dictionary.
/// </summary>
/// <param name="tags">The tags.</param>
/// <param name="key">The key.</param>
/// <returns>System.Nullable{System.Int32}.</returns>
public static int? GetDictionaryNumericValue(IReadOnlyDictionary<string, string> tags, string key)
{
if (tags.TryGetValue(key, out var val) && int.TryParse(val, out var i))
{
return i;
}
return null;
}
/// <summary>
/// Gets a DateTime from an FFProbeResult tags dictionary.
/// </summary>
/// <param name="tags">The tags.</param>
/// <param name="key">The key.</param>
/// <returns>System.Nullable{DateTime}.</returns>
public static DateTime? GetDictionaryDateTime(IReadOnlyDictionary<string, string> tags, string key)
{
if (tags.TryGetValue(key, out var val)
&& (DateTime.TryParse(val, DateTimeFormatInfo.CurrentInfo, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal, out var dateTime)
|| DateTime.TryParseExact(val, "yyyy", DateTimeFormatInfo.CurrentInfo, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal, out dateTime)))
{
return dateTime;
}
return null;
}
/// <summary>
/// Converts a dictionary to case-insensitive.
/// </summary>
/// <param name="dict">The dict.</param>
/// <returns>Dictionary{System.StringSystem.String}.</returns>
private static Dictionary<string, string> ConvertDictionaryToCaseInsensitive(IReadOnlyDictionary<string, string> dict)
{
return new Dictionary<string, string>(dict, StringComparer.OrdinalIgnoreCase);
}
}
}
@@ -0,0 +1,41 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace MediaBrowser.MediaEncoding.Probing
{
/// <summary>
/// Class MediaInfoResult.
/// </summary>
public class InternalMediaInfoResult
{
/// <summary>
/// Gets or sets the streams.
/// </summary>
/// <value>The streams.</value>
[JsonPropertyName("streams")]
public IReadOnlyList<MediaStreamInfo> Streams { get; set; }
/// <summary>
/// Gets or sets the format.
/// </summary>
/// <value>The format.</value>
[JsonPropertyName("format")]
public MediaFormatInfo Format { get; set; }
/// <summary>
/// Gets or sets the chapters.
/// </summary>
/// <value>The chapters.</value>
[JsonPropertyName("chapters")]
public IReadOnlyList<MediaChapter> Chapters { get; set; }
/// <summary>
/// Gets or sets the frames.
/// </summary>
/// <value>The streams.</value>
[JsonPropertyName("frames")]
public IReadOnlyList<MediaFrameInfo> Frames { get; set; }
}
}
@@ -0,0 +1,35 @@
#nullable disable
#pragma warning disable CS1591
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace MediaBrowser.MediaEncoding.Probing
{
/// <summary>
/// Class MediaChapter.
/// </summary>
public class MediaChapter
{
[JsonPropertyName("id")]
public long Id { get; set; }
[JsonPropertyName("time_base")]
public string TimeBase { get; set; }
[JsonPropertyName("start")]
public long Start { get; set; }
[JsonPropertyName("start_time")]
public string StartTime { get; set; }
[JsonPropertyName("end")]
public long End { get; set; }
[JsonPropertyName("end_time")]
public string EndTime { get; set; }
[JsonPropertyName("tags")]
public IReadOnlyDictionary<string, string> Tags { get; set; }
}
}
@@ -0,0 +1,83 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace MediaBrowser.MediaEncoding.Probing
{
/// <summary>
/// Class MediaFormat.
/// </summary>
public class MediaFormatInfo
{
/// <summary>
/// Gets or sets the filename.
/// </summary>
/// <value>The filename.</value>
[JsonPropertyName("filename")]
public string FileName { get; set; }
/// <summary>
/// Gets or sets the nb_streams.
/// </summary>
/// <value>The nb_streams.</value>
[JsonPropertyName("nb_streams")]
public int NbStreams { get; set; }
/// <summary>
/// Gets or sets the format_name.
/// </summary>
/// <value>The format_name.</value>
[JsonPropertyName("format_name")]
public string FormatName { get; set; }
/// <summary>
/// Gets or sets the format_long_name.
/// </summary>
/// <value>The format_long_name.</value>
[JsonPropertyName("format_long_name")]
public string FormatLongName { get; set; }
/// <summary>
/// Gets or sets the start_time.
/// </summary>
/// <value>The start_time.</value>
[JsonPropertyName("start_time")]
public string StartTime { get; set; }
/// <summary>
/// Gets or sets the duration.
/// </summary>
/// <value>The duration.</value>
[JsonPropertyName("duration")]
public string Duration { get; set; }
/// <summary>
/// Gets or sets the size.
/// </summary>
/// <value>The size.</value>
[JsonPropertyName("size")]
public string Size { get; set; }
/// <summary>
/// Gets or sets the bit_rate.
/// </summary>
/// <value>The bit_rate.</value>
[JsonPropertyName("bit_rate")]
public string BitRate { get; set; }
/// <summary>
/// Gets or sets the probe_score.
/// </summary>
/// <value>The probe_score.</value>
[JsonPropertyName("probe_score")]
public int ProbeScore { get; set; }
/// <summary>
/// Gets or sets the tags.
/// </summary>
/// <value>The tags.</value>
[JsonPropertyName("tags")]
public IReadOnlyDictionary<string, string> Tags { get; set; }
}
}
@@ -0,0 +1,184 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace MediaBrowser.MediaEncoding.Probing;
/// <summary>
/// Class MediaFrameInfo.
/// </summary>
public class MediaFrameInfo
{
/// <summary>
/// Gets or sets the media type.
/// </summary>
[JsonPropertyName("media_type")]
public string? MediaType { get; set; }
/// <summary>
/// Gets or sets the StreamIndex.
/// </summary>
[JsonPropertyName("stream_index")]
public int? StreamIndex { get; set; }
/// <summary>
/// Gets or sets the KeyFrame.
/// </summary>
[JsonPropertyName("key_frame")]
public int? KeyFrame { get; set; }
/// <summary>
/// Gets or sets the Pts.
/// </summary>
[JsonPropertyName("pts")]
public long? Pts { get; set; }
/// <summary>
/// Gets or sets the PtsTime.
/// </summary>
[JsonPropertyName("pts_time")]
public string? PtsTime { get; set; }
/// <summary>
/// Gets or sets the BestEffortTimestamp.
/// </summary>
[JsonPropertyName("best_effort_timestamp")]
public long BestEffortTimestamp { get; set; }
/// <summary>
/// Gets or sets the BestEffortTimestampTime.
/// </summary>
[JsonPropertyName("best_effort_timestamp_time")]
public string? BestEffortTimestampTime { get; set; }
/// <summary>
/// Gets or sets the Duration.
/// </summary>
[JsonPropertyName("duration")]
public int Duration { get; set; }
/// <summary>
/// Gets or sets the DurationTime.
/// </summary>
[JsonPropertyName("duration_time")]
public string? DurationTime { get; set; }
/// <summary>
/// Gets or sets the PktPos.
/// </summary>
[JsonPropertyName("pkt_pos")]
public string? PktPos { get; set; }
/// <summary>
/// Gets or sets the PktSize.
/// </summary>
[JsonPropertyName("pkt_size")]
public string? PktSize { get; set; }
/// <summary>
/// Gets or sets the Width.
/// </summary>
[JsonPropertyName("width")]
public int? Width { get; set; }
/// <summary>
/// Gets or sets the Height.
/// </summary>
[JsonPropertyName("height")]
public int? Height { get; set; }
/// <summary>
/// Gets or sets the CropTop.
/// </summary>
[JsonPropertyName("crop_top")]
public int? CropTop { get; set; }
/// <summary>
/// Gets or sets the CropBottom.
/// </summary>
[JsonPropertyName("crop_bottom")]
public int? CropBottom { get; set; }
/// <summary>
/// Gets or sets the CropLeft.
/// </summary>
[JsonPropertyName("crop_left")]
public int? CropLeft { get; set; }
/// <summary>
/// Gets or sets the CropRight.
/// </summary>
[JsonPropertyName("crop_right")]
public int? CropRight { get; set; }
/// <summary>
/// Gets or sets the PixFmt.
/// </summary>
[JsonPropertyName("pix_fmt")]
public string? PixFmt { get; set; }
/// <summary>
/// Gets or sets the SampleAspectRatio.
/// </summary>
[JsonPropertyName("sample_aspect_ratio")]
public string? SampleAspectRatio { get; set; }
/// <summary>
/// Gets or sets the PictType.
/// </summary>
[JsonPropertyName("pict_type")]
public string? PictType { get; set; }
/// <summary>
/// Gets or sets the InterlacedFrame.
/// </summary>
[JsonPropertyName("interlaced_frame")]
public int? InterlacedFrame { get; set; }
/// <summary>
/// Gets or sets the TopFieldFirst.
/// </summary>
[JsonPropertyName("top_field_first")]
public int? TopFieldFirst { get; set; }
/// <summary>
/// Gets or sets the RepeatPict.
/// </summary>
[JsonPropertyName("repeat_pict")]
public int? RepeatPict { get; set; }
/// <summary>
/// Gets or sets the ColorRange.
/// </summary>
[JsonPropertyName("color_range")]
public string? ColorRange { get; set; }
/// <summary>
/// Gets or sets the ColorSpace.
/// </summary>
[JsonPropertyName("color_space")]
public string? ColorSpace { get; set; }
/// <summary>
/// Gets or sets the ColorPrimaries.
/// </summary>
[JsonPropertyName("color_primaries")]
public string? ColorPrimaries { get; set; }
/// <summary>
/// Gets or sets the ColorTransfer.
/// </summary>
[JsonPropertyName("color_transfer")]
public string? ColorTransfer { get; set; }
/// <summary>
/// Gets or sets the ChromaLocation.
/// </summary>
[JsonPropertyName("chroma_location")]
public string? ChromaLocation { get; set; }
/// <summary>
/// Gets or sets the SideDataList.
/// </summary>
[JsonPropertyName("side_data_list")]
public IReadOnlyList<MediaFrameSideDataInfo>? SideDataList { get; set; }
}
@@ -0,0 +1,16 @@
using System.Text.Json.Serialization;
namespace MediaBrowser.MediaEncoding.Probing;
/// <summary>
/// Class MediaFrameSideDataInfo.
/// Currently only records the SideDataType for HDR10+ detection.
/// </summary>
public class MediaFrameSideDataInfo
{
/// <summary>
/// Gets or sets the SideDataType.
/// </summary>
[JsonPropertyName("side_data_type")]
public string? SideDataType { get; set; }
}
@@ -0,0 +1,321 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace MediaBrowser.MediaEncoding.Probing
{
/// <summary>
/// Represents a stream within the output.
/// </summary>
public class MediaStreamInfo
{
/// <summary>
/// Gets or sets the index.
/// </summary>
/// <value>The index.</value>
[JsonPropertyName("index")]
public int Index { get; set; }
/// <summary>
/// Gets or sets the profile.
/// </summary>
/// <value>The profile.</value>
[JsonPropertyName("profile")]
public string Profile { get; set; }
/// <summary>
/// Gets or sets the codec_name.
/// </summary>
/// <value>The codec_name.</value>
[JsonPropertyName("codec_name")]
public string CodecName { get; set; }
/// <summary>
/// Gets or sets the codec_long_name.
/// </summary>
/// <value>The codec_long_name.</value>
[JsonPropertyName("codec_long_name")]
public string CodecLongName { get; set; }
/// <summary>
/// Gets or sets the codec_type.
/// </summary>
/// <value>The codec_type.</value>
[JsonPropertyName("codec_type")]
public CodecType CodecType { get; set; }
/// <summary>
/// Gets or sets the sample_rate.
/// </summary>
/// <value>The sample_rate.</value>
[JsonPropertyName("sample_rate")]
public string SampleRate { get; set; }
/// <summary>
/// Gets or sets the channels.
/// </summary>
/// <value>The channels.</value>
[JsonPropertyName("channels")]
public int Channels { get; set; }
/// <summary>
/// Gets or sets the channel_layout.
/// </summary>
/// <value>The channel_layout.</value>
[JsonPropertyName("channel_layout")]
public string ChannelLayout { get; set; }
/// <summary>
/// Gets or sets the avg_frame_rate.
/// </summary>
/// <value>The avg_frame_rate.</value>
[JsonPropertyName("avg_frame_rate")]
public string AverageFrameRate { get; set; }
/// <summary>
/// Gets or sets the duration.
/// </summary>
/// <value>The duration.</value>
[JsonPropertyName("duration")]
public string Duration { get; set; }
/// <summary>
/// Gets or sets the bit_rate.
/// </summary>
/// <value>The bit_rate.</value>
[JsonPropertyName("bit_rate")]
public string BitRate { get; set; }
/// <summary>
/// Gets or sets the width.
/// </summary>
/// <value>The width.</value>
[JsonPropertyName("width")]
public int Width { get; set; }
/// <summary>
/// Gets or sets the refs.
/// </summary>
/// <value>The refs.</value>
[JsonPropertyName("refs")]
public int Refs { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
/// <value>The height.</value>
[JsonPropertyName("height")]
public int Height { get; set; }
/// <summary>
/// Gets or sets the display_aspect_ratio.
/// </summary>
/// <value>The display_aspect_ratio.</value>
[JsonPropertyName("display_aspect_ratio")]
public string DisplayAspectRatio { get; set; }
/// <summary>
/// Gets or sets the tags.
/// </summary>
/// <value>The tags.</value>
[JsonPropertyName("tags")]
public IReadOnlyDictionary<string, string> Tags { get; set; }
/// <summary>
/// Gets or sets the bits_per_sample.
/// </summary>
/// <value>The bits_per_sample.</value>
[JsonPropertyName("bits_per_sample")]
public int BitsPerSample { get; set; }
/// <summary>
/// Gets or sets the bits_per_raw_sample.
/// </summary>
/// <value>The bits_per_raw_sample.</value>
[JsonPropertyName("bits_per_raw_sample")]
public int BitsPerRawSample { get; set; }
/// <summary>
/// Gets or sets the r_frame_rate.
/// </summary>
/// <value>The r_frame_rate.</value>
[JsonPropertyName("r_frame_rate")]
public string RFrameRate { get; set; }
/// <summary>
/// Gets or sets the has_b_frames.
/// </summary>
/// <value>The has_b_frames.</value>
[JsonPropertyName("has_b_frames")]
public int HasBFrames { get; set; }
/// <summary>
/// Gets or sets the sample_aspect_ratio.
/// </summary>
/// <value>The sample_aspect_ratio.</value>
[JsonPropertyName("sample_aspect_ratio")]
public string SampleAspectRatio { get; set; }
/// <summary>
/// Gets or sets the pix_fmt.
/// </summary>
/// <value>The pix_fmt.</value>
[JsonPropertyName("pix_fmt")]
public string PixelFormat { get; set; }
/// <summary>
/// Gets or sets the level.
/// </summary>
/// <value>The level.</value>
[JsonPropertyName("level")]
public int Level { get; set; }
/// <summary>
/// Gets or sets the time_base.
/// </summary>
/// <value>The time_base.</value>
[JsonPropertyName("time_base")]
public string TimeBase { get; set; }
/// <summary>
/// Gets or sets the start_time.
/// </summary>
/// <value>The start_time.</value>
[JsonPropertyName("start_time")]
public string StartTime { get; set; }
/// <summary>
/// Gets or sets the codec_time_base.
/// </summary>
/// <value>The codec_time_base.</value>
[JsonPropertyName("codec_time_base")]
public string CodecTimeBase { get; set; }
/// <summary>
/// Gets or sets the codec_tag.
/// </summary>
/// <value>The codec_tag.</value>
[JsonPropertyName("codec_tag")]
public string CodecTag { get; set; }
/// <summary>
/// Gets or sets the codec_tag_string.
/// </summary>
/// <value>The codec_tag_string.</value>
[JsonPropertyName("codec_tag_string")]
public string CodecTagString { get; set; }
/// <summary>
/// Gets or sets the sample_fmt.
/// </summary>
/// <value>The sample_fmt.</value>
[JsonPropertyName("sample_fmt")]
public string SampleFmt { get; set; }
/// <summary>
/// Gets or sets the dmix_mode.
/// </summary>
/// <value>The dmix_mode.</value>
[JsonPropertyName("dmix_mode")]
public string DmixMode { get; set; }
/// <summary>
/// Gets or sets the start_pts.
/// </summary>
/// <value>The start_pts.</value>
[JsonPropertyName("start_pts")]
public long StartPts { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the stream is AVC.
/// </summary>
/// <value>The is_avc.</value>
[JsonPropertyName("is_avc")]
public bool IsAvc { get; set; }
/// <summary>
/// Gets or sets the nal_length_size.
/// </summary>
/// <value>The nal_length_size.</value>
[JsonPropertyName("nal_length_size")]
public string NalLengthSize { get; set; }
/// <summary>
/// Gets or sets the ltrt_cmixlev.
/// </summary>
/// <value>The ltrt_cmixlev.</value>
[JsonPropertyName("ltrt_cmixlev")]
public string LtrtCmixlev { get; set; }
/// <summary>
/// Gets or sets the ltrt_surmixlev.
/// </summary>
/// <value>The ltrt_surmixlev.</value>
[JsonPropertyName("ltrt_surmixlev")]
public string LtrtSurmixlev { get; set; }
/// <summary>
/// Gets or sets the loro_cmixlev.
/// </summary>
/// <value>The loro_cmixlev.</value>
[JsonPropertyName("loro_cmixlev")]
public string LoroCmixlev { get; set; }
/// <summary>
/// Gets or sets the loro_surmixlev.
/// </summary>
/// <value>The loro_surmixlev.</value>
[JsonPropertyName("loro_surmixlev")]
public string LoroSurmixlev { get; set; }
/// <summary>
/// Gets or sets the field_order.
/// </summary>
/// <value>The field_order.</value>
[JsonPropertyName("field_order")]
public string FieldOrder { get; set; }
/// <summary>
/// Gets or sets the disposition.
/// </summary>
/// <value>The disposition.</value>
[JsonPropertyName("disposition")]
public IReadOnlyDictionary<string, int> Disposition { get; set; }
/// <summary>
/// Gets or sets the color range.
/// </summary>
/// <value>The color range.</value>
[JsonPropertyName("color_range")]
public string ColorRange { get; set; }
/// <summary>
/// Gets or sets the color space.
/// </summary>
/// <value>The color space.</value>
[JsonPropertyName("color_space")]
public string ColorSpace { get; set; }
/// <summary>
/// Gets or sets the color transfer.
/// </summary>
/// <value>The color transfer.</value>
[JsonPropertyName("color_transfer")]
public string ColorTransfer { get; set; }
/// <summary>
/// Gets or sets the color primaries.
/// </summary>
/// <value>The color primaries.</value>
[JsonPropertyName("color_primaries")]
public string ColorPrimaries { get; set; }
/// <summary>
/// Gets or sets the side_data_list.
/// </summary>
/// <value>The side_data_list.</value>
[JsonPropertyName("side_data_list")]
public IReadOnlyList<MediaStreamInfoSideData> SideDataList { get; set; }
}
}
@@ -0,0 +1,80 @@
using System.Text.Json.Serialization;
namespace MediaBrowser.MediaEncoding.Probing
{
/// <summary>
/// Class MediaStreamInfoSideData.
/// </summary>
public class MediaStreamInfoSideData
{
/// <summary>
/// Gets or sets the SideDataType.
/// </summary>
/// <value>The SideDataType.</value>
[JsonPropertyName("side_data_type")]
public string? SideDataType { get; set; }
/// <summary>
/// Gets or sets the DvVersionMajor.
/// </summary>
/// <value>The DvVersionMajor.</value>
[JsonPropertyName("dv_version_major")]
public int? DvVersionMajor { get; set; }
/// <summary>
/// Gets or sets the DvVersionMinor.
/// </summary>
/// <value>The DvVersionMinor.</value>
[JsonPropertyName("dv_version_minor")]
public int? DvVersionMinor { get; set; }
/// <summary>
/// Gets or sets the DvProfile.
/// </summary>
/// <value>The DvProfile.</value>
[JsonPropertyName("dv_profile")]
public int? DvProfile { get; set; }
/// <summary>
/// Gets or sets the DvLevel.
/// </summary>
/// <value>The DvLevel.</value>
[JsonPropertyName("dv_level")]
public int? DvLevel { get; set; }
/// <summary>
/// Gets or sets the RpuPresentFlag.
/// </summary>
/// <value>The RpuPresentFlag.</value>
[JsonPropertyName("rpu_present_flag")]
public int? RpuPresentFlag { get; set; }
/// <summary>
/// Gets or sets the ElPresentFlag.
/// </summary>
/// <value>The ElPresentFlag.</value>
[JsonPropertyName("el_present_flag")]
public int? ElPresentFlag { get; set; }
/// <summary>
/// Gets or sets the BlPresentFlag.
/// </summary>
/// <value>The BlPresentFlag.</value>
[JsonPropertyName("bl_present_flag")]
public int? BlPresentFlag { get; set; }
/// <summary>
/// Gets or sets the DvBlSignalCompatibilityId.
/// </summary>
/// <value>The DvBlSignalCompatibilityId.</value>
[JsonPropertyName("dv_bl_signal_compatibility_id")]
public int? DvBlSignalCompatibilityId { get; set; }
/// <summary>
/// Gets or sets the Rotation in degrees.
/// </summary>
/// <value>The Rotation.</value>
[JsonPropertyName("rotation")]
public int? Rotation { get; set; }
}
}
File diff suppressed because it is too large Load Diff