Initial commit of redesigned internal processing and audio management.

Note: Several of the decoders are currently non-functioning in this
commit.  If you want the latest functioning codebase, please checkout
the commit prior to this one.  All decoders will eventually be updated
with this new architecture.

Currently broken:
- Logging and recording
- Aux decoders (Fleetsync/MDC/LoJack/Tait)
- LTR/Passport decoders

Changes in this commit:
- Module architecture for decoders and components with central
provisioning by the DecoderFactory
- Transition from Complex sample stream processing to float buffer
processing for improved memory management
- Redesigned filter structures - to support buffers and streams
- Resolved several memory leak issues
- Universal sharing of the thread pool manager
- Added centralized audio management with call/user prioritization and
new gui with mute/volume controls
- Embedded audio metadata for eventual streaming support
- Redesigned ProcessingChain to support independent re-use
- Added new TrafficChannelManager to handle traffic channel allocations
- Traffic Channel pool size and Call timeout available in P25 and
MPT1327 configs
- Redesigned channel and decoder gui components
This commit is contained in:
denny
2015-09-01 07:10:26 -04:00
parent 538a299246
commit f4d8ea281d
570 changed files with 21578 additions and 17012 deletions

View File

@@ -0,0 +1,180 @@
package audio.metadata;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sample.Listener;
import alias.Metadata;
import alias.MetadataType;
public class AudioMetadata implements Listener<Metadata>
{
protected static final Logger mLog = LoggerFactory.getLogger( AudioMetadata.class );
private int mSource;
private int mPriority = 99;
private boolean mSelected = false;
private List<Metadata> mMetadata = new ArrayList<>();
private boolean mUpdated = false;
public AudioMetadata( int source )
{
mSource = source;
}
public AudioMetadata copyOf()
{
AudioMetadata copy = new AudioMetadata( mSource );
copy.mPriority = mPriority;
copy.mSelected = mSelected;
copy.mMetadata.addAll( mMetadata );
if( mUpdated )
{
copy.mUpdated = true;
mUpdated = false;
}
return copy;
}
/**
* Removes any accumulated temporal metadata and returns to a default set.
*/
public void reset()
{
Iterator<Metadata> it = mMetadata.iterator();
while( it.hasNext() )
{
if( it.next().isTemporal() )
{
it.remove();
}
}
mUpdated = true;
}
/**
* Indicates if this audio metadata contains updated information. The flag
* will only be set when new data is added and will be reset by a copyOf()
* method invocation.
*/
public boolean isUpdated()
{
return mUpdated;
}
/**
* Adds the metadata. Any temporal metadata will be removed when the
* dispose() method is invoked.
*/
@Override
public void receive( Metadata metadata )
{
if( metadata.isReset() )
{
reset();
}
else
{
mMetadata.add( metadata );
if( metadata.hasAlias() )
{
//TODO: assign priority from alias here
}
}
mUpdated = true;
}
/**
* Returns the complete set of metadata
*/
public List<Metadata> getMetadata()
{
return mMetadata;
}
/**
* Returns the first metadata object matching the type, or null if the
* metadata type is not found.
*/
public Metadata getMetadata( MetadataType type )
{
for( Metadata metadata: mMetadata )
{
if( metadata.getMetadataType() == type )
{
return metadata;
}
}
return null;
}
/**
* Source channel ID
*/
public void setSource( int source )
{
mSource = source;
mUpdated = true;
}
public int getSource()
{
return mSource;
}
/**
* Sets the priority of this audio packet in the range of 1 - Max Integer value
*
* @param priority (1 - Max Int)
*/
public void setPriority( int priority )
{
assert( 1 <= priority && priority <= Integer.MAX_VALUE );
mPriority = priority;
mUpdated = true;
}
/**
* Returns the priority of this audio packet or a priority of -1 if the
* audio source is currently selected, so that the priority of this packet
* is higher (lower?) than any other audio source
*
* @return - priority of audio packet where lower numbers are higher priority
*/
public int getPriority()
{
return mSelected ? -1 : mPriority;
}
/**
* Selected audio channel. A selected channel will override the priority
* level so that the audio can be listened to immediately.
*/
public void setSelected( boolean selected )
{
mSelected = selected;
mUpdated = true;
}
public boolean isSelected()
{
return mSelected;
}
}

View File

@@ -0,0 +1,9 @@
package audio.metadata;
import sample.Listener;
import alias.Metadata;
public interface IMetadataListener
{
public Listener<Metadata> getMetadataListener();
}

View File

@@ -0,0 +1,10 @@
package audio.metadata;
import sample.Listener;
import alias.Metadata;
public interface IMetadataProvider
{
public void setMetadataListener( Listener<Metadata> listener );
public void removeMetadataListener();
}