Skip to content

Commit a4922e5

Browse files
committed
Merge branch 'develop'
* 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.
2 parents fe4dbc1 + e9fe63c commit a4922e5

File tree

9 files changed

+50
-33
lines changed

9 files changed

+50
-33
lines changed

src/SoundFingerprinting.Tests/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
[assembly: AssemblyCulture("")]
1212
[assembly: ComVisible(false)]
1313
[assembly: Guid("4cac962e-ebc5-4006-a1e0-7ffb3e2483c2")]
14-
[assembly: AssemblyVersion("10.3.1.100")]
15-
[assembly: AssemblyInformationalVersion("10.3.1.100")]
14+
[assembly: AssemblyVersion("10.4.0.100")]
15+
[assembly: AssemblyInformationalVersion("10.4.0.100")]

src/SoundFingerprinting/Command/IUsingQueryServices.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public interface IUsingQueryServices : IQueryCommand
3232
/// <param name="audioService">Audio service used in building the fingerprints from the source.</param>
3333
/// <param name="queryMatchRegistry">Match registry used to store the results in a separate storage.</param>
3434
/// <returns>Query command.</returns>
35-
IQueryCommand UsingServices(IQueryService queryService, IAudioService audioService, IQueryMatchRegistry queryMatchRegistry);
35+
IQueryCommand UsingServices(IQueryService queryService, IAudioService audioService, IAVQueryMatchRegistry queryMatchRegistry);
3636

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

6060
/// <summary>
6161
/// Sets model service as well as media service.
@@ -78,6 +78,6 @@ public interface IUsingQueryServices : IQueryCommand
7878
/// <remarks>
7979
/// 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.
8080
/// </remarks>
81-
IQueryCommand UsingServices(IQueryService queryService, IMediaService mediaService, IQueryMatchRegistry queryMatchRegistry);
81+
IQueryCommand UsingServices(IQueryService queryService, IMediaService mediaService, IAVQueryMatchRegistry queryMatchRegistry);
8282
}
8383
}

src/SoundFingerprinting/Command/QueryCommand.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public sealed class QueryCommand : IQuerySource, IWithQueryConfiguration
2626
private IAudioService audioService;
2727
private IVideoService? videoService;
2828
private IMediaService? mediaService;
29-
private IQueryMatchRegistry? queryMatchRegistry;
29+
private IAVQueryMatchRegistry? queryMatchRegistry;
3030
private Func<AVHashes, AVHashes> hashesInterceptor;
3131

3232
private Func<IWithFingerprintConfiguration>? createFingerprintCommand;
@@ -115,8 +115,8 @@ public IQueryCommand UsingServices(IQueryService queryService, IAudioService aud
115115
return this;
116116
}
117117

118-
/// <inheritdoc cref="IUsingQueryServices.UsingServices(IQueryService,IAudioService,IQueryMatchRegistry)"/>
119-
public IQueryCommand UsingServices(IQueryService queryService, IAudioService audioService, IQueryMatchRegistry queryMatchRegistry)
118+
/// <inheritdoc cref="IUsingQueryServices.UsingServices(IQueryService,IAudioService,IAVQueryMatchRegistry)"/>
119+
public IQueryCommand UsingServices(IQueryService queryService, IAudioService audioService, IAVQueryMatchRegistry queryMatchRegistry)
120120
{
121121
this.queryService = queryService;
122122
this.audioService = audioService;
@@ -132,8 +132,8 @@ public IQueryCommand UsingServices(IQueryService queryService, IVideoService vid
132132
return this;
133133
}
134134

135-
/// <inheritdoc cref="IUsingQueryServices.UsingServices(IQueryService,IVideoService,IQueryMatchRegistry)"/>
136-
public IQueryCommand UsingServices(IQueryService queryService, IVideoService videoService, IQueryMatchRegistry queryMatchRegistry)
135+
/// <inheritdoc cref="IUsingQueryServices.UsingServices(IQueryService,IVideoService,IAVQueryMatchRegistry)"/>
136+
public IQueryCommand UsingServices(IQueryService queryService, IVideoService videoService, IAVQueryMatchRegistry queryMatchRegistry)
137137
{
138138
this.queryService = queryService;
139139
this.videoService = videoService;
@@ -149,8 +149,8 @@ public IQueryCommand UsingServices(IQueryService queryService, IMediaService med
149149
return this;
150150
}
151151

152-
/// <inheritdoc cref="IUsingQueryServices.UsingServices(IQueryService,IMediaService,IQueryMatchRegistry)"/>
153-
public IQueryCommand UsingServices(IQueryService queryService, IMediaService mediaService, IQueryMatchRegistry queryMatchRegistry)
152+
/// <inheritdoc cref="IUsingQueryServices.UsingServices(IQueryService,IMediaService,IAVQueryMatchRegistry)"/>
153+
public IQueryCommand UsingServices(IQueryService queryService, IMediaService mediaService, IAVQueryMatchRegistry queryMatchRegistry)
154154
{
155155
this.queryService = queryService;
156156
this.mediaService = mediaService;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace SoundFingerprinting
2+
{
3+
using System.Collections.Generic;
4+
using SoundFingerprinting.Query;
5+
6+
/// <summary>
7+
/// Register query matches with associated metadata.
8+
/// </summary>
9+
public interface IAVQueryMatchRegistry
10+
{
11+
/// <summary>
12+
/// Register query matches with associated metadata.
13+
/// </summary>
14+
/// <param name="avQueryMatches">AV query matches to register.</param>
15+
/// <param name="publishToDownstreamSubscribers">A flag indicating whether we should publish the query matches to downstream components.</param>
16+
void RegisterMatches(IEnumerable<AVQueryMatch> avQueryMatches, bool? publishToDownstreamSubscribers = true);
17+
}
18+
}

src/SoundFingerprinting/IQueryMatchRegistry.cs

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/SoundFingerprinting/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
[assembly: InternalsVisibleTo("SoundFingerprinting.FFT.FFTW")]
2020
[assembly: InternalsVisibleTo("SoundFingerprinting.FFT.FFTW.Tests")]
2121

22-
[assembly: AssemblyVersion("10.3.1.100")]
23-
[assembly: AssemblyInformationalVersion("10.3.1.100")]
22+
[assembly: AssemblyVersion("10.4.0.100")]
23+
[assembly: AssemblyInformationalVersion("10.4.0.100")]

src/SoundFingerprinting/Query/AVQueryMatch.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace SoundFingerprinting.Query
22
{
33
using System;
4+
using System.Collections.Generic;
45
using ProtoBuf;
56
using SoundFingerprinting.Data;
67
using SoundFingerprinting.LCS;
@@ -19,7 +20,8 @@ public class AVQueryMatch
1920
/// <param name="video">Video match information.</param>
2021
/// <param name="streamId">Stream ID information.</param>
2122
/// <param name="reviewStatus">Review status.</param>
22-
public AVQueryMatch(string id, QueryMatch? audio, QueryMatch? video, string? streamId, ReviewStatus reviewStatus = ReviewStatus.None)
23+
/// <param name="metaFields">Meta fields associated with the match.</param>
24+
public AVQueryMatch(string id, QueryMatch? audio, QueryMatch? video, string? streamId, ReviewStatus reviewStatus = ReviewStatus.None, IDictionary<string, string>? metaFields = null)
2325
{
2426
if (audio == null && video == null)
2527
{
@@ -31,6 +33,7 @@ public AVQueryMatch(string id, QueryMatch? audio, QueryMatch? video, string? str
3133
Audio = audio;
3234
Video = video;
3335
ReviewStatus = reviewStatus;
36+
MetaFields = metaFields;
3437
}
3538

3639
/// <summary>
@@ -101,6 +104,12 @@ public DateTime MatchedAt
101104
}
102105
}
103106

107+
/// <summary>
108+
/// Gets meta fields associated with the query match.
109+
/// </summary>
110+
[ProtoMember(6)]
111+
public IDictionary<string, string>? MetaFields { get; }
112+
104113
/// <summary>
105114
/// Deconstructs instance of <see cref="AVQueryMatch"/> class.
106115
/// </summary>

src/SoundFingerprinting/Query/AVResultEntry.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace SoundFingerprinting.Query
22
{
33
using System;
4+
using System.Collections.Generic;
45
using SoundFingerprinting.DAO.Data;
56
using SoundFingerprinting.Data;
67

@@ -61,16 +62,17 @@ public DateTime MatchedAt
6162
}
6263

6364
/// <summary>
64-
/// Converts to audio video query match object that you can register in the registry service <see cref="IQueryMatchRegistry"/>.
65+
/// Converts to audio video query match object that you can register in the registry service <see cref="IAVQueryMatchRegistry"/>.
6566
/// </summary>
6667
/// <param name="avQueryMatchId">Query match identifier.</param>
6768
/// <param name="streamId">Stream identifier.</param>
6869
/// <param name="reviewStatus">review status.</param>
70+
/// <param name="metaFields">Meta fields.</param>
6971
/// <returns>An instance of <see cref="AVQueryMatch"/>.</returns>
70-
public AVQueryMatch ConvertToAvQueryMatch(string avQueryMatchId = "", string streamId = "", ReviewStatus reviewStatus = ReviewStatus.None)
72+
public AVQueryMatch ConvertToAvQueryMatch(string avQueryMatchId = "", string streamId = "", ReviewStatus reviewStatus = ReviewStatus.None, IDictionary<string, string>? metaFields = null)
7173
{
7274
string id = string.IsNullOrEmpty(avQueryMatchId) ? Guid.NewGuid().ToString() : avQueryMatchId;
73-
return new AVQueryMatch(id, ToQueryMatch(Audio), ToQueryMatch(Video), streamId, reviewStatus);
75+
return new AVQueryMatch(id, ToQueryMatch(Audio), ToQueryMatch(Video), streamId, reviewStatus, metaFields);
7476
}
7577

7678
/// <summary>

src/SoundFingerprinting/SoundFingerprinting.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
55
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
66
<Nullable>enable</Nullable>
7-
<PackageVersion>10.3.1</PackageVersion>
7+
<PackageVersion>10.4.0</PackageVersion>
88
<Authors>Sergiu Ciumac</Authors>
99
<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>
1010
<PackageProjectUrl>https://github.com/addictedcs/soundfingerprinting</PackageProjectUrl>
1111
<RepositoryUrl>https://github.com/AddictedCS/soundfingerprinting</RepositoryUrl>
1212
<RepositoryType>git</RepositoryType>
1313
<PackageReleaseNotes>
14+
Version 10.4.0
15+
- Added new property MetaFields to AVQueryMatch, to be able to store additional metadata about the match.
1416
Version 10.3.0
1517
- Improved the ability to reconstruct coverage from tone signal matches (silence can be treated as a tone signal).
1618
- Added a fingerprinting flag that allows including silence fingerprints in the generated result set.

0 commit comments

Comments
 (0)