Example #1
0
        public EncodeInfo()
        {
            JobName             = string.Empty;
            BaseName            = string.Empty;
            InputFile           = string.Empty;
            Input               = InputType.InputUndefined;
            OutputFile          = string.Empty;
            AudioStreams        = new List <AudioInfo>();
            SubtitleStreams     = new List <SubtitleInfo>();
            Chapters            = new List <TimeSpan>();
            NextStep            = EncodingStep.NotSet;
            CompletedStep       = EncodingStep.NotSet;
            MediaInfo           = null;
            VideoStream         = new VideoInfo();
            StereoVideoStream   = new StereoVideoInfo();
            StreamId            = int.MinValue;
            TrackId             = int.MinValue;
            TempInput           = string.Empty;
            TempOutput          = string.Empty;
            DumpOutput          = string.Empty;
            SelectedDvdChapters = string.Empty;
            TempFiles           = new List <string>();
            ExitCode            = int.MinValue;

            FfIndexFile          = string.Empty;
            AviSynthScript       = string.Empty;
            AviSynthStereoConfig = string.Empty;
        }
Example #2
0
        public EncodeInfo()
        {
            JobName = string.Empty;
            InputFile = string.Empty;
            Input = InputType.InputUndefined;
            OutputFile = string.Empty;
            AudioStreams = new List<AudioInfo>();
            SubtitleStreams = new List<SubtitleInfo>();
            Chapters = new List<TimeSpan>();
            NextStep = EncodingStep.NotSet;
            CompletedStep = EncodingStep.NotSet;
            MediaInfo = null;
            VideoStream = new VideoInfo();
            StereoVideoStream = new StereoVideoInfo();
            StreamId = int.MinValue;
            TrackId = int.MinValue;
            TempInput = string.Empty;
            TempOutput = string.Empty;
            DumpOutput = string.Empty;
            SelectedDvdChapters = string.Empty;
            TempFiles = new List<string>();
            ExitCode = int.MinValue;

            FfIndexFile = string.Empty;
            AviSynthScript = string.Empty;
            AviSynthStereoConfig = string.Empty;
        }
        private void GetBDInfo()
        {
            string strChapters = Processing.GetResourceString("streamselect_chapters");
            string strVideo = Processing.GetResourceString("streamselect_video");
            string strAudio = Processing.GetResourceString("streamselect_audio");
            string strSubtitles = Processing.GetResourceString("streamselect_subtitles");

            string bdTitleFormat = Processing.GetResourceString("streamselect_bd_general");
            const string bdAudioFormat = "{5:g}: {0} ({1}) / {2} ({3}) / {4}";
            const string bdSubFormat = "{3:g}: {0} / {1} ({2}); {4}";

            _bdInfo = new BDROM(JobInfo.InputFile);
            _bdInfo.Scan();

            int longestClip = GetLongestBDPlaylist();

            int playlistIndex = 1;

            foreach (TSPlaylistFile item in _bdInfo.PlaylistFiles.Values)
            {
                if (!item.IsValid)
                {
                    playlistIndex++;
                    continue;
                }

                int streamIndex = 0;

                DateTime duration = new DateTime();

                duration = duration.AddSeconds(item.TotalLength);

                string treeRoot = string.Format(bdTitleFormat, playlistIndex, item.Name,
                                                duration.ToString("H:mm:ss.fff"));

                Dictionary<string, object> treeData = new Dictionary<string, object>
                    {
                        {
                            "Name",
                            Path.Combine(_bdInfo.DirectoryPLAYLIST.FullName,
                                         item.Name)
                        },
                        {"PlaylistIndex", playlistIndex}
                    };

                TreeNode root = new TreeNode
                    {
                        ID = _treeNodeID++,
                        Name = treeRoot,
                        Data = treeData,
                        Children = new List<TreeNode>(),
                        IsChecked = true,
                    };
                root.IsExpanded = root.IsChecked;
                _tree.Add(root);

                TreeNode chaptersTree = CreateNode(root, strChapters, null);
                TreeNode videoTree = CreateNode(root, strVideo, null);
                TreeNode audioTree = CreateNode(root, strAudio, null);
                TreeNode subTree = CreateNode(root, strSubtitles, null);

                List<TimeSpan> streamChapters = new List<TimeSpan>();
                if (item.Chapters.Count > 1)
                {
                    streamIndex++;

                    streamChapters.AddRange(item.Chapters.Select(TimeSpan.FromSeconds));

                    string chaptersFormat = string.Format("{0:0} {1}", streamChapters.Count, strChapters);

                    CreateNode(chaptersTree, chaptersFormat, streamChapters);
                }

                string videoDescStereo = string.Empty;
                int leftVideoStreamID = -1;
                foreach (TSVideoStream clip in item.VideoStreams)
                {
                    streamIndex++;
                    string videoCodec = clip.CodecName;
                    string videoCodecShort = clip.CodecShortName;
                    string videoDesc = clip.Description;

                    if ((clip.StreamType == TSStreamType.AVC_VIDEO) && (item.VideoStreams.Count > 1)
                        && (item.VideoStreams[0].PID == clip.PID)
                        && (item.VideoStreams[item.VideoStreams.Count - 1].StreamType == TSStreamType.MVC_VIDEO))
                    {
                        videoDescStereo = videoDesc;
                        videoCodec += " (left eye)";
                        leftVideoStreamID = streamIndex;
                    }
                    if ((clip.StreamType == TSStreamType.MVC_VIDEO) && (item.VideoStreams.Count > 1)
                        && (item.VideoStreams[item.VideoStreams.Count - 1].PID == clip.PID)
                        && (item.VideoStreams[0].StreamType == TSStreamType.AVC_VIDEO))
                    {
                        videoDesc = videoDescStereo;
                        videoCodec = "MPEG-4 MVC Video (right eye)";
                    }
                     /* */
                    string videoStreamFormat =  string.Format("{3:g}: {0} ({1}), {2}", videoCodec, videoCodecShort,
                                                                   videoDesc, streamIndex);
                    switch (clip.StreamType)
                    {
                        case TSStreamType.AVC_VIDEO:
                        case TSStreamType.MPEG2_VIDEO:
                        case TSStreamType.MPEG1_VIDEO:
                        case TSStreamType.VC1_VIDEO:
                            {
                                VideoInfo vid = new VideoInfo
                                    {
                                        StreamId = streamIndex,
                                        TrackId = playlistIndex,
                                        FPS = (float) clip.FrameRateEnumerator/clip.FrameRateDenominator,
                                        PicSize = (VideoFormat) clip.VideoFormat,
                                        Interlaced = clip.IsInterlaced,
                                        Format = clip.CodecShortName,
                                        DemuxStreamId = clip.PID,
                                        FrameCount = 0,
                                        Encoded = false,
                                        IsRawStream = false,
                                        StreamSize = 0,
                                        Length = item.TotalLength,
                                        FrameRateEnumerator = clip.FrameRateEnumerator,
                                        FrameRateDenominator = clip.FrameRateDenominator,
                                        Height = clip.Height
                                    };

                                Int32.TryParse(item.Name.Substring(0, item.Name.LastIndexOf('.')), NumberStyles.Number,
                                               AppSettings.CInfo, out vid.DemuxPlayList);

                                foreach (TSStreamClip streamClip in item.StreamClips)
                                    vid.DemuxStreamNames.Add(streamClip.StreamFile.FileInfo.FullName);

                                float mod;
                                switch (clip.AspectRatio)
                                {
                                    case TSAspectRatio.ASPECT_16_9:
                                        mod = (float) 1.777778;
                                        break;
                                    default:
                                        mod = (float) 1.333333;
                                        break;
                                }
                                vid.Width = (int) (vid.Height*mod);
                                vid.AspectRatio = mod;

                                CreateNode(videoTree, videoStreamFormat, vid);
                            }
                            break;
                        case TSStreamType.MVC_VIDEO:
                            {
                                StereoVideoInfo vid = new StereoVideoInfo
                                    {
                                        RightStreamId = streamIndex,
                                        LeftStreamId = leftVideoStreamID
                                    };
                                CreateNode(videoTree, videoStreamFormat, vid);
                            }
                            break;
                    }
                }

                foreach (TSAudioStream audio in item.AudioStreams)
                {
                    streamIndex++;
                    string audioCodec = audio.CodecName;
                    string audioCodecShort = audio.CodecShortName;
                    string audioDesc = audio.Description;
                    string audioLangCode = audio.LanguageCode;
                    string audioLanguage = audio.LanguageName;

                    string audioStreamFormat = string.Format(bdAudioFormat, audioCodec, audioCodecShort, audioLangCode,
                                                             audioLanguage, audioDesc, streamIndex);

                    AudioInfo aud = new AudioInfo
                        {
                            Format = audioCodecShort,
                            FormatProfile = string.Empty,
                            Id = streamIndex,
                            StreamId = streamIndex,
                            LangCode = audioLangCode,
                            TempFile = string.Empty,
                            OriginalId = streamIndex,
                            Delay = 0,
                            Bitrate = audio.BitRate,
                            DemuxStreamId = audio.PID,
                            SampleRate = audio.SampleRate,
                            ChannelCount = audio.ChannelCount + audio.LFE,
                            BitDepth = audio.BitDepth,
                            ShortLang = audio.LanguageCode,
                            StreamSize = 0,
                            Length = item.TotalLength,
                            IsHdStream = audio.CoreStream != null
                        };

                    CreateNode(audioTree, audioStreamFormat, aud);
                }

                foreach (TSTextStream sub in item.TextStreams)
                {
                    streamIndex++;
                    string subCodecShort = sub.CodecShortName;
                    string subDesc = sub.Description;
                    string subLangCode = sub.LanguageCode;
                    string subLanguage = sub.LanguageName;

                    string subStreamFormat = string.Format(bdSubFormat, subCodecShort, subLangCode, subLanguage,
                                                           streamIndex, subDesc);

                    SubtitleInfo subInfo = new SubtitleInfo
                        {
                            Id = streamIndex,
                            StreamId = streamIndex,
                            TempFile = string.Empty,
                            LangCode = subLangCode,
                            Format = subCodecShort,
                            Delay = 0,
                            DemuxStreamId = sub.PID,
                            StreamSize = 0
                        };

                    CreateNode(subTree, subStreamFormat, subInfo);
                }

                foreach (TSGraphicsStream sub in item.GraphicsStreams)
                {
                    streamIndex++;
                    string subCodecShort = sub.CodecShortName;
                    string subDesc = sub.Description;
                    string subLangCode = sub.LanguageCode;
                    string subLanguage = sub.LanguageName;

                    string subStreamFormat = string.Format(bdSubFormat, subCodecShort, subLangCode, subLanguage,
                                                           streamIndex, subDesc);

                    SubtitleInfo subInfo = new SubtitleInfo
                        {
                            Id = streamIndex,
                            StreamId = streamIndex,
                            TempFile = string.Empty,
                            LangCode = subLangCode,
                            Format = subCodecShort,
                            DemuxStreamId = sub.PID,
                            StreamSize = 0
                        };

                    CreateNode(subTree, subStreamFormat, subInfo);
                }
                playlistIndex++;
            }
            _defaultSelection = longestClip - 1;
        }