private ITranscoder StartTranscoder(ITranscoder inTranscoder) { ITranscoder transcoder = inTranscoder; if ((object)transcoder != null) { // Don't reuse direct transcoders if (!transcoder.IsDirect && transcoders.Contains(transcoder)) { logger.IfInfo("Using existing transcoder"); // Get the existing transcoder int index = transcoders.IndexOf(transcoder); transcoder = transcoders[index]; // Increment the reference count transcoder.ReferenceCount++; } else { logger.IfInfo("Creating a new transcoder"); // Add the transcoder to the array transcoders.Add(transcoder); // Increment the reference count transcoder.ReferenceCount++; // Start the transcode process transcoder.StartTranscode(); } } return(transcoder); }