Example #1
0
        /// <summary>
        /// Initializes previously preparsed next media to play.
        /// </summary>
        /// <param name="preparsedMedia">
        /// A <see cref="PreparsedMedia"/> instance returned from <see cref="ParseMediaInput"/> method.
        /// </param>
        public override void SetNextMediaInput(PreparsedMedia preparsedMedia)
        {
            VerifyObjectIsNotDisposed();
            //
            if (preparsedMedia == null)
            {
                throw new ArgumentNullException("mediaInput");
            }
            //
            nextMedia = preparsedMedia.MediaInput;
            // precreating of libvlc media
            if (currentMediaInternal != currentMediaInternalPreprepared)
            {
                if (nextMediaInternalPreprepared != null)
                {
                    nextMediaInternalPreprepared.Dispose();
                    nextMediaInternalPreprepared = null;
                }
            }
            VlcMediaInternal media = GetPreparsedMediaInternal(preparsedMedia);

            media.SetOutput(playerOutput);
            //
            nextMediaInternalPreprepared = media;
            disposeNextMediaPreprepared  = true;
        }
Example #2
0
 public void TestPreparsedMediaCreate()
 {
     using (VlcMediaLibraryFactory factory = CreateNewFactory()) {
         factory.CreateSinglePlayers = true;
         PlayerOutput nullOutput = new PlayerOutput();
         //
         string path = GetSampleAudioPath();
         if (!System.IO.File.Exists(path))
         {
             Assert.Ignore("The sample file doesn't exists. Ignoring.");
         }
         MediaInput input = new MediaInput(MediaInputType.File,
                                           path);
         //
         using (Player player = factory.CreatePlayer(nullOutput)) {
             PreparsedMedia media = player.ParseMediaInput(input);
             media = player.ParseMediaInput(input);
             //
             Assert.IsTrue(media.ContainsAudio);
             Assert.IsFalse(media.ContainsVideo);
             //
             AudioTrackInfo[] tracks = media.GetAudioTracks();
             Assert.IsTrue(tracks.Length == 1, "There should be one audio track.");
             //
             VideoTrackInfo[] tracksVideo = media.GetVideoTracks();
             Assert.IsTrue(tracksVideo.Length == 0, "There shouldn't be any video tracks.");
         }
     }
 }
Example #3
0
 /// <summary>
 /// Returns <see cref="VlcMediaInternal"/> preparsed using <see cref="ParseMediaInput"/>.
 /// </summary>
 /// <param name="media">
 /// A <see cref="PreparsedMedia"/> instance returned by <see cref="ParseMediaInput"/>,
 /// </param>
 /// <returns>
 /// A <see cref="VlcMediaInternal"/> instance in parsed state.
 /// </returns>
 internal VlcMediaInternal GetPreparsedMediaInternal(PreparsedMedia media)
 {
     if (media == null)
     {
         throw new ArgumentNullException("media");
     }
     if (!(media is VlcPreparsedMedia))
     {
         throw new ArgumentException("Media is invalid.", "media");
     }
     //
     return((media as VlcPreparsedMedia).MediaInternal);
 }