Search in sources :

Example 1 with DUPLICATE_HANDLING

use of com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs.DUPLICATE_HANDLING in project VideoOptimzer by attdevsupport.

the class PlotHelperAbstract method filterSegmentByVideoPref.

public List<VideoEvent> filterSegmentByVideoPref(StreamingVideoData videoData) {
    this.streamingVideoData = videoData;
    Map<VideoEvent, VideoStream> veManifestList = new HashMap<>();
    chunkDownload = new ArrayList<>();
    List<VideoEvent> allSegments = new ArrayList<>();
    streamingVideoData.getStreamingVideoCompiled().getDeleteChunkList().clear();
    DUPLICATE_HANDLING segmentFilterChoice = videoPrefManager.getVideoUsagePreference().getDuplicateHandling();
    for (VideoStream videoStream : streamingVideoData.getVideoStreamMap().values()) {
        // don't count if no videos with manifest, or only one video
        if (videoStream != null && videoStream.isSelected() && !videoStream.getVideoEventMap().isEmpty()) {
            for (VideoEvent videoEvent : videoStream.getVideoEventMap().values()) {
                if (!(videoEvent.getSegmentID() == 0 && videoStream.getManifest().getVideoFormat().equals(VideoFormat.MPEG4)) && (!chunkDownload.contains(videoEvent))) {
                    switch(segmentFilterChoice) {
                        case FIRST:
                            filterByFirst(chunkDownload, videoEvent);
                            break;
                        case LAST:
                            filterByLast(chunkDownload, videoEvent);
                            break;
                        case HIGHEST:
                            filterByHighest(chunkDownload, videoEvent);
                            break;
                        default:
                    }
                    veManifestList.put(videoEvent, videoStream);
                    chunkDownload.add(videoEvent);
                    allSegments.add(videoEvent);
                }
            }
        }
    }
    if (segmentFilterChoice == DUPLICATE_HANDLING.FIRST || segmentFilterChoice == DUPLICATE_HANDLING.LAST) {
        for (VideoEvent ve : streamingVideoData.getStreamingVideoCompiled().getDeleteChunkList()) {
            veManifestList.keySet().remove(ve);
            chunkDownload.remove(ve);
        }
    }
    streamingVideoData.getStreamingVideoCompiled().setAllSegments(allSegments);
    return chunkDownload;
}
Also used : HashMap(java.util.HashMap) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) ArrayList(java.util.ArrayList) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) DUPLICATE_HANDLING(com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs.DUPLICATE_HANDLING)

Example 2 with DUPLICATE_HANDLING

use of com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs.DUPLICATE_HANDLING in project VideoOptimzer by attdevsupport.

the class VideoPreferencesPanel method getVideoPrefencesPanel.

private Component getVideoPrefencesPanel() {
    stallTriggerTimeEdit = new JTextField(String.format("%.3f", videoUsagePrefs.getStallTriggerTime()), 5);
    maxBufferEdit = new JTextField(String.format("%.2f", videoUsagePrefs.getMaxBuffer()), 5);
    stallPausePointEdit = new JTextField(String.format("%.4f", videoUsagePrefs.getStallPausePoint()), 5);
    stallRecoveryEdit = new JTextField(String.format("%.4f", videoUsagePrefs.getStallRecovery()), 5);
    targetedStartupDelayEdit = new JTextField(String.format("%.2f", videoUsagePrefs.getStartupDelay()), 5);
    nearStallEdit = new JTextField(String.format("%.4f", videoUsagePrefs.getNearStall()), 5);
    stallTriggerTimeEdit.setInputVerifier(getNumericInputVerifier(MAX_STALLTRIGGERTIME, 0.01, 3));
    stallTriggerTimeEdit.addKeyListener(getKeyListener(stallTriggerTimeEdit));
    maxBufferEdit.setInputVerifier(getNumericInputVerifier(MAX_BUFFER, 0, 2));
    maxBufferEdit.addKeyListener(getKeyListener(maxBufferEdit));
    stallPausePointEdit.setInputVerifier(getNumericInputVerifier(MAX_STALLRECOVERY, 0, 4));
    stallPausePointEdit.addKeyListener(getKeyListener(stallPausePointEdit));
    stallRecoveryEdit.setInputVerifier(getNumericInputVerifier(MAX_STALLRECOVERY, 0, 4));
    stallRecoveryEdit.addKeyListener(getKeyListener(stallRecoveryEdit));
    targetedStartupDelayEdit.setInputVerifier(getNumericInputVerifier(MAX_TARGETEDSTARTUPDELAY, 0, 2));
    targetedStartupDelayEdit.addKeyListener(getKeyListener(targetedStartupDelayEdit));
    NumericInputVerifier numericInputVerifier = getNumericInputVerifier(MAX_NEARSTALL, 0.01, 4);
    nearStallEdit.setInputVerifier(numericInputVerifier);
    nearStallEdit.addKeyListener(getKeyListener(nearStallEdit));
    startupDelayReminder = new JCheckBox();
    duplicateHandlingEditCombo = new JComboBox<>();
    for (DUPLICATE_HANDLING item : DUPLICATE_HANDLING.values()) {
        duplicateHandlingEditCombo.addItem(item);
    }
    duplicateHandlingEditCombo.setSelectedItem(videoUsagePrefs.getDuplicateHandling());
    idx = 0;
    GridBagLayout gridBagLayout = new GridBagLayout();
    JPanel panel = new JPanel(gridBagLayout);
    panel.setAlignmentX(CENTER_ALIGNMENT);
    panel.setBorder(new RoundedBorder(new Insets(10, 10, 10, 10), null));
    addVideoPreference(panel);
    addDefaultButton(panel, 2, numericInputVerifier);
    return panel;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) NumericInputVerifier(com.att.aro.ui.utils.NumericInputVerifier) JTextField(javax.swing.JTextField) RoundedBorder(com.att.aro.ui.commonui.RoundedBorder) DUPLICATE_HANDLING(com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs.DUPLICATE_HANDLING)

Aggregations

DUPLICATE_HANDLING (com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs.DUPLICATE_HANDLING)2 VideoEvent (com.att.aro.core.videoanalysis.pojo.VideoEvent)1 VideoStream (com.att.aro.core.videoanalysis.pojo.VideoStream)1 RoundedBorder (com.att.aro.ui.commonui.RoundedBorder)1 NumericInputVerifier (com.att.aro.ui.utils.NumericInputVerifier)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 JCheckBox (javax.swing.JCheckBox)1 JPanel (javax.swing.JPanel)1 JTextField (javax.swing.JTextField)1