Exemplo n.º 1
0
        private void CreateEncoderAppWithUI()
        {
            WMEncoderApp EncoderApp = new WMEncoderApp();
            IWMEncoder   Encoder    = EncoderApp.Encoder;

            // Display the predefined Encoder UI.
            EncoderApp.Visible = true;
        }
Exemplo n.º 2
0
        public MediaPusher()
        {
            this.app = new WMEncoderAppClass();

            //WMEncoderAppClass から取得しなければ
            //ブロードキャストが実行できない
            this.enc = (WMEncoder)(this.app.Encoder);

            this.InitDevice();
            this.InitEncodeProfile();
            this.InitBroadCast();

            this.InitEvent();
        }
Exemplo n.º 3
0
        public MediaPusher()
        {
            this.app = new WMEncoderAppClass();

            //WMEncoderAppClass ����擾���Ȃ����
            //�u���[�h�L���X�g�����s�ł��Ȃ�
            this.enc = (WMEncoder)(this.app.Encoder);

            this.InitDevice();
            this.InitEncodeProfile();
            this.InitBroadCast();

            this.InitEvent();
        }
Exemplo n.º 4
0
        public MediaTrimer(string inputFile, string profileName)
        {
            this.inputFile = inputFile;

            this.app = new WMEncoderAppClass();
            this.enc = app.Encoder as IWMEncoder2;
            this.sgcol = enc.SourceGroupCollection;

            this.profile = SelectProfile(profileName);

            if (this.profile == null)
            {
                throw new ArgumentException("nothing profile", "profileName");
            }

            this.DestFile = "default.wmv";
        }
Exemplo n.º 5
0
        public MediaTrimer(string inputFile, string profileName)
        {
            this.inputFile = inputFile;

            this.app   = new WMEncoderAppClass();
            this.enc   = app.Encoder as IWMEncoder2;
            this.sgcol = enc.SourceGroupCollection;

            this.profile = SelectProfile(profileName);

            if (this.profile == null)
            {
                throw new ArgumentException("nothing profile", "profileName");
            }

            this.DestFile = "default.wmv";
        }
Exemplo n.º 6
0
		//To Start the Recording.
		private void startRecordingToolStripMenuItem_Click(object sender, EventArgs e)
		{
			IWMEncProfile SelProfile;
			IWMEncSource AudioSrc;
			try
			{
				if (DesktopEncoder != null)
				{
					if (DesktopEncoder.RunState == WMENC_ENCODER_STATE.WMENC_ENCODER_PAUSED)
					{
						DesktopEncoder.Start();
						return;
					}
				}
				DesktopEncoderAppln = new WMEncoderApp();
				DesktopEncoder = DesktopEncoderAppln.Encoder;
				IWMEncSourceGroupCollection SrcGroupCollection = DesktopEncoder.SourceGroupCollection;
				IWMEncSourceGroup SrcGroup = SrcGroupCollection.Add("SG_1");
				IWMEncVideoSource2 VideoSrc = (IWMEncVideoSource2)SrcGroup.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
				//Set Audio Source.
				if (addAudio.Checked)
				{
					AudioSrc = SrcGroup.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
					if (txtAudioFile.Text.Trim() != "")
					{
						if (File.Exists(txtAudioFile.Text.Trim()))
						{
							AudioSrc.SetInput(txtAudioFile.Text.Trim(), "", "");
						}
						else
						{
							AudioSrc.SetInput("Default_Audio_Device", "Device", "");
						}
					}
					else
					{
						AudioSrc.SetInput("Default_Audio_Device", "Device", "");
					}
				}
				//Set Video Source:Desktop.
				VideoSrc.SetInput("ScreenCapture1", "ScreenCap", "");
				IWMEncProfileCollection ProfileCollection = DesktopEncoder.ProfileCollection;
				ProfileCollection = DesktopEncoder.ProfileCollection;
				int lLength = ProfileCollection.Count;
				//Set Profile.
				if (toolstripEnableBroadcast.Checked && txtPortNbr.Text.Trim() != "")
				{
					IWMEncBroadcast broadcast = DesktopEncoder.Broadcast;
					broadcast.set_PortNumber(WMENC_BROADCAST_PROTOCOL.WMENC_PROTOCOL_HTTP, Convert.ToInt32(txtPortNbr.Text.Trim()));
					for (int i = 0; i <= lLength - 1; i++)
					{
						SelProfile = ProfileCollection.Item(i);
						if (SelProfile.Name == "Windows Media Video 8 for Local Area Network (768 Kbps)")
						{
							SrcGroup.set_Profile((IWMEncProfile)SelProfile);
							break;
						}
					}
				}
				else
				{
					for (int i = 0; i <= lLength - 1; i++)
					{
						SelProfile = ProfileCollection.Item(i);
						if (SelProfile.Name == "Screen Video/Audio High (CBR)")
						{
							SrcGroup.set_Profile((IWMEncProfile)SelProfile);
							break;
						}
					}
				}
				//Local File to Store Recording temporarily.
				IWMEncFile inputFile = DesktopEncoder.File;
				inputFile.LocalFileName = "C:\\TempRecording.wmv";
				DesktopEncoder.PrepareToEncode(true);
				DesktopEncoder.Start();
				tmrRcCounter.Enabled = true;
				recordStarttime = DateTime.Now;
				if (toolstripEnableBroadcast.Checked && txtPortNbr.Text.Trim() != "")
				{
					//Start Timer to Count Viewers connected to Broadcast.
					tmrViewerCount.Enabled = true;
				}
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}
Exemplo n.º 7
0
        //To Start the Recording.
        private void startRecordingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IWMEncProfile SelProfile;
            IWMEncSource  AudioSrc;

            try
            {
                if (DesktopEncoder != null)
                {
                    if (DesktopEncoder.RunState == WMENC_ENCODER_STATE.WMENC_ENCODER_PAUSED)
                    {
                        DesktopEncoder.Start();
                        return;
                    }
                }
                DesktopEncoderAppln = new WMEncoderApp();
                DesktopEncoder      = DesktopEncoderAppln.Encoder;
                IWMEncSourceGroupCollection SrcGroupCollection = DesktopEncoder.SourceGroupCollection;
                IWMEncSourceGroup           SrcGroup           = SrcGroupCollection.Add("SG_1");
                IWMEncVideoSource2          VideoSrc           = (IWMEncVideoSource2)SrcGroup.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
                //Set Audio Source.
                if (addAudio.Checked)
                {
                    AudioSrc = SrcGroup.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
                    if (txtAudioFile.Text.Trim() != "")
                    {
                        if (File.Exists(txtAudioFile.Text.Trim()))
                        {
                            AudioSrc.SetInput(txtAudioFile.Text.Trim(), "", "");
                        }
                        else
                        {
                            AudioSrc.SetInput("Default_Audio_Device", "Device", "");
                        }
                    }
                    else
                    {
                        AudioSrc.SetInput("Default_Audio_Device", "Device", "");
                    }
                }
                //Set Video Source:Desktop.
                VideoSrc.SetInput("ScreenCapture1", "ScreenCap", "");
                IWMEncProfileCollection ProfileCollection = DesktopEncoder.ProfileCollection;
                ProfileCollection = DesktopEncoder.ProfileCollection;
                int lLength = ProfileCollection.Count;
                //Set Profile.
                if (toolstripEnableBroadcast.Checked && txtPortNbr.Text.Trim() != "")
                {
                    IWMEncBroadcast broadcast = DesktopEncoder.Broadcast;
                    broadcast.set_PortNumber(WMENC_BROADCAST_PROTOCOL.WMENC_PROTOCOL_HTTP, Convert.ToInt32(txtPortNbr.Text.Trim()));
                    for (int i = 0; i <= lLength - 1; i++)
                    {
                        SelProfile = ProfileCollection.Item(i);
                        if (SelProfile.Name == "Windows Media Video 8 for Local Area Network (768 Kbps)")
                        {
                            SrcGroup.set_Profile((IWMEncProfile)SelProfile);
                            break;
                        }
                    }
                }
                else
                {
                    for (int i = 0; i <= lLength - 1; i++)
                    {
                        SelProfile = ProfileCollection.Item(i);
                        if (SelProfile.Name == "Screen Video/Audio High (CBR)")
                        {
                            SrcGroup.set_Profile((IWMEncProfile)SelProfile);
                            break;
                        }
                    }
                }
                //Local File to Store Recording temporarily.
                IWMEncFile inputFile = DesktopEncoder.File;
                inputFile.LocalFileName = "C:\\TempRecording.wmv";
                DesktopEncoder.PrepareToEncode(true);
                DesktopEncoder.Start();
                tmrRcCounter.Enabled = true;
                recordStarttime      = DateTime.Now;
                if (toolstripEnableBroadcast.Checked && txtPortNbr.Text.Trim() != "")
                {
                    //Start Timer to Count Viewers connected to Broadcast.
                    tmrViewerCount.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 8
0
 public void InitializeBasic()
 {
     if (EncoderApp == null)
     {
         EncoderApp = new WMEncoderApp();
         Encoder = EncoderApp.Encoder;
         // IMPORTANT: set to false on product release
         EncoderApp.Visible = false; //true;
         //Encoder.OnStateChange += new _IWMEncoderEvents_OnStateChangeEventHandler(OnStateChange);
         InitializeEncoder();
     }
 }