Vidka.Core.DragAndDropManager.metaGenerator_MetaReady C# (CSharp) Метод

metaGenerator_MetaReady() приватный Метод

private metaGenerator_MetaReady ( string filename, VideoMetadataUseful meta ) : void
filename string
meta Vidka.Core.VideoMeta.VideoMetadataUseful
Результат void
        private void metaGenerator_MetaReady(string filename, VideoMetadataUseful meta)
        {
            lock (this)
            {
                // 2 cases: meta is ready for one of the draggies, or for one of the outstanding media
                var draggyMaybe = _draggies.FirstOrDefault(x => x.Filename == filename);
                if (draggyMaybe != null)
                {
                    draggyMaybe.Meta = meta;
                    if (MetaReadyForDraggy != null)
                        MetaReadyForDraggy(filename, meta);
                    return;
                }
                // at this point it could be one of outstanding media (video or audio)
                var outstandingMaybeVid = outstandingVideo.FirstOrDefault(x => x.FileName == filename);
                if (outstandingMaybeVid != null)
                {
                    // TODO: handle variable fps, fps == proj.fps and counted frames for PENTAX avis
                    outstandingMaybeVid.FileLengthSec = meta.GetVideoDurationSec(Proj.FrameRate);
                    // remember, this clip could be different fps, we need proj's fps
                    var projFramesThisOne = Proj.SecToFrame(outstandingMaybeVid.FileLengthSec ?? 0);
                    outstandingMaybeVid.FileLengthFrames = projFramesThisOne;
                    outstandingMaybeVid.FrameEnd = projFramesThisOne;
                    if (outstandingMaybeVid is VidkaClipVideo)
                    {
                        var outstandingMaybeVidVVV = (VidkaClipVideo)outstandingMaybeVid;
                        outstandingMaybeVidVVV.HasAudioXml = meta.HasAudio;
                    }
                    outstandingMaybeVid.IsNotYetAnalyzed = false;
                    outstandingVideo.Remove(outstandingMaybeVid);
                    if (MetaReadyForOutstandingVideo != null)
                        MetaReadyForOutstandingVideo(outstandingMaybeVid, meta);
                    return;
                }
                var outstandingMaybeAud = outstandingAudio.FirstOrDefault(x => x.FileName == filename);
                if (outstandingMaybeAud != null)
                {
                    outstandingMaybeAud.FileLengthSec = meta.AudioDurationSec;
                    var projFramesThisOne = Proj.SecToFrame(outstandingMaybeAud.FileLengthSec ?? 0);
                    outstandingMaybeAud.FileLengthFrames = projFramesThisOne;
                    outstandingMaybeAud.FrameEnd = projFramesThisOne;
                    outstandingAudio.Remove(outstandingMaybeAud);
                    if (MetaReadyForOutstandingAudio != null)
                        MetaReadyForOutstandingAudio(outstandingMaybeAud, meta);
                    return;
                }
            }
        }