Changeset 4931a9265236c3a8382f108840a6e72d27d0637c

Show
Ignore:
Timestamp:
20/10/07 18:02:03 (1 year ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1192896123 +0000
git-parent:

[2edb3900e75e631eb1d5cf398763950cd214dad1]

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

Add sound volume, rate, and fullscreen support

Files:

Legend:

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

    rcd6d499 r4931a92  
    154154        } 
    155155 
     156        /** 
     157         * Switches to the next playlist item 
     158         */ 
    156159        public void NextItem () 
    157160        { 
     
    161164            MediaControlAPI.PlaylistNextItem (self, ref e); 
    162165            e.Consume (); 
     166        } 
     167 
     168        /** 
     169         * Normalized audio output volume in percent (must be [0..100]). 
     170         */ 
     171        public short SoundVolume 
     172        { 
     173            get 
     174            { 
     175                CheckDisposed (); 
     176 
     177                NativeException e = NativeException.Prepare (); 
     178                short vol = MediaControlAPI.SoundGetVolume (self, ref e); 
     179                e.Consume (); 
     180                return vol; 
     181            } 
     182            set 
     183            { 
     184                CheckDisposed (); 
     185 
     186                if ((value < 0) || (value > 100)) 
     187                    throw new ArgumentOutOfRangeException ("Volume not within [0..100]"); 
     188 
     189                NativeException e = NativeException.Prepare (); 
     190                MediaControlAPI.SoundSetVolume (self, value, ref e); 
     191                e.Consume (); 
     192            } 
     193        } 
     194 
     195        /** 
     196         * Performance speed rate in percent. 
     197         */ 
     198        public int Rate 
     199        { 
     200            get 
     201            { 
     202                CheckDisposed (); 
     203 
     204                NativeException e = NativeException.Prepare (); 
     205                int rate = MediaControlAPI.GetRate (self, ref e); 
     206                e.Consume (); 
     207                return rate; 
     208            } 
     209            set 
     210            { 
     211                CheckDisposed (); 
     212 
     213                NativeException e = NativeException.Prepare (); 
     214                MediaControlAPI.SetRate (self, value, ref e); 
     215                e.Consume (); 
     216            } 
     217        } 
     218 
     219        /** 
     220         * Fullscreen flag. 
     221         */ 
     222        public bool Fullscreen 
     223        { 
     224            get 
     225            { 
     226                CheckDisposed (); 
     227 
     228                NativeException e = NativeException.Prepare (); 
     229                int ret = MediaControlAPI.GetFullscreen (self, ref e); 
     230                e.Consume (); 
     231                return ret != 0; 
     232            } 
     233            set 
     234            { 
     235                CheckDisposed (); 
     236 
     237                NativeException e = NativeException.Prepare (); 
     238                MediaControlAPI.SetFullscreen (self, value ? 1 : 0, ref e); 
     239                e.Consume (); 
     240            } 
    163241        } 
    164242 
  • bindings/cil/marshal.cs

    rcd6d499 r4931a92  
    5151        [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_playlist_next_item")] 
    5252        public static extern void PlaylistNextItem (MediaControlHandle self, ref NativeException e); 
    53     } 
     53 
     54        [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_sound_get_volume")] 
     55        public static extern short SoundGetVolume (MediaControlHandle self, ref NativeException e); 
     56        [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_sound_set_volume")] 
     57        public static extern void SoundSetVolume (MediaControlHandle self, short volume, ref NativeException e); 
     58        /* SetVisual */ 
     59 
     60        [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_get_rate")] 
     61        public static extern short GetRate (MediaControlHandle self, ref NativeException e); 
     62        [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_set_rate")] 
     63        public static extern void SetRate (MediaControlHandle self, int rate, ref NativeException e); 
     64        [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_get_fullscreen")] 
     65        public static extern int GetFullscreen (MediaControlHandle self, ref NativeException e); 
     66        [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_set_fullscreen")] 
     67        public static extern void SetFullscreen (MediaControlHandle self, int full, ref NativeException e); 
     68    }; 
    5469 
    5570    /** 
  • bindings/cil/testvlc.cs

    rcd6d499 r4931a92  
    3535                mc.AddItem (s); 
    3636 
     37            Console.WriteLine ("Volume    : {0}%", mc.SoundVolume); 
     38            Console.WriteLine ("Rate      : {0}%", mc.Rate); 
     39            Console.WriteLine ("Fullscreen: {0}", mc.Fullscreen); 
     40            mc.Fullscreen = false; 
     41 
    3742            /*mc.Play ();*/ 
    3843            Console.ReadLine (); 
     
    4045            mc.Stop (); 
    4146            mc.Clear (); 
     47            mc.SoundVolume = 100; 
     48            mc.Rate = 100; 
    4249 
    4350            mc.Dispose ();