Package org.gudy.azureus2.plugins.ipc

Examples of org.gudy.azureus2.plugins.ipc.IPCInterface


  removeDynamicXCode(
    final DiskManagerFileInfo    source )
  {
    final TranscodeProfile profile = dynamic_transcode_profile;
   
    IPCInterface      ipc  = upnpav_ipc;
   
    if ( profile == null || ipc == null ){
     
      return;
    }
   
    try{
      TranscodeFileImpl transcode_file = lookupFile( profile, source );

        // if the file completed transcoding then we leave the result around for
        // the user to re-use
     
      if ( transcode_file != null && !transcode_file.isComplete()){
       
        AzureusContentFile acf = null;
       
        synchronized( this ){
 
          if ( dynamic_xcode_map != null ){
         
            acf = dynamic_xcode_map.get( transcode_file.getKey());
          }
        }
       
        transcode_file.delete( true );
       
        if ( acf != null ){
       
          ipc.invoke( "removeContent", new Object[]{ acf });
        }
       
        synchronized( acf_map ){
         
          acf_map.remove( transcode_file.getKey());
View Full Code Here


    if ( acf != null ){
     
      return( true );
    }
   
    IPCInterface      ipc  = upnpav_ipc;

    if ( ipc == null ){
     
      return( false );
    }
   
    if ( transcode_file.getDurationMillis() == 0 ){
     
      return( false );
    }
   
    try{
      final DiskManagerFileInfo stream_file =
        new TranscodeJobOutputLeecher( job, transcode_file );
                   
      acf =  new AzureusContentFile()
          { 
               public DiskManagerFileInfo
               getFile()
               {
                 return( stream_file );
               }
              
            public Object
            getProperty(
              String    name )
            {
                // TODO: duration etc
 
              if ( name.equals( MY_ACF_KEY )){
               
                return( new Object[]{ DeviceUPnPImpl.this, tf_key });
               
              }else if ( name.equals( PT_PERCENT_DONE )){
               
                return( new Long(1000));
               
              }else if ( name.equals( PT_ETA )){
               
                return( new Long(0));
              }
             
              return( null );
            }
          };
     
      synchronized( acf_map ){
 
        acf_map.put( tf_key, acf );
      }
   
      ipc.invoke( "addContent", new Object[]{ acf });

      log( "Set up stream-xcode for " + transcode_file.getName());
     
      return( true );
     
View Full Code Here

    TranscodeFile    _transcode_file,
    boolean        _new_file )
  {
    TranscodeFileImpl  transcode_file = (TranscodeFileImpl)_transcode_file;
   
    IPCInterface ipc = upnpav_ipc;
   
    synchronized( this ){
     
      if ( ipc == null ){

        return;
      }
     
      if ( !transcode_file.isComplete()){
       
        syncCategories( transcode_file, _new_file );

        return;
      }
     
      AzureusContentFile acf = (AzureusContentFile)transcode_file.getTransientProperty( UPNPAV_FILE_KEY );
     
      if ( acf != null ){
       
        return;
      }

      final String tf_key  = transcode_file.getKey();

      synchronized( acf_map ){
       
        acf = acf_map.get( tf_key );
      }
     
      if ( acf != null ){
       
        return;
      }

      try{
        final DiskManagerFileInfo   f     = transcode_file.getTargetFile();
             
        acf =
          new AzureusContentFile()
          {
            public DiskManagerFileInfo
              getFile()
            {
              return( f );
            }
           
            public Object
            getProperty(
              String    name )
            {           
              ifname.equals( MY_ACF_KEY )){
               
                return( new Object[]{ DeviceUPnPImpl.this, tf_key });
               
              }else if ( name.equals( PT_CATEGORIES )){
               
                TranscodeFileImpl  tf = getTranscodeFile( tf_key );

                if ( tf != null ){
                 
                  return( tf.getCategories());
                }
             
                return( new String[0] );
               
              }else{
               
                TranscodeFileImpl  tf = getTranscodeFile( tf_key );
               
                if ( tf != null ){
                 
                  long  res = 0;
                 
                  if ( name.equals( PT_DURATION )){
                   
                    res = tf.getDurationMillis();
                   
                  }else if ( name.equals( PT_VIDEO_WIDTH )){
                   
                    res = tf.getVideoWidth();
                   
                  }else if ( name.equals( PT_VIDEO_HEIGHT )){
                   
                    res = tf.getVideoHeight();
                   
                  }else if ( name.equals( PT_DATE )){

                    res = tf.getCreationDateMillis();
                   
                  }else if ( name.equals( PT_PERCENT_DONE )){

                    if ( tf.isComplete()){
                     
                      res = 1000;
                     
                    }else{
                     
                      TranscodeJob job = tf.getJob();
                     
                      if ( job == null ){
                       
                        res = 0;
                       
                      }else{
                       
                        res = 10*job.getPercentComplete();
                      }
                    }
                   
                    return( res );
                   
                  }else if ( name.equals( PT_ETA )){

                    if ( tf.isComplete()){
                     
                      res = 0;
                     
                    }else{
                     
                      TranscodeJob job = tf.getJob();
                     
                      if ( job == null ){
                       
                        res = Long.MAX_VALUE;
                       
                      }else{
                       
                        res = job.getETASecs();
                      }
                    }
                   
                    return( res );
                  }
                 
                  if ( res > 0 ){
                   
                    return( new Long( res ));
                  }
                }
              }
             
              return( null );
            }
          };
       
        transcode_file.setTransientProperty( UPNPAV_FILE_KEY, acf );

        synchronized( acf_map ){

          acf_map.put( tf_key, acf );
       
       
        syncCategories( transcode_file, _new_file );
         
        try{
          ipc.invoke( "addContent", new Object[]{ acf });
       
        }catch( Throwable e ){
         
          Debug.out( e );
        }   
View Full Code Here

 
  public void
  fileRemoved(
    TranscodeFile    file )
  {
    IPCInterface ipc = upnp_manager.getUPnPAVIPC();
   
    if ( ipc == null ){
     
      return;
    }

    synchronized( this ){

      AzureusContentFile acf = (AzureusContentFile)file.getTransientProperty( UPNPAV_FILE_KEY );

      if ( acf == null ){
   
        return;
      }
     
      file.setTransientProperty( UPNPAV_FILE_KEY, null );

      try{
        ipc.invoke( "removeContent", new Object[]{ acf });
     
       
      }catch( Throwable e ){
       
        Debug.out( e );
View Full Code Here

  protected URL
  getStreamURL(
    TranscodeFileImpl    file,
    String          host )
  {
    IPCInterface ipc = upnp_manager.getUPnPAVIPC();
   
    if ( ipc != null ){

      try{
        DiskManagerFileInfo f = file.getTargetFile();
       
        String str = (String)ipc.invoke( "getContentURL", new Object[]{ f });
       
        if ( str != null && str.length() > 0 ){
         
          if ( host != null ){
           
View Full Code Here

    if ( getMimeType_fails > 5 ){
     
      return( null );
    }
   
    IPCInterface ipc = upnp_manager.getUPnPAVIPC();
   
    if ( ipc != null ){

      try{
        DiskManagerFileInfo f = file.getTargetFile();
       
        String str = (String)ipc.invoke( "getMimeType", new Object[]{ f });
       
        if ( str != null && str.length() > 0 ){
         
          return( str );
        }
View Full Code Here

              {
                if ( result instanceof Boolean ){
                 
                  PluginInterface pi = AzureusCoreFactory.getSingleton().getPluginManager().getPluginInterfaceByID( "mlab" );

                  IPCInterface callback =
                    new IPCInterface()
                    {
                      public Object
                      invoke(
                        String     methodName,
                        Object[]  params )
View Full Code Here

  public MessageStreamEncoderAdapter( MessageStreamEncoder plug_encoder ) {
    this.plug_encoder = plug_encoder;
  }
 
  public com.aelitis.azureus.core.networkmanager.RawMessage[] encodeMessage( com.aelitis.azureus.core.peermanager.messaging.Message message ) {
    Message plug_msg;
   
    if( message instanceof MessageAdapter ) {  //original message created by plugin, unwrap
      plug_msg = ((MessageAdapter)message).getPluginMessage();
    }
    else {
View Full Code Here

 
    throws MessageException
  {
    if ( incoming ){
     
      throw( new MessageException( "Already connected" ));
    }
   
    if ( connecting ){
     
      throw( new MessageException( "Connect already performed" ));
    }
   
    connecting  = true;
   
    if ( closed ){
     
      throw( new MessageException( "Connection has been closed" ));
    }
   
    InetSocketAddress  tcp_ep = endpoint.getTCP();
       
    if ( tcp_ep != null ){
     
      connectTCP( initial_data, tcp_ep );
     
    }else{
     
      InetSocketAddress  udp_ep = endpoint.getUDP();

      if ( udp_ep != null ){
       
        connectUDP( initial_data, udp_ep, false );
       
      }else{
       
        throw( new MessageException( "No protocols availabld" ));
      }
    }
  }
View Full Code Here

                delegate.close();
               
              }catch( Throwable e ){
              }
             
              reportFailed( new MessageException( "Connection has been closed" ));

            }else{
             
              reportConnected();
            }
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.plugins.ipc.IPCInterface

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.