@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()]); }
size = ((VideoFormat) inputFormat).getSize(); if ((size == null) && format.matches(outputFormat)) size = ((VideoFormat) outputFormat).getSize(); = new VideoFormat( videoFormat.getEncoding(), size, videoFormat.getFrameRate());
= ((VideoFormat) getCaptureDeviceFormat()).getSize(); Dimension videoFormatSize; = new VideoFormat( videoFormat.getEncoding(), videoFormatSize, videoFormat.getMaxDataLength(), videoFormat.getDataType(), videoFormat.getFrameRate());
/** * Get matching outputs for a specified input <tt>Format</tt>. * * @param inputFormat input <tt>Format</tt> * @return array of matching outputs or null if there are no matching * outputs. */ @Override protected Format[] getMatchingOutputFormats(Format inputFormat) { VideoFormat inputVideoFormat = (VideoFormat) inputFormat; return new Format[] { new AVFrameFormat( inputVideoFormat.getSize(), inputVideoFormat.getFrameRate(), FFmpeg.PIX_FMT_YUV420P) }; }
/** * 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) }; }
/** * Gets the matching output formats for a specific format. * * @param in input format * @return array for formats matching input format */ private Format[] getMatchingOutputFormats(Format in) { VideoFormat videoIn = (VideoFormat) in; return new VideoFormat[] { new VideoFormat( Constants.H263P, videoIn.getSize(), Format.NOT_SPECIFIED, Format.byteArray, videoIn.getFrameRate()) }; }
if (sourceFormat.matches(new Format(VideoFormat.JPEG_RTP))) Dimension size = sourceFormat.getSize(); else if (sourceFormat.matches(new Format(VideoFormat.H263_RTP))) = new VideoFormat( null, new Dimension(width, height), null, Format.NOT_SPECIFIED); return (VideoFormat) result.intersects(sourceFormat);
if (videoFormat.getSize() != null) this.format = format; else = videoFormat.intersects( new VideoFormat(
format.getEncoding(), format.getSize(), format.getMaxDataLength(), format.getDataType(), frameRate, formatParameters),
if (genericVideoFormat.getSize() == null) new VideoFormat(genericVideoFormat.getEncoding()), null, PlugInManager.CODEC); .getSize(); new VideoFormat( null, size,
size = ((VideoFormat) inputFormat).getSize(); if ((size == null) && format.matches(outputFormat)) size = ((VideoFormat) outputFormat).getSize(); videoFormat.getEncoding(), size, videoFormat.getFrameRate(), fmtps);
Dimension size = ((VideoFormat) format).getSize(); new VideoFormat(
Format thisInFormat = getInputFormat(); if ((inFormat != thisInFormat) && !inFormat.equals(thisInFormat)) setInputFormat(inFormat); Dimension inSize = inFormat.getSize(); Dimension outSize = outFormat.getSize(); return BUFFER_PROCESSED_FAILED; Class<?> outDataType = outFormat.getDataType(); Object dst = out.getData();
Class<?> dataType = format.getDataType(); int bitsPerPixel = rgbFormat.getBitsPerPixel(); int pixelStride = rgbFormat.getPixelStride(); format.getFrameRate(), bitsPerPixel, rgbFormat.getRedMask(), size, format.getDataType(), format.getFrameRate(), yuvFormat.getYuvType(),
/** * 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(); }
/** * Determines whether a specific format matches this instance i.e. whether * their attributes match according to the definition of "match" given by * {@link Format#matches(Format)}. * * @param format the <tt>Format</tt> to compare to this instance * @return <tt>true</tt> if the specified <tt>format</tt> matches this one; * otherwise, <tt>false</tt> */ @Override public boolean matches(Format format) { boolean matches; if (super.matches(format)) { if (format instanceof AVFrameFormat) { AVFrameFormat avFrameFormat = (AVFrameFormat) format; matches = ((pixFmt == NOT_SPECIFIED) || (avFrameFormat.pixFmt == NOT_SPECIFIED) || (pixFmt == avFrameFormat.pixFmt)); } else matches = true; } else matches = false; return matches; }
/** * Copies the properties of the specified <tt>Format</tt> into this * instance. * * @param f the <tt>Format</tt> the properties of which are to be copied * into this instance */ @Override protected void copy(Format f) { super.copy(f); if (f instanceof AVFrameFormat) { AVFrameFormat avFrameFormat = (AVFrameFormat) f; pixFmt = avFrameFormat.pixFmt; deviceSystemPixFmt = avFrameFormat.deviceSystemPixFmt; } }
/** * Finds the attributes shared by two matching <tt>Format</tt>s. If the * specified <tt>Format</tt> does not match this one, the result is * undefined. * * @param format the matching <tt>Format</tt> to intersect with this one * @return a <tt>Format</tt> with its attributes set to the attributes * common to this instance and the specified <tt>format</tt> */ @Override public Format intersects(Format format) { Format intersection = super.intersects(format); if (intersection != null) { AVFrameFormat avFrameFormatIntersection = (AVFrameFormat) intersection; avFrameFormatIntersection.pixFmt = ((pixFmt == NOT_SPECIFIED) && (format instanceof AVFrameFormat)) ? ((AVFrameFormat) format).pixFmt : pixFmt; } return intersection; }
/** * Determines whether a specific <tt>Object</tt> represents a value that is * equal to the value represented by this instance. * * @param obj the <tt>Object</tt> to be determined whether it represents a * value that is equal to the value represented by this instance * @return <tt>true</tt> if the specified <tt>obj</tt> represents a value * that is equal to the value represented by this instance; otherwise, * <tt>false</tt> */ @Override public boolean equals(Object obj) { if ((obj instanceof AVFrameFormat) && super.equals(obj)) { AVFrameFormat avFrameFormat = (AVFrameFormat) obj; return (pixFmt == avFrameFormat.pixFmt); } else return false; }
size = ((VideoFormat) inputFormat).getSize(); if ((size == null) && format.matches(outputFormat)) size = ((VideoFormat) outputFormat).getSize(); = new VideoFormat( videoFormat.getEncoding(), size, videoFormat.getFrameRate());