private void disposeDecoder()
 {
     if (_decoder != null)
     {
         _decoder.VideoFrameEvent -= onDisplay;
         _decoder.Dispose();
     }
     _decoder = null;
 }
Beispiel #2
0
        private bool?GetNextDecoder(bool keepOldDecoder)
        {
            // look for the next unplayed decoder after our current decoder
            LinkedListNode <IStreamDecoder> node;

            if (_streamDecoder == null)
            {
                // first stream...
                node = _streamDecoders.First;
            }
            else
            {
                node = _streamDecoders.Find(_streamDecoder);
                while (node != null && node.Value.IsEndOfStream)
                {
                    node = node.Next;
                }
            }

            // clean up and remove the old decoder if we're not keeping it
            if (!keepOldDecoder)
            {
                _streamDecoders.Remove(_streamDecoder);
                _streamDecoder.Dispose();
            }

            // finally, if we still don't have a valid decoder, try to find a new stream in the container
            if (node == null && FindNextStream())
            {
                node = _streamDecoders.Last;
            }

            // switch to the new decoder, if one was found
            if (node != null)
            {
                return(SwitchToDecoder(node.Value));
            }
            return(null);
        }