Changeset 54f91faac813fba2cb8b94fdc11ee977a9a94c66

Show
Ignore:
Timestamp:
21/10/07 14:55:32 (1 year ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1192971332 +0000
git-parent:

[77015ab46b9aff1d25ac3ca3c064893549fd4137]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1192971332 +0000
Message:

Basic playlist controls

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bindings/cil/libvlc.cs

    r77015ab r54f91fa  
    6565    }; 
    6666 
     67    /** 
     68     * Managed class for LibVLC instance (including playlist) 
     69     */ 
    6770    public class Instance : BaseObject<InstanceHandle> 
    6871    { 
     
    7881 
    7982            return new MediaDescriptor (dh); 
     83        } 
     84 
     85 
     86        [DllImport ("libvlc-control.dll", EntryPoint="libvlc_playlist_loop")] 
     87        static extern void PlaylistLoop (InstanceHandle self, int b, 
     88                                         NativeException ex); 
     89        /** Sets the playlist loop flag */ 
     90        public bool Loop 
     91        { 
     92            set 
     93            { 
     94                PlaylistLoop (self, value ? 1 : 0, ex); 
     95                ex.Raise (); 
     96            } 
     97        } 
     98 
     99        [DllImport ("libvlc-control.dll", EntryPoint="libvlc_playlist_play")] 
     100        static extern void PlaylistPlay (InstanceHandle self, int id, int optc, 
     101                                         U8String[] optv, NativeException ex); 
     102        /** Plays the next playlist item */ 
     103        public void Play () 
     104        { 
     105            PlaylistPlay (self, -1, 0, new U8String[0], ex); 
     106            ex.Raise (); 
     107        } 
     108 
     109        [DllImport ("libvlc-control.dll", EntryPoint="libvlc_playlist_pause")] 
     110        static extern void PlaylistPause (InstanceHandle self, 
     111                                          NativeException ex); 
     112        /** Toggles pause */ 
     113        public void TogglePause () 
     114        { 
     115            PlaylistPause (self, ex); 
     116            ex.Raise (); 
     117        } 
     118 
     119        [DllImport ("libvlc-control.dll", 
     120                    EntryPoint="libvlc_playlist_isplaying")] 
     121        static extern int PlaylistIsPlaying (InstanceHandle self, 
     122                                             NativeException ex); 
     123        /** Whether the playlist is running, or in pause/stop */ 
     124        public bool IsPlaying 
     125        { 
     126            get 
     127            { 
     128                int ret = PlaylistIsPlaying (self, ex); 
     129                ex.Raise (); 
     130                return ret != 0; 
     131            } 
     132        } 
     133 
     134        [DllImport ("libvlc-control.dll", EntryPoint="libvlc_playlist_stop")] 
     135        static extern void PlaylistStop (InstanceHandle self, 
     136                                         NativeException ex); 
     137        /** Stops playing */ 
     138        public void Stop () 
     139        { 
     140            PlaylistStop (self, ex); 
     141            ex.Raise (); 
     142        } 
     143 
     144        [DllImport ("libvlc-control.dll", EntryPoint="libvlc_playlist_next")] 
     145        static extern void PlaylistNext (InstanceHandle self, 
     146                                         NativeException ex); 
     147        /** Goes to next playlist item (and start playing it) */ 
     148        public void Next () 
     149        { 
     150            PlaylistNext (self, ex); 
     151            ex.Raise (); 
     152        } 
     153 
     154        [DllImport ("libvlc-control.dll", EntryPoint="libvlc_playlist_prev")] 
     155        static extern void PlaylistPrev (InstanceHandle self, 
     156                                         NativeException ex); 
     157        /** Goes to previous playlist item (and start playing it) */ 
     158        public void Prev () 
     159        { 
     160            PlaylistPrev (self, ex); 
     161            ex.Raise (); 
     162        } 
     163 
     164        [DllImport ("libvlc-control.dll", EntryPoint="libvlc_playlist_clear")] 
     165        static extern void PlaylistClear (InstanceHandle self, 
     166                                          NativeException ex); 
     167        /** Clears the whole playlist */ 
     168        public void Clear () 
     169        { 
     170            PlaylistClear (self, ex); 
     171            ex.Raise (); 
     172        } 
     173 
     174        [DllImport ("libvlc-control.dll", EntryPoint="libvlc_playlist_add")] 
     175        static extern void PlaylistAdd (InstanceHandle self, U8String uri, 
     176                                        U8String name, NativeException e); 
     177        /** Appends an item to the playlist */ 
     178        public void Add (string mrl) 
     179        { 
     180            Add (mrl, null); 
     181        } 
     182        /** Appends an item to the playlist */ 
     183        public void Add (string mrl, string name) 
     184        { 
     185            U8String umrl = new U8String (mrl); 
     186            U8String uname = new U8String (name); 
     187 
     188            PlaylistAdd (self, umrl, uname, ex); 
     189            ex.Raise (); 
    80190        } 
    81191    }; 
  • bindings/cil/testvlc.cs

    r77015ab r54f91fa  
    3535            Instance vlc = VLC.CreateInstance (argv); 
    3636            MediaDescriptor md = vlc.CreateDescriptor (args[0]); 
     37            md.Dispose (); 
    3738 
    38             md.Dispose (); 
     39            foreach (string s in args) 
     40                vlc.Add (s); 
     41 
     42            vlc.Loop = false; 
     43            vlc.TogglePause (); 
     44            Console.ReadLine (); 
    3945            vlc.Dispose (); 
    4046            return 0; 
  • bindings/cil/ustring.cs

    r77aa5b9 r54f91fa  
    3737        public U8String (string value) 
    3838        { 
     39            if (value == null) 
     40                return; 
     41 
    3942            byte[] bytes = System.Text.Encoding.UTF8.GetBytes (value); 
    4043            mb_str = new byte[bytes.Length + 1];