fixes for libvlc medialistplayer_play_item and medialistplayer_play_item_at_index...
authorFilippo Carone <littlejohn@videolan.org>
Tue, 18 Mar 2008 18:28:38 +0000 (19:28 +0100)
committerFilippo Carone <littlejohn@videolan.org>
Tue, 18 Mar 2008 18:28:38 +0000 (19:28 +0100)
core/src/main/java/org/videolan/jvlc/internal/LibVlcState.java [new file with mode: 0644]
core/src/test/java/org/videolan/jvlc/internal/MediaListPlayerTest.java

diff --git a/core/src/main/java/org/videolan/jvlc/internal/LibVlcState.java b/core/src/main/java/org/videolan/jvlc/internal/LibVlcState.java
new file mode 100644 (file)
index 0000000..7512861
--- /dev/null
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * LibVlcState.java: VLC Java Bindings
+ *****************************************************************************
+ * Copyright (C) 1998-2008 the VideoLAN team
+ *
+ * Authors: Filippo Carone <filippo@carone.org>
+ *
+ *
+ * $Id $
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+package org.videolan.jvlc.internal;
+
+
+public enum LibVlcState
+{
+    libvlc_NothingSpecial,
+    libvlc_Stopped,
+    libvlc_Opening,
+    libvlc_Buffering,
+    libvlc_Ended,
+    libvlc_Error,
+    libvlc_Playing,
+    libvlc_Paused
+}
index f6e436a..c8ec022 100644 (file)
@@ -110,10 +110,10 @@ public class MediaListPlayerTest
         Assert.assertEquals(1, exception.raised);
     }
     
-//    @Test
     /**
-     * disabled: see https://trac.videolan.org/vlc/attachment/ticket/1527
+     * this fails: see https://trac.videolan.org/vlc/attachment/ticket/1527
      */
+    @Test
     public void mediaListPlayerPlay()
     {
         libvlc_exception_t exception = new libvlc_exception_t();
@@ -123,6 +123,41 @@ public class MediaListPlayerTest
         libvlc.libvlc_media_list_add_media_descriptor(mediaList, mediaDescriptor, exception);
         libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
         libvlc.libvlc_media_list_player_play(mediaListPlayer, exception);
+        Assert.assertEquals("Exception message: " + exception.message + ".\n", 0, exception.raised);
+    }
+    
+    @Test
+    public void mediaListPlayerPlayItemAtIndex()
+    {
+        libvlc_exception_t exception = new libvlc_exception_t();
+        LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
+        LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
+        LibVlcMediaDescriptor mediaDescriptor = libvlc.libvlc_media_descriptor_new(libvlcInstance, mrl, exception);
+        libvlc.libvlc_media_list_add_media_descriptor(mediaList, mediaDescriptor, exception);
+        libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
+        libvlc.libvlc_media_list_player_play_item_at_index(mediaListPlayer, 0, exception);
+    }
+    
+    @Test
+    public void mediaListPlayerPlayItem() throws Exception
+    {
+        libvlc_exception_t exception = new libvlc_exception_t();
+        LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
+        LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
+        LibVlcMediaDescriptor mediaDescriptor = libvlc.libvlc_media_descriptor_new(libvlcInstance, mrl, exception);
+        libvlc.libvlc_media_list_add_media_descriptor(mediaList, mediaDescriptor, exception);
+        libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
+        libvlc.libvlc_media_list_player_play_item(mediaListPlayer, mediaDescriptor, exception);
+        Thread.sleep(6000);
+    }
+    
+    @Test
+    public void mediaListPlayerGetStateStopped()
+    {
+        libvlc_exception_t exception = new libvlc_exception_t();
+        LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
+        int state = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception);
+        Assert.assertEquals(LibVlcState.libvlc_Stopped.ordinal(), state);
     }
 
 }