mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-14 17:47:32 -05:00
Co-authored-by: Denny <denny@denny-desktop>
This commit is contained in:
@@ -190,8 +190,9 @@ public class P25P2AudioModule extends AmbeAudioModule implements IdentifierUpdat
|
|||||||
*/
|
*/
|
||||||
private void processMetadata(IAudioWithMetadata audioWithMetadata)
|
private void processMetadata(IAudioWithMetadata audioWithMetadata)
|
||||||
{
|
{
|
||||||
if(audioWithMetadata.hasMetadata() && mIdentifierUpdateNotificationListener != null)
|
if(audioWithMetadata.hasMetadata())
|
||||||
{
|
{
|
||||||
|
//JMBE only places 1 entry in the map, but for consistency we'll process the map entry set
|
||||||
for(Map.Entry<String,String> entry: audioWithMetadata.getMetadata().entrySet())
|
for(Map.Entry<String,String> entry: audioWithMetadata.getMetadata().entrySet())
|
||||||
{
|
{
|
||||||
//Each metadata map entry contains a tone-type (key) and tone (value)
|
//Each metadata map entry contains a tone-type (key) and tone (value)
|
||||||
@@ -203,6 +204,10 @@ public class P25P2AudioModule extends AmbeAudioModule implements IdentifierUpdat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mToneMetadataProcessor.closeMetadata();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -243,6 +248,7 @@ public class P25P2AudioModule extends AmbeAudioModule implements IdentifierUpdat
|
|||||||
public class ToneMetadataProcessor
|
public class ToneMetadataProcessor
|
||||||
{
|
{
|
||||||
private List<ToneMetadata> mToneMetadata = new ArrayList<>();
|
private List<ToneMetadata> mToneMetadata = new ArrayList<>();
|
||||||
|
private ToneMetadata mCurrentToneMetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets or clears any accumulated call tone metadata to prepare for the next call.
|
* Resets or clears any accumulated call tone metadata to prepare for the next call.
|
||||||
@@ -265,18 +271,27 @@ public class P25P2AudioModule extends AmbeAudioModule implements IdentifierUpdat
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToneMetadata toneMetadata = (mToneMetadata.size() > 0 ? mToneMetadata.get(mToneMetadata.size() - 1) : null);
|
if(mCurrentToneMetadata != null && mCurrentToneMetadata.matches(type, value))
|
||||||
|
|
||||||
if(toneMetadata == null || !toneMetadata.matches(type, value))
|
|
||||||
{
|
{
|
||||||
toneMetadata = new ToneMetadata(type, value);
|
mCurrentToneMetadata.incrementCount();
|
||||||
mToneMetadata.add(toneMetadata);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mCurrentToneMetadata = new ToneMetadata(type, value);
|
||||||
|
mToneMetadata.add(mCurrentToneMetadata);
|
||||||
|
mCurrentToneMetadata.incrementCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
toneMetadata.incrementCount();
|
|
||||||
|
|
||||||
return P25ToneIdentifier.create(Joiner.on(",").join(mToneMetadata));
|
return P25ToneIdentifier.create(Joiner.on(",").join(mToneMetadata));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes current tone metadata when there is no metadata for the current audio frame.
|
||||||
|
*/
|
||||||
|
public void closeMetadata()
|
||||||
|
{
|
||||||
|
mCurrentToneMetadata = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user