Ejemplo n.º 1
0
        /// <summary>
        /// エンコードプロファイルの初期設定を行う
        /// </summary>
        private void InitEncodeProfile()
        {
            /*
             * IWMEncProfileCollection pc = this.enc.ProfileCollection;
             *
             * foreach (IWMEncProfile2 pf in pc)
             * {
             *  if (pf.Name.StartsWith("Windows Media Video"))
             *  {
             *      this.group.set_Profile(pf);
             *      break;
             *  }
             * }
             */

            //自分で作成したプロファイルを使用すると
            //データ送信前後の遅延が無くなる。
            WMEncProfile2Class pf = new WMEncProfile2Class();

            pf.LoadFromFile(new FileInfo("../../test1.prx").FullName);

            this.group.set_Profile(pf);

            //    Marshal.ReleaseComObject(pc);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// �������ꂽ���f�B�A�t�@�C�����������
        /// </summary>
        /// <param name="profileName"></param>
        private static void CombineParts(string dir)
        {
            WMEncoderApp app = new WMEncoderAppClass();
            IWMEncoder2 enc = app.Encoder as IWMEncoder2;

            IWMEncSourceGroupCollection sgcol = enc.SourceGroupCollection;

            WMEncProfile2 pf = new WMEncProfile2Class();
            pf.LoadFromFile(dir + "/default.prx");

            int index = 0;
            IWMEncSourceGroup2 sg2 = null;

            foreach (FileInfo fi in new DirectoryInfo(dir).GetFiles("dest*.wmv"))
            {
                Console.WriteLine("target : {0}", fi.Name);

                sg2 = sgcol.Add("sg" + index) as IWMEncSourceGroup2;
                sg2.set_Profile(pf);

                IWMEncSource asrc = sg2.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
                asrc.SetInput(fi.FullName, "", "");

                IWMEncSource vsrc = sg2.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
                vsrc.SetInput(fi.FullName, "", "");

                //sg2.AutoSetFileSource(fi.FullName);

                if (index > 0)
                {
                    sg2.SetAutoRollover(-1, "sg" + (index - 1));
                }

                index++;
            }

            sgcol.Active = sg2;

            FileInfo destFile = new FileInfo("default_all.wmv");
            destFile.Delete();

            enc.File.LocalFileName = destFile.FullName;

            enc.PrepareToEncode(true);
            enc.Start();

            Console.WriteLine("combine start");

            while (enc.RunState != WMENC_ENCODER_STATE.WMENC_ENCODER_STOPPED)
            {
                Thread.Sleep(2000);
            }

            Console.WriteLine("combine end : 0x{0}", enc.ErrorState.ToString("X"));

            Marshal.ReleaseComObject(pf);
            Marshal.ReleaseComObject(sgcol);
            Marshal.ReleaseComObject(enc);
            Marshal.ReleaseComObject(app);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 分割されたメディアファイルを結合する
        /// </summary>
        /// <param name="profileName"></param>
        private static void CombineParts(string dir)
        {
            WMEncoderApp app = new WMEncoderAppClass();
            IWMEncoder2  enc = app.Encoder as IWMEncoder2;

            IWMEncSourceGroupCollection sgcol = enc.SourceGroupCollection;

            WMEncProfile2 pf = new WMEncProfile2Class();

            pf.LoadFromFile(dir + "/default.prx");

            int index = 0;
            IWMEncSourceGroup2 sg2 = null;

            foreach (FileInfo fi in new DirectoryInfo(dir).GetFiles("dest*.wmv"))
            {
                Console.WriteLine("target : {0}", fi.Name);

                sg2 = sgcol.Add("sg" + index) as IWMEncSourceGroup2;
                sg2.set_Profile(pf);

                IWMEncSource asrc = sg2.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
                asrc.SetInput(fi.FullName, "", "");

                IWMEncSource vsrc = sg2.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
                vsrc.SetInput(fi.FullName, "", "");

                //sg2.AutoSetFileSource(fi.FullName);

                if (index > 0)
                {
                    sg2.SetAutoRollover(-1, "sg" + (index - 1));
                }

                index++;
            }

            sgcol.Active = sg2;

            FileInfo destFile = new FileInfo("default_all.wmv");

            destFile.Delete();

            enc.File.LocalFileName = destFile.FullName;

            enc.PrepareToEncode(true);
            enc.Start();

            Console.WriteLine("combine start");

            while (enc.RunState != WMENC_ENCODER_STATE.WMENC_ENCODER_STOPPED)
            {
                Thread.Sleep(2000);
            }

            Console.WriteLine("combine end : 0x{0}", enc.ErrorState.ToString("X"));

            Marshal.ReleaseComObject(pf);
            Marshal.ReleaseComObject(sgcol);
            Marshal.ReleaseComObject(enc);
            Marshal.ReleaseComObject(app);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// �G���R�[�h�v���t�@�C���̏����ݒ��s��
        /// </summary>
        private void InitEncodeProfile()
        {
            /*
            IWMEncProfileCollection pc = this.enc.ProfileCollection;

            foreach (IWMEncProfile2 pf in pc)
            {
                if (pf.Name.StartsWith("Windows Media Video"))
                {
                    this.group.set_Profile(pf);
                    break;
                }
            }
             */

            //�����ō쐬�����v���t�@�C����g�p�����
            //�f�[�^���M�O��̒x���������Ȃ�B
            WMEncProfile2Class pf = new WMEncProfile2Class();
            pf.LoadFromFile(new FileInfo("../../test1.prx").FullName);

            this.group.set_Profile(pf);

            //    Marshal.ReleaseComObject(pc);
        }