Show
Ignore:
Timestamp:
04/14/09 18:19:59 (3 years ago)
Author:
Robin Gareus <robin@…>
Parents:
3b91569fdc9315612c62458ca02a2ef74b7c7970
Children:
f260f21876d739831315b71cf713e64cfbab9660
git-committer:
Robin Gareus <robin@gareus.org> / 2009-04-14T20:19:59Z+0200
Message:

deployed this.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/org/red5/rg/recorder/Application.java

    rcb749e0 re89e3a9  
    1717import org.slf4j.Logger; 
    1818 
     19import java.util.HashMap; 
     20import java.util.Iterator; 
     21 
    1922public class Application extends ApplicationAdapter { 
    2023 
    2124        private static Logger log = Red5LoggerFactory.getLogger(Application.class, "recorder"); 
     25        private HashMap streams = new HashMap(); 
    2226         
    23         private IScope appScope; 
    24  
    2527        { 
    2628                log.info("recorder created"); 
     
    2830        } 
    2931         
     32        private boolean checkPass(String u, String p) { 
     33                if (u.equals("4dc84c9279d0fcaa793eecfbc544cdbe7ea5f6e4")  
     34                 && p.equals("f78b64c9e0f2ea24fddce2b0d809cb2855fed1a6")) 
     35                         return true; 
     36                return false; 
     37        } 
     38 
    3039    @Override 
    3140        public boolean appStart(IScope app) { 
    3241                log.info("recorder appStart"); 
    33                 System.out.println("recorder appStart");         
    34                 appScope = app; 
     42//              System.out.println("recorder appStart");         
    3543                return true; 
    3644        } 
    3745 
    3846 
    39         private boolean checkPass(String u, String p) { 
    40                 if (u.equals("secret")) return true; 
    41                 return false; 
    42         } 
    43  
    4447    @Override 
    4548        public boolean appConnect(IConnection conn, Object[] params) { 
    46                 log.info("recorder appConnect" + conn.getClient().getId() ); 
     49                String id = conn.getClient().getId(); 
     50                log.info("recorder appConnect: " + id + "(" + streams.get("file_"+id)+ ")"); 
     51/* 
     52                log.info("recorder host=" + conn.getHost()); 
     53                log.info("recorder remote=" + conn.getRemoteAddress()); 
     54                log.info("recorder clientAtt=" + conn.getClient().getAttributeNames()); 
     55                log.info("recorder connectParams=" + conn.getConnectParams().toString()); 
     56//              log.info("recorder file=" + conn.getPublishedName()); 
     57                log.info("recorder file=" + params[2].toString()); 
     58*/ 
     59 
     60                streams.put("file_"+id,params[2].toString()); 
     61                streams.put("host_"+id,conn.getRemoteAddress()); 
     62//              streams.put("host_"+id,conn.getHost()); 
     63 
    4764                // Trigger calling of "onBWDone", required for some FLV players 
    4865                measureBandwidth(conn); 
    4966                if (conn instanceof IStreamCapableConnection) { 
    5067                        IStreamCapableConnection streamConn = (IStreamCapableConnection) conn; 
     68        //              log.info("recorder path=" + streamConn.getStreamById(0).getPublishedName()); 
    5169                        SimpleConnectionBWConfig bwConfig = new SimpleConnectionBWConfig(); 
    5270                        bwConfig.getChannelBandwidth()[IBandwidthConfigure.OVERALL_CHANNEL] = 
     
    6684        } 
    6785 
    68         /** {@inheritDoc} */ 
    6986    @Override 
    7087        public void appDisconnect(IConnection conn) { 
    71                 log.info("recorder appDisconnect" + conn.getClient().getId() ); 
     88                String id = conn.getClient().getId(); 
     89                log.info("recorder appDisconnect: " + id + "(" + streams.get("file_"+id)+ ")"); 
     90 
    7291                try{ 
    73                         Runtime.getRuntime().exec("/tmp/test.sh"); 
     92                        Runtime.getRuntime().exec("/usr/local/bin/cfvb-transcode.sh "+streams.get("file_"+id)+" "+streams.get("host_"+id)); 
    7493                 } catch (IOException e) {} 
     94 
     95                streams.remove("file_"+id); 
     96                streams.remove("host_"+id); 
    7597                super.appDisconnect(conn); 
    7698        }