コード例 #1
0
ファイル: NewMetaHeader.cs プロジェクト: dxcheng25/SublerW32
        public NewMetaHeader(String MHDFPath, OPType opType)
        {
            InitializeComponent();
            tcMetaInfo.TabPages.Remove(tpMISummary);
            this.MHDFPath = MHDFPath;

            if (opType == OPType.Modify)
            {
                //Deserialize XML file
                if (CoreData.CommonData.mdm != null)
                    mdm = CoreData.CommonData.mdm;

                else
                {
                    MetaXMLReader mxReader = new MetaXMLReader();
                    mdm = mxReader.readMetaHeaderFile(MHDFPath);
                }
            }

            else if (opType == OPType.New)
            {
                mdm = new MetaDataModel();
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: dxcheng25/SublerW32
        private void btnCompile_Click(object sender, EventArgs e)
        {
            if (!tbFilePath.Text.EndsWith(".mp4") &&
                !tbMetaPath.Text.EndsWith(".mxml"))
            {

                MessageBox.Show(this, "请补全信息再试!", "错误",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            MetaDataModel mdm;

            if (CoreData.CommonData.mdm == null)
            {
                MetaXMLReader metaReader = new MetaXMLReader();
                mdm = metaReader.readMetaHeaderFile(tbMetaPath.Text);
            }

            else
            {
                mdm = CoreData.CommonData.mdm;
            }

            if (mdm.posterPath != "")
            {
                mvca = new mp4v2Wrapper.mp4v2CoverArt(mdm.posterPath, tbFilePath.Text);
            }

            mvt = new mp4v2Wrapper.mp4v2Tagging(mdm, tbFilePath.Text);

            //Subtitles
            if (mdm.subtitles.Count != 0)
            {
                foreach (KeyValuePair<String, String> pair in mdm.subtitles)
                {
                    MP4BoxWrapper.MP4BoxTrackModel mtm
                        = new MP4BoxWrapper.MP4BoxTrackModel();

                    mtm.trackName = "Subtitle Track";
                    mtm.trackToAdd = pair.Value;
                    mtm.trackType = MP4BoxWrapper.MP4BoxTrackModel.TrackType.Subtitle;
                    mtm.languageCode = pair.Key;
                    mtm.groupID = 2;
                    mtm.originalVideo = tbFilePath.Text;

                    lIT.Add(new MP4BoxWrapper.ImportTrack(mtm));
                }
            }

            //chapters
            if ( mdm.chaptersFilePath.EndsWith(".txt") || mdm.chaptersFilePath.EndsWith(".ogm") )
            {
                MP4BoxWrapper.MP4BoxTrackModel mtm
                        = new MP4BoxWrapper.MP4BoxTrackModel();

                mtm.trackName = "Chapters";
                mtm.trackToAdd = mdm.chaptersFilePath;
                mtm.trackType = MP4BoxWrapper.MP4BoxTrackModel.TrackType.Chapter;
                mtm.originalVideo = tbFilePath.Text;

                lIT.Add(new MP4BoxWrapper.ImportTrack(mtm));
            }

            gbVideoNMeta.Enabled = false;
            btnCompile.Enabled = false;
            pbCompileProgress.Style = ProgressBarStyle.Marquee;
            pbCompileProgress.MarqueeAnimationSpeed = 100;

            mp4CompileWorker.RunWorkerAsync();
        }