Ejemplo n.º 1
0
        public List <AudioTrackInfo> AnalyzeFile(MovieFile File)
        {
            List <AudioTrackInfo> TrackInfoList = new List <AudioTrackInfo>();

            for (int i = 0; i < File.AudioTracksCount; i++)
            {
                AudioTrackInfo Info = new AudioTrackInfo(File.getTrackID(StreamKind.Audio, i), File.getAudioTrackFormat(i), File.getAudioBitDepth(i), File.getAudioChannels(i), i + File.VideoTracksCount + 1);
                TrackInfoList.Add(Info);
            }

            return(TrackInfoList);
        }
Ejemplo n.º 2
0
 private void lv_WaitingFileList_DragDrop(object sender, DragEventArgs e)
 {
     string[] DragDropFiles = (string[])e.Data.GetData(DataFormats.FileDrop, false);
     foreach (string File in DragDropFiles)
     {
         MovieFile tempFile = new MovieFile(File);
         foreach (string SupportedFileFormat in SupportedFileFormats)
         {
             if (SupportedFileFormat.Equals(tempFile.FileExtension.ToUpper()))
             {
                 ListViewItem LVI = new ListViewItem("Pending");
                 LVI.SubItems.Add(File);
                 lv_WaitingFileList.Items.Add(LVI);
             }
         }
     }
     lv_WaitingFileList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
 }
Ejemplo n.º 3
0
 private void OFD_InputFile_FileOk(object sender, CancelEventArgs e)
 {
     nowFile = new MovieFile(OFD_InputFile.FileName);
     Analyse_File(OFD_InputFile.FileName);
 }
Ejemplo n.º 4
0
 private void OFD_InputFile_FileOk(object sender, CancelEventArgs e)
 {
     nowFile = new MovieFile(OFD_InputFile.FileName);
     OutputAudioTracksInfoToGridview(nowFile.AudioTrackInfoList);
 }
Ejemplo n.º 5
0
        private void ProcessFile(MovieFile File, bool ReadSelectionFromGridview)
        {
            ListDictionary TrackID_SourceFileName = new ListDictionary();
            ListDictionary TrackID_OutputFileName = new ListDictionary();
            string         OutputFormat           = "flac";
            IDemuxProcess  DP;

            switch (File.FileExtension.ToUpper())
            {
            case "MP4":
                if (ReadSelectionFromGridview)
                {
                    foreach (DataGridViewRow Row in gridview_Tracks.Rows)
                    {
                        DataGridViewCheckBoxCell CCell = Row.Cells[0] as DataGridViewCheckBoxCell;
                        if ((bool)CCell.Value)
                        {
                            TrackID_SourceFileName.Add(Row.Cells[1].Value, File.FileName);
                        }
                    }
                }
                else
                {
                    foreach (AudioTrackInfo Info in File.AudioTrackInfoList)
                    {
                        TrackID_SourceFileName.Add(Info.TrackID, File.FileName);
                    }
                }
                //txt_CommandLine.Text = AudioDemuxer.Tools.MP4Box.CommandBuilder(TrackID_SourceFileName);
                DP = new Tools.MP4Box.MP4DemuxProcess(TrackID_SourceFileName);
                DP.Start();
                DP.Dispose();
                break;

            case "MKV":
                if (ReadSelectionFromGridview)
                {
                    foreach (DataGridViewRow Row in gridview_Tracks.Rows)
                    {
                        DataGridViewCheckBoxCell CCell = Row.Cells[0] as DataGridViewCheckBoxCell;
                        if ((bool)CCell.Value)
                        {
                            TrackID_OutputFileName.Add(Row.Cells[1].Value, String.Format("{0}\\{1}-track{2}.{3}", File.FileFolder, File.SafeFileNameWithoutExtension, Row.Cells[1].Value.ToString(), Row.Cells[2].Value.ToString().ToLower()));
                        }
                    }
                }
                else
                {
                    foreach (AudioTrackInfo Info in File.AudioTrackInfoList)
                    {
                        TrackID_OutputFileName.Add(Info.TrackID, String.Format("{0}\\{1}-track{2}.{3}", File.FileFolder, File.SafeFileNameWithoutExtension, Info.TrackID, Info.Format.ToLower()));
                    }
                }
                //txt_CommandLine.Text = AudioDemuxer.Tools.MKVExtract.CommandBuilder(TrackID_OutputFileName, File.FileName);
                DP = new Tools.MKVExtract.MKVDemuxProcess(TrackID_OutputFileName, File.FileName);
                DP.Start();
                DP.Dispose();
                break;

            case "M2TS":
                if (ReadSelectionFromGridview)
                {
                    foreach (DataGridViewRow Row in gridview_Tracks.Rows)
                    {
                        DataGridViewCheckBoxCell CCell = Row.Cells[0] as DataGridViewCheckBoxCell;
                        if ((bool)CCell.Value)
                        {
                            int OutputTrackID = Row.Cells[1].RowIndex + File.VideoTracksCount + 1;
                            TrackID_OutputFileName.Add(OutputTrackID.ToString(), String.Format("{0}\\{1}-track{2}.{3}", File.FileFolder, File.SafeFileNameWithoutExtension, OutputTrackID.ToString(), OutputFormat));
                        }
                    }
                }
                else
                {
                    foreach (AudioTrackInfo Info in File.AudioTrackInfoList)
                    {
                        TrackID_OutputFileName.Add(Info.Index.ToString(), String.Format("{0}\\{1}-track{2}.{3}", File.FileFolder, File.SafeFileNameWithoutExtension, Info.Index.ToString(), OutputFormat));
                    }
                }
                //txt_CommandLine.Text = AudioDemuxer.Tools.eac3to.CommandBuilder(TrackID_OutputFileName, File.FileName);
                //txt_CommandLine.Text = AudioDemuxer.Tools.eac3to.AnalyseByEac3to(nowFile.FileName);
                DP = new Tools.eac3to.M2TSDemuxProcess(TrackID_OutputFileName, File.FileName);
                DP.Start();
                DP.Dispose();
                break;

            case "TS":
                if (ReadSelectionFromGridview)
                {
                    foreach (DataGridViewRow Row in gridview_Tracks.Rows)
                    {
                        DataGridViewCheckBoxCell CCell = Row.Cells[0] as DataGridViewCheckBoxCell;
                        if ((bool)CCell.Value)
                        {
                            int OutputTrackID = Row.Cells[1].RowIndex + File.VideoTracksCount + 1;
                            TrackID_OutputFileName.Add(OutputTrackID.ToString(), String.Format("{0}\\{1}-track{2}.{3}", File.FileFolder, File.SafeFileNameWithoutExtension, OutputTrackID.ToString(), Row.Cells[2].Value.ToString().ToLower()));
                        }
                    }
                }
                else
                {
                    foreach (AudioTrackInfo Info in File.AudioTrackInfoList)
                    {
                        TrackID_OutputFileName.Add(Info.Index.ToString(), String.Format("{0}\\{1}-track{2}.{3}", File.FileFolder, File.SafeFileNameWithoutExtension, Info.Index.ToString(), Info.Format.ToLower()));
                    }
                }
                //txt_CommandLine.Text = AudioDemuxer.Tools.eac3to.CommandBuilder(TrackID_OutputFileName, File.FileName);
                //txt_CommandLine.Text = AudioDemuxer.Tools.eac3to.AnalyseByEac3to(nowFile.FileName);
                DP = new Tools.eac3to.TSDemuxProcess(TrackID_OutputFileName, File.FileName);
                DP.Start();
                DP.Dispose();
                break;
            }
            if (Thread.CurrentThread != MainThread)
            {
                Thread.Sleep(3000); Thread.CurrentThread.Abort();
            }
        }