Examples of VideoFormat


Examples of javax.media.format.VideoFormat

  public Format[] getSupportedInputFormats()
  {
    // TODO: we accept anything, really, as long as it is in a byte array
    return new Format[] {
        new AudioFormat(null, -1.0, -1, -1, -1, -1, -1, -1.0, Format.byteArray),
        new VideoFormat(null, null, -1, Format.byteArray, -1.0f)
      };
  }
View Full Code Here

Examples of javax.media.format.VideoFormat

  @Override
  public Format[] getSupportedOutputFormats(Format input)
  {
    if (input == null)
      return supportedOutputFormats;
    final VideoFormat inputCast = (VideoFormat) input;
    final Format[] result = new Format[] {
        new GIFFormat(inputCast.getSize(), -1, Format.byteArray, inputCast.getFrameRate())};
 
    return result;
  }
View Full Code Here

Examples of javax.media.format.VideoFormat

  @Override
  public Format[] getSupportedOutputFormats(Format input)
  {
    if (input == null)
      return supportedOutputFormats;
    final VideoFormat inputCast = (VideoFormat) input;
    final Format[] result = new Format[] {
        new PNGFormat(inputCast.getSize(), -1, Format.byteArray, inputCast.getFrameRate())};
 
    return result;
  }
View Full Code Here

Examples of javax.media.format.VideoFormat

     
    }
    else if (c == VideoFormat.class)
    {
     
      final VideoFormat o = (VideoFormat) f;
      return "new VideoFormat(" +
      CGUtils.toLiteral(o.getEncoding()) +
      ", " + toLiteral(o.getSize()) +
      ", " + o.getMaxDataLength() +
      ", " + dataTypeToStr(o.getDataType()) +
      ", " + CGUtils.toLiteral(o.getFrameRate())
      + ")";

     
    }
    else if (c == Format.class)
    {
 
      final Format o = (Format) f;
      return "new Format(" +
      CGUtils.toLiteral(o.getEncoding()) +
      ", " + dataTypeToStr(o.getDataType())
      + ")";

     
    }
    else if (c == FileTypeDescriptor.class)
    {
      final FileTypeDescriptor o = (FileTypeDescriptor) f;
      return "new FileTypeDescriptor(" +
      CGUtils.toLiteral(o.getEncoding())
      + ")";
    }
    else if (c == ContentDescriptor.class)
    {
      final ContentDescriptor o = (ContentDescriptor) f;
      return "new ContentDescriptor(" +
      CGUtils.toLiteral(o.getEncoding())
      + ")";
    }
    else if (c == com.sun.media.format.WavAudioFormat.class)
    {
      // TODO: are the parameters correct?
      final com.sun.media.format.WavAudioFormat o = (com.sun.media.format.WavAudioFormat) f;
      return "new com.sun.media.format.WavAudioFormat(" +
      CGUtils.toLiteral(o.getEncoding()) +
      ", " + CGUtils.toLiteral(o.getSampleRate()) +
      //", -1" + // int arg TODO - what is this?
      ", " + CGUtils.toLiteral(o.getSampleSizeInBits()) +
      ", " + CGUtils.toLiteral(o.getChannels()) +
      ", " + CGUtils.toLiteral(o.getFrameSizeInBits()) +
      ", " + CGUtils.toLiteral(o.getAverageBytesPerSecond()) +
      ", " + CGUtils.toLiteral(o.getEndian()) +
      ", " + CGUtils.toLiteral(o.getSigned()) +
      ", " + CGUtils.toLiteral((float) o.getFrameRate()) +
      ", " + dataTypeToStr(o.getDataType()) +
      ", " + CGUtils.toLiteral(o.getCodecSpecificHeader())
      + ")";
    }
    else
    throw new IllegalArgumentException("" + f.getClass());
      //System.err.println(f.getClass());
View Full Code Here

Examples of javax.media.format.VideoFormat

  @Override
  public Format[] getSupportedOutputFormats(Format input)
  {
    if (input == null)
      return supportedOutputFormats;
    VideoFormat inputCast = (VideoFormat) input;
    final Format[] result = new Format[] {
        new JPEGFormat(inputCast.getSize(), -1, Format.byteArray, inputCast.getFrameRate(), -1, -1)};

    return result;
  }
View Full Code Here

Examples of javax.media.format.VideoFormat


    @Override
  public Format setInputFormat(Format format)
  {
    final VideoFormat videoFormat = (VideoFormat) format;
    if (videoFormat.getSize() == null)
      return null// must set a size.
//    logger.fine("FORMAT: " + MediaCGUtils.formatToStr(format));
    // TODO: check VideoFormat and compatibility
    bufferToImage = new BufferToImage((VideoFormat) format);
    return super.setInputFormat(format);
View Full Code Here

Examples of javax.media.format.VideoFormat

//  YUVFOrmat
 
  public void testBitMapInfo8()
  {
    {
      BitMapInfo b = new BitMapInfo(new VideoFormat("xyz"));
      assertEquals(b.biBitCount, 24);
      assertEquals(b.biWidth, 320);
      assertEquals(b.biHeight, 240);
      assertEquals(b.biPlanes, 1);
      assertEquals(b.biSizeImage, -1);
View Full Code Here

Examples of javax.media.format.VideoFormat

{

  public void testConstructors()
  {
    {
      final VideoFormat f = new VideoFormat("abc");
      assertEquals(f.getEncoding(), "abc");
      assertEquals(f.getDataType(), byte[].class);
      assertEquals(f.getFrameRate(), -1.f);
      assertEquals(f.getMaxDataLength(), -1L);
      assertEquals(f.getSize(), null);
    }
   
    {
      final VideoFormat f = new VideoFormat("abc", new Dimension(100, 200), 2000, int[].class, 2.f);
      assertEquals(f.getEncoding(), "abc");
      assertEquals(f.getDataType(), int[].class);
      assertEquals(f.getFrameRate(), 2.f);
      assertEquals(f.getMaxDataLength(), 2000);
      assertEquals(f.getSize(), new Dimension(100, 200));
    }
  }
View Full Code Here

Examples of javax.media.format.VideoFormat

 
  public void testFieldDuplication()
  {
    {
      final Dimension d = new Dimension(100, 200);
      final VideoFormat f1 = new VideoFormat("abc", d, 2000, int[].class, 2.f);
      final VideoFormat f2 = (VideoFormat) f1.clone();
     
      assertTrue(f1.getSize().equals(d));
      assertTrue(f1.getSize() != d);
      assertTrue(f1.getSize() != f2.getSize());
      assertTrue(f1.getSize().equals(f2.getSize()));
     
    }
   
    {
      final VideoFormat f1 = new VideoFormat("abc", new Dimension(100, 200), 2000, int[].class, 2.f);
      final VideoFormat f2 = (VideoFormat) f1.relax();
     
      assertTrue(f1.getSize() != f2.getSize());
      assertTrue(f2.getSize() == null);
     
    }
   
    {
      final VideoFormat f1 = new VideoFormat("abc", new Dimension(100, 200), 2000, int[].class, 2.f);
      final VideoFormat f2 = (VideoFormat) f1.intersects(f1);
     
      assertTrue(f1.getSize() == f2.getSize());
      assertTrue(f1.getSize().equals(f2.getSize()));
     
    }
   
    {
      final VideoFormat f1 = new VideoFormat("abc", new Dimension(100, 200), 2000, int[].class, 2.f);
      final VideoFormat f2 = new VideoFormat("abc", new Dimension(100, 201), 2000, int[].class, 2.f);
      final VideoFormat f3 = (VideoFormat) f1.intersects(f2);
     
      assertTrue(f1.getSize() == f3.getSize());
      assertTrue(f1.getSize().equals(f3.getSize()));
     
    }

    {
      final VideoFormat f1 = new VideoFormat("abc", null, 2000, int[].class, 2.f);
      final VideoFormat f2 = new VideoFormat("abc", new Dimension(100, 201), 2000, int[].class, 2.f);
      final VideoFormat f3 = (VideoFormat) f1.intersects(f2);
     
      assertTrue(f3.getSize() == f2.getSize());
     
    }
   
    {
      final Format f1 = new Format("abc");
      final VideoFormat f2 = new VideoFormat("abc", new Dimension(100, 201), 2000, int[].class, 2.f);
      final VideoFormat f3 = (VideoFormat) f1.intersects(f2);
      final VideoFormat f4 = (VideoFormat) f2.intersects(f1);
     
      assertTrue(f3.getSize() != f2.getSize());
      assertTrue(f4.getSize() != f2.getSize());
     
    }
   
   
    {
View Full Code Here

Examples of javax.media.format.VideoFormat

    final Buffer input = (Buffer) o;
   
   
    final Format f = s.getFormat();   // TODO
    if (f.getEncoding().equals(VideoFormat.JPEG_RTP) && f.getClass() == VideoFormat.class)
    {  final VideoFormat vf = (VideoFormat) f;
      final JpegRTPHeader jpegRtpHeader = input.getLength() >= JpegRTPHeader.HEADER_SIZE ? JpegRTPHeader.parse((byte[]) input.getData(), input.getOffset()) : null;
      if (jpegRtpHeader== null)
      {  logger.warning("Expected buffer to be large enough for JPEG RTP Header")// TODO: we could read buffers until we get one big enough.
        fullFormat = f;
      }
      fullFormat = new VideoFormat(vf.getEncoding(), new Dimension(jpegRtpHeader.getWidthInPixels(), jpegRtpHeader.getHeightInPixels()), vf.getMaxDataLength(), vf.getDataType(), vf.getFrameRate());
    }
    else
      fullFormat = f;  // TODO: others
   
    logger.info("Full format: " + fullFormat);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.