/** * Creates all the controls (including encoding) for a type(AUDIO or VIDEO) * * @param type the type. * @return the build Component. */ private static Component createControls(int type) { ConfigurationService cfg = NeomediaActivator.getConfigurationService(); SIPCommTabbedPane container = new SIPCommTabbedPane(); ResourceManagementService res = NeomediaActivator.getResources(); if ((cfg == null) || !cfg.getBoolean(DEVICES_DISABLED_PROP, false)) { container.insertTab( res.getI18NString("impl.media.configform.DEVICES"), null, createBasicControls(type), null, 0); } if ((cfg == null) || !cfg.getBoolean(ENCODINGS_DISABLED_PROP, false)) { container.insertTab( res.getI18NString("impl.media.configform.ENCODINGS"), null, new PriorityTable( new EncodingConfigurationTableModel(mediaService.getEncodingConfiguration(), type), 100), null, 1); } if ((type == DeviceConfigurationComboBoxModel.VIDEO) && ((cfg == null) || !cfg.getBoolean(VIDEO_MORE_SETTINGS_DISABLED_PROP, false))) { container.insertTab( res.getI18NString("impl.media.configform.VIDEO_MORE_SETTINGS"), null, createVideoAdvancedSettings(), null, 2); } return container; }
static { ConfigurationService cfg = LibJitsi.getConfigurationService(); boolean dropUnencryptedPkts = false; if (cfg == null) { String s = System.getProperty(DROP_UNENCRYPTED_PKTS_PNAME); if (s != null) dropUnencryptedPkts = Boolean.parseBoolean(s); } else { dropUnencryptedPkts = cfg.getBoolean(DROP_UNENCRYPTED_PKTS_PNAME, dropUnencryptedPkts); } DROP_UNENCRYPTED_PKTS = dropUnencryptedPkts; }
/** * Initializes a new <tt>RecordButton</tt> instance which is to record the audio stream. * * @param call the <tt>Call</tt> to be associated with the new instance and to have its audio * stream recorded * @param selected <tt>true</tt> if the new toggle button is to be initially selected; otherwise, * <tt>false</tt> */ public RecordButton(Call call, boolean selected) { super(call, true, selected, ImageLoader.RECORD_BUTTON, ImageLoader.RECORD_BUTTON_PRESSED, null); String toolTip = resources.getI18NString("service.gui.RECORD_BUTTON_TOOL_TIP"); String saveDir = configuration.getString(Recorder.SAVED_CALLS_PATH); if ((saveDir != null) && (saveDir.length() != 0)) toolTip += " (" + saveDir + ")"; setToolTipText(toolTip); }
/** * Returns the path to the directory where the media recording related files should be saved, or * <tt>null</tt> if recording is not enabled in the configuration, or a recording path has not * been configured. * * @return the path to the directory where the media recording related files should be saved, or * <tt>null</tt> if recording is not enabled in the configuration, or a recording path has not * been configured. */ String getRecordingPath() { if (recordingPath == null) { ConfigurationService cfg = getVideobridge().getConfigurationService(); if (cfg != null) { boolean recordingIsEnabled = cfg.getBoolean(Videobridge.ENABLE_MEDIA_RECORDING_PNAME, false); if (recordingIsEnabled) { String path = cfg.getString(Videobridge.MEDIA_RECORDING_PATH_PNAME, null); if (path != null) { this.recordingPath = path + "/" + this.getRecordingDirectory(); } } } } return recordingPath; }
/** * Creates a full filename for the call by combining the directory, file prefix and extension. If * the directory is <tt>null</tt> user's home directory is used. * * @param savedCallsPath the path to the directory in which the generated file name is to be * placed * @return a full filename for the call */ private String createDefaultFilename(String savedCallsPath) { // set to user's home when null if (savedCallsPath == null) { try { savedCallsPath = GuiActivator.getFileAccessService().getDefaultDownloadDirectory().getAbsolutePath(); } catch (IOException ioex) { // Leave it in the current directory. } } String ext = configuration.getString(Recorder.FORMAT); // Use a default format when the configured one seems invalid. if ((ext == null) || (ext.length() == 0) || !isSupportedFormat(ext)) ext = SoundFileUtils.DEFAULT_CALL_RECORDING_FORMAT; return ((savedCallsPath == null) ? "" : (savedCallsPath + File.separator)) + generateCallFilename(ext); }
/** * Starts recording {@link #call} creating {@link #recorder} first and asking the user for the * recording format and file if they are not configured in the "Call Recording" configuration * form. * * @return <tt>true</tt> if the recording has been started successfully; otherwise, <tt>false</tt> */ private boolean startRecording() { String savedCallsPath = configuration.getString(Recorder.SAVED_CALLS_PATH); String callFormat; // Ask the user where to save the call. if ((savedCallsPath == null) || (savedCallsPath.length() == 0)) { /* * Delay the initialization of callFileChooser in order to delay the * creation of the recorder. */ if (callFileChooser == null) { callFileChooser = GenericFileDialog.create( null, resources.getI18NString("plugin.callrecordingconfig.SAVE_CALL"), SipCommFileChooser.SAVE_FILE_OPERATION); callFileChooser.addFilter( new SipCommFileFilter() { @Override public boolean accept(File f) { return f.isDirectory() || isSupportedFormat(f); } @Override public String getDescription() { StringBuilder description = new StringBuilder(); description.append("Recorded call"); Recorder recorder; try { recorder = getRecorder(); } catch (OperationFailedException ofex) { logger.error("Failed to get Recorder", ofex); recorder = null; } if (recorder != null) { List<String> supportedFormats = recorder.getSupportedFormats(); if (supportedFormats != null) { description.append(" ("); boolean firstSupportedFormat = true; for (String supportedFormat : supportedFormats) { if (firstSupportedFormat) firstSupportedFormat = false; else description.append(", "); description.append("*."); description.append(supportedFormat); } description.append(')'); } } return description.toString(); } }); } // Offer a default name for the file to record into. callFileChooser.setStartPath(createDefaultFilename(null)); File selectedFile = callFileChooser.getFileFromDialog(); if (selectedFile != null) { callFilename = selectedFile.getAbsolutePath(); /* * If the user specified no extension (which seems common on Mac * OS X at least) i.e. no format, then it is not obvious that we * have to override the set Recorder.CALL_FORMAT. */ callFormat = SoundFileUtils.getExtension(selectedFile); if ((callFormat != null) && (callFormat.length() != 0)) { /* * If the use has specified an extension and thus a format * which is not supported, use a default format instead. */ if (!isSupportedFormat(selectedFile)) { /* * If what appears to be an extension seems a lot like * an extension, then it should be somewhat safer to * replace it. */ if (SoundFileUtils.isSoundFile(selectedFile)) { callFilename = callFilename.substring(0, callFilename.lastIndexOf('.')); } String configuredFormat = configuration.getString(Recorder.FORMAT); callFormat = (configuredFormat != null && configuredFormat.length() != 0) ? configuredFormat : SoundFileUtils.DEFAULT_CALL_RECORDING_FORMAT; callFilename += '.' + callFormat; } configuration.setProperty(Recorder.FORMAT, callFormat); } } else { // user canceled the recording return false; } } else { callFilename = createDefaultFilename(savedCallsPath); callFormat = SoundFileUtils.getExtension(new File(callFilename)); } Throwable exception = null; try { Recorder recorder = getRecorder(); if (recorder != null) { if ((callFormat == null) || (callFormat.length() <= 0)) callFormat = SoundFileUtils.DEFAULT_CALL_RECORDING_FORMAT; recorder.start(callFormat, callFilename); } this.recorder = recorder; } catch (IOException ioex) { exception = ioex; } catch (MediaException mex) { exception = mex; } catch (OperationFailedException ofex) { exception = ofex; } if ((recorder == null) || (exception != null)) { logger.error( "Failed to start recording call " + call + " into file " + callFilename, exception); return false; } else return true; }
/** * Starts the execution of the neomedia bundle in the specified context. * * @param bundleContext the context in which the neomedia bundle is to start executing * @throws Exception if an error occurs while starting the execution of the neomedia bundle in the * specified context */ public void start(BundleContext bundleContext) throws Exception { if (logger.isDebugEnabled()) logger.debug("Started."); NeomediaActivator.bundleContext = bundleContext; // MediaService mediaServiceImpl = (MediaServiceImpl) LibJitsi.getMediaService(); bundleContext.registerService(MediaService.class.getName(), mediaServiceImpl, null); if (logger.isDebugEnabled()) logger.debug("Media Service ... [REGISTERED]"); // mediaConfiguration = new MediaConfigurationImpl(); // bundleContext.registerService( // MediaConfigurationService.class.getStatus(), // getMediaConfiguration(), // null); if (logger.isDebugEnabled()) logger.debug("Media Configuration ... [REGISTERED]"); ConfigurationService cfg = NeomediaActivator.getConfigurationService(); Dictionary<String, String> mediaProps = new Hashtable<String, String>(); mediaProps.put(ConfigurationForm.FORM_TYPE, ConfigurationForm.GENERAL_TYPE); // If the audio configuration form is disabled don't register it. // if ((cfg == null) || !cfg.getBoolean(AUDIO_CONFIG_DISABLED_PROP, false)) // { // audioConfigurationForm // = new LazyConfigurationForm( // AudioConfigurationPanel.class.getStatus(), // getClass().getClassLoader(), // "plugin.mediaconfig.AUDIO_ICON", // "impl.neomedia.configform.AUDIO", // 3); // // bundleContext.registerService( // ConfigurationForm.class.getStatus(), // audioConfigurationForm, // mediaProps); // // if (deviceConfigurationPropertyChangeListener == null) // { // // Initializes and registers the changed device configuration // // event ot the notification service. // getNotificationService(); // // deviceConfigurationPropertyChangeListener // = new AudioDeviceConfigurationListener(); // mediaServiceImpl // .getDeviceConfiguration() // .addPropertyChangeListener( // deviceConfigurationPropertyChangeListener); // } // } // If the video configuration form is disabled don't register it. // if ((cfg == null) || !cfg.getBoolean(VIDEO_CONFIG_DISABLED_PROP, false)) // { // bundleContext.registerService( // ConfigurationForm.class.getStatus(), // new LazyConfigurationForm( // VideoConfigurationPanel.class.getStatus(), // getClass().getClassLoader(), // "plugin.mediaconfig.VIDEO_ICON", // "impl.neomedia.configform.VIDEO", // 4), // mediaProps); // } // H.264 // If the H.264 configuration form is disabled don't register it. // if ((cfg == null) || !cfg.getBoolean(H264_CONFIG_DISABLED_PROP, false)) // { // Dictionary<String, String> h264Props // = new Hashtable<String, String>(); // // h264Props.put( // ConfigurationForm.FORM_TYPE, // ConfigurationForm.ADVANCED_TYPE); // bundleContext.registerService( // ConfigurationForm.class.getStatus(), // new LazyConfigurationForm( // ConfigurationPanel.class.getStatus(), // getClass().getClassLoader(), // "plugin.mediaconfig.VIDEO_ICON", // "impl.neomedia.configform.H264", // -1, // true), // h264Props); // } // ZRTP // If the ZRTP configuration form is disabled don't register it. // if ((cfg == null) || !cfg.getBoolean(ZRTP_CONFIG_DISABLED_PROP, false)) // { // Dictionary<String, String> securityProps // = new Hashtable<String, String>(); // // securityProps.put( ConfigurationForm.FORM_TYPE, // ConfigurationForm.SECURITY_TYPE); // bundleContext.registerService( // ConfigurationForm.class.getStatus(), // new LazyConfigurationForm( // SecurityConfigForm.class.getStatus(), // getClass().getClassLoader(), // "impl.media.security.zrtp.CONF_ICON", // "impl.media.security.zrtp.TITLE", // 0), // securityProps); // } // we use the nist-sdp stack to make parse sdp and we need to set the // following property to make sure that it would accept java generated // IPv6 addresses that contain address scope zones. System.setProperty("gov.nist.core.STRIP_ADDR_SCOPES", "true"); // AudioNotifierService AudioNotifierService audioNotifierService = LibJitsi.getAudioNotifierService(); audioNotifierService.setMute( (cfg == null) || !cfg.getBoolean("net.java.sip.communicator" + ".impl.sound.isSoundEnabled", true)); bundleContext.registerService(AudioNotifierService.class.getName(), audioNotifierService, null); if (logger.isInfoEnabled()) logger.info("Audio Notifier Service ...[REGISTERED]"); // Call Recording // If the call recording configuration form is disabled don't continue. // if ((cfg == null) // || !cfg.getBoolean(CALL_RECORDING_CONFIG_DISABLED_PROP, false)) // { // Dictionary<String, String> callRecordingProps // = new Hashtable<String, String>(); // // callRecordingProps.put( // ConfigurationForm.FORM_TYPE, // ConfigurationForm.ADVANCED_TYPE); // bundleContext.registerService( // ConfigurationForm.class.getStatus(), // new LazyConfigurationForm( // CallRecordingConfigForm.class.getStatus(), // getClass().getClassLoader(), // null, // "plugin.callrecordingconfig.CALL_RECORDING_CONFIG", // 1100, // true), // callRecordingProps); // } }