Click here to Skip to main content
15,879,096 members
Articles / Web Development / HTML

nVLC

Rate me:
Please Sign up or sign in to vote.
4.94/5 (213 votes)
12 Feb 2018GPL316 min read 12.1M   69.9K   379  
A .NET API for the libVLC interface so the vast majority of VLC functionality could be utilized in managed applications
//    nVLC
//    
//    Author:  Roman Ginzburg
//
//    nVLC 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 3 of the License, or
//    (at your option) any later version.
//
//    nVLC 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.
//     
// ========================================================================

using System;
using Declarations;
using Declarations.Filters;
using LibVlcWrapper;
using System.Runtime.InteropServices;

namespace Implementation.Filters
{
   internal class MarqueeFilter : IMarqueeFilter
   {
      IntPtr m_hMediaPlayer;

      public MarqueeFilter(IntPtr hMediaPlayer)
      {
         m_hMediaPlayer = hMediaPlayer;
      }

      #region IMarqueeFilter Members

      public bool Enabled
      {
         get
         {
            return GetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Enable) == 1;
         }
         set
         {
            SetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Enable, Convert.ToInt32(value));
         }
      }

      public string Text
      {
         get
         {
            return GetMarqueeString(libvlc_video_marquee_option_t.libvlc_marquee_Text);
         }
         set
         {
            SetMarqueeString(libvlc_video_marquee_option_t.libvlc_marquee_Text,value);
         }
      }

      public VlcColor Color
      {
         get
         {
            return (VlcColor)GetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Color);
         }
         set
         {
            SetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Color, (int)value);
         }
      }

      public Position Position
      {
         get
         {
            return (Position)GetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Position);
         }
         set
         {
            SetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Position, (int)value);
         }
      }

      public int Refresh
      {
         get
         {
            return GetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Refresh);
         }
         set
         {
            SetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Refresh, value);
         }
      }

      public int Size
      {
         get
         {
            return GetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Size);
         }
         set
         {
            SetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Size, value);
         }
      }

      public int Timeout
      {
         get
         {
            return GetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Timeout);
         }
         set
         {
            SetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Timeout, value);
         }
      }

      public int X
      {
         get
         {
            return GetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_X);
         }
         set
         {
            SetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_X, value);
         }
      }

      public int Y
      {
         get
         {
            return GetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Y);
         }
         set
         {
            SetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Y, value);
         }
      }

      public int Opacity
      {
         get
         {
            return GetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Opacity);
         }
         set
         {
            SetMarquee(libvlc_video_marquee_option_t.libvlc_marquee_Opacity, value);
         }
      }

      #endregion

      int GetMarquee(libvlc_video_marquee_option_t option)
      {
         return LibVlcMethods.libvlc_video_get_marquee_int(m_hMediaPlayer, option);
      }

      void SetMarquee(libvlc_video_marquee_option_t option, int argument)
      {
         LibVlcMethods.libvlc_video_set_marquee_int(m_hMediaPlayer, option, argument);
      }

      string GetMarqueeString(libvlc_video_marquee_option_t option)
      {
         IntPtr pData = LibVlcMethods.libvlc_video_get_marquee_string(m_hMediaPlayer, option);
         return Marshal.PtrToStringAnsi(pData);
      }

      void SetMarqueeString(libvlc_video_marquee_option_t option, string argument)
      {
         LibVlcMethods.libvlc_video_set_marquee_string(m_hMediaPlayer, option, argument.ToUtf8());
      }    
   }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
Israel Israel
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions