Package org.jaudiotagger.audio.asf.data

Examples of org.jaudiotagger.audio.asf.data.AsfHeader


   */
    @Override
  public void process(RandomAccessFile file, String filename) throws Exception {
      file.seek(0);
    // Let the audio library read the ASF file.
    AsfHeader header = AsfHeaderReader.readHeader(file);

    VideoStreamChunk video = null;
    for (Chunk chunk : header.getChunks()) {
            if (chunk instanceof VideoStreamChunk)
                video = (VideoStreamChunk) chunk;
    }
   
    this.videoStreamPresent = video != null;

    if (this.videoStreamPresent) {
      setVideoResolution(video.getPictureWidth() + "x" + video.getPictureHeight());
      setVideoCodec(video.getCodecIdAsString());
      setDuration(header.getFileHeader().getDurationInSeconds());
     
      // The average bit rate of the video is as hard to gather as the FPS.
      // However in this case there is a recommended chunk in ASF files
      // which contains this information.
      StreamBitratePropertiesChunk propertiesChunk = header.getStreamBitratePropertiesChunk();
      if (propertiesChunk != null)
        setVideoBitRate((int) propertiesChunk.getAvgBitrate(video.getStreamNumber()));

      // The audio part of the video. (optional)
      if (header.getAudioStreamChunk() != null) {
        setAudioCodec(header.getAudioStreamChunk().getCodecDescription());
        setAudioRate((int) header.getAudioStreamChunk().getSamplingRate());
        setAudioBitRate(header.getAudioStreamChunk().getKbps() * 1000);
        setAudioChannels((int) header.getAudioStreamChunk().getChannelCount());
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.jaudiotagger.audio.asf.data.AsfHeader

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.