Search in sources :

Example 1 with EncoderStream

use of us.mn.state.dot.tms.EncoderStream in project iris by mnit-rtmc.

the class EncoderStreamModel method createColumns.

/**
 * Create the columns in the model
 */
@Override
protected ArrayList<ProxyColumn<EncoderStream>> createColumns() {
    ArrayList<ProxyColumn<EncoderStream>> cols = new ArrayList<ProxyColumn<EncoderStream>>(8);
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.view.num", 80, Integer.class) {

        public Object getValueAt(EncoderStream es) {
            return es.getViewNum();
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "viewNum");
        }

        public void setValueAt(EncoderStream es, Object value) {
            Integer view = (value instanceof Integer) ? (Integer) value : null;
            es.setViewNum(view);
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.flow", 90, Boolean.class) {

        public Object getValueAt(EncoderStream es) {
            return es.getFlowStream();
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "flowStream");
        }

        public void setValueAt(EncoderStream es, Object value) {
            if (value instanceof Boolean)
                es.setFlowStream((Boolean) value);
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.encoding", 90) {

        public Object getValueAt(EncoderStream es) {
            return Encoding.fromOrdinal(es.getEncoding());
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "encoding");
        }

        public void setValueAt(EncoderStream es, Object value) {
            if (value instanceof Encoding) {
                Encoding e = (Encoding) value;
                es.setEncoding(e.ordinal());
            }
        }

        protected TableCellEditor createCellEditor() {
            return new DefaultCellEditor(new JComboBox<Encoding>(Encoding.values()));
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.quality", 80) {

        public Object getValueAt(EncoderStream es) {
            return EncodingQuality.fromOrdinal(es.getQuality());
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "quality");
        }

        public void setValueAt(EncoderStream es, Object value) {
            if (value instanceof EncodingQuality) {
                EncodingQuality q = (EncodingQuality) value;
                es.setQuality(q.ordinal());
            }
        }

        protected TableCellEditor createCellEditor() {
            return new DefaultCellEditor(new JComboBox<EncodingQuality>(EncodingQuality.values()));
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.uri.scheme", 100) {

        public Object getValueAt(EncoderStream es) {
            return es.getUriScheme();
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "uriScheme");
        }

        public void setValueAt(EncoderStream es, Object value) {
            String s = value.toString().trim();
            es.setUriScheme((s.length() > 0) ? s : null);
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.uri.path", 240) {

        public Object getValueAt(EncoderStream es) {
            return es.getUriPath();
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "uriPath");
        }

        public void setValueAt(EncoderStream es, Object value) {
            String p = value.toString().trim();
            es.setUriPath((p.length() > 0) ? p : null);
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.mcast.port", 100, Integer.class) {

        public Object getValueAt(EncoderStream es) {
            return es.getMcastPort();
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "mcastPort");
        }

        public void setValueAt(EncoderStream es, Object value) {
            Integer port = (value instanceof Integer) ? (Integer) value : null;
            es.setMcastPort(port);
        }
    });
    cols.add(new ProxyColumn<EncoderStream>("encoder.stream.latency", 100, Integer.class) {

        public Object getValueAt(EncoderStream es) {
            return es.getLatency();
        }

        public boolean isEditable(EncoderStream es) {
            return canWrite(es, "latency");
        }

        public void setValueAt(EncoderStream es, Object value) {
            if (value instanceof Integer)
                es.setLatency((Integer) value);
        }
    });
    return cols;
}
Also used : JComboBox(javax.swing.JComboBox) ArrayList(java.util.ArrayList) Encoding(us.mn.state.dot.tms.Encoding) EncodingQuality(us.mn.state.dot.tms.EncodingQuality) DefaultCellEditor(javax.swing.DefaultCellEditor) TableCellEditor(javax.swing.table.TableCellEditor) EncoderStream(us.mn.state.dot.tms.EncoderStream) ProxyColumn(us.mn.state.dot.tms.client.proxy.ProxyColumn)

Example 2 with EncoderStream

use of us.mn.state.dot.tms.EncoderStream in project iris by mnit-rtmc.

the class SwitchProp method formatReq.

/**
 * Format a switch request
 */
private String formatReq() {
    EncoderStream es = getEncoderStream();
    StringBuilder sb = new StringBuilder();
    sb.append("play");
    sb.append(UNIT_SEP);
    sb.append(pin - 1);
    sb.append(UNIT_SEP);
    sb.append(getCamNum());
    sb.append(UNIT_SEP);
    sb.append(getUri());
    sb.append(UNIT_SEP);
    sb.append(getEncoding(es));
    sb.append(UNIT_SEP);
    sb.append(getDescription());
    sb.append(UNIT_SEP);
    sb.append(getLatency(es));
    sb.append(RECORD_SEP);
    return sb.toString();
}
Also used : EncoderStream(us.mn.state.dot.tms.EncoderStream)

Example 3 with EncoderStream

use of us.mn.state.dot.tms.EncoderStream in project iris by mnit-rtmc.

the class VideoRequest method getEncoding.

/**
 * Get the encoding for a camera
 */
private Encoding getEncoding(Camera c) {
    EncoderStream es = CameraHelper.getStream(c);
    Encoding enc = getEncoding(es);
    if (usingServletProxy() && (enc != Encoding.UNKNOWN))
        return Encoding.MJPEG;
    else
        return enc;
}
Also used : Encoding(us.mn.state.dot.tms.Encoding) EncoderStream(us.mn.state.dot.tms.EncoderStream)

Example 4 with EncoderStream

use of us.mn.state.dot.tms.EncoderStream in project iris by mnit-rtmc.

the class FlowStreamImpl method getSinkPort.

/**
 * Get the sink port
 */
public String getSinkPort() {
    Integer p = getPort();
    if (p != null)
        return p.toString();
    EncodingQuality eq = getEncodingQuality();
    EncoderStream es = CameraHelper.getStream(camera, eq, true);
    if (es != null) {
        p = es.getMcastPort();
        if (p != null)
            return p.toString();
    }
    return "";
}
Also used : EncodingQuality(us.mn.state.dot.tms.EncodingQuality) EncoderStream(us.mn.state.dot.tms.EncoderStream)

Aggregations

EncoderStream (us.mn.state.dot.tms.EncoderStream)4 Encoding (us.mn.state.dot.tms.Encoding)2 EncodingQuality (us.mn.state.dot.tms.EncodingQuality)2 ArrayList (java.util.ArrayList)1 DefaultCellEditor (javax.swing.DefaultCellEditor)1 JComboBox (javax.swing.JComboBox)1 TableCellEditor (javax.swing.table.TableCellEditor)1 ProxyColumn (us.mn.state.dot.tms.client.proxy.ProxyColumn)1