当前位置: 首页>>代码示例>>Java>>正文


Java Rational.valueOf方法代码示例

本文整理汇总了Java中org.monte.media.math.Rational.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java Rational.valueOf方法的具体用法?Java Rational.valueOf怎么用?Java Rational.valueOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.monte.media.math.Rational的用法示例。


在下文中一共展示了Rational.valueOf方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MonteScreenRecorder

import org.monte.media.math.Rational; //导入方法依赖的package包/类
public MonteScreenRecorder() {
	GraphicsConfiguration gc = GraphicsEnvironment
			.getLocalGraphicsEnvironment().getDefaultScreenDevice()
			.getDefaultConfiguration();
	this.files = new TreeSet<File>();
	try {
		this.screenRecorder = new ScreenRecorder(gc, new Format(
				MediaTypeKey, MediaType.FILE, MimeTypeKey, FormatKeys.MIME_QUICKTIME),
				new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey,
						VideoFormatKeys.ENCODING_QUICKTIME_ANIMATION,
						CompressorNameKey,
						ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, DepthKey,
						24, FrameRateKey, Rational.valueOf(15), QualityKey,
						1.0f, KeyFrameIntervalKey, 15 * 60), new Format(
						MediaTypeKey, MediaType.VIDEO, EncodingKey,
						"black", FrameRateKey, Rational.valueOf(30)), null);
	} catch (Exception e) {
		throw new RuntimeException(e);
	}

}
 
开发者ID:bharathkumar-gopalan,项目名称:grid-video-recorder,代码行数:22,代码来源:MonteScreenRecorder.java

示例2: SpecializedScreenRecorder

import org.monte.media.math.Rational; //导入方法依赖的package包/类
public SpecializedScreenRecorder(GraphicsConfiguration cfg, String name,
		Configuration config) throws IOException, AWTException {
	super(cfg, new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey,
			config.getValue("video.format", MIME_QUICKTIME)), new Format(
			MediaTypeKey, MediaType.VIDEO, EncodingKey,
			config.getValue("video.encoding",
					ENCODING_QUICKTIME_CINEPAK),
			CompressorNameKey, config.getValue("video.compression",
					COMPRESSOR_NAME_QUICKTIME_CINEPAK), DepthKey,
			(int) 24, FrameRateKey, Rational.valueOf(Integer
					.parseInt(config.getValue("video.format.frameRate",
							"15"))), QualityKey, 1.0f, KeyFrameIntervalKey,
			(int) (15 * 60)), new Format(MediaTypeKey, MediaType.VIDEO,
			EncodingKey, "black", FrameRateKey, Rational.valueOf(30)), null);
	this.name = name;
	this.config = config;
	this.setMaxFileSize(Long.parseLong(config.getValue("maxFileSize",MAX_SIZE_DEFAULT_KB)));
	this.setMaxRecordingTime(Long.parseLong(config.getValue("maxRecordingTime",MAX_DURATION_DEFAULT_MS)));
}
 
开发者ID:sugarcrm,项目名称:candybean,代码行数:20,代码来源:SpecializedScreenRecorder.java

示例3: initScreen

import org.monte.media.math.Rational; //导入方法依赖的package包/类
/**
 * initializes a graphic configurations
 */
public static void initScreen() {
	// get the graphics configuration of the current screen
	GraphicsConfiguration gc = GraphicsEnvironment
			.getLocalGraphicsEnvironment()
			.getDefaultScreenDevice()
			.getDefaultConfiguration();

	// set screen recorder configuration
	try {
		screenLogger = new ScreenRecorder(gc, null,
				new Format(MediaTypeKey, MediaType.FILE, MimeTypeKey, MIME_AVI),
				new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,
						CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,
						DepthKey, 24, FrameRateKey, Rational.valueOf(15),
						QualityKey, 1.0f,
						KeyFrameIntervalKey, 15 * 60),
				new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, "black",
						FrameRateKey, Rational.valueOf(30)),
				null, new File(pathToFile));
	} catch (IOException ioe) {
		ioe.printStackTrace();
	} catch (AWTException awte) {
		awte.printStackTrace();
	}
}
 
开发者ID:atinfo,项目名称:at.info-knowledge-base,代码行数:29,代码来源:CaptureVideo.java

示例4: getScreenRecorder

import org.monte.media.math.Rational; //导入方法依赖的package包/类
private MonteScreenRecorder getScreenRecorder() {
    int frameRate = videoConfiguration.frameRate();

    Format fileFormat = new Format(MediaTypeKey, MediaType.VIDEO, MimeTypeKey, FormatKeys.MIME_AVI);
    Format screenFormat = new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey,
            ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,
            CompressorNameKey, ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE,
            DepthKey, 24, FrameRateKey, Rational.valueOf(frameRate),
            QualityKey, 1.0f,
            KeyFrameIntervalKey, 15 * 60);
    Format mouseFormat = new Format(MediaTypeKey, MediaType.VIDEO, EncodingKey, "black",
            FrameRateKey, Rational.valueOf(frameRate));

    Dimension screenSize = videoConfiguration.screenSize();
    int width = screenSize.width;
    int height = screenSize.height;

    Rectangle captureSize = new Rectangle(0, 0, width, height);

    return MonteScreenRecorderBuilder
            .builder()
            .setGraphicConfig(getGraphicConfig())
            .setRectangle(captureSize)
            .setFileFormat(fileFormat)
            .setScreenFormat(screenFormat)
            .setFolder(new File(videoConfiguration.folder()))
            .setMouseFormat(mouseFormat).build();
}
 
开发者ID:SergeyPirogov,项目名称:video-recorder-java,代码行数:29,代码来源:MonteRecorder.java

示例5: fromAudioFormat

import org.monte.media.math.Rational; //导入方法依赖的package包/类
public static Format fromAudioFormat(AudioFormat fmt) {
    return new Format(
            MediaTypeKey, MediaType.AUDIO,
            EncodingKey, fmt.getEncoding().toString(),
            SampleRateKey, Rational.valueOf(fmt.getSampleRate()),
            SampleSizeInBitsKey, fmt.getSampleSizeInBits(),
            ChannelsKey, fmt.getChannels(),
            FrameSizeKey, fmt.getFrameSize(),
            FrameRateKey, Rational.valueOf(fmt.getFrameRate()),
            ByteOrderKey, fmt.isBigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN,
            SignedKey, Encoding.PCM_SIGNED.equals(fmt.getEncoding())//,
            //
            );
}
 
开发者ID:pojosontheweb,项目名称:selenium-utils,代码行数:15,代码来源:AudioFormatKeys.java

示例6: fromAudioFormat

import org.monte.media.math.Rational; //导入方法依赖的package包/类
public static Format fromAudioFormat(javax.sound.sampled.AudioFormat fmt) {
    return new Format(
            MediaTypeKey, MediaType.AUDIO,
            EncodingKey, fmt.getEncoding().toString(),
            SampleRateKey, Rational.valueOf(fmt.getSampleRate()),
            SampleSizeInBitsKey, fmt.getSampleSizeInBits(),
            ChannelsKey, fmt.getChannels(),
            FrameSizeKey, fmt.getFrameSize(),
            FrameRateKey, Rational.valueOf(fmt.getFrameRate()),
            ByteOrderKey, fmt.isBigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN,
            SignedKey, AudioFormat.Encoding.PCM_SIGNED.equals(fmt.getEncoding())//,
            //
            );
}
 
开发者ID:jindrapetrik,项目名称:jpexs-decompiler,代码行数:15,代码来源:AudioFormatKeys.java

示例7: run

import org.monte.media.math.Rational; //导入方法依赖的package包/类
@Override
public void run() {
    Buffer buf = new Buffer();
    AudioFormat lineFormat = line.getFormat();
    buf.format = fromAudioFormat(lineFormat).append(SilenceBugKey, true);

    // For even sample rates, we select a buffer size that can 
    // hold half a second of audio. This allows audio/video interlave
    // twice a second, as recommended for AVI and QuickTime movies.
    // For odd sample rates, we have to select a buffer size that can hold
    // one second of audio. 
    int bufferSize = lineFormat.getFrameSize() * (int) lineFormat.getSampleRate();
    if (((int) lineFormat.getSampleRate() & 1) == 0) {
        bufferSize /= 2;
    }

    byte bdat[] = new byte[bufferSize];
    buf.data = bdat;
    Rational sampleRate = Rational.valueOf(lineFormat.getSampleRate());
    Rational frameRate = Rational.valueOf(lineFormat.getFrameRate());
    int count = line.read(bdat, 0, bdat.length);
    if (count > 0) {
        computeAudioLevel(bdat, count, lineFormat);
        buf.sampleCount = count / (lineFormat.getSampleSizeInBits() / 8 * lineFormat.getChannels());
        buf.sampleDuration = sampleRate.inverse();
        buf.offset = 0;
        buf.sequenceNumber = sequenceNumber++;
        buf.length = count;
        buf.track = audioTrack;
        buf.timeStamp = new Rational(totalSampleCount, 1).divide(frameRate);

        // Check if recording should be stopped
        Rational stopTS = new Rational(getStopTime() - startTime, 1000);
        if (buf.timeStamp.add(buf.sampleDuration.multiply(buf.sampleCount)).compareTo(stopTS) > 0) {
            // we recorderd too much => truncate the buffer 
            buf.sampleCount = Math.max(0, (int) Math.ceil(stopTS.subtract(buf.timeStamp).divide(buf.sampleDuration).floatValue()));
            buf.length = buf.sampleCount * (lineFormat.getSampleSizeInBits() / 8 * lineFormat.getChannels());

            future.cancel(false);
        }
        if (buf.sampleCount > 0) {
            try {
                queue.put(buf);
            } catch (InterruptedException ex) {
                // nothing to do
            }
        }
        totalSampleCount += buf.sampleCount;
    }
}
 
开发者ID:pojosontheweb,项目名称:selenium-utils,代码行数:51,代码来源:ScreenRecorder.java

示例8: addAudioTrack

import org.monte.media.math.Rational; //导入方法依赖的package包/类
/**
 * Adds an audio track.
 *
 * @param waveFormatTag The format of the audio stream given in MMREG.H, for
 * example 0x0001 for WAVE_FORMAT_PCM.
 * @param scale The numerator of the sample rate.
 * @param rate The denominator of the sample rate.
 * @param numberOfChannels The number of channels: 1 for mono, 2 for stereo.
 * @param sampleSizeInBits The number of bits in a sample: 8 or 16.
 * @param isCompressed Whether the sound is compressed.
 * @param frameDuration The frame duration, expressed in the media’s
 * timescale, where the timescale is equal to the sample rate. For
 * uncompressed formats, this field is always 1.
 * @param frameSize For uncompressed audio, the number of bytes in a sample
 * for a single channel (sampleSize divided by 8). For compressed audio, the
 * number of bytes in a frame.
 *
 * @throws IllegalArgumentException if the format is not 4 characters long,
 * if the time scale is not between 1 and 2^32, if the integer portion of
 * the sampleRate is not equal to the scale, if numberOfChannels is not 1 or
 * 2.
 * @return Returns the track index.
 */
public int addAudioTrack(int waveFormatTag, //
        long scale, long rate, //
        int numberOfChannels, int sampleSizeInBits, //
        boolean isCompressed, //
        int frameDuration, int frameSize) throws IOException {
    ensureFinished();

    if (scale < 1 || scale > (2L << 32)) {
        throw new IllegalArgumentException("timeScale must be between 1 and 2^32:" + scale);
    }
    if (numberOfChannels != 1 && numberOfChannels != 2) {
        throw new IllegalArgumentException("numberOfChannels must be 1 or 2: " + numberOfChannels);
    }
    if (sampleSizeInBits != 8 && sampleSizeInBits != 16) {
        throw new IllegalArgumentException("sampleSize must be 8 or 16: " + numberOfChannels);
    }

    AudioTrack t = new AudioTrack(tracks.size(), typeToInt("\u0000\u0000\u0000\u0000"));
    t.wFormatTag = waveFormatTag;

    float afSampleRate = (float) rate / (float) scale;

    t.format = new Format(MediaTypeKey, MediaType.AUDIO,
            MimeTypeKey, MIME_AVI,
            EncodingKey, RIFFParser.idToString(waveFormatTag),
            SampleRateKey, Rational.valueOf(afSampleRate),
            SampleSizeInBitsKey, sampleSizeInBits,
            ChannelsKey, numberOfChannels,
            FrameSizeKey, frameSize,
            FrameRateKey, Rational.valueOf(afSampleRate),
            SignedKey, sampleSizeInBits != 8,
            ByteOrderKey, ByteOrder.LITTLE_ENDIAN);

    t.scale = scale;
    t.rate = rate;
    t.samplesPerSec = rate / scale;
    t.channels = numberOfChannels;
    t.avgBytesPerSec = t.samplesPerSec * frameSize;
    t.blockAlign = t.channels * sampleSizeInBits / 8;
    t.bitsPerSample = sampleSizeInBits;
    tracks.add(t);
    return tracks.size() - 1;
}
 
开发者ID:pojosontheweb,项目名称:selenium-utils,代码行数:67,代码来源:AVIOutputStream.java

示例9: addAudioTrack

import org.monte.media.math.Rational; //导入方法依赖的package包/类
/**
 * Adds an audio track.
 *
 * @param compressionType The QuickTime 4-character code. A list of
 * supported 4-Character codes is given in qtff, table 3-7, page 113.
 * @param timeScale The media time scale between 1 and 2^32.
 * @param sampleRate The sample rate. The integer portion must match the
 * {@code timeScale}.
 * @param numberOfChannels The number of channels: 1 for mono, 2 for stereo.
 * @param sampleSizeInBits The number of bits in a sample: 8 or 16.
 * @param isCompressed Whether the sound is compressed.
 * @param frameDuration The frame duration, expressed in the media’s
 * timescale, where the timescale is equal to the sample rate. For
 * uncompressed formats, this field is always 1.
 * @param frameSize For uncompressed audio, the number of bytes in a sample
 * for a single channel (sampleSize divided by 8). For compressed audio, the
 * number of bytes in a frame.
 *
 * @throws IllegalArgumentException if the audioFormat is not 4 characters
 * long, if the time scale is not between 1 and 2^32, if the integer portion
 * of the sampleRate is not equal to the timeScale, if numberOfChannels is
 * not 1 or 2.
 * @return Returns the track index.
 */
public int addAudioTrack(String compressionType, //
        long timeScale, double sampleRate, //
        int numberOfChannels, int sampleSizeInBits, //
        boolean isCompressed, //
        int frameDuration, int frameSize, boolean signed, ByteOrder byteOrder) throws IOException {
    ensureStarted();
    if (compressionType == null || compressionType.length() != 4) {
        throw new IllegalArgumentException("audioFormat must be 4 characters long:" + compressionType);
    }
    if (timeScale < 1 || timeScale > (2L << 32)) {
        throw new IllegalArgumentException("timeScale must be between 1 and 2^32:" + timeScale);
    }
    if (timeScale != (int) Math.floor(sampleRate)) {
        throw new IllegalArgumentException("timeScale: " + timeScale + " must match integer portion of sampleRate: " + sampleRate);
    }
    if (numberOfChannels != 1 && numberOfChannels != 2) {
        throw new IllegalArgumentException("numberOfChannels must be 1 or 2: " + numberOfChannels);
    }
    if (sampleSizeInBits != 8 && sampleSizeInBits != 16) {
        throw new IllegalArgumentException("sampleSize must be 8 or 16: " + numberOfChannels);
    }

    AudioTrack t = new AudioTrack();
    t.mediaCompressionType = compressionType;
    t.mediaTimeScale = timeScale;
    t.soundSampleRate = sampleRate;
    t.soundCompressionId = isCompressed ? -2 : -1;
    t.soundNumberOfChannels = numberOfChannels;
    t.soundSampleSize = sampleSizeInBits;
    t.soundSamplesPerPacket = frameDuration;
    if (isCompressed) {
        t.soundBytesPerPacket = frameSize;
        t.soundBytesPerFrame = frameSize * numberOfChannels;
    } else {
        t.soundBytesPerPacket = frameSize / numberOfChannels;
        t.soundBytesPerFrame = frameSize;
    }
    t.soundBytesPerSample = sampleSizeInBits / 8;

    t.format = new Format(
            MediaTypeKey, MediaType.AUDIO,
            MimeTypeKey, MIME_QUICKTIME,
            EncodingKey, compressionType,
            SampleRateKey, Rational.valueOf(sampleRate),
            SampleSizeInBitsKey, sampleSizeInBits,
            ChannelsKey, numberOfChannels,
            FrameSizeKey, frameSize,
            SampleRateKey, Rational.valueOf(sampleRate),
            SignedKey, signed,
            ByteOrderKey, byteOrder);
    tracks.add(t);
    return tracks.size() - 1;
}
 
开发者ID:pojosontheweb,项目名称:selenium-utils,代码行数:78,代码来源:QuickTimeOutputStream.java

示例10: parseTime

import org.monte.media.math.Rational; //导入方法依赖的package包/类
private static Rational parseTime(String str, ArrayList<File> infiles, MovieReader[] r) throws IOException {
    if (str != null) {
        try {
            return Rational.valueOf(str);
        } catch (NumberFormatException e) {
            if (r[0] == null && !infiles.isEmpty()) {
                r[0] = Registry.getInstance().getReader(infiles.get(0));
            }
            if (r[0] != null) {
                int t = r[0].findTrack(0, new Format(MediaTypeKey, MediaType.VIDEO));
                if (t != -1) {
                    Format f = r[0].getFormat(t);
                    Rational frameRate = f.get(FrameRateKey);

                    long seconds = 0, frame = 0;
                    StreamTokenizer tt = new StreamTokenizer(new StringReader(str));
                    tt.resetSyntax();
                    tt.wordChars('0', '9');
                    if (tt.nextToken() != StreamTokenizer.TT_WORD) {
                        throw new NumberFormatException("hh:mm:ss.frame, hours missing: " + str);
                    }
                    seconds += Long.valueOf(tt.sval) * 3600;
                    if (tt.nextToken() != ':') {
                        throw new NumberFormatException("hh:mm:ss.frame, 1st ':' missing: " + str);
                    }
                    if (tt.nextToken() != StreamTokenizer.TT_WORD) {
                        throw new NumberFormatException("hh:mm:ss.frame, minutes missing: " + str);
                    }
                    seconds += Long.valueOf(tt.sval) * 60;
                    if (tt.nextToken() != ':') {
                        throw new NumberFormatException("hh:mm:ss.frame, 2nd ':' missing: " + str);
                    }
                    if (tt.nextToken() != StreamTokenizer.TT_WORD) {
                        throw new NumberFormatException("hh:mm:ss, seconds missing: " + str);
                    }
                    seconds += Long.valueOf(tt.sval);
                    if (tt.nextToken() == '.') {// frame number is optional
                        if (tt.nextToken() != StreamTokenizer.TT_WORD) {
                            throw new NumberFormatException("hh:mm:ss.frame, frames missing: " + str);
                        }
                        frame += Long.valueOf(tt.sval);
                    }
                    return new Rational(seconds).add(new Rational(frame).divide(frameRate));
                }
            }
        }
    }
    return null;
}
 
开发者ID:sebkur,项目名称:montemedia,代码行数:50,代码来源:TrimDemoMain.java

示例11: readAudioSTRF

import org.monte.media.math.Rational; //导入方法依赖的package包/类
/**
 * /**
 * <p> The format of a video track is defined in a "strf" chunk, which
 * contains a {@code WAVEFORMATEX} struct.
 * <pre>
 * ----------------------
 * AVI Wave Format Header
 * ----------------------
 * // values for this enum taken from mmreg.h
 * enum {
 *         WAVE_FORMAT_PCM = 0x0001,
 *         //  Microsoft Corporation
 *       ...many more...
 * } wFormatTagEnum;
 *
 * typedef struct {
 *   WORD enum wFormatTagEnum formatTag;
 *   WORD  numberOfChannels;
 *   DWORD samplesPerSec;
 *   DWORD avgBytesPerSec;
 *   WORD  blockAlignment;
 *   WORD  bitsPerSample;
 *   WORD  cbSize;
 *     // Size, in bytes, of extra format information appended to the end of the
 *     // WAVEFORMATEX structure. This information can be used by non-PCM formats
 *     // to store extra attributes for the "wFormatTag". If no extra information
 *     // is required by the "wFormatTag", this member must be set to zero. For
 *     // WAVE_FORMAT_PCM formats (and only WAVE_FORMAT_PCM formats), this member
 *     // is ignored.
 *   byte[cbSize] extra;
 * } WAVEFORMATEX;
 * </pre>
 *
 *
 * @param tr
 * @param data
 * @throws java.io.IOException
 */
private void readAudioSTRF(AudioTrack tr, byte[] data) throws IOException {
    ByteArrayImageInputStream in = new ByteArrayImageInputStream(data, ByteOrder.LITTLE_ENDIAN);

    String formatTag = RIFFParser.idToString(in.readUnsignedShort());
    tr.channels = in.readUnsignedShort();
    tr.samplesPerSec = in.readUnsignedInt();
    tr.avgBytesPerSec = in.readUnsignedInt();
    tr.blockAlign = in.readUnsignedShort();
    tr.bitsPerSample = in.readUnsignedShort();
    if (data.length > 16) {
        long cbSize = in.readUnsignedShort();
        // FIXME - Don't ignore extra format information
    }

    tr.format = new Format(MimeTypeKey, MIME_AVI,
            MediaTypeKey, MediaType.AUDIO,
            EncodingKey, formatTag,
            SampleRateKey, Rational.valueOf(tr.samplesPerSec),
            SampleSizeInBitsKey, tr.bitsPerSample,
            ChannelsKey, tr.channels,
            FrameSizeKey, tr.blockAlign,
            FrameRateKey, new Rational(tr.samplesPerSec, 1),
            SignedKey, tr.bitsPerSample != 8,
            ByteOrderKey, ByteOrder.LITTLE_ENDIAN);

}
 
开发者ID:pojosontheweb,项目名称:selenium-utils,代码行数:65,代码来源:AVIInputStream.java

示例12: readAudioSTRF

import org.monte.media.math.Rational; //导入方法依赖的package包/类
/**
 * /**
 * <p> The format of a video track is defined in a "strf" chunk, which
 * contains a {@code WAVEFORMATEX} struct.
 * <pre>
 * ----------------------
 * AVI Wave Format Header
 * ----------------------
 * // values for this enum taken from mmreg.h
 * enum {
 *         WAVE_FORMAT_PCM = 0x0001,
 *         //  Microsoft Corporation
 *       ...many more...
 * } wFormatTagEnum;
 *
 * typedef struct {
 *   WORD enum wFormatTagEnum formatTag;
 *   WORD  numberOfChannels;
 *   DWORD samplesPerSec;
 *   DWORD avgBytesPerSec;
 *   WORD  blockAlignment;
 *   WORD  bitsPerSample;
 *   WORD  cbSize;
 *     // Size, in bytes, of extra format information appended to the end of the
 *     // WAVEFORMATEX structure. This information can be used by non-PCM formats
 *     // to store extra attributes for the "wFormatTag". If no extra information
 *     // is required by the "wFormatTag", this member must be set to zero. For
 *     // WAVE_FORMAT_PCM formats (and only WAVE_FORMAT_PCM formats), this member
 *     // is ignored.
 *   byte[cbSize] extra;
 * } WAVEFORMATEX;
 * </pre>
 *
 *
 * @param tr
 * @param data
 * @throws IOException
 */
private void readAudioSTRF(AudioTrack tr, byte[] data) throws IOException {
    ByteArrayImageInputStream in = new ByteArrayImageInputStream(data, ByteOrder.LITTLE_ENDIAN);

    String formatTag = RIFFParser.idToString(in.readUnsignedShort());
    tr.channels = in.readUnsignedShort();
    tr.samplesPerSec = in.readUnsignedInt();
    tr.avgBytesPerSec = in.readUnsignedInt();
    tr.blockAlign = in.readUnsignedShort();
    tr.bitsPerSample = in.readUnsignedShort();
    if (data.length > 16) {
        long cbSize = in.readUnsignedShort();
        // FIXME - Don't ignore extra format information
    }

    tr.format = new Format(MimeTypeKey, MIME_AVI,
            MediaTypeKey, MediaType.AUDIO,
            EncodingKey, formatTag,
            SampleRateKey, Rational.valueOf(tr.samplesPerSec),
            SampleSizeInBitsKey, tr.bitsPerSample,
            ChannelsKey, tr.channels,
            FrameSizeKey, tr.blockAlign,
            FrameRateKey, new Rational(tr.samplesPerSec, 1),
            SignedKey, tr.bitsPerSample != 8,
            ByteOrderKey, ByteOrder.LITTLE_ENDIAN);

}
 
开发者ID:sebkur,项目名称:montemedia,代码行数:65,代码来源:AVIInputStream.java


注:本文中的org.monte.media.math.Rational.valueOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。