Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
zznty committed Apr 7, 2024
1 parent a914a20 commit 58205d9
Show file tree
Hide file tree
Showing 80 changed files with 5,542 additions and 660 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ jobs:
dotnet-version: |
7.0.x
6.0.x
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
name: Setup Windows 10 SDK
with:
sdk-version: 22621

- name: Restore dependencies
run: dotnet restore MusicX/MusicX.csproj --locked-mode
Expand Down Expand Up @@ -87,18 +92,19 @@ jobs:
contents: ${{ steps.changelog.outputs.changes }}
write-mode: overwrite

- name: Install csq
run: dotnet tool install --global csq --version 3.0.210-g5f9f594
- name: Install vpk
run: dotnet tool install -g vpk

- run: mkdir rel

- run: curl.exe --remove-on-error -sfLO https://github.com/Fooxboy/MusicX-WPF/releases/download/${{ needs.compute-version.outputs.previous-version }}/RELEASES && curl.exe --remove-on-error -sfLO https://github.com/Fooxboy/MusicX-WPF/releases/download/${{ needs.compute-version.outputs.previous-version }}/MusicX.WPF-${{ needs.compute-version.outputs.previous-version }}-full.nupkg
continue-on-error: true
working-directory: ./rel
- run: vpk download github --repoUrl https://github.com/Fooxboy/MusicX-WPF -c ${{ github.ref == 'refs/heads/develop' && 'win-beta' || 'win' }} --pre --token ${{ secrets.GITHUB_TOKEN }}
name: Download previous release

- name: Build package
run: csq --csq-version=3.0.210-g5f9f594 pack -f vcredist140 -r rel -p pub -u MusicX.WPF -v ${{ needs.compute-version.outputs.version }} --packTitle "MusicX Player" -e MusicX.exe -i MusicX/StoreLogo.scale-400.ico --appIcon MusicX/StoreLogo.scale-400.ico --msi x64 --includePdb --packAuthors "Fooxboy, zznty" --releaseNotes notes.md -s MusicX/StoreLogo.scale-400.png
run: vpk pack -c ${{ github.ref == 'refs/heads/develop' && 'win-beta' || 'win' }} -f vcredist140-x64 -p pub -u MusicX.WPF -v ${{ needs.compute-version.outputs.version }} --packTitle "MusicX Player" -e MusicX.exe -i MusicX/StoreLogo.scale-400.ico --includePdb --skipVeloAppCheck --packAuthors "Fooxboy, zznty" --releaseNotes notes.md -s MusicX/StoreLogo.scale-400.png

- name: Push package
run: csq --csq-version=3.0.210-g5f9f594 github-up -r rel --repoUrl https://github.com/Fooxboy/MusicX-WPF --publish --token ${{ secrets.GITHUB_TOKEN }}
- name: Push pre-release package
if: ${{ github.ref == 'refs/heads/develop' }}
run: vpk upload github -c ${{ github.ref == 'refs/heads/develop' && 'win-beta' || 'win' }} --repoUrl https://github.com/Fooxboy/MusicX-WPF --publish --pre --token ${{ secrets.GITHUB_TOKEN }}

- name: Push release package
if: ${{ github.ref != 'refs/heads/develop' }}
run: vpk upload github -c ${{ github.ref == 'refs/heads/develop' && 'win-beta' || 'win' }} --repoUrl https://github.com/Fooxboy/MusicX-WPF --publish --token ${{ secrets.GITHUB_TOKEN }}
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion FFMediaToolkit
Submodule FFMediaToolkit deleted from cbdabe
85 changes: 85 additions & 0 deletions FFMediaToolkit/Audio/AudioData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
namespace FFMediaToolkit.Audio

Check warning on line 1 in FFMediaToolkit/Audio/AudioData.cs

View workflow job for this annotation

GitHub Actions / Build and Package

The file header is missing or not located at the top of the file. (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1633.md)
{
using System;
using FFMediaToolkit.Common.Internal;

/// <summary>
/// Represents a lightweight container for audio data.
/// </summary>
public ref struct AudioData
{
private readonly AudioFrame frame;

/// <summary>
/// Initializes a new instance of the <see cref="AudioData"/> struct.
/// </summary>
/// <param name="frame">frame object containing raw audio data.</param>
internal AudioData(AudioFrame frame)
{
this.frame = frame;
}

/// <summary>
/// Gets the number of samples.
/// </summary>
public int NumSamples => frame.NumSamples;

/// <summary>
/// Gets the number of channels.
/// </summary>
public int NumChannels => frame.NumChannels;

/// <summary>
/// Fetches raw audio data from this audio frame for specified channel.
/// </summary>
/// <param name="channel">The index of audio channel that should be retrieved, allowed range: [0..<see cref="NumChannels"/>).</param>
/// <returns>The span with samples in range of [-1.0, ..., 1.0].</returns>
public Span<T> GetChannelData<T>(uint channel)
where T : unmanaged
{
return frame.GetChannelData<T>(channel);
}

/// <summary>
/// Copies raw multichannel audio data from this frame to a heap allocated array.
/// </summary>
/// <returns>
/// The span with <see cref="NumChannels"/> rows and <see cref="NumSamples"/> columns;
/// samples in range of [-1.0, ..., 1.0].
/// </returns>
public float[][] GetSampleData()
{
return frame.GetSampleData();
}

/// <summary>
/// Updates the specified channel of this audio frame with the given sample data.
/// </summary>
/// <param name="samples">An array of samples with length <see cref="NumSamples"/>.</param>
/// <param name="channel">The index of audio channel that should be updated, allowed range: [0..<see cref="NumChannels"/>).</param>
public void UpdateChannelData(float[] samples, uint channel)
{
frame.UpdateChannelData(samples, channel);
}

/// <summary>
/// Updates this audio frame with the specified multi-channel sample data.
/// </summary>
/// <param name="samples">
/// A 2D jagged array of multi-channel sample data
/// with <see cref="NumChannels"/> rows and <see cref="NumSamples"/> columns.
/// </param>
public void UpdateFromSampleData(float[][] samples)
{
frame.UpdateFromSampleData(samples);
}

/// <summary>
/// Releases all unmanaged resources associated with this instance.
/// </summary>
public void Dispose()
{
frame.Dispose();
}
}
}
60 changes: 60 additions & 0 deletions FFMediaToolkit/Audio/SampleFormat.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
namespace FFMediaToolkit.Audio

Check warning on line 1 in FFMediaToolkit/Audio/SampleFormat.cs

View workflow job for this annotation

GitHub Actions / Build and Package

The file header is missing or not located at the top of the file. (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1633.md)
{
using FFmpeg.AutoGen;

/// <summary>
/// Enumerates common audio sample formats supported by FFmpeg.
/// </summary>
public enum SampleFormat
{
/// <summary>
/// Unsupported/Unknown.
/// </summary>
None = AVSampleFormat.AV_SAMPLE_FMT_NONE,

/// <summary>
/// Unsigned 8-bit integer.
/// </summary>
UnsignedByte = AVSampleFormat.AV_SAMPLE_FMT_U8,

/// <summary>
/// Signed 16-bit integer.
/// </summary>
SignedWord = AVSampleFormat.AV_SAMPLE_FMT_S16,

/// <summary>
/// Signed 32-bit integer.
/// </summary>
SignedDWord = AVSampleFormat.AV_SAMPLE_FMT_S32,

/// <summary>
/// Single precision floating point.
/// </summary>
Single = AVSampleFormat.AV_SAMPLE_FMT_FLT,

/// <summary>
/// Double precision floating point.
/// </summary>
Double = AVSampleFormat.AV_SAMPLE_FMT_DBL,

/// <summary>
/// Signed 16-bit integer (planar).
/// </summary>
SignedWordP = AVSampleFormat.AV_SAMPLE_FMT_S16P,

/// <summary>
/// Signed 32-bit integer (planar).
/// </summary>
SignedDWordP = AVSampleFormat.AV_SAMPLE_FMT_S32P,

/// <summary>
/// Single precision floating point (planar).
/// </summary>
SingleP = AVSampleFormat.AV_SAMPLE_FMT_FLTP,

/// <summary>
/// Double precision floating point (planar).
/// </summary>
DoubleP = AVSampleFormat.AV_SAMPLE_FMT_DBLP,
}
}
132 changes: 132 additions & 0 deletions FFMediaToolkit/Common/ContainerMetadata.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
namespace FFMediaToolkit.Common

Check warning on line 1 in FFMediaToolkit/Common/ContainerMetadata.cs

View workflow job for this annotation

GitHub Actions / Build and Package

The file header is missing or not located at the top of the file. (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1633.md)
{
using System.Collections.Generic;
using FFmpeg.AutoGen;

/// <summary>
/// Represents multimedia file metadata info.
/// </summary>
public class ContainerMetadata
{
private const string TitleKey = "title";
private const string AuthorKey = "author";
private const string AlbumKey = "album";
private const string YearKey = "year";
private const string GenreKey = "genre";
private const string DescriptionKey = "description";
private const string LanguageKey = "language";
private const string CopyrightKey = "copyright";
private const string RatingKey = "rating";
private const string TrackKey = "track";
private const string DateKey = "date";

/// <summary>
/// Initializes a new instance of the <see cref="ContainerMetadata"/> class.
/// </summary>
public ContainerMetadata() => Metadata = new Dictionary<string, string>();

/// <summary>
/// Initializes a new instance of the <see cref="ContainerMetadata"/> class.
/// </summary>
/// <param name="sourceMetadata">The source metadata dictionary.</param>
internal unsafe ContainerMetadata(AVDictionary* sourceMetadata)
=> Metadata = FFDictionary.ToDictionary(sourceMetadata, true);

/// <summary>
/// Gets or sets the multimedia title.
/// </summary>
public string Title
{
get => Metadata.ContainsKey(TitleKey) ? Metadata[TitleKey] : string.Empty;
set => Metadata[TitleKey] = value;
}

/// <summary>
/// Gets or sets the multimedia author info.
/// </summary>
public string Author
{
get => Metadata.ContainsKey(AuthorKey) ? Metadata[AuthorKey] : string.Empty;
set => Metadata[AuthorKey] = value;
}

/// <summary>
/// Gets or sets the multimedia album name.
/// </summary>
public string Album
{
get => Metadata.ContainsKey(AlbumKey) ? Metadata[AlbumKey] : string.Empty;
set => Metadata[AlbumKey] = value;
}

/// <summary>
/// Gets or sets multimedia release date/year.
/// </summary>
public string Year
{
get => Metadata.ContainsKey(YearKey)
? Metadata[YearKey]
: (Metadata.ContainsKey(DateKey) ? Metadata[DateKey] : string.Empty);
set => Metadata[YearKey] = value;
}

/// <summary>
/// Gets or sets the multimedia genre.
/// </summary>
public string Genre
{
get => Metadata.ContainsKey(GenreKey) ? Metadata[GenreKey] : string.Empty;
set => Metadata[GenreKey] = value;
}

/// <summary>
/// Gets or sets the multimedia description.
/// </summary>
public string Description
{
get => Metadata.ContainsKey(DescriptionKey) ? Metadata[DescriptionKey] : string.Empty;
set => Metadata[DescriptionKey] = value;
}

/// <summary>
/// Gets or sets the multimedia language.
/// </summary>
public string Language
{
get => Metadata.ContainsKey(LanguageKey) ? Metadata[LanguageKey] : string.Empty;
set => Metadata[LanguageKey] = value;
}

/// <summary>
/// Gets or sets the multimedia copyright info.
/// </summary>
public string Copyright
{
get => Metadata.ContainsKey(CopyrightKey) ? Metadata[CopyrightKey] : string.Empty;
set => Metadata[CopyrightKey] = value;
}

/// <summary>
/// Gets or sets the multimedia rating.
/// </summary>
public string Rating
{
get => Metadata.ContainsKey(RatingKey) ? Metadata[RatingKey] : string.Empty;
set => Metadata[RatingKey] = value;
}

/// <summary>
/// Gets or sets the multimedia track number string.
/// </summary>
public string TrackNumber
{
get => Metadata.ContainsKey(TrackKey) ? Metadata[TrackKey] : string.Empty;
set => Metadata[TrackKey] = value;
}

/// <summary>
/// Gets or sets the dictionary containing all metadata fields.
/// </summary>
public Dictionary<string, string> Metadata { get; set; }
}
}
Loading

0 comments on commit 58205d9

Please sign in to comment.