當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。