mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-17 11:07:35 -05:00
Merge pull request #138 from DSheirer/135-audio_recording_issue
135 audio recording issue
This commit is contained in:
@@ -23,12 +23,16 @@ import alias.id.broadcast.BroadcastChannel;
|
|||||||
import alias.id.priority.Priority;
|
import alias.id.priority.Priority;
|
||||||
import channel.state.State;
|
import channel.state.State;
|
||||||
import module.decode.DecoderType;
|
import module.decode.DecoderType;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Metadata
|
public class Metadata
|
||||||
{
|
{
|
||||||
|
private final static Logger mLog = LoggerFactory.getLogger(Metadata.class);
|
||||||
|
|
||||||
// Static unique metadata identifier tracking
|
// Static unique metadata identifier tracking
|
||||||
private static int UNIQUE_METADATA_ID_GENERATOR = 0;
|
private static int UNIQUE_METADATA_ID_GENERATOR = 0;
|
||||||
|
|
||||||
@@ -55,7 +59,8 @@ public class Metadata
|
|||||||
|
|
||||||
//Lazily constructed member variables.
|
//Lazily constructed member variables.
|
||||||
private Integer mAudioPriority;
|
private Integer mAudioPriority;
|
||||||
protected Boolean mRecordable;
|
protected Boolean mRecordable = false;
|
||||||
|
protected Boolean mDoNotRecord;
|
||||||
private List<BroadcastChannel> mBroadcastChannels;
|
private List<BroadcastChannel> mBroadcastChannels;
|
||||||
|
|
||||||
|
|
||||||
@@ -141,12 +146,12 @@ public class Metadata
|
|||||||
*/
|
*/
|
||||||
public boolean isRecordable()
|
public boolean isRecordable()
|
||||||
{
|
{
|
||||||
if(mRecordable == null)
|
if(mDoNotRecord == null)
|
||||||
{
|
{
|
||||||
determineRecordable();
|
determineRecordable();
|
||||||
}
|
}
|
||||||
|
|
||||||
return mRecordable;
|
return mRecordable && !mDoNotRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -545,29 +550,29 @@ public class Metadata
|
|||||||
*/
|
*/
|
||||||
private void determineRecordable()
|
private void determineRecordable()
|
||||||
{
|
{
|
||||||
mRecordable = false;
|
mDoNotRecord = false;
|
||||||
|
|
||||||
if(mPrimaryAddressTo.hasAlias() && mPrimaryAddressTo.getAlias().isRecordable())
|
if(mPrimaryAddressTo.hasAlias() && !mPrimaryAddressTo.getAlias().isRecordable())
|
||||||
{
|
{
|
||||||
mRecordable = true;
|
mDoNotRecord = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mPrimaryAddressFrom.hasAlias() && mPrimaryAddressFrom.getAlias().isRecordable())
|
if(mPrimaryAddressFrom.hasAlias() && !mPrimaryAddressFrom.getAlias().isRecordable())
|
||||||
{
|
{
|
||||||
mRecordable = true;
|
mDoNotRecord = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mSecondaryAddressTo.hasAlias() && mSecondaryAddressTo.getAlias().isRecordable())
|
if(mSecondaryAddressTo.hasAlias() && !mSecondaryAddressTo.getAlias().isRecordable())
|
||||||
{
|
{
|
||||||
mRecordable = true;
|
mDoNotRecord = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mSecondaryAddressFrom.hasAlias() && mSecondaryAddressFrom.getAlias().isRecordable())
|
if(mSecondaryAddressFrom.hasAlias() && !mSecondaryAddressFrom.getAlias().isRecordable())
|
||||||
{
|
{
|
||||||
mRecordable = true;
|
mDoNotRecord = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -634,6 +639,8 @@ public class Metadata
|
|||||||
{
|
{
|
||||||
Metadata copy = new Metadata(mMetadataID);
|
Metadata copy = new Metadata(mMetadataID);
|
||||||
|
|
||||||
|
copy.mDoNotRecord = mDoNotRecord;
|
||||||
|
copy.mRecordable = mRecordable;
|
||||||
copy.mState = mState;
|
copy.mState = mState;
|
||||||
copy.mPrimaryDecoderType = mPrimaryDecoderType;
|
copy.mPrimaryDecoderType = mPrimaryDecoderType;
|
||||||
copy.mChannelFrequency = mChannelFrequency;
|
copy.mChannelFrequency = mChannelFrequency;
|
||||||
|
|||||||
@@ -163,6 +163,8 @@ public class MutableMetadata extends Metadata implements Listener<AttributeChang
|
|||||||
*/
|
*/
|
||||||
public void resetTemporalAttributes()
|
public void resetTemporalAttributes()
|
||||||
{
|
{
|
||||||
|
mDoNotRecord = null;
|
||||||
|
|
||||||
if(hasMessage())
|
if(hasMessage())
|
||||||
{
|
{
|
||||||
mMessage = null;
|
mMessage = null;
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
case NOTIFICATION_CONFIGURATION_CHANGE:
|
case NOTIFICATION_CONFIGURATION_CHANGE:
|
||||||
if(isProcessing(channel))
|
if(isProcessing(channel))
|
||||||
{
|
{
|
||||||
stopProcessing(channel, false);
|
stopProcessing(channel, true);
|
||||||
startProcessing(event);
|
startProcessing(event);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -217,34 +217,35 @@ public class ChannelProcessingManager implements ChannelEventListener
|
|||||||
MessageActivityModel messageModel = new MessageActivityModel(messageFilter);
|
MessageActivityModel messageModel = new MessageActivityModel(messageFilter);
|
||||||
processingChain.setMessageActivityModel(messageModel);
|
processingChain.setMessageActivityModel(messageModel);
|
||||||
|
|
||||||
//Override recordable flag in metadata if user has specified audio recording
|
|
||||||
if(channel.getRecordConfiguration() != null &&
|
|
||||||
channel.getRecordConfiguration().getRecorders().contains(RecorderType.AUDIO))
|
|
||||||
{
|
|
||||||
processingChain.getChannelState().getMutableMetadata().setRecordable(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Inject channel metadata that will be inserted into audio packets for recorder manager and streaming
|
|
||||||
processingChain.getChannelState().getMutableMetadata().receive(
|
|
||||||
new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_SYSTEM, channel.getSystem()));
|
|
||||||
processingChain.getChannelState().getMutableMetadata().receive(
|
|
||||||
new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_SITE, channel.getSite()));
|
|
||||||
processingChain.getChannelState().getMutableMetadata().receive(
|
|
||||||
new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_NAME, channel.getName()));
|
|
||||||
|
|
||||||
if(channel.getSourceConfiguration().getSourceType() == SourceType.TUNER)
|
|
||||||
{
|
|
||||||
long frequency = ((SourceConfigTuner)channel.getSourceConfiguration()).getFrequency();
|
|
||||||
|
|
||||||
processingChain.getChannelState().getMutableMetadata().receive(
|
|
||||||
new AttributeChangeRequest<Long>(Attribute.CHANNEL_FREQUENCY, frequency));
|
|
||||||
}
|
|
||||||
|
|
||||||
processingChain.getChannelState().getMutableMetadata().receive(
|
|
||||||
new AttributeChangeRequest<DecoderType>(Attribute.PRIMARY_DECODER_TYPE,
|
|
||||||
channel.getDecodeConfiguration().getDecoderType()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Set the recordable flag to true if the user has requested recording. The metadata class can still
|
||||||
|
//override recordability if any of the aliased values has 'Do Not Record' alias identifier.
|
||||||
|
boolean recordable = channel.getRecordConfiguration() != null &&
|
||||||
|
channel.getRecordConfiguration().getRecorders().contains(RecorderType.AUDIO);
|
||||||
|
|
||||||
|
processingChain.getChannelState().getMutableMetadata().setRecordable(recordable);
|
||||||
|
|
||||||
|
//Inject channel metadata that will be inserted into audio packets for recorder manager and streaming
|
||||||
|
processingChain.getChannelState().getMutableMetadata().receive(
|
||||||
|
new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_SYSTEM, channel.getSystem()));
|
||||||
|
processingChain.getChannelState().getMutableMetadata().receive(
|
||||||
|
new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_SITE, channel.getSite()));
|
||||||
|
processingChain.getChannelState().getMutableMetadata().receive(
|
||||||
|
new AttributeChangeRequest<String>(Attribute.CHANNEL_CONFIGURATION_NAME, channel.getName()));
|
||||||
|
|
||||||
|
if(channel.getSourceConfiguration().getSourceType() == SourceType.TUNER)
|
||||||
|
{
|
||||||
|
long frequency = ((SourceConfigTuner)channel.getSourceConfiguration()).getFrequency();
|
||||||
|
|
||||||
|
processingChain.getChannelState().getMutableMetadata().receive(
|
||||||
|
new AttributeChangeRequest<Long>(Attribute.CHANNEL_FREQUENCY, frequency));
|
||||||
|
}
|
||||||
|
|
||||||
|
processingChain.getChannelState().getMutableMetadata().receive(
|
||||||
|
new AttributeChangeRequest<DecoderType>(Attribute.PRIMARY_DECODER_TYPE,
|
||||||
|
channel.getDecodeConfiguration().getDecoderType()));
|
||||||
|
|
||||||
/* Setup event logging */
|
/* Setup event logging */
|
||||||
List<Module> loggers = mEventLogManager.getLoggers(channel.getEventLogConfiguration(), channel.getName());
|
List<Module> loggers = mEventLogManager.getLoggers(channel.getEventLogConfiguration(), channel.getName());
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,8 @@ public class DecoderFactory
|
|||||||
ChannelMapModel channelMapModel,
|
ChannelMapModel channelMapModel,
|
||||||
ChannelProcessingManager channelProcessingManager,
|
ChannelProcessingManager channelProcessingManager,
|
||||||
AliasList aliasList,
|
AliasList aliasList,
|
||||||
Channel channel, Metadata metadata)
|
Channel channel,
|
||||||
|
Metadata metadata)
|
||||||
{
|
{
|
||||||
List<Module> modules = new ArrayList<Module>();
|
List<Module> modules = new ArrayList<Module>();
|
||||||
|
|
||||||
|
|||||||
@@ -72,8 +72,11 @@ public class DemodulatedAudioFilterModule extends Module implements IUnFilteredR
|
|||||||
mBandPassFilter.dispose();
|
mBandPassFilter.dispose();
|
||||||
mBandPassFilter = null;
|
mBandPassFilter = null;
|
||||||
|
|
||||||
mDCFilter.dispose();
|
if(mDCFilter != null)
|
||||||
mDCFilter = null;
|
{
|
||||||
|
mDCFilter.dispose();
|
||||||
|
mDCFilter = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user