/** * Get the best stanza size for a given codec and a codec rate * * @param codecFormat * @param milliseconds * @return the best stanza size * @throws IllegalArgumentException */ private int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException { String encoding = codecFormat.getEncoding(); if (encoding.equalsIgnoreCase(AudioFormat.GSM) || encoding.equalsIgnoreCase(AudioFormat.GSM_RTP)) { return milliseconds * 4; // 1 byte per millisec } else if (encoding.equalsIgnoreCase(AudioFormat.ULAW) || encoding.equalsIgnoreCase(AudioFormat.ULAW_RTP)) { return milliseconds * 8; } else { throw new IllegalArgumentException("Unknown codec type"); } }
@Override public Dimension[] getResolutions() { if (dimensions == null) { dimensions = new ArrayList<Dimension>(); Format[] formats = cdi.getFormats(); for (Format format : formats) { if ("RGB".equalsIgnoreCase(format.getEncoding())) { dimensions.add(((VideoFormat) format).getSize()); } } Collections.sort(dimensions, new Comparator<Dimension>() { @Override public int compare(Dimension a, Dimension b) { int apx = a.width * a.height; int bpx = b.width * b.height; if (apx > bpx) { return 1; } else if (apx < bpx) { return -1; } else { return 0; } } }); } return dimensions.toArray(new Dimension[dimensions.size()]); }
/** * Get video format for size. * * @param device device to get format from * @param size specific size to search * @return VideoFormat */ private VideoFormat getSizedVideoFormat(Dimension size) { Format[] formats = device.getFormats(); VideoFormat format = null; for (Format f : formats) { if (!"RGB".equalsIgnoreCase(f.getEncoding()) || !(f instanceof VideoFormat)) { continue; } Dimension d = ((VideoFormat) f).getSize(); if (d.width == size.width && d.height == size.height) { format = (VideoFormat) f; break; } } return format; }
/** * Get suitable video format to use (the largest one by default, but this * can be easily changed). * * @param device device to get video format for * @return Suitable video format */ private VideoFormat getLargestVideoFormat() { Format[] formats = device.getFormats(); VideoFormat format = null; int area = 0; // find the largest picture format for (Format f : formats) { if (!(f instanceof VideoFormat) || !"RGB".equalsIgnoreCase(f.getEncoding())) { continue; } VideoFormat vf = (VideoFormat) f; Dimension dim = vf.getSize(); int a = dim.width * dim.height; if (a > area) { area = a; format = vf; } } return format; }
if (tracks[i].getFormat().getEncoding().equals(AudioFormat.ULAW_RTP)) { Codec[] codec = new Codec[3];
/** * Gets the encoding of the JMF <tt>Format</tt> represented by this * instance as it is known to JMF (in contrast to its RFC name). * * @return the encoding of the JMF <tt>Format</tt> represented by this * instance as it is known to JMF (in contrast to its RFC name) */ public String getJMFEncoding() { return format.getEncoding(); }
/** * {@inheritDoc} */ @Override public Format setInputFormat(Format format, int trackID) { if ( !(format instanceof AudioFormat)) return null; if ( !AudioFormat.LINEAR.equals(format.getEncoding())) return null; return inputs[0] = format; }
/** * Check <tt>Format</tt>. * * @param format <tt>Format</tt> to check * @return true if <tt>Format</tt> is H263P_RTP */ public boolean checkFormat(Format format) { return format.getEncoding().equals(Constants.H263P_RTP); }
/** * Check <tt>Format</tt>. * * @param format <tt>Format</tt> to check * @return true if <tt>Format</tt> is H264_RTP */ public boolean checkFormat(Format format) { return format.getEncoding().equals(Constants.H264_RTP); }
/** * Get the best packet size for a given codec and a codec rate * * @param codecFormat * @param milliseconds * @return the best packet size * @throws IllegalArgumentException */ private int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException { String encoding = codecFormat.getEncoding(); if (encoding.equalsIgnoreCase(AudioFormat.GSM) || encoding.equalsIgnoreCase(AudioFormat.GSM_RTP)) { return milliseconds * 4; // 1 byte per millisec } else if (encoding.equalsIgnoreCase(AudioFormat.ULAW) || encoding.equalsIgnoreCase(AudioFormat.ULAW_RTP)) { return milliseconds * 8; } else { throw new IllegalArgumentException("Unknown codec type"); } }
/** * Get the best packet size for a given codec and a codec rate * * @param codecFormat * @param milliseconds * @return * @throws IllegalArgumentException */ private int getPacketSize(Format codecFormat, int milliseconds) throws IllegalArgumentException { String encoding = codecFormat.getEncoding(); if (encoding.equalsIgnoreCase(AudioFormat.GSM) || encoding.equalsIgnoreCase(AudioFormat.GSM_RTP)) { return milliseconds * 4; // 1 byte per millisec } else if (encoding.equalsIgnoreCase(AudioFormat.ULAW) || encoding.equalsIgnoreCase(AudioFormat.ULAW_RTP)) { return milliseconds * 8; } else { throw new IllegalArgumentException("Unknown codec type"); } }
/** * {@inheritDoc} * * Additionally, determines whether this <tt>JNIEncoder</tt> is to perform * RTP packetization. */ @Override public Format setOutputFormat(Format format) { format = super.setOutputFormat(format); if (format != null) { String encoding = format.getEncoding(); packetize = ((encoding != null) && encoding.endsWith(Constants._RTP)); } return format; } }
/** * {@inheritDoc} * * Additionally, determines whether this <tt>JNIDecoder</tt> is to perform * RTP depacketization. */ @Override public Format setInputFormat(Format format) { format = super.setInputFormat(format); if (format != null) { String encoding = format.getEncoding(); depacketize = ((encoding != null) && encoding.endsWith(Constants._RTP)); } return format; } }
byte rtpPayloadType = getRTPPayloadType(format.getEncoding(), clockRate);
if ("h263-1998/rtp".equalsIgnoreCase(format.getEncoding()))
&& "h264/rtp".equalsIgnoreCase(format.getEncoding()))
if (tracks[i].getFormat().getEncoding().equals(AudioFormat.ULAW_RTP)) { Codec codec[] = new Codec[3];
SilenceEffect silenceEffect; if (Constants.OPUS_RTP.equals(desc.format.getEncoding()))
if (tracks[i].getFormat().getEncoding().equals(AudioFormat.ULAW_RTP)) { Codec codec[] = new Codec[3];