Example #1
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            const int VIDEODEVICE = 0; // zero based index of video capture device to use

            string filename=textBox1.Text;
            int moji=filename.Length;
            Cursor.Current = Cursors.WaitCursor;

            if (cam == null)
            {
                cam = new AsfFilter.Form2.Capt(VIDEODEVICE, textBox1.Text + num + ".wmv");
                cam.Start();
                movienumber.Text=textBox1.Text+num+"��B�e��";
                button1.Text = "Stop";
                textBox1.ReadOnly = true;
                sync.Enabled = true;
                synctime.Text = ("00:00:00:00:000");
                syn.Clear();
                MyStopWatch.Start();
            }
            else
            {
                button1.Text = "Start";
                textBox1.ReadOnly = false;

                // Pause the recording
                cam.Pause();
                MyStopWatch.Stop();
                timeTextBox.Text = string.Format("{00:00:00:00:000}", MyStopWatch.ElapsedMilliseconds);

                // Close it down
                cam.Dispose();
                cam = null;

                //string name = textBox1.Text;
                //name = name.Replace(".wmv", "");
                string[] synctime = new string[syn.Count];
                MyStopWatch.Reset();
                timeTextBox.Text = ("00:00:00:000");
                StreamWriter fs = new StreamWriter(textBox1.Text +num+ ".json");

                for (int count = 0; count < syn.Count; count++)
                {
                    synctime[count] = (string)syn[count];
                }
                for (int count = 0; count < syn.Count; count++)
                {
                    synctime[count] = synctime[count].Remove(8, 1);
                }
                for (int count = 0; count < syn.Count; count++)
                {
                    synctime[count] = synctime[count].Insert(8, ".");
                }

                fs.WriteLine("{");
                fs.WriteLine("\"tag\" : " + "\"" + textBox1.Text + ".wmv" + "\"" + ",");
                fs.WriteLine("\"url\" : " + "[" + "\"" + textBox1.Text + ".wmv" + "\"" + "],");
                fs.WriteLine("\"viewpoint\" : [\"����\"],");
                fs.Write("\"sync\" : [");

                for (int count = 0; count < syn.Count; count++)
                {
                    fs.Write("\"" + synctime[count] + "\"");
                    if (count != syn.Count - 1)
                    {
                        fs.WriteLine(",");
                    }
                }

                fs.WriteLine("],");
                fs.WriteLine("\"rectangle\" : [],");
                fs.WriteLine("\"text\" : []");
                fs.WriteLine("}");
                fs.Close();

                num++;
                movienumber.Text = textBox1.Text + num + "�̎B�e��ҋ@��";

                ///json�t�@�C���̏����o��
                ///�v���C���[��JSON�t�H�[�}�b�g
                ///
                /// {
                ///"tag" : "output.wmv",
                ///"url" : ["output.wmv"],
                ///"viewpoint" : ["����"],
                ///"sync" : ["00:01:00","00:02:00"],
                ///"rectangle" : [],
                ///"text" : []
                ///}
                ///

                //foreach (string s in syn)
                //{
                //   synctime.Text += System.Environment.NewLine + s;
                //}

            }

            Cursor.Current = Cursors.Default;
        }
Example #2
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            const int VIDEODEVICE = 0; // zero based index of video capture device to use

            string filename = textBox1.Text;
            int    moji     = filename.Length;

            Cursor.Current = Cursors.WaitCursor;

            if (cam == null)
            {
                cam = new AsfFilter.Form2.Capt(VIDEODEVICE, textBox1.Text + num + ".wmv");
                cam.Start();
                movienumber.Text  = textBox1.Text + num + "を撮影中";
                button1.Text      = "Stop";
                textBox1.ReadOnly = true;
                sync.Enabled      = true;
                synctime.Text     = ("00:00:00:00:000");
                syn.Clear();
                MyStopWatch.Start();
            }
            else
            {
                button1.Text      = "Start";
                textBox1.ReadOnly = false;

                // Pause the recording
                cam.Pause();
                MyStopWatch.Stop();
                timeTextBox.Text = string.Format("{00:00:00:00:000}", MyStopWatch.ElapsedMilliseconds);

                // Close it down
                cam.Dispose();
                cam = null;

                //string name = textBox1.Text;
                //name = name.Replace(".wmv", "");
                string[] synctime = new string[syn.Count];
                MyStopWatch.Reset();
                timeTextBox.Text = ("00:00:00:000");
                StreamWriter fs = new StreamWriter(textBox1.Text + num + ".json");

                for (int count = 0; count < syn.Count; count++)
                {
                    synctime[count] = (string)syn[count];
                }
                for (int count = 0; count < syn.Count; count++)
                {
                    synctime[count] = synctime[count].Remove(8, 1);
                }
                for (int count = 0; count < syn.Count; count++)
                {
                    synctime[count] = synctime[count].Insert(8, ".");
                }

                fs.WriteLine("{");
                fs.WriteLine("\"tag\" : " + "\"" + textBox1.Text + ".wmv" + "\"" + ",");
                fs.WriteLine("\"url\" : " + "[" + "\"" + textBox1.Text + ".wmv" + "\"" + "],");
                fs.WriteLine("\"viewpoint\" : [\"正面\"],");
                fs.Write("\"sync\" : [");

                for (int count = 0; count < syn.Count; count++)
                {
                    fs.Write("\"" + synctime[count] + "\"");
                    if (count != syn.Count - 1)
                    {
                        fs.WriteLine(",");
                    }
                }

                fs.WriteLine("],");
                fs.WriteLine("\"rectangle\" : [],");
                fs.WriteLine("\"text\" : []");
                fs.WriteLine("}");
                fs.Close();

                num++;
                movienumber.Text = textBox1.Text + num + "の撮影を待機中";

                ///jsonファイルの書き出し
                ///プレイヤーのJSONフォーマット
                ///
                /// {
                ///"tag" : "output.wmv",
                ///"url" : ["output.wmv"],
                ///"viewpoint" : ["正面"],
                ///"sync" : ["00:01:00","00:02:00"],
                ///"rectangle" : [],
                ///"text" : []
                ///}
                ///

                //foreach (string s in syn)
                //{
                //   synctime.Text += System.Environment.NewLine + s;
                //}
            }

            Cursor.Current = Cursors.Default;
        }