Package javax.media.format

Examples of javax.media.format.VideoFormat


        addFormat(new AudioFormat(AudioFormat.MPEG_RTP), 14);
        addFormat(new AudioFormat(AudioFormat.G728_RTP, 8000.0, Format.NOT_SPECIFIED, 1), 15);
        addFormat(new AudioFormat(AudioFormat.DVI_RTP, 11025, 4, 1), 16);
        addFormat(new AudioFormat(AudioFormat.DVI_RTP, 22050, 4, 1), 17);
    addFormat(new AudioFormat(AudioFormat.G729_RTP, 8000.0, Format.NOT_SPECIFIED, 1), 18);
        addFormat(new VideoFormat(VideoFormat.JPEG_RTP), 26);
        addFormat(new VideoFormat(VideoFormat.H261_RTP), 31);
        addFormat(new VideoFormat(VideoFormat.MPEG_RTP), 32);
        addFormat(new VideoFormat(VideoFormat.H263_RTP), 34);

        addFormat(new VideoFormat(VideoFormat.H263_1998_RTP), 42);
    }
View Full Code Here


        if ( format.getEncoding().equalsIgnoreCase(VideoFormat.JPEG_RTP) )
        {
            int width = data[offset + 6] << 3;
            int height = data[offset + 7] << 3;
           
            return new VideoFormat(VideoFormat.JPEG_RTP, new Dimension(width, height), -1, format.getDataType(), -1);
        }
        return format;
    }
View Full Code Here

    Format[] f = m.getSupportedInputFormats();
    assertEquals(f.length, 2);
   
    assertEquals(f.length, 2);
    assertEquals(f[0], new AudioFormat(null, -1.0, -1, -1, -1, -1, -1, -1.0, Format.byteArray));
    assertEquals(f[1], new VideoFormat(null, null, -1, Format.byteArray, -1.0f));

    {
      Format f1 = new AudioFormat(AudioFormat.ULAW_RTP, -1.0, -1, -1, -1, -1, -1, -1.0, Format.byteArray);
      for (int i = 0; i < 100; ++i)
      {
View Full Code Here

 
  public void testVideoCodec3()
  {
    MyVideoCodec c = new MyVideoCodec();
    Buffer b = new Buffer();
    VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
    c.doUpdateOutput(b, f, 3333, 44);
    assertTrue(b.getFormat() == f);
    assertTrue(b.getLength() == 3333);
    assertTrue(b.getOffset() == 44);
    assertFalse(b.isDiscard());
View Full Code Here

    c.setDefaultOutputFormats(new VideoFormat[]{
        new RGBFormat(new java.awt.Dimension(320, 200), 64000, Format.intArray, 1.3414634f, 32, 0xff, 0xff00, 0xff0000, 1, 320, 0, -1)
    });
    {
      VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
      //assertEquals(c.checkFormat(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f)), true);
      VideoFormat[] fs = new VideoFormat[] {f};
      c.setSupportedInputFormats(fs);
      assertTrue(c.getSupportedInputFormats() == fs);
    }
   
    // only works once setSupportedInputFormats is called
    Format[] r = c.getSupportedOutputFormats(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f));
    assertFalse(r == null);
    assertEquals(r.length, 1);
    assertTrue(c.accessSupportedOutputFormats().length == 1);
   
   
    {
      VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
      VideoFormat result = (VideoFormat) c.setInputFormat(f)// this calls matches
      assertTrue(f == result);
     
     
    }
   
View Full Code Here

    c.setPlugInName("abc");
    assertEquals(c.getName(), "abc");
   

    {
      VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
      //assertEquals(c.checkFormat(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f)), true);
      VideoFormat[] fs = new VideoFormat[] {f};
      c.setSupportedInputFormats(fs);
      assertTrue(c.getSupportedInputFormats() == fs);
    }
   
    // only works once setSupportedInputFormats is called
    c.getSupportedOutputFormats(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f));

 
    {
      Format f = new Format("xyz");
      VideoFormat result = (VideoFormat) c.setInputFormat(f)// this calls matches
      assertTrue(null == result);
     
    }
   
    {
      VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
      VideoFormat result = (VideoFormat) c.setInputFormat(f)// this calls matches
      assertTrue(f == result);
     
     
    }
    assertTrue(c.accessSupportedOutputFormats() == null);
   
    {
      VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), -1, null, 2.f);
      VideoFormat result = (VideoFormat) c.setInputFormat(f)// this calls matches
      assertTrue(f == result);
     
     
    }
   
    {
      VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, int[].class, 2.f);
      VideoFormat result = (VideoFormat) c.setInputFormat(f)// this calls matches
      assertTrue(null == result);
     
    }
   
    c.getSupportedOutputFormats(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f));

    // TODO: need to set default output formats?
    {
      VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
      VideoFormat result = (VideoFormat) c.setOutputFormat(f)
      assertTrue(null == result);
     
    }
   
    c.getSupportedOutputFormats(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f));
   
    {
      VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
      //assertEquals(c.checkFormat(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f)), true);
      VideoFormat[] fs = new VideoFormat[] {f};
      c.setSupportedOutputFormats(fs);
      assertFalse(c.getSupportedOutputFormats(f) == fs);
     
      assertEquals(c.accessMatchingOutputFormats(f).length, 0);
     
    }
   
    {
      VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
      VideoFormat result = (VideoFormat) c.setOutputFormat(f)
      assertTrue(null == result);
     
    }
   
    {
      VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
      VideoFormat[] fs = new VideoFormat[] {f};
      c.setDefaultOutputFormats(fs);
      assertTrue(c.accessDefaultOutputFormats() == fs);
     
     
    }
   
    assertTrue(c.accessDefaultOutputFormats() != null);
    assertTrue(c.accessSupportedInputFormats() != null);
    assertTrue(c.accessSupportedOutputFormats() != null);
    assertTrue(c.accessInputFormat() != null);
    assertTrue(c.accessOutputFormat() == null);
    {
      VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
      VideoFormat result = (VideoFormat) c.setOutputFormat(f)
      assertTrue(null == result);
      assertTrue(c.accessOutputFormat() == null);
   
      c.forceSetOutputFormat(f);
      assertTrue(c.accessOutputFormat() == f);
      assertTrue(c.checkFormat(new VideoFormat("ayz", new Dimension(1, 2), 2000, null, 3.f)));
      //assertTrue(c.checkFormat(new VideoFormat("ayz", null, 2000, int[].class, 3.f))); // NPE
      //assertTrue(c.checkFormat(new Format("ayz"))); // class cast except
     
     
      assertTrue(c.checkFormat(f));
      {
        VideoFormat f2 = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
        assertTrue(c.checkFormat(f2));
      }
      {
        VideoFormat f2 = new VideoFormat("xyc", new Dimension(1, 2), 1000, byte[].class, 2.f);
        assertTrue(c.checkFormat(f2));
      }
//      {
//        VideoFormat f2 = new VideoFormat("xyc", new Dimension(1, 3), 1000, byte[].class, 2.f);
//        assertTrue(c.checkFormat(f2)); // calls videoResized
//      }   
      assertTrue(c.accessOutputFormat() == f);
    }
   
    if (false)
    {
      TracingVideoCodec c2 = new TracingVideoCodec();
     
      {
        VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
        //assertEquals(c.checkFormat(new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f)), true);
        VideoFormat[] fs = new VideoFormat[] {f};
        c2.setSupportedInputFormats(fs);
        assertTrue(c2.getSupportedInputFormats() == fs);
      }
     
      System.out.println("-->");
      VideoFormat f = new VideoFormat("xyz", new Dimension(1, 2), 1000, byte[].class, 2.f);
      c2.getSupportedOutputFormats(f);
     
      System.out.println("-->");
      c2.setInputFormat(f);
      System.out.println("-->");
View Full Code Here

   
   
    Format[] f = m.getSupportedInputFormats();
    assertEquals(f.length, 2);
    assertEquals(f[0], new AudioFormat(null, -1.0, -1, -1, -1, -1, -1, -1.0, Format.byteArray));
    assertEquals(f[1], new VideoFormat(null, null, -1, Format.byteArray, -1.0f));

    ContentDescriptor[] d2 = m.getSupportedOutputContentDescriptors(f);
    assertEquals(d2.length, 1);
    assertEquals(d2[0], new ContentDescriptor("raw"));
   
View Full Code Here

 
  //@Override
  @Override
  public Format setInputFormat(Format format)
  {
    VideoFormat chosenFormat = (VideoFormat) super.setInputFormat(format);
    if (chosenFormat != null)
    {
      getComponent().setPreferredSize(chosenFormat.getSize());
    }
    return chosenFormat;
  }
View Full Code Here

    @Override
    public Dimension getPreferredSize() {
      if (inputFormat == null) {
        return super.getPreferredSize();
      }
      VideoFormat videoFormat = (VideoFormat) inputFormat;
      return videoFormat.getSize();
    }
View Full Code Here

    @Override
    public Dimension getPreferredSize() {
      if (inputFormat == null) {
        return super.getPreferredSize();
      }
      VideoFormat videoFormat = (VideoFormat) inputFormat;
      return videoFormat.getSize();
    }
View Full Code Here

TOP

Related Classes of javax.media.format.VideoFormat

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.