Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  Version bump.
  Adding the ability to set meta-fields on AVResultEntry converter.
  Adding new field to AVQueryMatch, MetaFields, to be able to associate more information with the match. Unifying interfaces, IAVQueryMatchRegistry will be implemented by IEmyModelService, to be able to register matches directly from QueryCommand.
  • Loading branch information
AddictedCS committed Jun 5, 2024
2 parents fe4dbc1 + e9fe63c commit a4922e5
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/SoundFingerprinting.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("4cac962e-ebc5-4006-a1e0-7ffb3e2483c2")]
[assembly: AssemblyVersion("10.3.1.100")]
[assembly: AssemblyInformationalVersion("10.3.1.100")]
[assembly: AssemblyVersion("10.4.0.100")]
[assembly: AssemblyInformationalVersion("10.4.0.100")]
6 changes: 3 additions & 3 deletions src/SoundFingerprinting/Command/IUsingQueryServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface IUsingQueryServices : IQueryCommand
/// <param name="audioService">Audio service used in building the fingerprints from the source.</param>
/// <param name="queryMatchRegistry">Match registry used to store the results in a separate storage.</param>
/// <returns>Query command.</returns>
IQueryCommand UsingServices(IQueryService queryService, IAudioService audioService, IQueryMatchRegistry queryMatchRegistry);
IQueryCommand UsingServices(IQueryService queryService, IAudioService audioService, IAVQueryMatchRegistry queryMatchRegistry);

/// <summary>
/// Sets model service as well as video service.
Expand All @@ -55,7 +55,7 @@ public interface IUsingQueryServices : IQueryCommand
/// <remarks>
/// Set video service in case you want to generate video fingerprints only by setting MediaType.Video on the <see cref="IQuerySource"/> overloads.
/// </remarks>
IQueryCommand UsingServices(IQueryService queryService, IVideoService videoService, IQueryMatchRegistry queryMatchRegistry);
IQueryCommand UsingServices(IQueryService queryService, IVideoService videoService, IAVQueryMatchRegistry queryMatchRegistry);

/// <summary>
/// Sets model service as well as media service.
Expand All @@ -78,6 +78,6 @@ public interface IUsingQueryServices : IQueryCommand
/// <remarks>
/// Media service can be used to read both <see cref="AudioSamples"/> and <see cref="Frames"/> from a media file, and generate <see cref="AVHashes"/> that will be used to query the underlying source.
/// </remarks>
IQueryCommand UsingServices(IQueryService queryService, IMediaService mediaService, IQueryMatchRegistry queryMatchRegistry);
IQueryCommand UsingServices(IQueryService queryService, IMediaService mediaService, IAVQueryMatchRegistry queryMatchRegistry);
}
}
14 changes: 7 additions & 7 deletions src/SoundFingerprinting/Command/QueryCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public sealed class QueryCommand : IQuerySource, IWithQueryConfiguration
private IAudioService audioService;
private IVideoService? videoService;
private IMediaService? mediaService;
private IQueryMatchRegistry? queryMatchRegistry;
private IAVQueryMatchRegistry? queryMatchRegistry;
private Func<AVHashes, AVHashes> hashesInterceptor;

private Func<IWithFingerprintConfiguration>? createFingerprintCommand;
Expand Down Expand Up @@ -115,8 +115,8 @@ public IQueryCommand UsingServices(IQueryService queryService, IAudioService aud
return this;
}

/// <inheritdoc cref="IUsingQueryServices.UsingServices(IQueryService,IAudioService,IQueryMatchRegistry)"/>
public IQueryCommand UsingServices(IQueryService queryService, IAudioService audioService, IQueryMatchRegistry queryMatchRegistry)
/// <inheritdoc cref="IUsingQueryServices.UsingServices(IQueryService,IAudioService,IAVQueryMatchRegistry)"/>
public IQueryCommand UsingServices(IQueryService queryService, IAudioService audioService, IAVQueryMatchRegistry queryMatchRegistry)
{
this.queryService = queryService;
this.audioService = audioService;
Expand All @@ -132,8 +132,8 @@ public IQueryCommand UsingServices(IQueryService queryService, IVideoService vid
return this;
}

/// <inheritdoc cref="IUsingQueryServices.UsingServices(IQueryService,IVideoService,IQueryMatchRegistry)"/>
public IQueryCommand UsingServices(IQueryService queryService, IVideoService videoService, IQueryMatchRegistry queryMatchRegistry)
/// <inheritdoc cref="IUsingQueryServices.UsingServices(IQueryService,IVideoService,IAVQueryMatchRegistry)"/>
public IQueryCommand UsingServices(IQueryService queryService, IVideoService videoService, IAVQueryMatchRegistry queryMatchRegistry)
{
this.queryService = queryService;
this.videoService = videoService;
Expand All @@ -149,8 +149,8 @@ public IQueryCommand UsingServices(IQueryService queryService, IMediaService med
return this;
}

/// <inheritdoc cref="IUsingQueryServices.UsingServices(IQueryService,IMediaService,IQueryMatchRegistry)"/>
public IQueryCommand UsingServices(IQueryService queryService, IMediaService mediaService, IQueryMatchRegistry queryMatchRegistry)
/// <inheritdoc cref="IUsingQueryServices.UsingServices(IQueryService,IMediaService,IAVQueryMatchRegistry)"/>
public IQueryCommand UsingServices(IQueryService queryService, IMediaService mediaService, IAVQueryMatchRegistry queryMatchRegistry)
{
this.queryService = queryService;
this.mediaService = mediaService;
Expand Down
18 changes: 18 additions & 0 deletions src/SoundFingerprinting/IAVQueryMatchRegistry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace SoundFingerprinting
{
using System.Collections.Generic;
using SoundFingerprinting.Query;

/// <summary>
/// Register query matches with associated metadata.
/// </summary>
public interface IAVQueryMatchRegistry
{
/// <summary>
/// Register query matches with associated metadata.
/// </summary>
/// <param name="avQueryMatches">AV query matches to register.</param>
/// <param name="publishToDownstreamSubscribers">A flag indicating whether we should publish the query matches to downstream components.</param>
void RegisterMatches(IEnumerable<AVQueryMatch> avQueryMatches, bool? publishToDownstreamSubscribers = true);
}
}
14 changes: 0 additions & 14 deletions src/SoundFingerprinting/IQueryMatchRegistry.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/SoundFingerprinting/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
[assembly: InternalsVisibleTo("SoundFingerprinting.FFT.FFTW")]
[assembly: InternalsVisibleTo("SoundFingerprinting.FFT.FFTW.Tests")]

[assembly: AssemblyVersion("10.3.1.100")]
[assembly: AssemblyInformationalVersion("10.3.1.100")]
[assembly: AssemblyVersion("10.4.0.100")]
[assembly: AssemblyInformationalVersion("10.4.0.100")]
11 changes: 10 additions & 1 deletion src/SoundFingerprinting/Query/AVQueryMatch.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace SoundFingerprinting.Query
{
using System;
using System.Collections.Generic;
using ProtoBuf;
using SoundFingerprinting.Data;
using SoundFingerprinting.LCS;
Expand All @@ -19,7 +20,8 @@ public class AVQueryMatch
/// <param name="video">Video match information.</param>
/// <param name="streamId">Stream ID information.</param>
/// <param name="reviewStatus">Review status.</param>
public AVQueryMatch(string id, QueryMatch? audio, QueryMatch? video, string? streamId, ReviewStatus reviewStatus = ReviewStatus.None)
/// <param name="metaFields">Meta fields associated with the match.</param>
public AVQueryMatch(string id, QueryMatch? audio, QueryMatch? video, string? streamId, ReviewStatus reviewStatus = ReviewStatus.None, IDictionary<string, string>? metaFields = null)
{
if (audio == null && video == null)
{
Expand All @@ -31,6 +33,7 @@ public AVQueryMatch(string id, QueryMatch? audio, QueryMatch? video, string? str
Audio = audio;
Video = video;
ReviewStatus = reviewStatus;
MetaFields = metaFields;
}

/// <summary>
Expand Down Expand Up @@ -101,6 +104,12 @@ public DateTime MatchedAt
}
}

/// <summary>
/// Gets meta fields associated with the query match.
/// </summary>
[ProtoMember(6)]
public IDictionary<string, string>? MetaFields { get; }

/// <summary>
/// Deconstructs instance of <see cref="AVQueryMatch"/> class.
/// </summary>
Expand Down
8 changes: 5 additions & 3 deletions src/SoundFingerprinting/Query/AVResultEntry.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace SoundFingerprinting.Query
{
using System;
using System.Collections.Generic;
using SoundFingerprinting.DAO.Data;
using SoundFingerprinting.Data;

Expand Down Expand Up @@ -61,16 +62,17 @@ public DateTime MatchedAt
}

/// <summary>
/// Converts to audio video query match object that you can register in the registry service <see cref="IQueryMatchRegistry"/>.
/// Converts to audio video query match object that you can register in the registry service <see cref="IAVQueryMatchRegistry"/>.
/// </summary>
/// <param name="avQueryMatchId">Query match identifier.</param>
/// <param name="streamId">Stream identifier.</param>
/// <param name="reviewStatus">review status.</param>
/// <param name="metaFields">Meta fields.</param>
/// <returns>An instance of <see cref="AVQueryMatch"/>.</returns>
public AVQueryMatch ConvertToAvQueryMatch(string avQueryMatchId = "", string streamId = "", ReviewStatus reviewStatus = ReviewStatus.None)
public AVQueryMatch ConvertToAvQueryMatch(string avQueryMatchId = "", string streamId = "", ReviewStatus reviewStatus = ReviewStatus.None, IDictionary<string, string>? metaFields = null)
{
string id = string.IsNullOrEmpty(avQueryMatchId) ? Guid.NewGuid().ToString() : avQueryMatchId;
return new AVQueryMatch(id, ToQueryMatch(Audio), ToQueryMatch(Video), streamId, reviewStatus);
return new AVQueryMatch(id, ToQueryMatch(Audio), ToQueryMatch(Video), streamId, reviewStatus, metaFields);
}

/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion src/SoundFingerprinting/SoundFingerprinting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Nullable>enable</Nullable>
<PackageVersion>10.3.1</PackageVersion>
<PackageVersion>10.4.0</PackageVersion>
<Authors>Sergiu Ciumac</Authors>
<PackageDescription>SoundFingerprinting is a C# framework that implements an efficient algorithm of audio fingerprinting and identification. Designed for developers, enthusiasts, researchers in the fields of audio processing, data mining, digital signal processing.</PackageDescription>
<PackageProjectUrl>https://github.com/addictedcs/soundfingerprinting</PackageProjectUrl>
<RepositoryUrl>https://github.com/AddictedCS/soundfingerprinting</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageReleaseNotes>
Version 10.4.0
- Added new property MetaFields to AVQueryMatch, to be able to store additional metadata about the match.
Version 10.3.0
- Improved the ability to reconstruct coverage from tone signal matches (silence can be treated as a tone signal).
- Added a fingerprinting flag that allows including silence fingerprints in the generated result set.
Expand Down

0 comments on commit a4922e5

Please sign in to comment.