mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-21 13:05:43 -05:00
Co-authored-by: Denny <denny@denny-desktop>
This commit is contained in:
@@ -75,6 +75,7 @@ public class AudioSegment implements Listener<IdentifierUpdateNotification>
|
||||
private long mStartTimestamp = System.currentTimeMillis();
|
||||
private boolean mDisposing = false;
|
||||
private AudioSegment mLinkedAudioSegment;
|
||||
private int mTimeslot;
|
||||
|
||||
/**
|
||||
* Constructs an instance
|
||||
@@ -84,9 +85,18 @@ public class AudioSegment implements Listener<IdentifierUpdateNotification>
|
||||
public AudioSegment(AliasList aliasList, int timeslot)
|
||||
{
|
||||
mAliasList = aliasList;
|
||||
mTimeslot = timeslot;
|
||||
mIdentifierCollection.setTimeslot(timeslot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Timeslot for this audio segment
|
||||
*/
|
||||
public int getTimeslot()
|
||||
{
|
||||
return mTimeslot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creation timestamp for this audio segment
|
||||
* @return long milliseconds since epoch
|
||||
@@ -211,7 +221,7 @@ public class AudioSegment implements Listener<IdentifierUpdateNotification>
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier collection for this audio segment
|
||||
* Immutable identifier collection for this audio segment
|
||||
*/
|
||||
public IdentifierCollection getIdentifierCollection()
|
||||
{
|
||||
@@ -226,7 +236,7 @@ public class AudioSegment implements Listener<IdentifierUpdateNotification>
|
||||
{
|
||||
for(Identifier identifier: identifiers)
|
||||
{
|
||||
mIdentifierCollection.update(identifier);
|
||||
addIdentifier(identifier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,23 +365,15 @@ public class AudioSegment implements Listener<IdentifierUpdateNotification>
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes identifier update notifications and updates audio segment properties using the associated aliases
|
||||
* from the alias list.
|
||||
* Adds the identifier to this audio segment and updates record, priority and streaming properties.
|
||||
*
|
||||
* @param identifierUpdateNotification containing an identifier.
|
||||
* Note: identifiers pass to this method must be checked for timeslot match.
|
||||
*/
|
||||
@Override
|
||||
public void receive(IdentifierUpdateNotification identifierUpdateNotification)
|
||||
public void addIdentifier(Identifier identifier)
|
||||
{
|
||||
IdentifierUpdateNotification.Operation operation = identifierUpdateNotification.getOperation();
|
||||
mIdentifierCollection.update(identifier);
|
||||
|
||||
//Only process ADD updates. Ignore REMOVE to preserve the full metadata set
|
||||
if(operation == IdentifierUpdateNotification.Operation.ADD ||
|
||||
operation == IdentifierUpdateNotification.Operation.SILENT_ADD)
|
||||
{
|
||||
mIdentifierCollection.receive(identifierUpdateNotification);
|
||||
|
||||
List<Alias> aliases = mAliasList.getAliases(identifierUpdateNotification.getIdentifier());
|
||||
List<Alias> aliases = mAliasList.getAliases(identifier);
|
||||
|
||||
for(Alias alias: aliases)
|
||||
{
|
||||
@@ -394,7 +396,22 @@ public class AudioSegment implements Listener<IdentifierUpdateNotification>
|
||||
mMonitorPriority.set(playbackPriority);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes identifier update notifications and updates audio segment properties using the associated aliases
|
||||
* from the alias list.
|
||||
*
|
||||
* @param identifierUpdateNotification containing an identifier.
|
||||
*/
|
||||
@Override
|
||||
public void receive(IdentifierUpdateNotification identifierUpdateNotification)
|
||||
{
|
||||
//Only process add updates that match this timeslot
|
||||
if(identifierUpdateNotification.getTimeslot() == getTimeslot() &&
|
||||
(identifierUpdateNotification.isAdd() || identifierUpdateNotification.isSilentAdd()))
|
||||
{
|
||||
addIdentifier(identifierUpdateNotification.getIdentifier());
|
||||
mIdentifierUpdateNotificationBroadcaster.broadcast(identifierUpdateNotification);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user