コード例 #1
0
ファイル: AviDemux.cs プロジェクト: lanchu/SkyZoneVR
        private static AVIStreamHeader ParseStreamHeader(AtomicBinaryReader br, long p)
        {
            var strh = new AVIStreamHeader();

            strh.fccType               = br.ReadUInt32(ref p);
            strh.fccHandler            = br.ReadUInt32(ref p);
            strh.dwFlags               = br.ReadUInt32(ref p);
            strh.wPriority             = br.ReadUInt16(ref p);
            strh.wLanguage             = br.ReadUInt16(ref p);
            strh.dwInitialFrames       = br.ReadUInt32(ref p);
            strh.dwScale               = br.ReadUInt32(ref p);
            strh.dwRate                = br.ReadUInt32(ref p);
            strh.dwStart               = br.ReadUInt32(ref p);
            strh.dwLength              = br.ReadUInt32(ref p);
            strh.dwSuggestedBufferSize = br.ReadUInt32(ref p);
            strh.dwQuality             = br.ReadUInt32(ref p);
            strh.dwSampleSize          = br.ReadUInt32(ref p);
            strh.rcFrameLeft           = br.ReadInt16(ref p);
            strh.rcFrameTop            = br.ReadInt16(ref p);
            strh.rcFrameRight          = br.ReadInt16(ref p);
            strh.rcFrameBottom         = br.ReadInt16(ref p);
            return(strh);
        }
コード例 #2
0
ファイル: AviDemux.cs プロジェクト: lanchu/SkyZoneVR
        private void ProcessAviChunk(RiffParser rp, uint fourCC, int unpaddedLength, int paddedLength)
        {
            //Debug.Log("CHUNK " + RiffParser.FromFourCC(fourCC) + " " + rp.Position + " " + unpaddedLength + " " + paddedLength);
            switch (fourCC)
            {
            case ID_avih:
                avi.avih = ParseMainHeader(rp.reader, rp.Position);
                break;

            case ID_strh:
                AVIStreamHeader strh = ParseStreamHeader(rp.reader, rp.Position);
                currentStrh4CC = strh.fccType;
                if (currentStrh4CC == FCC_vids)
                {
                    avi.strhVideo = strh;
                }
                else if (currentStrh4CC == FCC_auds)
                {
                    avi.strhAudio = strh;
                }
                else
                {
                                        #if MP_DEBUG
                    Debug.LogWarning("Skipping unknown stream header with fccType=" + currentStrh4CC);
                                        #endif
                }
                break;

            case ID_strf:
                if (currentStrh4CC == FCC_vids)
                {
                    avi.strfVideo = ParseVideoFormatHeader(rp.reader, rp.Position);
                }
                else if (currentStrh4CC == FCC_auds)
                {
                    avi.strfAudio = ParseAudioFormatHeader(rp.reader, rp.Position);
                }
                break;

            case ID_idx1:
                idx1Offset = rp.Position;
                idx1Size   = unpaddedLength;
                // index.idx1 will be filled later in ParseIndex method
                break;

            case ID_dmlh:             // OpenDML header
                avi.odml = ParseOdmlHeader(rp.reader, rp.Position);
                break;

            case ID_indx:             // OpenDML index
                uint streamId;
                var  index = ParseOdmlIndex(rp.reader, rp.Position, out streamId);
                if (streamId == ID_00dc || streamId == ID_00db)
                {
                    avi.videoIndex = index;
                }
                else if (streamId == ID_01wb)
                {
                    avi.audioIndex = index;
                }
                                #if MP_DEBUG
                else
                {
                    Debug.LogWarning("Ignoring index for unknown stream " + RiffParser.FromFourCC(streamId));
                }
                                #endif
                break;

                        #if MP_DEBUG
            default:
                // comment in for logging chunks that are ignored (not relevant for us)
                //Debug.Log("Ignoring CHUNK " + RiffParser.FromFourCC(fourCC) + " " + unpaddedLength + " " + paddedLength);
                break;
                        #endif
            }
        }