Package javax.media

Examples of javax.media.Format


      return;
    }
    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;
View Full Code Here


      RTPBonusFormatsMgr.addBonusFormats(mgr);
     
          final Iterator iter = mgr.formatMap.keySet().iterator();
          while (iter.hasNext()) {
              Integer id = (Integer) iter.next();
              Format testFormat = (Format) mgr.formatMap.get(id);
              if (testFormat.matches(f)) {
                 return true;
              }
          }
         
      return false;
View Full Code Here

     */
    @Override
  public SendStream createSendStream(DataSource dataSource, int streamIndex)
            throws UnsupportedFormatException, IOException {
        int format = -1;
        Format fmt = null;
        double clockRate = 90000;
        if (dataSource instanceof PushBufferDataSource) {
            PushBufferStream stream =
                ((PushBufferDataSource) dataSource).getStreams()[streamIndex];
            fmt = stream.getFormat();
        } else if (dataSource instanceof PullBufferDataSource) {
            PullBufferStream stream =
                ((PullBufferDataSource) dataSource).getStreams()[streamIndex];
            fmt = stream.getFormat();
        } else {
            throw new IOException("Cannot use stream sources");
        }
        //System.out.println("createSendStream : Trying to find handler for format "+ fmt);
        Iterator iter = formatMap.keySet().iterator();
        while (iter.hasNext()) {
            Integer id = (Integer) iter.next();
            Format testFormat = (Format) formatMap.get(id);
            //System.out.println("Comparing with format "+testFormat);
            if (testFormat.matches(fmt)) {
                format = id.intValue();
                //System.out.println("GOT IT!");
            }
        }
        if (format == -1) {
View Full Code Here

            if (packetType == null) {
                RTPReceiveStream stream =
                    (RTPReceiveStream) receiveStreams.get(new Long(ssrc));
                if (stream == null) {
                    int type = header.getPacketType();
                    Format format = (Format) formatMap.get(new Integer(type));
                    if (format == null) {
                        globalReceptionStats.addUnknownType();
                        logger.warning("Unknown format identifier: "
                                + type);
                        ignoredStreams.put(new Long(ssrc), new Integer(type));
View Full Code Here

   
  }
 
  public Format intersects(Format other)
  {
    final Format result = super.intersects(other);

    if (other instanceof H261Format)
    {
      final H261Format resultCast = (H261Format) result;
     
View Full Code Here

     
  }
 
  public Format intersects(Format other)
  {
    final Format result = super.intersects(other);
    if (other instanceof YUVFormat)
    {
      final YUVFormat resultCast = (YUVFormat) result;
     
      final YUVFormat oCast = (YUVFormat) other;
View Full Code Here

  }
 
  public Format intersects(Format other)
  { 
    final Format result = super.intersects(other);

    if (other instanceof VideoFormat)
    {
      final VideoFormat resultCast = (VideoFormat) result;
     
View Full Code Here

    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)
      {
        // JMF doesn't mind if we set the input format before the mux or tracks are initialized.
        // not sure if it remembers the formats in this case though.
        Format f2 = m.setInputFormat(f1, i);
        assertTrue(f2 == f1);
      }
    }
   
    {
      Format f1 = new AudioFormat(AudioFormat.ULAW, -1.0, -1, -1, -1, -1, -1, -1.0, Format.byteArray);
      Format f2 = m.setInputFormat(f1, 0);
      assertTrue(f2 == null);
    }
  }
View Full Code Here

      for (int i = 0; i < 4; ++i)
        assertEquals(p.getTrackCount(i), -1);
     
      assertEquals(p.getOutputTrackFormat(0), null);
      assertEquals(p.getInputLocator(), null);
      assertTrue(p.isFormatAcceptable(0, new Format("xyz")));

    }
   
    {
     
      final ProcessorModel p = new ProcessorModel(
          new Format[] {
            new Format("abc"),
            new Format("xyz")
          },
          new ContentDescriptor("abc"));
      for (int i = 0; i < 4; ++i)
        assertEquals(p.getTrackCount(i), 2);
     
      assertTrue(p.getOutputTrackFormat(0).equals(new Format("abc")));
      assertTrue(p.getOutputTrackFormat(1).equals(new Format("xyz")));
      assertEquals(p.getOutputTrackFormat(2), null);
      assertTrue(p.isFormatAcceptable(0, new Format("abc")));
      assertTrue(p.isFormatAcceptable(0, new Format(null)));
      assertFalse(p.isFormatAcceptable(0, new Format("xyz")));
      assertTrue(p.isFormatAcceptable(2, new Format(null)));
      try
      {
        p.isFormatAcceptable(0, null);
        assertTrue(false);
      }
      catch (NullPointerException e)
      {
      }

      final StringBuffer b = new StringBuffer();
      assertTrue(p.isFormatAcceptable(0, new Format("abc"){

        //@Override
        public boolean matches(Format arg0)
        {
          b.append("matches called");
View Full Code Here

       
       
        if (TRACE) logger.fine("Track format for track " + trackIndex + ": " + t.getFormat());
       
        final int muxDestTrack;
        final Format muxInputFormat;
        final MuxNode muxNode;
        final InputPin muxInputPin;
        if (muxInputTrackNumbers == null)
        { 
          // not building to a mux
View Full Code Here

TOP

Related Classes of javax.media.Format

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.