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


Java ByteArrayImageInputStream.readShort方法代码示例

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


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

示例1: readSTRH

import org.monte.media.io.ByteArrayImageInputStream; //导入方法依赖的package包/类
/**
 * Reads an AVI Stream Header and returns a Track object.
 */
/*typedef struct {
 *     FOURCC enum aviStrhType type; 
 *        // Contains a FOURCC that specifies the type of the data contained in 
 *        // the stream. The following standard AVI values for video and audio are 
 *        // defined.
 *     FOURCC handler;
 *     DWORD  set aviStrhFlags flags;
 *     WORD   priority;
 *     WORD   language;
 *     DWORD  initialFrames;
 *     DWORD  scale;
 *     DWORD  rate;
 *     DWORD  startTime;
 *     DWORD  length;
 *     DWORD  suggestedBufferSize;
 *     DWORD  quality;
 *     DWORD  sampleSize;
 *    aviRectangle frame;
 * } AVISTREAMHEADER;     */
private Track readSTRH(byte[] data) throws IOException, ParseException {
    ByteArrayImageInputStream in = new ByteArrayImageInputStream(data, ByteOrder.LITTLE_ENDIAN);
    Track tr = null;

    in.setByteOrder(ByteOrder.BIG_ENDIAN);
    String type = intToType(in.readInt());
    in.setByteOrder(ByteOrder.LITTLE_ENDIAN);
    int handler = in.readInt();

    if (type.equals(AVIMediaType.AUDIO.fccType)) {
        tr = new AudioTrack(tracks.size(), handler);
    } else if (type.equals(AVIMediaType.VIDEO.fccType)) {
        tr = new VideoTrack(tracks.size(), handler, null);
    } else if (type.equals(AVIMediaType.MIDI.fccType)) {
        tr = new MidiTrack(tracks.size(), handler);
    } else if (type.equals(AVIMediaType.TEXT.fccType)) {
        tr = new TextTrack(tracks.size(), handler);
    } else {
        throw new ParseException("Unknown track type " + type);
    }

    tr.fccHandler = handler;

    tr.flags = in.readInt();
    tr.priority = in.readUnsignedShort();
    tr.language = in.readUnsignedShort();
    tr.initialFrames = in.readUnsignedInt();
    tr.scale = in.readUnsignedInt();
    tr.rate = in.readUnsignedInt();
    tr.startTime = in.readUnsignedInt();
    tr.length = in.readUnsignedInt();
    /*tr.suggestedBufferSize=*/ in.readUnsignedInt();
    tr.quality = in.readInt();
    /*tr.sampleSize=*/ in.readUnsignedInt();
    tr.frameLeft = in.readShort();
    tr.frameTop = in.readShort();
    tr.frameRight = in.readShort();
    tr.frameBottom = in.readShort();

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


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