Package org.red5.server.api.stream

Examples of org.red5.server.api.stream.IStreamableFileFactory


         }
         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

   *             I/O exception
   */
  private void init() throws IOException {
    file = new File(OmFileHelper.getStreamsSubDir(scope.getName()), streamName + ".flv");

    IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class,
        StreamableFileFactory.class);

    if (!file.isFile()) {
      // Maybe the (previously existing) file has been deleted
      file.createNewFile();

    } else if (!file.canWrite()) {
      throw new IOException("The file is read-only");
    }

    IStreamableFileService service = factory.getService(file);
    IStreamableFile flv = service.getStreamableFile(file);
    writer = flv.getWriter();
  }
View Full Code Here

  public double getStreamLength(String name) {
    double duration = 0;
    IProviderService provider = (IProviderService) ScopeUtils.getScopeService(scope, IProviderService.class, ProviderService.class);
    File file = provider.getVODProviderFile(scope, name);
    if (file != null && file.canRead()) {
      IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
      IStreamableFileService service = factory.getService(file);
      if (service != null) {
        ITagReader reader = null;
        try {
          IStreamableFile streamFile = service.getStreamableFile(file);
          reader = streamFile.getReader();
View Full Code Here

  /**
   * Initializes file provider. Creates streamable file factory and service, seeks to start position
   */
  private void init() throws IOException {
    IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
    IStreamableFileService service = factory.getService(file);
    if (service == null) {
      log.error("No service found for {}", file.getAbsolutePath());
      return;
    }
    IStreamableFile streamFile = service.getStreamableFile(file);
View Full Code Here

        // add associated locks
        reentrantLock = new ReentrantReadWriteLock();
        writeLock = reentrantLock.writeLock();
        readLock = reentrantLock.readLock();
      }
      IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
      File folder = file.getParentFile();
      if (!folder.exists()) {
        if (!folder.mkdirs()) {
          throw new IOException("Could not create parent folder");
        }
      }
      if (!file.isFile()) {
        // Maybe the (previously existing) file has been deleted
        file.createNewFile();
      } else if (!file.canWrite()) {
        throw new IOException("The file is read-only");
      }
      IStreamableFileService service = factory.getService(file);
      IStreamableFile flv = service.getStreamableFile(file);
      if (mode == null || mode.equals(IClientStream.MODE_RECORD)) {
        writer = flv.getWriter();
        //write the decoder config tag if it exists
        if (videoConfigurationTag != null) {
View Full Code Here

    // verify that scope was removed
    return scope.getBasicScope(ScopeType.BROADCAST, name) == null;
  }

  private File getStreamFile(IScope scope, String name) {
    IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class);
    if (name.indexOf(':') == -1 && name.indexOf('.') == -1) {
      // Default to .flv files if no prefix and no extension is given.
      name = "flv:" + name;
    }
    log.debug("getStreamFile null check - factory: {} name: {}", factory, name);
    for (IStreamableFileService service : factory.getServices()) {
      if (name.startsWith(service.getPrefix() + ':')) {
        name = service.prepareFilename(name);
        break;
      }
    }
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.api.stream.IStreamableFileFactory

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.