Ejemplo n.º 1
0
        public void Add(SubFingerprintsGeneratedEventArgs e, bool suppressSilentCollisions = false)
        {
            if (e.SubFingerprints.Count == 0)
            {
                return;
            }

            lock (this) {
                if (!store.ContainsKey(e.AudioTrack))
                {
                    store.Add(e.AudioTrack, new List <SubFingerprintHash>());
                }

                foreach (var sfp in e.SubFingerprints)
                {
                    if (!sfp.IsVariation)
                    {
                        // store the sub-fingerprint in the sequential list of the audio track
                        store[e.AudioTrack].Add(sfp.Hash);
                    }

                    if (suppressSilentCollisions && sfp.Hash.Value == 0)
                    {
                        // Skip a silent hash, i.e. a hash without any changes, as it happens with silent signals as input
                        continue;
                    }

                    // insert a track/index lookup entry for the sub-fingerprint
                    collisionMap.Add(sfp.Hash, new SubFingerprintLookupEntry(e.AudioTrack, sfp.Index));
                }
            }
        }
Ejemplo n.º 2
0
        public void Add(SubFingerprintsGeneratedEventArgs e)
        {
            if (e.SubFingerprints.Count == 0)
            {
                return;
            }

            lock (this) {
                if (!store.ContainsKey(e.AudioTrack))
                {
                    store.Add(e.AudioTrack, new List <SubFingerprintHash>());
                }

                foreach (var sfp in e.SubFingerprints)
                {
                    if (!sfp.IsVariation)
                    {
                        // store the sub-fingerprint in the sequential list of the audio track
                        store[e.AudioTrack].Add(sfp.Hash);
                    }

                    // insert a track/index lookup entry for the sub-fingerprint
                    collisionMap.Add(sfp.Hash, new SubFingerprintLookupEntry(e.AudioTrack, sfp.Index));
                }
            }
        }