use of com.att.aro.ui.view.MainFrame in project VideoOptimzer by attdevsupport.
the class ARODataCollectorMenu method chooseDevice.
private IAroDevice chooseDevice(IAroDevices aroDevices, List<IDataCollector> collectors) {
ArrayList<IAroDevice> deviceList = aroDevices.getDeviceList();
IAroDevice device = null;
int delayTimeDL = 0;
int throttleDL = 0;
int throttleUL = 0;
boolean throttleDLEnable = false;
boolean throttleULEnable = false;
boolean profileBoolean = false;
String traceFolderName = "";
String profileLocation = "";
if (((MainFrame) parent).getPreviousOptions() != null) {
previousOptions = ((MainFrame) parent).getPreviousOptions();
}
metaDataModel = new MetaDataModel();
DataCollectorSelectNStartDialog dialog = new DataCollectorSelectNStartDialog(((MainFrame) parent).getJFrame(), parent, deviceList, traceFolderName, collectors, true, previousOptions, metaDataModel);
if (dialog.getResponse()) {
device = dialog.getDevice();
traceFolderName = dialog.getTraceFolder();
device.setCollector(dialog.getCollectorOption());
/*debug purpose*/
delayTimeDL = dialog.getDeviceOptionPanel().getAttenuatorModel().getDelayDS();
dialog.getDeviceOptionPanel().getAttenuatorModel().getDelayUS();
throttleDL = dialog.getDeviceOptionPanel().getAttenuatorModel().getThrottleDL();
throttleUL = dialog.getDeviceOptionPanel().getAttenuatorModel().getThrottleUL();
throttleDLEnable = dialog.getDeviceOptionPanel().getAttenuatorModel().isThrottleDLEnabled();
throttleULEnable = dialog.getDeviceOptionPanel().getAttenuatorModel().isThrottleULEnabled();
profileLocation = dialog.getDeviceOptionPanel().getAttenuatorModel().getLocalPath();
profileBoolean = dialog.getDeviceOptionPanel().getAttenuatorModel().isLoadProfile();
LOG.info("set U delay: " + delayTimeDL + ", set D delay: " + delayTimeDL + ", set U throttle: " + throttleUL + ", set D throttle: " + throttleDL + ", set profile: " + profileBoolean + ", set profileLocation: " + profileLocation);
if (device.isPlatform(IAroDevice.Platform.iOS)) {
IDataCollector iosCollector = findIOSCollector(collectors);
if ((throttleDLEnable || throttleULEnable) && !NetworkUtil.isNetworkUp(SharedNetIF)) {
MessageDialogFactory.getInstance().showInformationDialog(((MainFrame) parent).getJFrame(), ResourceBundleHelper.getMessageString("dlog.collector.option.attenuator.attenuation.finalwarning"), ResourceBundleHelper.getMessageString("dlog.collector.option.attenuator.attenuation.noshared"));
return null;
}
if (!checkSetSuPassword(iosCollector)) {
return null;
} else {
LOG.info("pw validated");
}
}
String traceFolderPath = (device.getPlatform().equals(IAroDevice.Platform.Android)) ? Util.getAROTraceDirAndroid() + System.getProperty("file.separator") + traceFolderName : Util.getAROTraceDirIOS() + System.getProperty("file.separator") + traceFolderName;
String currentPath = ((MainFrame) parent).getTracePath();
if (fileManager.directoryExistAndNotEmpty(traceFolderPath)) {
int result = folderExistsDialog();
if (result == JOptionPane.OK_OPTION) {
if (traceFolderPath.equals(currentPath)) {
new MessageDialogFactory().showErrorDialog(null, ResourceBundleHelper.getMessageString("viewer.contentUnwritable"));
return null;
}
File mountPoint = fileManager.createFile(traceFolderPath, IOSCollectorImpl.IOSAPP_MOUNT);
if (fileManager.createFile(traceFolderPath, IOSCollectorImpl.IOSAPP_MOUNT).exists() && device.getPlatform().equals(IAroDevice.Platform.iOS)) {
IExternalProcessRunner runner = new ExternalProcessRunnerImpl();
String results = runner.executeCmd(String.format("umount %s;rmdir %s", mountPoint, mountPoint));
if (!results.isEmpty()) {
new MessageDialogFactory().showErrorDialog(null, traceFolderPath + "/" + IOSCollectorImpl.IOSAPP_MOUNT + " is BUSY");
return null;
} else {
int count = 0;
while (fileManager.directoryExistAndNotEmpty(mountPoint.toString())) {
if (++count > 5) {
new MessageDialogFactory().showErrorDialog(null, traceFolderPath + "/" + IOSCollectorImpl.IOSAPP_MOUNT + " will not release, please detach the iOS device and delete the foldere manually");
return null;
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Log.error("sleep interrupted");
}
}
}
}
fileManager.deleteFolderContents(traceFolderPath);
} else {
return null;
}
}
Hashtable<String, Object> extras = prepareStartCollectorExtras(device, traceFolderName, dialog);
updateMetaData(device, traceFolderName, dialog);
extras.put("DIALOG_SIZE", dialog.getBaseSize());
if (dialog.getDeviceOptionPanel().getLabeledExpandedOptionFields().isVisible()) {
extras.put("MetaDataExpanded", true);
}
((MainFrame) parent).startCollector(device, traceFolderName, extras, metaDataModel);
} else {
traceFolderName = null;
}
dialog.dispose();
return device;
}
use of com.att.aro.ui.view.MainFrame in project VideoOptimzer by attdevsupport.
the class OpenPcapFileDialog method reloadTrace.
private void reloadTrace() {
LOG.info("Starting analysis");
if (parent instanceof MainFrame) {
if (StringUtils.isNotBlank(newPcapFileTracePath)) {
parent.updateTracePath(new File(newPcapFileTracePath + Util.FILE_SEPARATOR + originalPcapFileObj.getName()));
}
}
LOG.info("Ending analysis");
}
use of com.att.aro.ui.view.MainFrame in project VideoOptimzer by attdevsupport.
the class JFxPlayerControl method setUpMediaPlayer.
private void setUpMediaPlayer() {
AnalysisFilter filter = ((MainFrame) aroView).getController().getTheModel().getAnalyzerResult().getFilter();
if (null != filter) {
Double startTime = filter.getTimeRange().getBeginTime();
mediaPlayer.setStartTime(new Duration(startTime * 1000));
updateControllerBar();
}
mediaPlayer.currentTimeProperty().addListener(new InvalidationListener() {
@Override
public void invalidated(Observable arg0) {
updateControllerBar();
}
});
mediaPlayer.setOnPlaying(new Runnable() {
@Override
public void run() {
playButton.setText("||");
diagnosticTabSynThread = new VideoSyncThread(jfxPlayer, diagnosticTab, videoOffset);
new Thread(diagnosticTabSynThread).start();
}
});
mediaPlayer.setOnPaused(new Runnable() {
@Override
public void run() {
playButton.setText(">");
}
});
mediaPlayer.setOnStopped(new Runnable() {
@Override
public void run() {
Double startTime = 0.0;
AnalysisFilter filter = ((MainFrame) aroView).getController().getTheModel().getAnalyzerResult().getFilter();
if (null != filter) {
startTime = filter.getTimeRange().getBeginTime();
}
mediaPlayer.seek(new Duration(startTime));
playButton.setText(">");
timeSlider.setValue(startTime);
}
});
mediaPlayer.setOnReady(new Runnable() {
@Override
public void run() {
// Duration is available when player is ready (not available before that)
duration = mediaPlayer.getMedia().getDuration();
sliderMax = getVideoDuration() * FRAME_RATE;
if (timeSlider != null) {
timeSlider.setMax(sliderMax);
}
updateControllerBar();
}
});
mediaPlayer.setOnEndOfMedia(new Runnable() {
@Override
public void run() {
Double startTime = 0.0;
AnalysisFilter filter = ((MainFrame) aroView).getController().getTheModel().getAnalyzerResult().getFilter();
if (null != filter) {
startTime = filter.getTimeRange().getBeginTime();
}
mediaPlayer.seek(new Duration(startTime));
mediaPlayer.pause();
playButton.setText(">");
timeSlider.setValue(startTime);
updateTimeLabel();
}
});
}
use of com.att.aro.ui.view.MainFrame in project VideoOptimzer by attdevsupport.
the class SegmentTablePanel method reAnalyze.
protected void reAnalyze() {
StreamingVideoData streamingVideoData = analyzerResult.getAnalyzerResult().getStreamingVideoData();
if (streamingVideoData != null) {
streamingVideoData.scanVideoStreams();
}
((MainFrame) aroView).getDiagnosticTab().getGraphPanel().refresh(analyzerResult);
analyzerResult = videoBestPractices.analyze(analyzerResult);
((MainFrame) aroView).getDiagnosticTab().getGraphPanel().setTraceData(analyzerResult);
((MainFrame) aroView).getVideoTab().refreshLocal(analyzerResult, false);
((MainFrame) ((MainFrame) aroView).getDiagnosticTab().getGraphPanel().getGraphPanelParent().getAroView()).refreshBestPracticesTab();
if (!videoStream.getVideoEventMap().isEmpty()) {
if (checkBoxVideo != null && checkBoxAudio != null && (checkBoxVideo.isVisible() || checkBoxAudio.isVisible())) {
refresh(checkBoxVideo, checkBoxAudio);
} else {
refresh(null, null);
}
}
}
use of com.att.aro.ui.view.MainFrame in project VideoOptimzer by attdevsupport.
the class LoadManifestDialog method loadManifest.
/**
* Copy a file, files or a folder of files into tracepath/downloads/ Will traverse folders within a folder
*/
protected void loadManifest(AnalysisFilter analysisfilter) {
if (aroView.getTracePath() != null) {
// Open filechooser
JFileChooser fileChooser = new JFileChooser(aroView.getTracePath());
fileChooser.setMultiSelectionEnabled(true);
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("mpd, m3u8 or json", "mpd", "m3u8", "json"));
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.setAcceptAllFileFilterUsed(false);
int result = fileChooser.showOpenDialog(this);
if (result == JFileChooser.APPROVE_OPTION) {
if (checkBoxCSI.isSelected() && analysisfilter != null) {
String folderNameForCSIStuff = aroView.getTracePath() + File.separator + "CSI";
String expectedManifestFileName = folderNameForCSIStuff + File.separator + fileChooser.getSelectedFile().getName();
File expectedManifestFile = new File(expectedManifestFileName);
try {
if (!fileChooser.getSelectedFile().getPath().equals(expectedManifestFileName) && !expectedManifestFile.exists()) {
IFileManager fileManager = new FileManagerImpl();
if (fileManager.directoryExistAndNotEmpty(expectedManifestFile.getParentFile().getPath())) {
if (folderExistsDialog() == JOptionPane.YES_OPTION) {
FileUtils.deleteDirectory(expectedManifestFile.getParentFile());
}
}
if (!Files.exists(expectedManifestFile.getParentFile().toPath())) {
Files.createDirectory(expectedManifestFile.getParentFile().toPath());
}
if (fileChooser.getSelectedFile().getParent().equals(aroView.getTracePath())) {
Files.move(fileChooser.getSelectedFile().toPath(), expectedManifestFile.toPath());
} else {
Files.copy(fileChooser.getSelectedFile().toPath(), expectedManifestFile.toPath());
}
}
} catch (IOException ioe) {
expectedManifestFileName = fileChooser.getSelectedFile().getPath();
}
analysisfilter.setCSI(true);
analysisfilter.setManifestFilePath(expectedManifestFileName);
((MainFrame) aroView).updateFilter(analysisfilter);
} else {
// save selected file/files inside downloads folder
fileChooser.getSelectedFile().getPath();
String downloadsPath = aroView.getTracePath() + Util.FILE_SEPARATOR + "downloads";
try {
File[] files = fileChooser.getSelectedFiles();
if (!files[0].toString().equals(downloadsPath)) {
// expand out of folder
if (fileChooser.getSelectedFile().isDirectory()) {
files = files[0].listFiles();
}
if (null == files) {
return;
}
for (File file : files) {
if (file.isFile()) {
FileCopyUtils.copy(file, new File(downloadsPath, file.getName()));
}
}
} else {
LOG.error("user error :Chose downloads folder, will ignore");
}
} catch (IOException e1) {
LOG.error("IOException :" + e1.getMessage());
}
// refresh analyzer
aroView.updateTracePath(new File(aroView.getTracePath()));
}
}
}
}
Aggregations