Exemplo n.º 1
0
        public Decoder(MediaType type, DecoderContext decCtx)
        {
            this.type   = type;
            this.decCtx = decCtx;

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

            status = Status.None;
        }
Exemplo n.º 2
0
        public Demuxer(MediaType type = MediaType.Video, DecoderContext decCtx = null)
        {
            this.decCtx = decCtx;
            this.type   = type;
            status      = Status.None;

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

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

            case MediaType.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);
        }