• 大小: 27.11MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-28
  • 语言: C#
  • 标签: vlc  c#  rtsp  

资源简介

用网上找来的vlc 1.1.9,用C#做简单的测试程序,可以播放rtsp,地址在源码上,可以自己修改

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace vlc.net
{
    public partial class Form1 : Form
    {
        private VlcPlayer vlc_player_;
        private bool is_playinig_;

        public Form1()
        {
            InitializeComponent();
            vlc_init(false);
            //string pluginPath = System.Environment.CurrentDirectory + “\\plugins\\“;
            //vlc_player_ = new VlcPlayer(pluginPathfalse);
            //IntPtr render_wnd = this.panel1.Handle;
            //vlc_player_.SetRenderWindow((int)render_wnd);

            //tbVideoTime.Text = “00:00:00/00:00:00“;

            //is_playinig_ = false;
        }

        public void vlc_init(bool is_record)
        {
            string pluginPath = System.Environment.CurrentDirectory + “\\plugins\\“;
            vlc_player_ = new VlcPlayer(pluginPath is_record);
            IntPtr render_wnd = this.pictureBox1.Handle; //this.panel1.Handle;
            vlc_player_.SetRenderWindow((int)render_wnd);

            tbVideoTime.Text = “00:00:00/00:00:00“;

            is_playinig_ = false;
        }

        private void btnStart_Click(object sender EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                vlc_player_.PlayFile(ofd.FileName);
                trackBar1.SetRange(0 (int)vlc_player_.Duration());
                trackBar1.Value = 0;
                timer1.Start();
                is_playinig_ = true;
            }
        }

        private void btnReset_Click(object sender EventArgs e)
        {
            if (is_playinig_)
            {
                vlc_player_.Stop();
                trackBar1.Value = 0;
                timer1.Stop();
                is_playinig_ = false;
            }
        }

        private void timer1_Tick(object sender EventArgs e)
        {
            if (is_playinig_)
            {
                if (trackBar1.Value == trackBar1.Maximum)
                {
                    vlc_player_.Stop();
                    timer1.Stop();
                }
                else
                {
                    trackBar1.Value = trackBar1.Value + 1;
                    tbVideoTime.Text = string.Format(“{0}/{1}“ 
                        GetTimeString(trackBar1.Value) 
                        GetTimeString(trackBar1.Maximum));
                }
            }
        }

        private string GetTimeString(int val)
        {
            int hour = val / 3600;
            val %= 3600;
            int minute = val / 60;
            int second = val % 60;
            return string.Format(“{0:00}:{1:00}:{2:00}“ hour minute second);
        }

        private void trackBar1_Scroll(object s

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-12-19 14:11  vlc.net\
     目录           0  2014-12-19 14:11  vlc.net\bin\
     目录           0  2014-12-19 14:12  vlc.net\bin\Debug\
     文件      530451  2014-07-23 07:29  vlc.net\bin\Debug\axvlc.dll
     文件      102400  2011-04-12 08:45  vlc.net\bin\Debug\libvlc.dll
     文件     2279936  2011-04-12 08:45  vlc.net\bin\Debug\libvlccore.dll
     目录           0  2014-12-19 14:12  vlc.net\bin\Debug\plugins\
     文件       65536  2011-06-07 07:29  vlc.net\bin\Debug\plugins\liba52tofloat32_plugin.dll
     文件       30720  2011-06-07 07:29  vlc.net\bin\Debug\plugins\liba52tospdif_plugin.dll
     文件       36352  2011-06-07 07:29  vlc.net\bin\Debug\plugins\liba52_plugin.dll
     文件       31232  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_attachment_plugin.dll
     文件       90112  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_bd_plugin.dll
     文件       33792  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_fake_plugin.dll
     文件       41472  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_ftp_plugin.dll
     文件       88064  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_http_plugin.dll
     文件       44544  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_imem_plugin.dll
     文件       75776  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_mms_plugin.dll
     文件       30720  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_output_dummy_plugin.dll
     文件       32256  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_output_file_plugin.dll
     文件       35840  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_output_http_plugin.dll
     文件      394240  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_output_shout_plugin.dll
     文件       36352  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_output_udp_plugin.dll
     文件       70144  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_realrtsp_plugin.dll
     文件       34304  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_smb_plugin.dll
     文件       31744  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_tcp_plugin.dll
     文件       32768  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaccess_udp_plugin.dll
     文件       49152  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libadjust_plugin.dll
     文件       38912  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libadpcm_plugin.dll
     文件       33280  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaes3_plugin.dll
     文件       33792  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libaiff_plugin.dll
     文件       33280  2011-06-07 07:29  vlc.net\bin\Debug\plugins\libalphamask_plugin.dll
............此处省略282个文件信息

评论

共有 条评论