示例#1
0
        public Decoder(Type type, DecoderContext decCtx)
        {
            this.type   = type;
            this.decCtx = decCtx;
            opt         = decCtx.opt;

            decodeARE = new AutoResetEvent(false);
            packets   = new ConcurrentQueue <IntPtr>();
            frames    = new ConcurrentQueue <MediaFrame>();

            status = Status.NOTSET;
        }
示例#2
0
文件: Demuxer.cs 项目: huerd/Flyleaf
        public Demuxer(Type type = Type.Video, DecoderContext decCtx = null)
        {
            this.decCtx = decCtx;
            this.type   = type;
            status      = Status.NOTSET;

            switch (type)
            {
            case Type.Video:
                decoder = decCtx.vDecoder;
                mType   = AVMEDIA_TYPE_VIDEO;
                break;

            case Type.Audio:
                decoder = decCtx.aDecoder;
                mType   = AVMEDIA_TYPE_AUDIO;
                break;

            case Type.Subs:
                decoder = decCtx.sDecoder;
                mType   = AVMEDIA_TYPE_SUBTITLE;
                break;
            }

            demuxARE           = new AutoResetEvent(false);
            enabledStreams     = new List <int>();
            defaultAudioStream = -1;

            interruptClbk.Pointer = Marshal.GetFunctionPointerForDelegate(InterruptClbk);
            ioread.Pointer        = Marshal.GetFunctionPointerForDelegate(IORead);
            ioseek.Pointer        = Marshal.GetFunctionPointerForDelegate(IOSeek);

            gcPrevent = new List <object>();
            gcPrevent.Add(ioread);
            gcPrevent.Add(ioseek);
            gcPrevent.Add(IORead);
            gcPrevent.Add(IOSeek);
        }