diff --git a/src/SoundFingerprinting.Tests/Properties/AssemblyInfo.cs b/src/SoundFingerprinting.Tests/Properties/AssemblyInfo.cs index 6506e776..0ecd7ddb 100644 --- a/src/SoundFingerprinting.Tests/Properties/AssemblyInfo.cs +++ b/src/SoundFingerprinting.Tests/Properties/AssemblyInfo.cs @@ -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")] diff --git a/src/SoundFingerprinting/Command/IUsingQueryServices.cs b/src/SoundFingerprinting/Command/IUsingQueryServices.cs index 04c8e4b7..e596a357 100644 --- a/src/SoundFingerprinting/Command/IUsingQueryServices.cs +++ b/src/SoundFingerprinting/Command/IUsingQueryServices.cs @@ -32,7 +32,7 @@ public interface IUsingQueryServices : IQueryCommand /// Audio service used in building the fingerprints from the source. /// Match registry used to store the results in a separate storage. /// Query command. - IQueryCommand UsingServices(IQueryService queryService, IAudioService audioService, IQueryMatchRegistry queryMatchRegistry); + IQueryCommand UsingServices(IQueryService queryService, IAudioService audioService, IAVQueryMatchRegistry queryMatchRegistry); /// /// Sets model service as well as video service. @@ -55,7 +55,7 @@ public interface IUsingQueryServices : IQueryCommand /// /// Set video service in case you want to generate video fingerprints only by setting MediaType.Video on the overloads. /// - IQueryCommand UsingServices(IQueryService queryService, IVideoService videoService, IQueryMatchRegistry queryMatchRegistry); + IQueryCommand UsingServices(IQueryService queryService, IVideoService videoService, IAVQueryMatchRegistry queryMatchRegistry); /// /// Sets model service as well as media service. @@ -78,6 +78,6 @@ public interface IUsingQueryServices : IQueryCommand /// /// Media service can be used to read both and from a media file, and generate that will be used to query the underlying source. /// - IQueryCommand UsingServices(IQueryService queryService, IMediaService mediaService, IQueryMatchRegistry queryMatchRegistry); + IQueryCommand UsingServices(IQueryService queryService, IMediaService mediaService, IAVQueryMatchRegistry queryMatchRegistry); } } \ No newline at end of file diff --git a/src/SoundFingerprinting/Command/QueryCommand.cs b/src/SoundFingerprinting/Command/QueryCommand.cs index 028ff3fa..3b4636ec 100644 --- a/src/SoundFingerprinting/Command/QueryCommand.cs +++ b/src/SoundFingerprinting/Command/QueryCommand.cs @@ -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 hashesInterceptor; private Func? createFingerprintCommand; @@ -115,8 +115,8 @@ public IQueryCommand UsingServices(IQueryService queryService, IAudioService aud return this; } - /// - public IQueryCommand UsingServices(IQueryService queryService, IAudioService audioService, IQueryMatchRegistry queryMatchRegistry) + /// + public IQueryCommand UsingServices(IQueryService queryService, IAudioService audioService, IAVQueryMatchRegistry queryMatchRegistry) { this.queryService = queryService; this.audioService = audioService; @@ -132,8 +132,8 @@ public IQueryCommand UsingServices(IQueryService queryService, IVideoService vid return this; } - /// - public IQueryCommand UsingServices(IQueryService queryService, IVideoService videoService, IQueryMatchRegistry queryMatchRegistry) + /// + public IQueryCommand UsingServices(IQueryService queryService, IVideoService videoService, IAVQueryMatchRegistry queryMatchRegistry) { this.queryService = queryService; this.videoService = videoService; @@ -149,8 +149,8 @@ public IQueryCommand UsingServices(IQueryService queryService, IMediaService med return this; } - /// - public IQueryCommand UsingServices(IQueryService queryService, IMediaService mediaService, IQueryMatchRegistry queryMatchRegistry) + /// + public IQueryCommand UsingServices(IQueryService queryService, IMediaService mediaService, IAVQueryMatchRegistry queryMatchRegistry) { this.queryService = queryService; this.mediaService = mediaService; diff --git a/src/SoundFingerprinting/IAVQueryMatchRegistry.cs b/src/SoundFingerprinting/IAVQueryMatchRegistry.cs new file mode 100644 index 00000000..74e8e317 --- /dev/null +++ b/src/SoundFingerprinting/IAVQueryMatchRegistry.cs @@ -0,0 +1,18 @@ +namespace SoundFingerprinting +{ + using System.Collections.Generic; + using SoundFingerprinting.Query; + + /// + /// Register query matches with associated metadata. + /// + public interface IAVQueryMatchRegistry + { + /// + /// Register query matches with associated metadata. + /// + /// AV query matches to register. + /// A flag indicating whether we should publish the query matches to downstream components. + void RegisterMatches(IEnumerable avQueryMatches, bool? publishToDownstreamSubscribers = true); + } +} \ No newline at end of file diff --git a/src/SoundFingerprinting/IQueryMatchRegistry.cs b/src/SoundFingerprinting/IQueryMatchRegistry.cs deleted file mode 100644 index 573af5fc..00000000 --- a/src/SoundFingerprinting/IQueryMatchRegistry.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace SoundFingerprinting -{ - using System.Collections.Generic; - using SoundFingerprinting.Query; - - public interface IQueryMatchRegistry - { - /// - /// Register successful matches. - /// - /// Query matches to register as successful matches. - void RegisterMatches(IEnumerable queryMatches); - } -} \ No newline at end of file diff --git a/src/SoundFingerprinting/Properties/AssemblyInfo.cs b/src/SoundFingerprinting/Properties/AssemblyInfo.cs index f4a37924..14a03d5b 100644 --- a/src/SoundFingerprinting/Properties/AssemblyInfo.cs +++ b/src/SoundFingerprinting/Properties/AssemblyInfo.cs @@ -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")] diff --git a/src/SoundFingerprinting/Query/AVQueryMatch.cs b/src/SoundFingerprinting/Query/AVQueryMatch.cs index 73c16878..04b7df08 100644 --- a/src/SoundFingerprinting/Query/AVQueryMatch.cs +++ b/src/SoundFingerprinting/Query/AVQueryMatch.cs @@ -1,6 +1,7 @@ namespace SoundFingerprinting.Query { using System; + using System.Collections.Generic; using ProtoBuf; using SoundFingerprinting.Data; using SoundFingerprinting.LCS; @@ -19,7 +20,8 @@ public class AVQueryMatch /// Video match information. /// Stream ID information. /// Review status. - public AVQueryMatch(string id, QueryMatch? audio, QueryMatch? video, string? streamId, ReviewStatus reviewStatus = ReviewStatus.None) + /// Meta fields associated with the match. + public AVQueryMatch(string id, QueryMatch? audio, QueryMatch? video, string? streamId, ReviewStatus reviewStatus = ReviewStatus.None, IDictionary? metaFields = null) { if (audio == null && video == null) { @@ -31,6 +33,7 @@ public AVQueryMatch(string id, QueryMatch? audio, QueryMatch? video, string? str Audio = audio; Video = video; ReviewStatus = reviewStatus; + MetaFields = metaFields; } /// @@ -101,6 +104,12 @@ public DateTime MatchedAt } } + /// + /// Gets meta fields associated with the query match. + /// + [ProtoMember(6)] + public IDictionary? MetaFields { get; } + /// /// Deconstructs instance of class. /// diff --git a/src/SoundFingerprinting/Query/AVResultEntry.cs b/src/SoundFingerprinting/Query/AVResultEntry.cs index 66701f31..715f0c7d 100644 --- a/src/SoundFingerprinting/Query/AVResultEntry.cs +++ b/src/SoundFingerprinting/Query/AVResultEntry.cs @@ -1,6 +1,7 @@ namespace SoundFingerprinting.Query { using System; + using System.Collections.Generic; using SoundFingerprinting.DAO.Data; using SoundFingerprinting.Data; @@ -61,16 +62,17 @@ public DateTime MatchedAt } /// - /// Converts to audio video query match object that you can register in the registry service . + /// Converts to audio video query match object that you can register in the registry service . /// /// Query match identifier. /// Stream identifier. /// review status. + /// Meta fields. /// An instance of . - public AVQueryMatch ConvertToAvQueryMatch(string avQueryMatchId = "", string streamId = "", ReviewStatus reviewStatus = ReviewStatus.None) + public AVQueryMatch ConvertToAvQueryMatch(string avQueryMatchId = "", string streamId = "", ReviewStatus reviewStatus = ReviewStatus.None, IDictionary? 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); } /// diff --git a/src/SoundFingerprinting/SoundFingerprinting.csproj b/src/SoundFingerprinting/SoundFingerprinting.csproj index 442fa038..129f272b 100644 --- a/src/SoundFingerprinting/SoundFingerprinting.csproj +++ b/src/SoundFingerprinting/SoundFingerprinting.csproj @@ -4,13 +4,15 @@ true false enable - 10.3.1 + 10.4.0 Sergiu Ciumac 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. https://github.com/addictedcs/soundfingerprinting https://github.com/AddictedCS/soundfingerprinting git + 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.