Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * @(#)AdjustTimeCodec
  * 
  * Copyright (c) 2011 Werner Randelshofer, Goldau, Switzerland.
  * All rights reserved.
  * 
  * You may not use, copy or modify this file, except in compliance with the
  * license agreement you entered into with Werner Randelshofer.
  * For details see accompanying license terms. 
 */
package org.monte.media.converter;
Adjusts the time stamp of the media.

Author(s):
Werner Randelshofer
Version:
$Id: AdjustTimeCodec.java 299 2013-01-03 07:40:18Z werner $
public class AdjustTimeCodec extends AbstractCodec {
    private Rational mediaTime=new Rational(0);
    public AdjustTimeCodec() {
        super(new Format[]{
                    new Format(), //
                },
                new Format[]{
                    new Format(), //
                });
         = "Adjust Time";
    }
    public Rational getMediaTime() {
        return ;
    }
    public void setMediaTime(Rational mediaTime) {
        this. = mediaTime;
    }
    @Override
    public Format setInputFormat(Format f) {
        Format fNew = super.setInputFormat(f);
         = fNew;
        return fNew;
    }
    @Override
    public int process(Buffer inBuffer out) {
        out.setMetaTo(in);
        out.setDataTo(in);
            if ( != null) {
                out.timeStamp = ;
                 = .add(out.sampleDuration.multiply(out.sampleCount));
            }
        return ;
    }
New to GrepCode? Check out our FAQ X