Exemplo n.º 1
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
     this.axQTControl1 = new AxQTOControlLib.AxQTControl();
     ((System.ComponentModel.ISupportInitialize)(this.axQTControl1)).BeginInit();
     this.SuspendLayout();
     //
     // axQTControl1
     //
     this.axQTControl1.Enabled = true;
     this.axQTControl1.Location = new System.Drawing.Point(29, 37);
     this.axQTControl1.Name = "axQTControl1";
     this.axQTControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axQTControl1.OcxState")));
     this.axQTControl1.Size = new System.Drawing.Size(288, 277);
     this.axQTControl1.TabIndex = 0;
     this.axQTControl1.Visible = false;
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
     this.ClientSize = new System.Drawing.Size(292, 266);
     this.Controls.Add(this.axQTControl1);
     this.Name = "Form1";
     this.Text = "Form1";
     ((System.ComponentModel.ISupportInitialize)(this.axQTControl1)).EndInit();
     this.ResumeLayout(false);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
     this.axQTControl1 = new AxQTOControlLib.AxQTControl();
     this.mainMenu1 = new System.Windows.Forms.MainMenu();
     this.menuItem1 = new System.Windows.Forms.MenuItem();
     this.mnuOpen = new System.Windows.Forms.MenuItem();
     this.mnuOpenURL = new System.Windows.Forms.MenuItem();
     this.mnuClose = new System.Windows.Forms.MenuItem();
     this.menuItem10 = new System.Windows.Forms.MenuItem();
     this.mnuExportWithDialog = new System.Windows.Forms.MenuItem();
     this.mnuExportWithSettings = new System.Windows.Forms.MenuItem();
     this.menuItem13 = new System.Windows.Forms.MenuItem();
     this.mnuFullscreen = new System.Windows.Forms.MenuItem();
     this.mnuGetInfo = new System.Windows.Forms.MenuItem();
     this.menuItem14 = new System.Windows.Forms.MenuItem();
     this.mnuExit = new System.Windows.Forms.MenuItem();
     this.menuItem5 = new System.Windows.Forms.MenuItem();
     this.mnuUndo = new System.Windows.Forms.MenuItem();
     this.mnuCut = new System.Windows.Forms.MenuItem();
     this.mnuCopy = new System.Windows.Forms.MenuItem();
     this.mnuPaste = new System.Windows.Forms.MenuItem();
     this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
     this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
     ((System.ComponentModel.ISupportInitialize)(this.axQTControl1)).BeginInit();
     this.SuspendLayout();
     //
     // axQTControl1
     //
     this.axQTControl1.Enabled = true;
     this.axQTControl1.Location = new System.Drawing.Point(0, 0);
     this.axQTControl1.Name = "axQTControl1";
     this.axQTControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axQTControl1.OcxState")));
     this.axQTControl1.Size = new System.Drawing.Size(192, 192);
     this.axQTControl1.TabIndex = 0;
     this.axQTControl1.Visible = false;
     this.axQTControl1.StatusUpdate += new AxQTOControlLib._IQTControlEvents_StatusUpdateEventHandler(this.axQTControl1_StatusUpdateEventHandler);
     this.axQTControl1.QTEvent += new AxQTOControlLib._IQTControlEvents_QTEventEventHandler(this.axQTControl1_QTEvent);
     this.axQTControl1.SizeChangedEvent += new AxQTOControlLib._IQTControlEvents_SizeChangedEventHandler(this.axQTControl1_SizeChangedEventHandler);
     //
     // mainMenu1
     //
     this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                               this.menuItem1,
                                                                               this.menuItem5});
     //
     // menuItem1
     //
     this.menuItem1.Index = 0;
     this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                               this.mnuOpen,
                                                                               this.mnuOpenURL,
                                                                               this.mnuClose,
                                                                               this.menuItem10,
                                                                               this.mnuExportWithDialog,
                                                                               this.mnuExportWithSettings,
                                                                               this.menuItem13,
                                                                               this.mnuFullscreen,
                                                                               this.mnuGetInfo,
                                                                               this.menuItem14,
                                                                               this.mnuExit});
     this.menuItem1.Text = "File";
     //
     // mnuOpen
     //
     this.mnuOpen.Index = 0;
     this.mnuOpen.Text = "&Open...";
     this.mnuOpen.Click += new System.EventHandler(this.mnuOpen_Click);
     //
     // mnuOpenURL
     //
     this.mnuOpenURL.Index = 1;
     this.mnuOpenURL.Text = "Open &URL...";
     this.mnuOpenURL.Click += new System.EventHandler(this.mnuOpenURL_Click);
     //
     // mnuClose
     //
     this.mnuClose.Index = 2;
     this.mnuClose.Text = "&Close";
     this.mnuClose.Click += new System.EventHandler(this.mnuClose_Click);
     //
     // menuItem10
     //
     this.menuItem10.Index = 3;
     this.menuItem10.Text = "-";
     //
     // mnuExportWithDialog
     //
     this.mnuExportWithDialog.Index = 4;
     this.mnuExportWithDialog.Text = "Export With Export Dialog...";
     this.mnuExportWithDialog.Click += new System.EventHandler(this.mnuExportWithDialog_Click);
     //
     // mnuExportWithSettings
     //
     this.mnuExportWithSettings.Index = 5;
     this.mnuExportWithSettings.Text = "Export With Settings Dialog...";
     this.mnuExportWithSettings.Click += new System.EventHandler(this.mnuExportWithSettings_Click);
     //
     // menuItem13
     //
     this.menuItem13.Index = 6;
     this.menuItem13.Text = "-";
     //
     // mnuFullscreen
     //
     this.mnuFullscreen.Index = 7;
     this.mnuFullscreen.Text = "Full Screen";
     this.mnuFullscreen.Click += new System.EventHandler(this.mnuFullscreen_Click);
     //
     // mnuGetInfo
     //
     this.mnuGetInfo.Index = 8;
     this.mnuGetInfo.Shortcut = System.Windows.Forms.Shortcut.CtrlI;
     this.mnuGetInfo.Text = "Get &Info...";
     this.mnuGetInfo.Click += new System.EventHandler(this.mnuGetInfo_Click);
     //
     // menuItem14
     //
     this.menuItem14.Index = 9;
     this.menuItem14.Text = "-";
     //
     // mnuExit
     //
     this.mnuExit.Index = 10;
     this.mnuExit.Text = "E&xit";
     this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);
     //
     // menuItem5
     //
     this.menuItem5.Index = 1;
     this.menuItem5.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                               this.mnuUndo,
                                                                               this.mnuCut,
                                                                               this.mnuCopy,
                                                                               this.mnuPaste});
     this.menuItem5.Text = "Edit";
     //
     // mnuUndo
     //
     this.mnuUndo.Index = 0;
     this.mnuUndo.Shortcut = System.Windows.Forms.Shortcut.CtrlZ;
     this.mnuUndo.Text = "&Undo";
     this.mnuUndo.Click += new System.EventHandler(this.mnuUndo_Click);
     //
     // mnuCut
     //
     this.mnuCut.Index = 1;
     this.mnuCut.Shortcut = System.Windows.Forms.Shortcut.CtrlX;
     this.mnuCut.Text = "Cu&t";
     this.mnuCut.Click += new System.EventHandler(this.mnuCut_Click);
     //
     // mnuCopy
     //
     this.mnuCopy.Index = 2;
     this.mnuCopy.Shortcut = System.Windows.Forms.Shortcut.CtrlC;
     this.mnuCopy.Text = "&Copy";
     this.mnuCopy.Click += new System.EventHandler(this.mnuCopy_Click);
     //
     // mnuPaste
     //
     this.mnuPaste.Index = 3;
     this.mnuPaste.Shortcut = System.Windows.Forms.Shortcut.CtrlV;
     this.mnuPaste.Text = "&Paste";
     this.mnuPaste.Click += new System.EventHandler(this.mnuPaste_Click);
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize = new System.Drawing.Size(304, 257);
     this.Controls.Add(this.axQTControl1);
     this.Menu = this.mainMenu1;
     this.Name = "Form1";
     this.Text = "QuickTime Control C# Sample";
     this.SizeChanged += new System.EventHandler(this.Form1_Resize);
     this.Load += new System.EventHandler(this.Form1_Load);
     ((System.ComponentModel.ISupportInitialize)(this.axQTControl1)).EndInit();
     this.ResumeLayout(false);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
     this.axQTControl1 = new AxQTOControlLib.AxQTControl();
     this.mainMenu1 = new System.Windows.Forms.MainMenu();
     this.menuItem1 = new System.Windows.Forms.MenuItem();
     this.menuItem3 = new System.Windows.Forms.MenuItem();
     this.menuItem2 = new System.Windows.Forms.MenuItem();
     this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
     this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
     ((System.ComponentModel.ISupportInitialize)(this.axQTControl1)).BeginInit();
     this.SuspendLayout();
     //
     // axQTControl1
     //
     this.axQTControl1.Enabled = true;
     this.axQTControl1.Location = new System.Drawing.Point(0, 0);
     this.axQTControl1.Name = "axQTControl1";
     this.axQTControl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axQTControl1.OcxState")));
     this.axQTControl1.Size = new System.Drawing.Size(192, 192);
     this.axQTControl1.TabIndex = 0;
     this.axQTControl1.SizeChangedEvent += new AxQTOControlLib._IQTControlEvents_SizeChangedEventHandler(this.axQTControl1_SizeChangedEventHandler);
     //
     // mainMenu1
     //
     this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                               this.menuItem1});
     //
     // menuItem1
     //
     this.menuItem1.Index = 0;
     this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                               this.menuItem3,
                                                                               this.menuItem2});
     this.menuItem1.Text = "File";
     //
     // menuItem3
     //
     this.menuItem3.Index = 0;
     this.menuItem3.Text = "New with Image Sequence...";
     this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
     //
     // menuItem2
     //
     this.menuItem2.Index = 1;
     this.menuItem2.Text = "Save";
     this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize = new System.Drawing.Size(272, 245);
     this.Controls.Add(this.axQTControl1);
     this.Menu = this.mainMenu1;
     this.Name = "Form1";
     this.Text = "Movie";
     this.SizeChanged += new System.EventHandler(this.Form1_Resize);
     this.Load += new System.EventHandler(this.Form1_Load);
     ((System.ComponentModel.ISupportInitialize)(this.axQTControl1)).EndInit();
     this.ResumeLayout(false);
 }
        private void initializePlayer()
        {
            if (MainModel.QuickTimePlayer == null)
            {
                // check QT version just to make sure
                // without this, Vista reported QT was installed just by having QTO*.dlls there
                if (!isQuickTimeInstalled())
                    throw new Exception("QuickTime is not installed!");

                MainModel.QuickTimePlayer = new AxQTOControlLib.AxQTControl();
            }

            qtPlayer = MainModel.QuickTimePlayer;

            ((System.ComponentModel.ISupportInitialize)(this.qtPlayer)).BeginInit();

            this.qtPlayer.Dock = DockStyle.Fill;
            this.qtPlayer.Enabled = true;
            this.qtPlayer.Name = "axQTControl1";
            this.qtPlayer.TabIndex = 0;

            // wmPlayer didn't have this line. everything seems to be working fine
            //this.QuickTimePlayer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("QuickTimePlayer.OcxState")));

            this.qtPlayer.QTEvent += new AxQTOControlLib._IQTControlEvents_QTEventEventHandler(qtPlayer_QTEvent);
            this.qtPlayer.StatusUpdate += new AxQTOControlLib._IQTControlEvents_StatusUpdateEventHandler(qtPlayer_StatusUpdate);
            this.qtPlayer.Error += new AxQTOControlLib._IQTControlEvents_ErrorEventHandler(qtPlayer_Error);

            this.Controls.Add(qtPlayer);
            ((System.ComponentModel.ISupportInitialize)(qtPlayer)).EndInit();

            if (qtPlayer.QuickTimeVersion == 0)
                throw new Exception("QuickTimeVersion == 0");

            this.qtPlayer.ErrorHandling = (int)QTErrorHandlingOptionsEnum.qtErrorHandlingRaiseException;
            this.qtPlayer.Sizing = QTSizingModeEnum.qtMovieFitsControlMaintainAspectRatio;
            this.qtPlayer.MovieControllerVisible = false;
        }
        static void Main(string[] args)
        {
            int arguments = args.Length;
            int i;
            // parse the command-line arguments
            for (i = 0; i < arguments; i++)
            {
                if ((0 == args[i].CompareTo("-i")) && i + 1 < arguments)
                    inFile = args[++i];
                if ((0 == args[i].CompareTo("-o")) && i + 1 < arguments)
                    outFile = args[++i];
                if ((0 == args[i].CompareTo("-codec")) && i + 1 < arguments)
                    codec = args[++i];
                if ((0 == args[i].CompareTo("-promptForSettings")) && i + 1 <= arguments)
                    promptForSettings = true;
                if ((0 == args[i].CompareTo("-saveSettings")) && i + 1 <= arguments)
                {
                    saveSettings = true;
                    saveSettingsFile = args[++i];
                }
                if ((0 == args[i].CompareTo("-loadSettings")) && i + 1 <= arguments)
                {
                    loadSettings = true;
                    loadSettingsFile = args[++i];
                }
            }

            // check for command usage errors
            if (null == inFile || null == outFile || ((promptForSettings == false) && (null == codec))
                || ((saveSettings == true) && (promptForSettings == false)))
            {
                PrintUsage();
                return;
            }

            // create a new Form - the QTControl must be hosted on a Form or Window
            frm = new Form1();

            try
            {
                // retrieve the instance of the QTControl object from the Form
                qtc = frm.QTControl;

                // specify that any errors generated will raise an exception
                qtc.ErrorHandling = (int) QTErrorHandlingOptionsEnum.qtErrorHandlingRaiseException;

                // use a QTEvent handler to display export progress information
                qtc.QTEvent += new AxQTOControlLib._IQTControlEvents_QTEventEventHandler(OnQTEvent);

                // get the source movie for the export operation
                qtc.URL = inFile;
                Console.WriteLine("Input file  : " + inFile);
                Console.WriteLine("Output file : " + outFile);

                if (qtc.Movie != null)
                {
                    // get the QuickTime object from the QTControl
                    QTOLibrary.QTQuickTime qt = qtc.QuickTime;

                    if (qt != null)
                    {
                        // must first add an exporter to the collection
                        if (qt.Exporters.Count == 0)
                            qt.Exporters.Add();

                        // retrieve the QTExporter object from the collection
                        QTExporter qtexp = qt.Exporters[1];

                        if (qtexp != null)
                        {
                            qtexp.SetDataSource(qtc.Movie);
                            // export our movie to specified format
                            // (can be overriden by load settings)
                            qtexp.TypeName = codec;
                            // dont show the progress dialog
                            qtexp.ShowProgressDialog = false;
                            // specify destination file for the export operation
                            qtexp.DestinationFileName = outFile;
                            // optionally load exporter settings from a file if one is specified
                            if (loadSettings)
                            {
                                // first check if settings file actually exists
                                if (File.Exists(loadSettingsFile))
                                {
                                    StreamReader reader = new StreamReader(loadSettingsFile);
                                    CFObject settingsObject = new CFObject();
                                    string xml = reader.ReadToEnd();    // read settings file as an XML string
                                    settingsObject.XML = xml;   // load XML settings string into a CFObject
                                    qtexp.Settings = settingsObject;    // set the XML onto the exporter
                                    reader.Close();
                                    Console.WriteLine("Settings loaded from: " + loadSettingsFile);
                                }
                            }
                            // we'll show the settings dialog if the user asks for it
                            if (promptForSettings)
                            {
                                // show the exporter settings dialog
                                qtexp.ShowSettingsDialog();

                                // Optionally save the exporter settings to a file
                                if (saveSettings)
                                {
                                    StreamWriter writer = new StreamWriter(saveSettingsFile, false);
                                    writer.Write(qtexp.Settings.XML);   // write the settings as XML
                                    writer.Close();
                                    Console.WriteLine("Settings saved to: " + saveSettingsFile);
                                }
                            }
                            // we want export progress events
                            qtexp.EventListeners.Add(QTEventClassesEnum.qtEventClassProgress, QTEventIDsEnum.qtEventExportProgress, 0, 0);

                            Console.WriteLine("Export started...");

                            exportProgress = 0;

                            // do the export!
                            qtexp.BeginExport();

                            Console.WriteLine("\nExport done.");
                        }
                    }
                }
            }
            catch(COMException ex)
            {
                QTUtils qtu = new QTUtils();
                Console.WriteLine("Error occurred: " + ex.ErrorCode.ToString("x") + " " + qtu.QTErrorFromErrorCode(ex.ErrorCode).ToString());
            }
            qtc.URL = "";
            frm.Dispose();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Unload of the Engine and clean up resources
        /// </summary>
        internal static void Dispose()
        {
            try
            {
                if (QuickTimePlayer != null)
                {
                    QuickTimePlayer.QuickTimeTerminate();
                    QuickTimePlayer.Dispose();
                    QuickTimePlayer = null;
                }

                NativeOdessaMethods.Dispose();
            }
            catch (Exception ex)
            {
                Logger.Error("Exception: " + ex.Message);
            }
        }