Search in sources :

Example 1 with QualityTime

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

the class BPAdaptiveBitrateTablePanel method getContentTable.

@SuppressWarnings("unchecked")
public DataTable<QualityTime> getContentTable() {
    if (contentTable == null) {
        contentTable = new DataTable<QualityTime>(tableModel);
        contentTable.setName(ResourceBundleHelper.getMessageString("video.adaptive.bitrate.tableName"));
        contentTable.setAutoCreateRowSorter(true);
        contentTable.setGridColor(Color.LIGHT_GRAY);
        contentTable.setRowHeight(ROW_HEIGHT);
        contentTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
        TableRowSorter<TableModel> sorter = new TableRowSorter<>(tableModel);
        contentTable.setRowSorter(sorter);
        sorter.toggleSortOrder(AdaptiveBitrateTableModel.COL_2);
        sorter.setComparator(AdaptiveBitrateTableModel.COL_3, Util.getFloatSorter());
        sorter.toggleSortOrder(AdaptiveBitrateTableModel.COL_4);
        sorter.setComparator(AdaptiveBitrateTableModel.COL_5, Util.getFloatSorter());
        sorter.setComparator(AdaptiveBitrateTableModel.COL_6, Util.getFloatSorter());
        sorter.setComparator(AdaptiveBitrateTableModel.COL_7, Util.getFloatSorter());
        sorter.setComparator(AdaptiveBitrateTableModel.COL_8, Util.getFloatSorter());
        // set default sort
        sorter.toggleSortOrder(AdaptiveBitrateTableModel.COL_1);
        DataTablePopupMenu popupMenu = (DataTablePopupMenu) contentTable.getPopup();
        popupMenu.initialize();
    }
    return contentTable;
}
Also used : QualityTime(com.att.aro.core.videoanalysis.pojo.QualityTime) DataTablePopupMenu(com.att.aro.ui.model.DataTablePopupMenu) AdaptiveBitrateTableModel(com.att.aro.ui.model.bestpractice.AdaptiveBitrateTableModel) TableModel(javax.swing.table.TableModel) TableRowSorter(javax.swing.table.TableRowSorter)

Example 2 with QualityTime

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

the class VideoAdaptiveBitrateLadderPanel method loadDataSet.

public void loadDataSet() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    timeAxis.setRange(new Range(0, timeLine));
    for (QualityTime qualityTime : graphicModel.getData()) {
        dataset.addValue(qualityTime.getPercentage(), MessageFormat.format(ResourceBundleHelper.getMessageString("abr_ladder.track"), qualityTime.getTrack(), String.format("%.0f", qualityTime.getPercentage())), qualityTime.getName());
    }
    // Add the dataset to the plot
    CategoryPlot plot = getChartPanel().getChart().getCategoryPlot();
    plot.setDataset(dataset);
}
Also used : QualityTime(com.att.aro.core.videoanalysis.pojo.QualityTime) Range(org.jfree.data.Range) DefaultCategoryDataset(org.jfree.data.category.DefaultCategoryDataset) CategoryPlot(org.jfree.chart.plot.CategoryPlot)

Example 3 with QualityTime

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

the class VideoAdaptiveBitrateLadderImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    BPResultType bpResultType = BPResultType.SELF_TEST;
    result = new VideoAdaptiveBitrateLadderResult();
    init(result);
    qualityMap.clear();
    if ((streamingVideoData = tracedata.getStreamingVideoData()) != null && (videoStreamCollection = streamingVideoData.getVideoStreamMap()) != null && MapUtils.isNotEmpty(videoStreamCollection)) {
        selectedManifestCount = streamingVideoData.getSelectedManifestCount();
        hasSelectedManifest = (selectedManifestCount > 0);
        invalidCount = streamingVideoData.getInvalidManifestCount();
        bpResultType = BPResultType.CONFIG_REQUIRED;
        result.setResultExcelText(bpResultType.getDescription());
        if (selectedManifestCount == 0) {
            if (invalidCount == videoStreamCollection.size()) {
                result.setResultText(invalidManifestsFound);
            } else if (invalidCount > 0) {
                result.setResultText(noManifestsSelectedMixed);
            } else {
                result.setResultText(noManifestsSelected);
            }
        } else if (selectedManifestCount > 1) {
            result.setResultText(multipleManifestsSelected);
        } else if (hasSelectedManifest) {
            QualityTime qualityTime;
            double maxTime = 0;
            QualityTime maxSection = null;
            double videoRatio = 1;
            double durationTotal = 0;
            Set<String> resolutions = new TreeSet<>();
            for (VideoStream videoStream : videoStreamCollection.values()) {
                if (videoStream.isSelected() && MapUtils.isNotEmpty(videoStream.getVideoEventMap())) {
                    videoRatio = PERCENTILE_LINE / videoStream.getDuration();
                    for (VideoEvent videoEvent : videoStream.getVideoEventMap().values()) {
                        if (videoEvent.isNormalSegment() && videoEvent.isSelected()) {
                            resolutions.add(String.valueOf(videoEvent.getResolutionHeight()));
                            double duration = videoEvent.getDuration();
                            durationTotal += duration;
                            Integer track = StringParse.stringToDouble(videoEvent.getQuality(), 0).intValue();
                            if ((qualityTime = qualityMap.get(track)) != null) {
                                int count = qualityTime.getCount();
                                qualityTime.setDuration(qualityTime.getDuration() + duration);
                                qualityTime.setPercentage(qualityTime.getDuration() * videoRatio);
                                qualityTime.setBitrateAverage((qualityTime.getBitrateAverage() * count + videoEvent.getBitrate()) / ++count);
                                qualityTime.setCount(count);
                            } else {
                                qualityTime = new QualityTime(videoEvent.getManifest().getVideoName(), 1, track, duration, duration * videoRatio, videoEvent.getResolutionHeight(), videoEvent.getSegmentStartTime(), // bitrateDeclared (kbps)
                                videoEvent.getChildManifest().getBandwidth() / 1000, // bitrateAverage (kbps)
                                videoEvent.getBitrate());
                                qualityMap.put(track, qualityTime);
                            }
                            if (maxTime < qualityTime.getDuration()) {
                                maxTime = qualityTime.getDuration();
                                maxSection = qualityTime;
                            }
                        }
                    }
                }
            }
            bpResultType = BPResultType.SELF_TEST;
            int count = qualityMap.size();
            double maxDuration = 0;
            double percentage = 0;
            int track = 0;
            if (maxSection != null) {
                maxDuration = maxSection.getDuration();
                percentage = maxSection.getPercentage();
                track = maxSection.getTrack();
            }
            result.setResultText(MessageFormat.format(textResults, count == 1 ? "was" : "were", count, count == 1 ? "" : "s", track, String.format("%.2f", maxDuration), String.format("%.2f", percentage), String.format("%.3f", durationTotal)));
            result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), String.join("p, ", resolutions) + "p"));
        } else {
            bpResultType = BPResultType.CONFIG_REQUIRED;
            result.setResultText(novalidManifestsFound);
            result.setResultExcelText(bpResultType.getDescription());
        }
        result.setResults(qualityMap);
    } else {
        // No Data
        result.setResultText(noData);
        bpResultType = BPResultType.NO_DATA;
        result.setResultExcelText(bpResultType.getDescription());
    }
    result.setResultType(bpResultType);
    result.setResults(qualityMap);
    return result;
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) TreeSet(java.util.TreeSet) QualityTime(com.att.aro.core.videoanalysis.pojo.QualityTime) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) VideoAdaptiveBitrateLadderResult(com.att.aro.core.bestpractice.pojo.VideoAdaptiveBitrateLadderResult) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent)

Aggregations

QualityTime (com.att.aro.core.videoanalysis.pojo.QualityTime)3 BPResultType (com.att.aro.core.bestpractice.pojo.BPResultType)1 VideoAdaptiveBitrateLadderResult (com.att.aro.core.bestpractice.pojo.VideoAdaptiveBitrateLadderResult)1 VideoEvent (com.att.aro.core.videoanalysis.pojo.VideoEvent)1 VideoStream (com.att.aro.core.videoanalysis.pojo.VideoStream)1 DataTablePopupMenu (com.att.aro.ui.model.DataTablePopupMenu)1 AdaptiveBitrateTableModel (com.att.aro.ui.model.bestpractice.AdaptiveBitrateTableModel)1 TreeSet (java.util.TreeSet)1 TableModel (javax.swing.table.TableModel)1 TableRowSorter (javax.swing.table.TableRowSorter)1 CategoryPlot (org.jfree.chart.plot.CategoryPlot)1 Range (org.jfree.data.Range)1 DefaultCategoryDataset (org.jfree.data.category.DefaultCategoryDataset)1