Exemplo n.º 1
0
        /**
         * Create a new media player event for a given native event.
         *
         * @param event native event
         * @param eventMask bit mask of enabled events (i.e. events to send notifications for)
         * @return media player event, or <code>null</code> if the native event type is not enabled or otherwise could not be handled
         */
        public MediaListPlayerEvent newMediaListPlayerEvent(libvlc_event_t evt, int eventMask)
        {
            // Create an event suitable for the native event type...
            MediaListPlayerEvent result = null;

            switch (evt.type)
            {
            // === Events relating to the media list player =========================

            case libvlc_event_e.libvlc_MediaListPlayerNextItemSet:
                //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_CHANGED)) {
                IntPtr media = evt.u.item;
                result = new MediaListPlayerNextItemSetEvent(mediaListPlayer, media, mediaListPlayer.Mrl(media));
                //                }
                break;

            // === Events relating to the current media =============================

            case libvlc_event_e.libvlc_MediaMetaChanged:
                //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_META_CHANGED)) {
                result = new MediaListMediaMetaChangedEvent(mediaListPlayer, evt.u.meta_type);
                //                }
                break;

            case libvlc_event_e.libvlc_MediaSubItemAdded:
                //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_SUB_ITEM_ADDED)) {
                result = new MediaListMediaSubItemAddedEvent(mediaListPlayer, evt.u.new_child);
                //                }
                break;

            case libvlc_event_e.libvlc_MediaDurationChanged:
                //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_DURATION_CHANGED)) {
                result = new MediaListMediaDurationChangedEvent(mediaListPlayer, evt.u.new_duration);
                //                }
                break;

            case libvlc_event_e.libvlc_MediaParsedChanged:
                //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_PARSED_CHANGED)) {
                result = new MediaListMediaParsedChangedEvent(mediaListPlayer, evt.u.new_status);
                //                }
                break;

            case libvlc_event_e.libvlc_MediaFreed:
                //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_FREED)) {
                result = new MediaListMediaFreedEvent(mediaListPlayer);
                //                }
                break;

            case libvlc_event_e.libvlc_MediaStateChanged:
                //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_STATE_CHANGED)) {
                result = new MediaListMediaStateChangedEvent(mediaListPlayer, evt.u.new_state);
                //                }
                break;
            }
            return(result);
        }
     /**
      * Create a new media player event for a given native event.
      * 
      * @param event native event
      * @param eventMask bit mask of enabled events (i.e. events to send notifications for)
      * @return media player event, or <code>null</code> if the native event type is not enabled or otherwise could not be handled
      */
     public MediaListPlayerEvent newMediaListPlayerEvent(libvlc_event_t evt, int eventMask) {
         // Create an event suitable for the native event type...
         MediaListPlayerEvent result = null;
         switch(evt.type) {
 
         // === Events relating to the media list player =========================
 
             case libvlc_event_e.libvlc_MediaListPlayerNextItemSet:
 //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_CHANGED)) {
                     IntPtr media = evt.u.item;
                     result = new MediaListPlayerNextItemSetEvent(mediaListPlayer, media, mediaListPlayer.Mrl(media));
 //                }
                 break;
 
             // === Events relating to the current media =============================
 
             case libvlc_event_e.libvlc_MediaMetaChanged:
 //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_META_CHANGED)) {
                     result = new MediaListMediaMetaChangedEvent(mediaListPlayer, evt.u.meta_type);
 //                }
                 break;
 
             case libvlc_event_e.libvlc_MediaSubItemAdded:
 //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_SUB_ITEM_ADDED)) {
                     result = new MediaListMediaSubItemAddedEvent(mediaListPlayer, evt.u.new_child);
 //                }
                 break;
 
             case libvlc_event_e.libvlc_MediaDurationChanged:
 //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_DURATION_CHANGED)) {
                     result = new MediaListMediaDurationChangedEvent(mediaListPlayer, evt.u.new_duration);
 //                }
                 break;
 
             case libvlc_event_e.libvlc_MediaParsedChanged:
 //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_PARSED_CHANGED)) {
                     result = new MediaListMediaParsedChangedEvent(mediaListPlayer, evt.u.new_status);
 //                }
                 break;
 
             case libvlc_event_e.libvlc_MediaFreed:
 //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_FREED)) {
                     result = new MediaListMediaFreedEvent(mediaListPlayer);
 //                }
                 break;
 
             case libvlc_event_e.libvlc_MediaStateChanged:
 //                if(MediaPlayerEventType.set(eventMask, MediaPlayerEventType.MEDIA_STATE_CHANGED)) {
                     result = new MediaListMediaStateChangedEvent(mediaListPlayer, evt.u.new_state);
 //                }
                 break;
         }
         return result;
     }