protected override void MediaPlayerEventOccured(ref libvlc_event_t libvlc_event, IntPtr userData)
 {
    switch (libvlc_event.type)
    {
       case libvlc_event_e.libvlc_MediaListPlayerPlayed:
          if (m_mediaListPlayerPlayed != null)
          {
             m_mediaListPlayerPlayed(m_eventProvider, EventArgs.Empty);
          }
          break;
       case libvlc_event_e.libvlc_MediaListPlayerNextItemSet:
          if (m_mediaListPlayerNextItemSet != null)
          {
             BasicMedia media = new BasicMedia(libvlc_event.media_list_player_next_item_set.item, ReferenceCountAction.AddRef);
             m_mediaListPlayerNextItemSet(m_eventProvider, new MediaListPlayerNextItemSet(media));
             //media.Release();
          }
          break;
       case libvlc_event_e.libvlc_MediaListPlayerStopped:
          if(m_mediaListPlayerStopped != null)
          {
             m_mediaListPlayerStopped(m_eventProvider, EventArgs.Empty);
          }
          break;
    }
 }
Beispiel #2
0
        protected override void MediaPlayerEventOccured(ref libvlc_event_t libvlc_event, IntPtr userData)
        {
            switch (libvlc_event.type)
            {
                case libvlc_event_e.libvlc_MediaPlayerTimeChanged:
                    RaiseTimeChanged(libvlc_event.MediaDescriptor.media_player_time_changed.new_time);
                    break;

                case libvlc_event_e.libvlc_MediaPlayerEndReached:
                    RaiseMediaEnded();
                    break;

                case libvlc_event_e.libvlc_MediaPlayerMediaChanged:
                    if (m_mediaChanged != null)
                    {
                        BasicMedia media = new BasicMedia(libvlc_event.MediaDescriptor.media_player_media_changed.new_media, ReferenceCountAction.AddRef);
                        m_mediaChanged(m_eventProvider, new MediaPlayerMediaChanged(media));
                        //media.Release();
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerNothingSpecial:
                    if (m_nothingSpecial != null)
                    {
                        m_nothingSpecial(m_eventProvider, EventArgs.Empty);
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerOpening:
                    if (m_playerOpening != null)
                    {
                        m_playerOpening(m_eventProvider, EventArgs.Empty);
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerBuffering:
                    if (m_playerBuffering != null)
                    {
                        m_playerBuffering(m_eventProvider, EventArgs.Empty);
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerPlaying:
                    if (m_playerPlaying != null)
                    {
                        m_playerPlaying(m_eventProvider, EventArgs.Empty);
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerPaused:
                    if (m_playerPaused != null)
                    {
                        m_playerPaused(m_eventProvider, EventArgs.Empty);
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerStopped:
                    if (m_playerStopped != null)
                    {
                        m_playerStopped(m_eventProvider, EventArgs.Empty);
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerForward:
                    if (m_playerForward != null)
                    {
                        m_playerForward(m_eventProvider, EventArgs.Empty);
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerBackward:
                    if (m_playerPaused != null)
                    {
                        m_playerPaused(m_eventProvider, EventArgs.Empty);
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerEncounteredError:
                    if (m_playerEncounteredError != null)
                    {
                        m_playerEncounteredError(m_eventProvider, EventArgs.Empty);
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerPositionChanged:
                    if (m_playerPositionChanged != null)
                    {
                        m_playerPositionChanged(m_eventProvider, new MediaPlayerPositionChanged(libvlc_event.MediaDescriptor.media_player_position_changed.new_position));
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerSeekableChanged:
                    if (m_playerSeekableChanged != null)
                    {
                        m_playerSeekableChanged(m_eventProvider, new MediaPlayerSeekableChanged(libvlc_event.MediaDescriptor.media_player_seekable_changed.new_seekable));
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerPausableChanged:
                    if (m_playerPausableChanged != null)
                    {
                        m_playerPausableChanged(m_eventProvider, new MediaPlayerPausableChanged(libvlc_event.MediaDescriptor.media_player_pausable_changed.new_pausable));
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerTitleChanged:
                    if (m_playerTitleChanged != null)
                    {
                        m_playerTitleChanged(m_eventProvider, new MediaPlayerTitleChanged(libvlc_event.MediaDescriptor.media_player_title_changed.new_title));
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerSnapshotTaken:
                    if (m_playerSnapshotTaken != null)
                    {
                        m_playerSnapshotTaken(m_eventProvider, new MediaPlayerSnapshotTaken(Marshal.PtrToStringAuto(libvlc_event.MediaDescriptor.media_player_snapshot_taken.psz_filename)));
                    }
                    break;

                case libvlc_event_e.libvlc_MediaPlayerLengthChanged:
                    if (m_playerLengthChanged != null)
                    {
                        m_playerLengthChanged(m_eventProvider, new MediaPlayerLengthChanged(libvlc_event.MediaDescriptor.media_player_length_changed.new_length));
                    }
                    break;
            }
        }
        protected override void MediaPlayerEventOccured(ref LibvlcEventT libvlcEvent, IntPtr userData)
        {
            switch (libvlcEvent.type)
            {
                case LibvlcEventE.LibvlcMediaListItemAdded:
                    if (MItemAdded != null)
                    {
                        var media = new BasicMedia(libvlcEvent.MediaDescriptor.media_list_item_added.item, ReferenceCountAction.AddRef);
                        MItemAdded(MEventProvider, new MediaListItemAdded(media, libvlcEvent.MediaDescriptor.media_list_item_added.index));
                        media.Release();
                    }
                    break;

                case LibvlcEventE.LibvlcMediaListWillAddItem:
                    if (MWillAddItem != null)
                    {
                        var media2 = new BasicMedia(libvlcEvent.MediaDescriptor.media_list_will_add_item.item, ReferenceCountAction.AddRef);
                        MWillAddItem(MEventProvider, new MediaListWillAddItem(media2, libvlcEvent.MediaDescriptor.media_list_will_add_item.index));
                        media2.Release();
                    }
                    break;

                case LibvlcEventE.LibvlcMediaListItemDeleted:
                    if (MItemDeleted != null)
                    {
                        var media3 = new BasicMedia(libvlcEvent.MediaDescriptor.media_list_item_deleted.item, ReferenceCountAction.AddRef);
                        MItemDeleted(MEventProvider, new MediaListItemDeleted(media3, libvlcEvent.MediaDescriptor.media_list_item_deleted.index));
                        media3.Release();
                    }
                    break;

                case LibvlcEventE.LibvlcMediaListWillDeleteItem:
                    if (MWillDeleteItem != null)
                    {
                        var media4 = new BasicMedia(libvlcEvent.MediaDescriptor.media_list_will_delete_item.item, ReferenceCountAction.AddRef);
                        MWillDeleteItem(MEventProvider, new MediaListWillDeleteItem(media4, libvlcEvent.MediaDescriptor.media_list_will_delete_item.index));
                        media4.Release();
                    }
                    break;
            }
        }
        protected override void MediaPlayerEventOccured(ref LibvlcEventT libvlcEvent, IntPtr userData)
        {
            switch (libvlcEvent.type)
            {
                case LibvlcEventE.LibvlcMediaMetaChanged:
                    if (metaDataChanged != null)
                    {
                        metaDataChanged(MEventProvider, new MediaMetaDataChange((MetaDataType)libvlcEvent.MediaDescriptor.media_meta_changed.meta_type));
                    }

                    break;
                case LibvlcEventE.LibvlcMediaSubItemAdded:
                    if (subItemAdded != null)
                    {
                        var media = new BasicMedia(libvlcEvent.MediaDescriptor.media_subitem_added.new_child, ReferenceCountAction.AddRef);
                        subItemAdded(MEventProvider, new MediaNewSubItem(media));
                        media.Release();
                    }

                    break;
                case LibvlcEventE.LibvlcMediaDurationChanged:
                    if (durationChanged != null)
                    {
                        durationChanged(MEventProvider, new MediaDurationChange(libvlcEvent.MediaDescriptor.media_duration_changed.new_duration));
                    }

                    break;
                case LibvlcEventE.LibvlcMediaParsedChanged:
                    if (parsedChanged != null)
                    {
                        parsedChanged(MEventProvider, new MediaParseChange(Convert.ToBoolean(libvlcEvent.MediaDescriptor.media_parsed_changed.new_status)));
                    }

                    break;
                case LibvlcEventE.LibvlcMediaFreed:
                    if (mediaFreed != null)
                    {
                        mediaFreed(MEventProvider, new MediaFree(libvlcEvent.MediaDescriptor.media_freed.md));
                    }

                    break;
                case LibvlcEventE.LibvlcMediaStateChanged:
                    if (stateChanged != null)
                    {
                        stateChanged(MEventProvider, new MediaStateChange((MediaState)libvlcEvent.MediaDescriptor.media_state_changed.new_state));
                    }

                    break;

                default:
                    break;
            }
        }
        protected override void MediaPlayerEventOccured(ref libvlc_event_t libvlc_event, IntPtr userData)
        {
            switch (libvlc_event.type)
             {
            case libvlc_event_e.libvlc_MediaListItemAdded:
               if (m_itemAdded != null)
               {
                  BasicMedia media = new BasicMedia(libvlc_event.media_list_item_added.item, ReferenceCountAction.AddRef);
                  m_itemAdded(m_eventProvider, new MediaListItemAdded(media, libvlc_event.media_list_item_added.index));
                  media.Release();
               }
               break;

            case libvlc_event_e.libvlc_MediaListWillAddItem:
               if (m_willAddItem != null)
               {
                  BasicMedia media2 = new BasicMedia(libvlc_event.media_list_will_add_item.item, ReferenceCountAction.AddRef);
                  m_willAddItem(m_eventProvider, new MediaListWillAddItem(media2, libvlc_event.media_list_will_add_item.index));
                  media2.Release();
               }
               break;

            case libvlc_event_e.libvlc_MediaListItemDeleted:
               if (m_itemDeleted != null)
               {
                  BasicMedia media3 = new BasicMedia(libvlc_event.media_list_item_deleted.item, ReferenceCountAction.AddRef);
                  m_itemDeleted(m_eventProvider, new MediaListItemDeleted(media3, libvlc_event.media_list_item_deleted.index));
                  media3.Release();
               }
               break;

            case libvlc_event_e.libvlc_MediaListWillDeleteItem:
               if (m_willDeleteItem != null)
               {
                  BasicMedia media4 = new BasicMedia(libvlc_event.media_list_will_delete_item.item, ReferenceCountAction.AddRef);
                  m_willDeleteItem(m_eventProvider, new MediaListWillDeleteItem(media4, libvlc_event.media_list_will_delete_item.index));
                  media4.Release();
               }
               break;
             }
        }
 protected override void MediaPlayerEventOccured(ref LibvlcEventT libvlcEvent, IntPtr userData)
 {
     switch (libvlcEvent.type)
     {
         case LibvlcEventE.LibvlcMediaListPlayerPlayed:
             if (MMediaListPlayerPlayed != null)
             {
                 MMediaListPlayerPlayed(MEventProvider, EventArgs.Empty);
             }
             break;
         case LibvlcEventE.LibvlcMediaListPlayerNextItemSet:
             if (MMediaListPlayerNextItemSet != null)
             {
                 var media = new BasicMedia(libvlcEvent.MediaDescriptor.media_list_player_next_item_set.item, ReferenceCountAction.AddRef);
                 MMediaListPlayerNextItemSet(MEventProvider, new MediaListPlayerNextItemSet(media));
                 //media.Release();
             }
             break;
         case LibvlcEventE.LibvlcMediaListPlayerStopped:
             if (MMediaListPlayerStopped != null)
             {
                 MMediaListPlayerStopped(MEventProvider, EventArgs.Empty);
             }
             break;
     }
 }