Package net.sourceforge.jaad.mp4.api

Examples of net.sourceforge.jaad.mp4.api.MetaData


        return false;
    }

    private void initDecoder(long sample) throws IOException {
        in.seek(0);
        MP4Container cont = new MP4Container(in);
        Movie movie = cont.getMovie();
        List<net.sourceforge.jaad.mp4.api.Track> tracks = movie.getTracks(AudioTrack.AudioCodec.AAC);

        if (tracks == null || tracks.isEmpty()) {
            throw new IOException("Could not find AAC track");
        }
View Full Code Here


  private AudioFormat audioFormat;
  private byte[] saved;

  MP4AudioInputStream(InputStream in, AudioFormat format, long length) throws IOException {
    super(in, format, length);
    final MP4Container cont = new MP4Container(in);
    final Movie movie = cont.getMovie();
    final List<Track> tracks = movie.getTracks(AudioTrack.AudioCodec.AAC);
    if(tracks.isEmpty()) throw new IOException("movie does not contain any AAC track");
    track = (AudioTrack) tracks.get(0);

    decoder = new Decoder(track.getDecoderSpecificInfo());
View Full Code Here

 
  private void decodeMP4(String in) throws Exception {
    byte[] b;
    try {
      //create container
      final MP4Container cont = new MP4Container(new RandomAccessFile(in, "r"));
      final Movie movie = cont.getMovie();
      //find AAC track
      List<net.sourceforge.jaad.mp4.api.Track> tracks = movie.getTracks(AudioTrack.AudioCodec.AAC);
      if(tracks.isEmpty()) throw new Exception("movie does not contain any AAC track");
      audioTrack = (AudioTrack) tracks.get(0);
      //create audio format
View Full Code Here

    if(!track.hasMoreFrames()) {
      buffer.close();
      return;
    }
    try {
      final Frame frame = track.readNextFrame();
      if(frame==null) {
        buffer.close();
        return;
      }
      decoder.decodeFrame(frame.getData(), sampleBuffer);
    }
    catch(IOException e) {
      buffer.close();
      return;
    }
View Full Code Here

     
     
      //create AAC decoder
      Decoder dec = new Decoder(audioTrack.getDecoderSpecificInfo());
      //decode
      Frame frame;
      SampleBuffer buf = new SampleBuffer();
      while(audioTrack.hasMoreFrames()) {
        frame = audioTrack.readNextFrame();
        try {
          dec.decodeFrame(frame.getData(), buf);
          b = buf.getData();
          line.write(b, 0, b.length);
        }
        catch(AACException e) {
          e.printStackTrace();
View Full Code Here

            audioFormat = new AudioFormat((float) track.getSampleRate(), bps * 8, track.getChannelCount(), true, false);
    }

    private void parseGaplessInfo(Movie movie) {
        gaplessPadding = track.getLastFramePadding();
        MetaData metaData = movie.getMetaData();
        String iTunSMPB = metaData.get(MetaData.Field.GAPLESS_PLAYBACK);
        if (iTunSMPB != null && iTunSMPB.length() > 0) {
            String[] data = iTunSMPB.trim().split(" ");
            gaplessDelay = Integer.parseInt(data[1], 16);
            gaplessPadding = (int) (track.getSampleDuration(0) - Integer.parseInt(data[2], 16));
        } else {
            //now estimate gapless delay based on the tool
            String tool = metaData.get(MetaData.Field.ENCODER_TOOL);
            if (tool != null && !tool.isEmpty()) {
                if (tool.startsWith("Nero")) {
                    gaplessDelay = (int) (track.getSampleDuration(0) * 2 + 576);
                } else if (tool.startsWith("FAAC")) {
                    gaplessDelay = (int) track.getSampleDuration(0);
View Full Code Here

    }

    private void initDecoder(long sample) throws IOException {
        in.seek(0);
        MP4Container cont = new MP4Container(in);
        Movie movie = cont.getMovie();
        List<net.sourceforge.jaad.mp4.api.Track> tracks = movie.getTracks(AudioTrack.AudioCodec.AAC);

        if (tracks == null || tracks.isEmpty()) {
            throw new IOException("Could not find AAC track");
        }
View Full Code Here

  private byte[] saved;

  MP4AudioInputStream(InputStream in, AudioFormat format, long length) throws IOException {
    super(in, format, length);
    final MP4Container cont = new MP4Container(in);
    final Movie movie = cont.getMovie();
    final List<Track> tracks = movie.getTracks(AudioTrack.AudioCodec.AAC);
    if(tracks.isEmpty()) throw new IOException("movie does not contain any AAC track");
    track = (AudioTrack) tracks.get(0);

    decoder = new Decoder(track.getDecoderSpecificInfo());
    sampleBuffer = new SampleBuffer();
View Full Code Here

  }

  //TODO: pdin, movie fragments??
  public Movie getMovie() {
    if(moov==null) return null;
    else if(movie==null) movie = new Movie(moov, in);
    return movie;
  }
View Full Code Here

  private void decodeMP4(String in) throws Exception {
    byte[] b;
    try {
      //create container
      final MP4Container cont = new MP4Container(new RandomAccessFile(in, "r"));
      final Movie movie = cont.getMovie();
      //find AAC track
      List<net.sourceforge.jaad.mp4.api.Track> tracks = movie.getTracks(AudioTrack.AudioCodec.AAC);
      if(tracks.isEmpty()) throw new Exception("movie does not contain any AAC track");
      audioTrack = (AudioTrack) tracks.get(0);
      //create audio format
      final AudioFormat aufmt = new AudioFormat(audioTrack.getSampleRate(), audioTrack.getSampleSize(), audioTrack.getChannelCount(), true, true);
      line = AudioSystem.getSourceDataLine(aufmt);
View Full Code Here

TOP

Related Classes of net.sourceforge.jaad.mp4.api.MetaData

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.