Package org.red5.codec

Examples of org.red5.codec.StreamCodecInfo


      if (listener.init(scope, name, isAppend)) {
        // get decoder info if it exists for the stream
        IStreamCodecInfo codecInfo = getCodecInfo();
        log.debug("Codec info: {}", codecInfo);
        if (codecInfo instanceof StreamCodecInfo) {
          StreamCodecInfo info = (StreamCodecInfo) codecInfo;
          IVideoStreamCodec videoCodec = info.getVideoCodec();
          log.debug("Video codec: {}", videoCodec);
          if (videoCodec != null) {
            //check for decoder configuration to send
            IoBuffer config = videoCodec.getDecoderConfiguration();
            if (config != null) {
              log.debug("Decoder configuration is available for {}", videoCodec.getName());
              VideoData videoConf = new VideoData(config.asReadOnlyBuffer());
              try {
                log.debug("Setting decoder configuration for recording");
                listener.getFileConsumer().setVideoDecoderConfiguration(videoConf);
              } finally {
                videoConf.release();
              }
            }
          } else {
            log.debug("Could not initialize stream output, videoCodec is null.");
          }
          IAudioStreamCodec audioCodec = info.getAudioCodec();
          log.debug("Audio codec: {}", audioCodec);
          if (audioCodec != null) {
            //check for decoder configuration to send
            IoBuffer config = audioCodec.getDecoderConfiguration();
            if (config != null) {
View Full Code Here


        }

        IStreamCodecInfo codecInfo = stream.getCodecInfo();
        log.debug("Codec info: {}", codecInfo);
        if (codecInfo instanceof StreamCodecInfo) {
          StreamCodecInfo info = (StreamCodecInfo) codecInfo;
          IVideoStreamCodec videoCodec = info.getVideoCodec();
          log.debug("Video codec: {}", videoCodec);
          if (videoCodec != null) {
            //check for decoder configuration to send
            IoBuffer config = videoCodec.getDecoderConfiguration();
            if (config != null) {
              log.debug("Decoder configuration is available for {}", videoCodec.getName());
              //log.debug("Dump:\n{}", Hex.encodeHex(config.array()));
              VideoData conf = new VideoData(config.asReadOnlyBuffer());
              log.trace("Configuration ts: {}", conf.getTimestamp());
              RTMPMessage confMsg = RTMPMessage.build(conf);
              try {
                log.debug("Pushing decoder configuration");
                msgOut.pushMessage(confMsg);
              } finally {
                conf.release();
              }
            }
            //check for a keyframe to send
            IoBuffer keyFrame = videoCodec.getKeyframe();
            if (keyFrame != null) {
              log.debug("Keyframe is available");
              VideoData video = new VideoData(keyFrame.asReadOnlyBuffer());
              log.trace("Keyframe ts: {}", video.getTimestamp());
              //log.debug("Dump:\n{}", Hex.encodeHex(keyFrame.array()));
              RTMPMessage videoMsg = RTMPMessage.build(video);
              try {
                log.debug("Pushing keyframe");
                msgOut.pushMessage(videoMsg);
              } finally {
                video.release();
              }
            }
          } else {
            log.debug("Could not initialize stream output, videoCodec is null");
          }
          // SplitmediaLabs - begin AAC fix
          IAudioStreamCodec audioCodec = info.getAudioCodec();
          log.debug("Audio codec: {}", audioCodec);
          if (audioCodec != null) {
            // check for decoder configuration to send
            IoBuffer config = audioCodec.getDecoderConfiguration();
            if (config != null) {
View Full Code Here

          if (rtmpEvent instanceof IStreamData && (buf = ((IStreamData<?>) rtmpEvent).getData()) != null) {
            bytesReceived += buf.limit();
          }
          // get stream codec
          IStreamCodecInfo codecInfo = getCodecInfo();
          StreamCodecInfo info = null;
          if (codecInfo instanceof StreamCodecInfo) {
            info = (StreamCodecInfo) codecInfo;
          }
          //log.trace("Stream codec info: {}", info);
          if (rtmpEvent instanceof AudioData) {
            IAudioStreamCodec audioStreamCodec = null;
            if (checkAudioCodec) {
              // dont try to read codec info from 0 length audio packets
              if (buf.limit() > 0) {
                  audioStreamCodec = AudioCodecFactory.getAudioCodec(buf);
                  if (info != null) {
                    info.setAudioCodec(audioStreamCodec);
                  }
                  checkAudioCodec = false;
              }
            } else if (codecInfo != null) {
              audioStreamCodec = codecInfo.getAudioCodec();
            }
            if (audioStreamCodec != null) {
              audioStreamCodec.addData(buf.asReadOnlyBuffer());
            }
            if (info != null) {
              info.setHasAudio(true);
            }
            eventTime = rtmpEvent.getTimestamp();
            log.trace("Audio: {}", eventTime);
          } else if (rtmpEvent instanceof VideoData) {
            IVideoStreamCodec videoStreamCodec = null;
            if (checkVideoCodec) {
              videoStreamCodec = VideoCodecFactory.getVideoCodec(buf);
              if (info != null) {
                info.setVideoCodec(videoStreamCodec);
              }
              checkVideoCodec = false;
            } else if (codecInfo != null) {
              videoStreamCodec = codecInfo.getVideoCodec();
            }
            if (videoStreamCodec != null) {
              videoStreamCodec.addData(buf.asReadOnlyBuffer());
            }
            if (info != null) {
              info.setHasVideo(true);
            }
            eventTime = rtmpEvent.getTimestamp();
            log.trace("Video: {}", eventTime);
          } else if (rtmpEvent instanceof Invoke) {
            eventTime = rtmpEvent.getTimestamp();
View Full Code Here

      if (listener.init(conn, name, isAppend)) {
        // get decoder info if it exists for the stream
        IStreamCodecInfo codecInfo = getCodecInfo();
        log.debug("Codec info: {}", codecInfo);
        if (codecInfo instanceof StreamCodecInfo) {
          StreamCodecInfo info = (StreamCodecInfo) codecInfo;
          IVideoStreamCodec videoCodec = info.getVideoCodec();
          log.debug("Video codec: {}", videoCodec);
          if (videoCodec != null) {
            //check for decoder configuration to send
            IoBuffer config = videoCodec.getDecoderConfiguration();
            if (config != null) {
              log.debug("Decoder configuration is available for {}", videoCodec.getName());
              VideoData videoConf = new VideoData(config.asReadOnlyBuffer());
              try {
                log.debug("Setting decoder configuration for recording");
                listener.getFileConsumer().setVideoDecoderConfiguration(videoConf);
              } finally {
                videoConf.release();
              }
            }
          } else {
            log.debug("Could not initialize stream output, videoCodec is null.");
          }
          IAudioStreamCodec audioCodec = info.getAudioCodec();
          log.debug("Audio codec: {}", audioCodec);
          if (audioCodec != null) {
            //check for decoder configuration to send
            IoBuffer config = audioCodec.getDecoderConfiguration();
            if (config != null) {
View Full Code Here

    latestTimeStamp = -1;
    bytesReceived = 0;
    IConsumerService consumerManager = (IConsumerService) getScope().getContext().getBean(IConsumerService.KEY);
    connMsgOut = consumerManager.getConsumerOutput(this);
    if (connMsgOut != null && connMsgOut.subscribe(this, null)) {
      setCodecInfo(new StreamCodecInfo());
      creationTime = System.currentTimeMillis();
      closed = false;
    } else {
      log.warn("Subscribe failed");
    }
View Full Code Here

  private Long creationTime;
 
  public AudioStream(String name) {
    publishedStreamName = name;
    livePipe = null;
    streamCodecInfo = new StreamCodecInfo();
    creationTime = null;
  }
View Full Code Here

  public AudioBroadcastStream(String name) {
    publishedStreamName = name;
    livePipe = null;
    log.trace("publishedStreamName: {}", name);

    streamCodecInfo = new StreamCodecInfo();
    creationTime = null;
  }
View Full Code Here

    livePipe = null;
    log.debug("name: {}", name);

    // we want to create a video codec when we get our
    // first video packet.
    streamCodecInfo = new StreamCodecInfo();
    creationTime = null;
  }
View Full Code Here

    }

    IStreamableFileService service = factory.getService(file);

    IStreamableFile flv = service.getStreamableFile(file);

    writer = flv.getWriter();

  }
View Full Code Here

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

    IStreamableFileService service = factory.getService(this.file);
    IStreamableFile flv = service.getStreamableFile(this.file);
    this.writer = flv.getWriter();

  }
View Full Code Here

TOP

Related Classes of org.red5.codec.StreamCodecInfo

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.