System.Windows.Media.MediaStreamSource.SetMediaElement C# (CSharp) Méthode

SetMediaElement() private méthode

private SetMediaElement ( System.Windows.Controls.MediaElement mediaElement ) : void
mediaElement System.Windows.Controls.MediaElement
Résultat void
		internal void SetMediaElement (MediaElement mediaElement)
		{
			IntPtr demuxer = IntPtr.Zero;
					
			if (this.demuxer != IntPtr.Zero)
				throw new InvalidOperationException ("MediaStreamSource: this source has already been initialized.");
			
			if (handle.IsAllocated)
				throw new InvalidOperationException ("MediaStreamSource: this source has already been initialized.");
			
			media_element = mediaElement;
		
			handle = GCHandle.Alloc (this);
			demuxer = NativeMethods.media_element_set_demuxer_source (media_element.native, GCHandle.ToIntPtr (handle), closeMediaCallback, getDiagnosticAsyncCallback, getSampleAsyncCallback, openMediaAsyncCallback, seekAsyncCallback, switchMediaStreamAsyncCallback);
			
			if (demuxer == IntPtr.Zero)
				throw new InvalidOperationException ("MediaStreamSource: Could not create native demuxer.");
			
			if (this.media == IntPtr.Zero)
				this.media = NativeMethods.imedia_object_get_media_reffed (demuxer);
			this.demuxer = demuxer;
		}

Usage Example

Exemple #1
0
		public void SetSource (MediaStreamSource mediaStreamSource)
		{
			if (mediaStreamSource == null)
				throw new ArgumentNullException ("mediaStreamSource");

			Source = null;

			if (media_stream_source != null) {
				media_stream_source.CloseMediaInternal ();
				media_stream_source = null;
			}

			if (mediaStreamSource.Closed)
				throw new InvalidOperationException ();
			
			media_stream_source = mediaStreamSource;
			media_stream_source.SetMediaElement (this);
		}