/** * Return a JMF AudioFormat for a given Jingle Payload type. * Return null if the payload is not supported by this jmf API. * * @param payloadtype payloadtype * @return correspondent audioType */ public static AudioFormat getAudioFormat(PayloadType payloadtype) { switch (payloadtype.getId()) { case 0: return new AudioFormat(AudioFormat.ULAW_RTP); case 3: return new AudioFormat(AudioFormat.GSM_RTP); case 4: return new AudioFormat(AudioFormat.G723_RTP); default: return null; } }
/** * 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; }
/** * Initializes a new <tt>JNIEncoder</tt> instance. */ public DePacketizer() { super("VP8 RTP DePacketizer", VideoFormat.class, new VideoFormat[]{ new VideoFormat(Constants.VP8) }); inputFormats = new VideoFormat[] { new VideoFormat(Constants.VP8_RTP) }; }
@Override protected Format[] getMatchingOutputFormats(Format in) { AudioFormat af = (AudioFormat) in; supportedOutputFormats = new AudioFormat[] { new AudioFormat(AudioFormat.LINEAR, af.getSampleRate(), 16, af.getChannels(), AudioFormat.LITTLE_ENDIAN, // isBigEndian(), AudioFormat.SIGNED // isSigned()); ) }; return supportedOutputFormats; }
/** * Gets the clock rate associated with this <tt>MediaFormat</tt>. * * @return the clock rate associated with this <tt>MediaFormat</tt> * @see MediaFormat#getClockRate() */ public double getClockRate() { return format.getSampleRate(); }
/** * Init the converter to the new format * @param inFormat AudioFormat */ private void initConverter(AudioFormat inFormat) { lastFormat = inFormat; inputSampleSize = inFormat.getSampleSizeInBits(); bigEndian = inFormat.getEndian()==AudioFormat.BIG_ENDIAN; }
/** * Gets the frame rate associated with this <tt>MediaFormat</tt>. * * @return the frame rate associated with this <tt>MediaFormat</tt> * @see VideoMediaFormat#getFrameRate() */ public float getFrameRate() { return format.getFrameRate(); }
localhost = InetAddress.getLocalHost(); AudioChannel audioChannel0 = new AudioChannel(new MediaLocator("javasound://8000"), localhost.getHostAddress(), localhost.getHostAddress(), 7002, 7020, new AudioFormat(AudioFormat.GSM_RTP), null); AudioChannel audioChannel1 = new AudioChannel(new MediaLocator("javasound://8000"), localhost.getHostAddress(), localhost.getHostAddress(), 7020, 7002, new AudioFormat(AudioFormat.GSM_RTP), null);
/** * Initializes a new <tt>VPXDecoder</tt> instance. */ public VPXDecoder() { super("VP8 VPX Decoder", VideoFormat.class, SUPPORTED_OUTPUT_FORMATS); inputFormat = null; outputFormat = null; inputFormats = new VideoFormat[] { new VideoFormat(Constants.VP8) }; }
/** * 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; }
try { AudioFormat af = new AudioFormat(AudioFormat.LINEAR, 44100, 16, 2); rend.setInputFormat(af);
/** * Initializes a new <tt>JNIDecoder</tt> instance which is to decode H.263+ * encoded data into frames in YUV format. */ public JNIDecoder() { inputFormats = new VideoFormat[] { new VideoFormat(Constants.H263P) }; outputFormats = DEFAULT_OUTPUT_FORMATS; }
@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()]); }
/** * Creates DePacketizer */ public DePacketizer() { inputFormats = new Format[]{new AudioFormat(Constants.ALAW_RTP)}; }
/** * Initializes a new <tt>Packetizer</tt> instance. */ public Packetizer() { super( "VP8 Packetizer", VideoFormat.class, new VideoFormat[] { new VideoFormat(Constants.VP8_RTP) }); inputFormats = new VideoFormat[] { new VideoFormat(Constants.VP8)}; }
/** * Gets the size of the image that this <tt>VideoMediaFormat</tt> describes. * * @return a {@link Dimension} instance indicating the image size (in * pixels) of this <tt>VideoMediaFormat</tt> * @see VideoMediaFormat#getSize() */ public Dimension getSize() { return format.getSize(); }
public JavaDecoder() { supportedInputFormats = new AudioFormat[] { new AudioFormat(AudioFormat.ULAW) }; defaultOutputFormats = new AudioFormat[] { new AudioFormat(AudioFormat.LINEAR) }; PLUGIN_NAME = "Mu-Law Decoder"; }
/** * Initializes a new <tt>Packetizer</tt> instance which is to packetize * H.263+ encoded data into RTP packets in accord with * RFC 4529 "RTP Payload Format for ITU-T Rec. H.263 Video". */ public Packetizer() { inputFormats = new Format[] { new VideoFormat(Constants.H263P) }; inputFormat = null; outputFormat = null; }
/** * Initializes a new <tt>AudioMediaFormatImpl</tt> instance with the * specified encoding and a single audio channel. * * @param encoding the encoding of the new <tt>AudioMediaFormatImpl</tt> * instance */ public AudioMediaFormatImpl(String encoding) { this(new AudioFormat(encoding)); }
/** * Initializes a new <tt>DePacketizer</tt> instance which is to depacketize * H.263+ RTP packet. */ public DePacketizer() { super( "H263+ DePacketizer", VideoFormat.class, new VideoFormat[] { new VideoFormat(Constants.H263P) }); inputFormats = new VideoFormat[] { new VideoFormat(Constants.H263P_RTP) }; }