Package org.red5.server.net.mrtmp

Examples of org.red5.server.net.mrtmp.MRTMPPacket


  public synchronized RoomClient setUsernameReconnect(String SID, Long userId,
          String username, String firstname, String lastname,
          String picture_uri){
    try {
      log.debug("#*#*#*#*#*#*# setUsername userId: "+userId+" username: "+username+" firstname: "+firstname+" lastname: "+lastname);
      IConnection current = Red5.getConnectionLocal();     
      String streamid = current.getClient().getId();
      RoomClient currentClient = this.clientListManager.getClientByStreamId(streamid);
     
      log.debug("[setUsername] id: "+currentClient.getStreamid());
     
      currentClient.setUsername(username);
View Full Code Here


          }
          String scopeName = "hibernate";
          if (rcl.getRoom_id() != null) {
            scopeName = rcl.getRoom_id().toString();
          }
          IScope currentScope = ScopeApplicationAdapter.getInstance()
              .getRoomScope(scopeName);
          ScopeApplicationAdapter.getInstance().roomLeaveByScope(rcl,
              currentScope);

          HashMap<Integer, String> messageObj = new HashMap<Integer, String>();
View Full Code Here

        String scopeName = "hibernate";
        if (rcl.getRoom_id() != null) {
          scopeName = rcl.getRoom_id().toString();
        }
        IScope currentScope = ScopeApplicationAdapter.getInstance()
            .getRoomScope(scopeName);
        ScopeApplicationAdapter.getInstance().roomLeaveByScope(rcl,
            currentScope);

        HashMap<Integer, String> messageObj = new HashMap<Integer, String>();
View Full Code Here

         }
         String scopeName = "hibernate";
         if (rcl.getRoom_id() != null) {
           scopeName = rcl.getRoom_id().toString();
         }
         IScope currentScope = this.scopeApplicationAdapter.getRoomScope(scopeName);
         this.scopeApplicationAdapter.roomLeaveByScope(rcl, currentScope);
        
        
         HashMap<Integer,String> messageObj = new HashMap<Integer,String>();
         messageObj.put(0, "kick");
View Full Code Here

          }
          String scopeName = "hibernate";
          if (rcl.getRoom_id() != null) {
            scopeName = rcl.getRoom_id().toString();
          }
          IScope currentScope = this.scopeApplicationAdapter.getRoomScope(scopeName);
         
          HashMap<Integer,String> messageObj = new HashMap<Integer,String>();
          messageObj.put(0, "kick");
         
          this.scopeApplicationAdapter.sendMessageById(messageObj, rcl.getStreamid(), currentScope);
View Full Code Here

    // ------------------------------------------------------------------------

    private void createPlayStream( IPendingServiceCallback callback ) {

        logger.debug( "create play stream" );
        IPendingServiceCallback wrapper = new CreatePlayStreamCallBack( callback );
        invoke( "createStream", null, wrapper );
    }
View Full Code Here

      if (stream.getStreamListeners() != null) {
       
        for (Iterator<IStreamListener> iter = stream.getStreamListeners().iterator();iter.hasNext();) {
         
          IStreamListener iStreamListener = iter.next();
         
          ListenerAdapter listenerAdapter = (ListenerAdapter) iStreamListener;
         
          log.debug("Stream Closing ?? "+listenerAdapter.getFlvRecordingMetaDataId()+ " " +flvRecordingMetaDataId);
         
View Full Code Here

  }

  public void encode(IoSession session, Object message,
      ProtocolEncoderOutput out) throws Exception {
    MRTMPPacket packet = (MRTMPPacket) message;
    MRTMPPacket.Header header = packet.getHeader();
    ByteBuffer buf = null;
    switch (header.getType()) {
      case MRTMPPacket.CONNECT:
      case MRTMPPacket.CLOSE:
        buf = ByteBuffer.allocate(MRTMPPacket.COMMON_HEADER_LENGTH);
        buf.setAutoExpand(true);
        break;
      case MRTMPPacket.RTMP:
        buf = ByteBuffer.allocate(MRTMPPacket.RTMP_HEADER_LENGTH);
        buf.setAutoExpand(true);
        break;
      default:
        break;
    }
    if (buf == null) {
      return;
    }
    buf.putShort(header.getType());
    buf.putShort(MRTMPPacket.JAVA_ENCODING);
    int preserved = header.isDynamic() ? 0x80000000 : 0;
    buf.putInt(preserved);
    buf.putInt(header.getClientId());
    if (header.getType() == MRTMPPacket.CONNECT ||
        header.getType() == MRTMPPacket.CLOSE) {
      buf.putInt(MRTMPPacket.COMMON_HEADER_LENGTH);
      buf.putInt(0);
    } else if (header.getType() == MRTMPPacket.RTMP) {
      buf.putInt(MRTMPPacket.RTMP_HEADER_LENGTH);
      int bodyLengthPos = buf.position();
      buf.putInt(0);
      MRTMPPacket.RTMPHeader rtmpHeader = (MRTMPPacket.RTMPHeader) packet.getHeader();
      buf.putInt(rtmpHeader.getRtmpType());
      MRTMPPacket.RTMPBody body = (MRTMPPacket.RTMPBody) packet.getBody();
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      oos.writeObject(body.getRtmpPacket());
      oos.close();
      buf.put(baos.toByteArray());
View Full Code Here

      if (buffer.remaining() < header.getBodyLength()) {
        buffer.position(pos);
        break;
      }
      MRTMPPacket.Body body = decodeBody(buffer, header);
      MRTMPPacket packet = new MRTMPPacket();
      packet.setHeader(header);
      packet.setBody(body);
      if (log.isDebugEnabled()) {
        log.debug(packet.toString());
      }
      out.write(packet);
    }
    buffer.compact();
  }
View Full Code Here

            if ( !( event instanceof IRTMPEvent ) ) {
                logger.debug( "skipping non rtmp event: " + event );
                return;
            }

            IRTMPEvent rtmpEvent = (IRTMPEvent) event;

            if ( logger.isDebugEnabled() ) {
                // logger.debug("rtmp event: " + rtmpEvent.getHeader() + ", " +
                // rtmpEvent.getClass().getSimpleName());
            }

            if ( !( rtmpEvent instanceof IStreamData ) ) {
                logger.debug( "skipping non stream data" );
                return;
            }

            if ( rtmpEvent.getHeader().getSize() == 0 ) {
                logger.debug( "skipping event where size == 0" );
                return;
            }

            if ( rtmpEvent instanceof VideoData ) {
View Full Code Here

TOP

Related Classes of org.red5.server.net.mrtmp.MRTMPPacket

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.