Package javax.media

Examples of javax.media.Codec


  System.err.println("Video format: " + videoTrack.getFormat());

  // Instantiate and set the frame access codec to the data flow path.
  try {
      Codec codec[] = { new RotationEffect() };
      videoTrack.setCodecChain(codec);
  } catch (UnsupportedPlugInException e) {
      System.err.println("The processor does not support effects.");
  }
View Full Code Here


    for (int i=0; i<node.getNumDestLinks(); i++)
    {
      Node dest = node.getDestLink(i).getDestNode();
      if ( dest instanceof CodecNode )
      {
        Codec c = ((CodecNode)dest).getCodec();
        final Object[] controls = c.getControls();
        if (controls != null)
        {
          for (Object o : controls)
          {
            addControl((Control) o);
View Full Code Here

       
      }
      else if (o instanceof Codec)
      {
        if (TRACE) logger.fine("PlugInUtility: Registering codec: " + className);
        final Codec oCast = (Codec) o;
        final Format[] inputFormats = oCast.getSupportedInputFormats();
 
        final Format[] outputFormats = oCast.getSupportedOutputFormats(null)// this is what JMRegistry does
       
        return new PlugInInfo(className, inputFormats, outputFormats, (o instanceof Effect) ? PlugInManager.EFFECT : PlugInManager.CODEC);
   
      }
      else if (o instanceof Renderer)
      {
        if (TRACE) logger.fine("PlugInUtility: Registering renderer: " + className);
        final Renderer oCast = (Renderer) o;
        final Format[] inputFormats = oCast.getSupportedInputFormats();
        return new PlugInInfo(className, inputFormats, new Format[] {}, PlugInManager.RENDERER);
      }
      else if (o instanceof Multiplexer)
      { 
        if (TRACE) logger.fine("PlugInUtility: Registering Multiplexer: " + className);
        final Multiplexer oCast = (Multiplexer) o;
        // JMF Multiplexers always have nothing for the input formats.
        return new PlugInInfo(className, new Format[] {}, oCast.getSupportedOutputContentDescriptors(null), PlugInManager.MULTIPLEXER);
      }
      else
      {
        logger.warning("PlugInUtility: Unknown or unsupported plug-in: " + o.getClass());
        return null;
View Full Code Here

      Demultiplexer demux = (Demultiplexer) pluginObject;
      in = demux.getSupportedInputContentDescriptors();
      out = null;
    }
    else if (pluginObject instanceof Codec) {
      Codec codec = (Codec) pluginObject;
      in = codec.getSupportedInputFormats();
      out = codec.getSupportedOutputFormats(null);
    }
    else if (pluginObject instanceof Multiplexer) {
      Multiplexer mux = (Multiplexer) pluginObject;
      in = mux.getSupportedInputFormats();
      out = mux.getSupportedOutputContentDescriptors(null);
View Full Code Here


      for (int j = 0; j < codecFormatPairs.size(); ++j)
      {
        final CodecFormatPair codecFormatPair = codecFormatPairs.get(j);
        final Codec codec = codecFormatPair.getCodec();
        final Format codecOutputFormat = codecFormatPair.getFormat();
       
        if (TRACE) logger.finer(indent(depth) + "Trying " + codec.getClass().getName() + " with output format: " + codecOutputFormat);
        {
         
          final CodecNode codecNode = new CodecNode(codec, null)// format will be set in negotiation
        if (PRE_LINK)
          link(from, codecNode.getInputPin(0));
        final Format fAccepted;
          if (FIND_NONSPECIFIC_GRAPH_FIRST)
          {
            fAccepted = f;
            if (fAccepted != null)
              codecNode.getInputPin(0).setFormat(fAccepted);
          }
          else
          {
            fAccepted = negotiate(f, codecNode.getInputPin(0), null, from);
          }
          if (fAccepted == null)
            {  logger.warning("Codec " + codec + " rejected input format (or negotiation failed) " + f);
            continue;
          }
         
          // TODO: the output format may be partially unspecified, so it has to be negotiated.
          // also, if we are connecting to something with a more specific format (say, a mux), then
          // we need to be able to constrain this output format using that.
          final Format codecOutputFormatAccepted;
          if (FIND_NONSPECIFIC_GRAPH_FIRST)
            codecOutputFormatAccepted = codecOutputFormat;
          else
            codecOutputFormatAccepted = codec.setOutputFormat(codecOutputFormat)// TODO: this should be set only in negotiation
          if (codecOutputFormatAccepted == null)
            {  logger.warning("Codec " + codec + " rejected output format " + codecOutputFormat);
            continue;
            }
         
View Full Code Here

      {
        final String codecClassName = (String) codecs.get(j);
       
        if (TRACE) logger.finer(indent(depth) + "Trying " + codecClassName);
       
        final Codec codec = (Codec) instantiate(codecClassName);
        if (codec == null)
          continue;
               
        final Format[] codecOutputFormats = codec.getSupportedOutputFormats(f);
       
        if (TRACE && logger.isLoggable(Level.FINEST))
        {
          for (int codecOutputFormatIndex = 0; codecOutputFormatIndex < codecOutputFormats.length; ++codecOutputFormatIndex)
          {
            final Format codecOutputFormat = codecOutputFormats[codecOutputFormatIndex];
            logger.finest(indent(depth) + "Found Codec output format: " + codecOutputFormat);
          }
        }
       
        for (int codecOutputFormatIndex = 0; codecOutputFormatIndex < codecOutputFormats.length; ++codecOutputFormatIndex)
        {
          final Format codecOutputFormat = codecOutputFormats[codecOutputFormatIndex];
          if (codecOutputFormat == null)
          {  logger.finer(indent(depth) + "Skipping null Codec (" + codec.getClass() + ") output format, input format: " + f);
            continue;
          }
          if (codecOutputFormat.equals(f))
          {  if (TRACE) logger.finest(indent(depth) + (SKIP_NON_FORMAT_CHANGING_CODECS ? "YES " : "NOT ") + "Skipping Codec output format, same as input format: " + codecOutputFormat);
            if (!FIND_NONSPECIFIC_GRAPH_FIRST && SKIP_NON_FORMAT_CHANGING_CODECS)
              continue// no need to have a codec that does not change formats.  this can happen in the case of
                    // something like com.sun.media.codec.audio.rc.RateCvrt, which will offer an output format
                    // the same as an input format.
          }
         
          // instantiate a new copy of the codec for each pair.
          codecFormatPairs.add(new CodecFormatPair((Codec) instantiate(codecClassName), codecOutputFormat));
        }
       
      }
     
      // now that we have all of the codec/format pairs, sort them (if we know what format we are trying to reach)
      if (muxInputFormat != null)
      {  Collections.sort(codecFormatPairs, new CodecFormatPairProximityComparator(muxInputFormat));
     
//        for (int j = 0; j < codecFormatPairs.size(); ++j)
//        {
//          final CodecFormatPair codecFormatPair = (CodecFormatPair) codecFormatPairs.get(j);
//          final Codec codec =codecFormatPair.getCodec();
//          final Format codecOutputFormat = codecFormatPair.getFormat();
//         
//          if (TRACE) logger.fine(indent(depth) + j + ". Will try " + codec.getClass().getName() + " with output format: " + codecOutputFormat);
// 
//        }
       
        // best-first enabled.
        if (maxBestCodecs > 1)
        {  while (codecFormatPairs.size() > maxBestCodecs)
            codecFormatPairs.remove(maxBestCodecs);
        }
       
        if (TRACE && logger.isLoggable(Level.FINER))
        {
          for (int j = 0; j < codecFormatPairs.size(); ++j)
          {
            final CodecFormatPair codecFormatPair = codecFormatPairs.get(j);
            final Codec codec = codecFormatPair.getCodec();
            final Format codecOutputFormat = codecFormatPair.getFormat();
           
            logger.finer(indent(depth) + j + ". Will try " + codec.getClass().getName() + " with output format: " + codecOutputFormat);
   
          }
        }
      }
      return codecFormatPairs;
View Full Code Here

    String className = "com.ibm.media.codec.audio.ulaw.JavaEncoder";
    String className2 = "net.sf.fmj.media.codec.audio.ulaw.Encoder";
   
    Format f = new AudioFormat(AudioFormat.LINEAR, -1.0, 16, 1, AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED, 16, -1.0, Format.byteArray);
   
    Codec encoder = open(className, f);
    Codec encoder2 = open(className2, f);
   
    // signed, big: all values with both bytes negative are wrong.  Half of the values are wrong.
    // signed, little: all values where first byte is negative is wrong.  Half are wrong.
    // unsigned, big: all values wrong
    // unsigned, little: all values wrong.
View Full Code Here

   
  }
 
  private Codec open(String className, Format f) throws Exception
  {
    Codec encoder = (Codec) Class.forName(className).newInstance();
    encoder.setInputFormat(f);
    encoder.setOutputFormat(encoder.getSupportedOutputFormats(f)[0]);
    encoder.open();
    return encoder;
   
  }
View Full Code Here

                                    // Do nothing
                                }
                            }

                            if (tracks[i].getFormat().getEncoding().equals(AudioFormat.ULAW_RTP)) {
                                Codec codec[] = new Codec[3];

                                codec[0] = new com.ibm.media.codec.audio.rc.RCModule();
                                codec[1] = new com.ibm.media.codec.audio.ulaw.JavaEncoder();
                                codec[2] = new com.sun.media.codec.audio.ulaw.Packetizer();
                                ((com.sun.media.codec.audio.ulaw.Packetizer) codec
View Full Code Here

    JMFInitializer.initJMF(this.getClass().getResource("jmf.properties"));
   
    try {
      // Registering FOBS JMF plugins
      String FFMPEG_VIDEO_NATIVE = "com.omnividea.media.codec.video.NativeDecoder";
        Codec videoNative = (Codec) Class.forName(FFMPEG_VIDEO_NATIVE).newInstance();
        PlugInManager.addPlugIn(FFMPEG_VIDEO_NATIVE,
                videoNative.getSupportedInputFormats(),
                videoNative.getSupportedOutputFormats(null),
                PlugInManager.CODEC);

        //
//        String FFMPEG_AUDIO_NATIVE = "com.omnividea.media.codec.audio.NativeDecoder";
//        Codec audioNative = (Codec) Class.forName(FFMPEG_AUDIO_NATIVE).newInstance();
View Full Code Here

TOP

Related Classes of javax.media.Codec

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.