Changeset 145

Show
Ignore:
Timestamp:
03/07/07 17:07:57 (2 years ago)
Author:
mgeske2
Message:

Added 2 functions from the libvlc dll to play the next and previous tracks, and implemented them in BadClient?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dmp/trunk/BadClient/Form1.Designer.cs

    r134 r145  
    3232            this.lblStatus = new System.Windows.Forms.Label(); 
    3333            this.splitContainer1 = new System.Windows.Forms.SplitContainer(); 
     34            this.button5 = new System.Windows.Forms.Button(); 
    3435            this.button4 = new System.Windows.Forms.Button(); 
    3536            this.button3 = new System.Windows.Forms.Button(); 
     
    4849            this.colAlbum = new System.Windows.Forms.DataGridViewTextBoxColumn(); 
    4950            this.colTrack = new System.Windows.Forms.DataGridViewTextBoxColumn(); 
     51            this.button6 = new System.Windows.Forms.Button(); 
    5052            this.splitContainer1.Panel1.SuspendLayout(); 
    5153            this.splitContainer1.Panel2.SuspendLayout(); 
     
    122124            // splitContainer1.Panel1 
    123125            //  
     126            this.splitContainer1.Panel1.Controls.Add(this.button5); 
    124127            this.splitContainer1.Panel1.Controls.Add(this.button4); 
     128            this.splitContainer1.Panel1.Controls.Add(this.button6); 
    125129            this.splitContainer1.Panel1.Controls.Add(this.button3); 
    126130            this.splitContainer1.Panel1.Controls.Add(this.btnListServers); 
     
    142146            this.splitContainer1.TabIndex = 8; 
    143147            //  
     148            // button5 
     149            //  
     150            this.button5.Location = new System.Drawing.Point(412, 8); 
     151            this.button5.Name = "button5"; 
     152            this.button5.Size = new System.Drawing.Size(75, 23); 
     153            this.button5.TabIndex = 12; 
     154            this.button5.Text = "Previous"; 
     155            this.button5.UseVisualStyleBackColor = true; 
     156            this.button5.Click += new System.EventHandler(this.button5_Click); 
     157            //  
    144158            // button4 
    145159            //  
     
    186200            this.button2.Size = new System.Drawing.Size(108, 23); 
    187201            this.button2.TabIndex = 6; 
    188             this.button2.Text = "Songs I'm Conn To"; 
     202            this.button2.Text = "Songs I\'m Conn To"; 
    189203            this.button2.UseVisualStyleBackColor = true; 
    190204            this.button2.Click += new System.EventHandler(this.button2_Click); 
     
    289303            this.colTrack.Name = "colTrack"; 
    290304            this.colTrack.ReadOnly = true; 
     305            //  
     306            // button6 
     307            //  
     308            this.button6.Location = new System.Drawing.Point(493, 7); 
     309            this.button6.Name = "button6"; 
     310            this.button6.Size = new System.Drawing.Size(75, 23); 
     311            this.button6.TabIndex = 13; 
     312            this.button6.Text = "Next"; 
     313            this.button6.UseVisualStyleBackColor = true; 
     314            this.button6.Click += new System.EventHandler(this.button6_Click); 
    291315            //  
    292316            // Form1 
     
    338362        private System.Windows.Forms.DataGridViewTextBoxColumn colTrack; 
    339363        private System.Windows.Forms.Button button4; 
     364        private System.Windows.Forms.Button button5; 
     365        private System.Windows.Forms.Button button6; 
    340366    } 
    341367} 
  • dmp/trunk/BadClient/Form1.cs

    r134 r145  
    126126            this.button3.Text = "Pause"; 
    127127        } 
     128 
     129        private void button5_Click(object sender, EventArgs e) 
     130        { 
     131            this.vlcPlayer.PrevPlaylistTrack(); 
     132        } 
     133 
     134        private void button6_Click(object sender, EventArgs e) 
     135        { 
     136            this.vlcPlayer.NextPlaylistTrack(); 
     137        } 
    128138        } 
    129139} 
  • dmp/trunk/vlc.NET/NativeLibVlc.cs

    r143 r145  
    399399                static extern void libvlc_playlist_play(ref libvlc_instance_t libvlc, Int32 id,  
    400400                        Int32 optionsCount, IntPtr optionsAlwaysNull, ref libvlc_exception_t p_exception); 
     401        [DllImport("libvlc")] 
     402        static extern void libvlc_playlist_next(ref libvlc_instance_t libvlc, ref libvlc_exception_t p_exception); 
     403        [DllImport("libvlc")] 
     404        static extern void libvlc_playlist_prev(ref libvlc_instance_t libvlc, ref libvlc_exception_t p_exception); 
    401405                [DllImport("libvlc")] 
    402406                static extern IntPtr libvlc_playlist_get_input(ref libvlc_instance_t libvlc, ref libvlc_exception_t p_exception); 
     
    15501554        } 
    15511555 
     1556        public VlcError NextTrack() 
     1557        { 
     1558            try 
     1559            { 
     1560                using (VlcPlaylistObject vpobj = new VlcPlaylistObject(this.vlcHandle)) 
     1561                { 
     1562                    if (vpobj.SubObject != IntPtr.Zero) 
     1563                    { 
     1564                        libvlc_playlist_next(ref vpobj.libvlc, ref vpobj.exception); 
     1565                        if (!vpobj.exception.WasExceptionRaised()) 
     1566                        { 
     1567                            return VlcError.Success; 
     1568                        } 
     1569                    } 
     1570                } 
     1571                return VlcError.Generic; 
     1572            } 
     1573            catch (Exception ex) 
     1574            { 
     1575                this.lastErrorMessage = ex.Message; 
     1576                return VlcError.Exception; 
     1577            } 
     1578        } 
     1579 
     1580        public VlcError PrevTrack() 
     1581        { 
     1582            try 
     1583            { 
     1584                using (VlcPlaylistObject vpobj = new VlcPlaylistObject(this.vlcHandle)) 
     1585                { 
     1586                    if (vpobj.SubObject != IntPtr.Zero) 
     1587                    { 
     1588                        libvlc_playlist_prev(ref vpobj.libvlc, ref vpobj.exception); 
     1589                        if (!vpobj.exception.WasExceptionRaised()) 
     1590                        { 
     1591                            return VlcError.Success; 
     1592                        } 
     1593                    } 
     1594                } 
     1595                return VlcError.Generic; 
     1596            } 
     1597            catch (Exception ex) 
     1598            { 
     1599                this.lastErrorMessage = ex.Message; 
     1600                return VlcError.Exception; 
     1601            } 
     1602        } 
     1603 
    15521604        public VlcError Stop() 
    15531605        { 
  • dmp/trunk/vlc.NET/VlcUserControl.cs

    r143 r145  
    11811181                } 
    11821182 
     1183        public void NextPlaylistTrack() 
     1184        { 
     1185            this.nativeVlc.NextTrack(); 
     1186        } 
     1187 
     1188        public void PrevPlaylistTrack() 
     1189        { 
     1190            this.nativeVlc.PrevTrack(); 
     1191        } 
     1192 
    11831193                public event MetaDataEventHandler NowPlaying; 
    11841194                // this 2nd event is a non-standard prototype needed for Com Interop event sourcing