Package javax.media.format

Examples of javax.media.format.JPEGFormat


        VideoFormat outputFormat = (VideoFormat)output.getFormat();
       
        if(outputFormat==null) {
          int width = inputFormat.getSize().width;
          int height = inputFormat.getSize().height;
          outputFormat = new JPEGFormat(
              new Dimension(width,height),
              width*height+200, //surely this is the max size, right?
              Format.byteArray,
              inputFormat.getFrameRate(),
              -1// TODO: specify quality
View Full Code Here


  }
 
  public void testVideo() throws ParseException
  {
    test(new JPEGFormat());
    test(new GIFFormat());
    test(new PNGFormat());
    test(new GIFFormat(new Dimension(640, 480), -1, Format.byteArray, -1.f));
   
//        test(new VideoFormat(VideoFormat.JPEG_RTP));
View Full Code Here

public class JPEGFormatTest extends TestCase
{
  public void testConstructors()
  {
    {
      final JPEGFormat f1 = new JPEGFormat();
      assertEquals(f1.getDataType(), byte[].class);
      assertEquals(f1.getFrameRate(), -1.f);
      assertEquals(f1.getMaxDataLength(), -1);
      assertEquals(f1.getSize(), null);
      assertEquals(f1.getQFactor(), -1);
      assertEquals(f1.getDecimation(), -1);
    }
   
   
    {
      final Dimension d = new Dimension(1, 2);
      final JPEGFormat f1 = new JPEGFormat(d, 1, int[].class, 2.f, 3, 4);
      assertEquals(f1.getDataType(), int[].class);
      assertEquals(f1.getFrameRate(), 2.f);
      assertEquals(f1.getMaxDataLength(), 1);
      assertEquals(f1.getSize(), new Dimension(1, 2));
      assertTrue(f1.getSize() != d);
      assertEquals(f1.getQFactor(), 3);
      assertEquals(f1.getDecimation(), 4);
    }
  }
View Full Code Here

   
    final IndexedColorFormat indexedColorFormat = new IndexedColorFormat(new java.awt.Dimension(0, 0), 0, null, 0.f, 0, 0, null, null, null);
    assertEquals(indexedColorFormat.getEncoding(), "irgb")
    assertEquals(indexedColorFormat.getDataType(), null);
   
    assertEquals(new JPEGFormat().getEncoding(), "jpeg")
    assertEquals(new JPEGFormat().getDecimation(), Format.NOT_SPECIFIED)
    assertEquals(new JPEGFormat().getQFactor(), Format.NOT_SPECIFIED)
    assertEquals(new JPEGFormat().getDataType(), Format.byteArray);
     
    assertEquals(new RGBFormat().getEncoding(), "rgb");
    assertEquals(new RGBFormat().getDataType(), null);

    assertEquals(new YUVFormat().getEncoding(), "yuv");
View Full Code Here

        "aced00057372001c6a617661782e6d656469612e666f726d61742e524742466f726d617444aa03c57c62554902000849000c62697473506572506978656c490008626c75654d61736b490006656e6469616e490007666c6970706564490009677265656e4d61736b49000a6c696e6553747269646549000b706978656c5374726964654900077265644d61736b7872001e6a617661782e6d656469612e666f726d61742e566964656f466f726d617431e50c6e211506de0200034600096672616d655261746549000d6d6178446174614c656e6774684c000473697a657400144c6a6176612f6177742f44696d656e73696f6e3b787200126a617661782e6d656469612e466f726d61744de4dddeaaf25de70200044a000c656e636f64696e67436f64654c0003636c7a7400114c6a6176612f6c616e672f436c6173733b4c0008646174615479706571007e00044c0008656e636f64696e677400124c6a6176612f6c616e672f537472696e673b787000000000000000007671007e000070740003726762bf800000ffffffff70ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
       
    );
   
    test(
        new JPEGFormat(),
        "aced00057372001d6a617661782e6d656469612e666f726d61742e4a504547466f726d61745250b9677e8361d102000249000a646563696d6174696f6e49000771466163746f727872001e6a617661782e6d656469612e666f726d61742e566964656f466f726d617431e50c6e211506de0200034600096672616d655261746549000d6d6178446174614c656e6774684c000473697a657400144c6a6176612f6177742f44696d656e73696f6e3b787200126a617661782e6d656469612e466f726d61744de4dddeaaf25de70200044a000c656e636f64696e67436f64654c0003636c7a7400114c6a6176612f6c616e672f436c6173733b4c0008646174615479706571007e00044c0008656e636f64696e677400124c6a6176612f6c616e672f537472696e673b787000000000000000007671007e0000767200025b42acf317f8060854e002000078707400046a706567bf800000ffffffff70ffffffffffffffff"
       
    );
   
    test(
View Full Code Here

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

     
    }
    else if (c == IndexedColorFormat.class)
    {
 

      final IndexedColorFormat o = (IndexedColorFormat) f;
      return "new IndexedColorFormat(" +
      toLiteral(o.getSize()) +
      ", " + o.getMaxDataLength() +
      ", " + dataTypeToStr(o.getDataType()) +
      ", " + CGUtils.toLiteral(o.getFrameRate()) +
      ", " + o.getLineStride() // TODO: use constants
      ", " + o.getMapSize() +
      ", " + CGUtils.toLiteral(o.getRedValues()) +
      ", " + CGUtils.toLiteral(o.getGreenValues()) +
      ", " + CGUtils.toLiteral(o.getBlueValues())
      + ")";

     
    }
    else if (c == H263Format.class)
    {

      final H263Format o = (H263Format) f;
      return "new H263Format(" +
      toLiteral(o.getSize()) +
      ", " + o.getMaxDataLength() +
      ", " + dataTypeToStr(o.getDataType()) +
      ", " + CGUtils.toLiteral(o.getFrameRate()) +
      ", " + o.getAdvancedPrediction()
      ", " + o.getArithmeticCoding() +
      ", " + o.getErrorCompensation() +
      ", " + o.getHrDB() +
      ", " + o.getPBFrames() +
      ", " + o.getUnrestrictedVector()
      + ")";

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

     
    }
    else if (c == AudioFormat.class)
    {
      final AudioFormat o = (AudioFormat) f;
      return "new AudioFormat(" +
      CGUtils.toLiteral(o.getEncoding()) +
      ", " + CGUtils.toLiteral(o.getSampleRate()) +
      ", " + CGUtils.toLiteral(o.getSampleSizeInBits()) +
      ", " + CGUtils.toLiteral(o.getChannels()) +
      ", " + CGUtils.toLiteral(o.getEndian()) +
      ", " + CGUtils.toLiteral(o.getSigned()) +
      ", " + CGUtils.toLiteral(o.getFrameSizeInBits()) +
      ", " + CGUtils.toLiteral(o.getFrameRate()) +
      ", " + dataTypeToStr(o.getDataType())
      + ")";

     
    }
    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

  }
 
  public void testBitMapInfo6()
  {
    {
      BitMapInfo b = new BitMapInfo(new JPEGFormat());
      assertEquals(b.biBitCount, 24);
      assertEquals(b.biWidth, 320);
      assertEquals(b.biHeight, 240);
      assertEquals(b.biPlanes, 1);
      assertEquals(b.biSizeImage, -1);
View Full Code Here

        if (input == null)
            return supportedOutputFormats;
        VideoFormat inputCast = (VideoFormat) input;
        final Dimension HARD_CODED_SIZE = new java.awt.Dimension(320, 240);
        final Format[] result = new Format[]{
                new JPEGFormat(inputCast.getSize() != null ? inputCast.getSize() : HARD_CODED_SIZE, -1, Format.byteArray, -1.0f, -1, -1)};

        if (baselineCodec != null) {
            final Format[] baselineResult = baselineCodec.getSupportedOutputFormats(input);
            System.out.println("input:  " + LoggingStringUtils.formatToStr(input));
            for (int i = 0; i < baselineResult.length; ++i)
View Full Code Here

    else if (f instanceof VideoFormat)
    {
      final VideoFormat vf = (VideoFormat) f;
      if (f.getClass() == JPEGFormat.class)
      {
        final JPEGFormat jf = (JPEGFormat) vf;
        list.add(dimensionToStr(jf.getSize()));
        list.add(intToStr(jf.getMaxDataLength()));
        if (jf.getDataType() != null && jf.getDataType() != Format.byteArray)
          list.add(dataTypeToStr(jf.getDataType()));
        list.add(floatToStr(jf.getFrameRate()));
        // TODO: Q, decimation
       
      }
      else if (f.getClass() == GIFFormat.class)
      {
View Full Code Here

          dataType = Format.byteArray;  // default
              final float frameRate = t.nextFloat();
              final int q = Format.NOT_SPECIFIED; // TODO
              final int dec = Format.NOT_SPECIFIED; // TODO
             
        return new JPEGFormat(size, maxDataLength, dataType, frameRate, q, dec);
      }
      else if (formatClass == GIFFormat.class)
      {
        final java.awt.Dimension size = t.nextDimension();
              final int maxDataLength = t.nextInt();
View Full Code Here

TOP

Related Classes of javax.media.format.JPEGFormat

Copyright © 2018 www.massapicom. 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.