Exemple #1
0
        private void OnVlcEvent(ref LibVlcEventArgs eventData, IntPtr userData)
        {
            switch (eventData.Type)
            {
            case EventTypes.MediaDurationChanged:
                EventsHelper.RaiseEvent(DurationChanged, this, new VlcEventArgs <long>(eventData.MediaDurationChanged.NewDuration));
                break;

            case EventTypes.MediaFreed:
                EventsHelper.RaiseEvent(Freed, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case EventTypes.MediaMetaChanged:
                EventsHelper.RaiseEvent(MetaChanged, this, new VlcEventArgs <Metadatas>(eventData.MediaMetaChanged.MetaType));
                break;

            case EventTypes.MediaParsedChanged:
                EventsHelper.RaiseEvent(ParsedChanged, this, new VlcEventArgs <int>(eventData.MediaParsedChanged.NewStatus));
                break;

            case EventTypes.MediaStateChanged:
                EventsHelper.RaiseEvent(StateChanged, this, new VlcEventArgs <States>(eventData.MediaStateChanged.NewState));
                break;
                //TODO
                //case EventTypes.MediaSubItemAdded:
                //    //eventData.MediaSubitemAdded.NewChild
                //    EventsHelper.RaiseEvent(MediaSubItemAdded, this, new VlcEventArgs<EventArgs>(EventArgs.Empty));
                //    break;
            }
        }
        private void OnVlcEvent(ref LibVlcEventArgs eventData, IntPtr userData)
        {
            switch (eventData.Type)
            {
            case EventTypes.MediaDurationChanged:
                EventsHelper.RaiseEvent(DurationChanged, this, new VlcEventArgs <long>(eventData.MediaDurationChanged.NewDuration));
                break;

            case EventTypes.MediaFreed:
                EventsHelper.RaiseEvent(Freed, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case EventTypes.MediaMetaChanged:
                EventsHelper.RaiseEvent(MetaChanged, this, new VlcEventArgs <Metadatas>(eventData.MediaMetaChanged.MetaType));
                break;

            case EventTypes.MediaParsedChanged:
                EventsHelper.RaiseEvent(ParsedChanged, this, new VlcEventArgs <int>(eventData.MediaParsedChanged.NewStatus));
                break;

            case EventTypes.MediaStateChanged:
                EventsHelper.RaiseEvent(StateChanged, this, new VlcEventArgs <States>(eventData.MediaStateChanged.NewState));
                break;

            //TODO
            case EventTypes.MediaSubItemAdded:
                MediaBase media;
                if (this is LocationMedia)
                {
                    media = new LocationMedia(eventData.MediaSubitemAdded.NewChild);
                }
                else
                {
                    media = new PathMedia(eventData.MediaSubitemAdded.NewChild);
                }
                EventsHelper.RaiseEvent(MediaSubItemAdded, this, new VlcEventArgs <MediaBase>(media));
                break;
            }
        }
Exemple #3
0
        private void OnVlcEvent(ref LibVlcEventArgs eventData, IntPtr userData)
        {
            switch (eventData.Type)
            {
            case EventTypes.MediaPlayerBackward:
                EventsHelper.RaiseEvent(Backward, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case EventTypes.MediaPlayerBuffering:
                EventsHelper.RaiseEvent(Buffering, this, new VlcEventArgs <float>(eventData.MediaPlayerBuffering.NewCache));
                break;

            case EventTypes.MediaPlayerEncounteredError:
                EventsHelper.RaiseEvent(EncounteredError, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case EventTypes.MediaPlayerEndReached:
                EventsHelper.RaiseEvent(EndReached, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case EventTypes.MediaPlayerForward:
                EventsHelper.RaiseEvent(Forward, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case EventTypes.MediaPlayerLengthChanged:
                EventsHelper.RaiseEvent(LengthChanged, this, new VlcEventArgs <long>(eventData.MediaPlayerLengthChanged.NewLength));
                break;

            case EventTypes.MediaPlayerMediaChanged:
                //TODO
                //EventsHelper.RaiseEvent(MediaChanged, this, new VlcEventArgs<MediaBase>(eventData.MediaPlayerMediaChanged.NewMediaHandle));
                break;

            case EventTypes.MediaPlayerNothingSpecial:
                break;

            case EventTypes.MediaPlayerOpening:
                break;

            case EventTypes.MediaPlayerPausableChanged:
                EventsHelper.RaiseEvent(PausableChanged, this, new VlcEventArgs <int>(eventData.MediaPlayerPausableChanged.NewPausable));
                break;

            case EventTypes.MediaPlayerPaused:
                EventsHelper.RaiseEvent(Paused, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case EventTypes.MediaPlayerPlaying:
                EventsHelper.RaiseEvent(Playing, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case EventTypes.MediaPlayerPositionChanged:
                EventsHelper.RaiseEvent(PositionChanged, this, new VlcEventArgs <float>(eventData.MediaPlayerPositionChanged.NewPosition));
                break;

            case EventTypes.MediaPlayerSeekableChanged:
                EventsHelper.RaiseEvent(SeekableChanged, this, new VlcEventArgs <int>(eventData.MediaPlayerSeekableChanged.NewSeekable));
                break;

            case EventTypes.MediaPlayerSnapshotTaken:
                EventsHelper.RaiseEvent(SnapshotTaken, this, new VlcEventArgs <string>(IntPtrExtensions.ToStringAnsi(eventData.MediaPlayerSnapshotTaken.pszFilename)));
                break;

            case EventTypes.MediaPlayerStopped:
                EventsHelper.RaiseEvent(Stopped, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case EventTypes.MediaPlayerTimeChanged:
                EventsHelper.RaiseEvent(TimeChanged, this, new VlcEventArgs <TimeSpan>(TimeSpan.FromMilliseconds(eventData.MediaPlayerTimeChanged.NewTime)));
                break;

            case EventTypes.MediaPlayerTitleChanged:
                EventsHelper.RaiseEvent(TitleChanged, this, new VlcEventArgs <long>(eventData.MediaPlayerTitleChanged.NewTitle));
                break;
            }
        }
Exemple #4
0
        private void OnVlcEvent(ref libvlc_event_t eventData, IntPtr userData)
        {
            switch (eventData.type)
            {
            case libvlc_event_e.MediaPlayerBackward:
                EventsHelper.RaiseEvent(Backward, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case libvlc_event_e.MediaPlayerBuffering:
                EventsHelper.RaiseEvent(Buffering, this, new VlcEventArgs <float>(eventData.media_player_buffering.new_cache));
                break;

            case libvlc_event_e.MediaPlayerEncounteredError:
                EventsHelper.RaiseEvent(EncounteredError, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case libvlc_event_e.MediaPlayerEndReached:
                EventsHelper.RaiseEvent(EndReached, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case libvlc_event_e.MediaPlayerForward:
                EventsHelper.RaiseEvent(Forward, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case libvlc_event_e.MediaPlayerLengthChanged:
                EventsHelper.RaiseEvent(LengthChanged, this, new VlcEventArgs <long>(eventData.media_player_length_changed.new_length));
                break;

            case libvlc_event_e.MediaPlayerMediaChanged:
                //TODO
                //EventsHelper.RaiseEvent(MediaChanged, this, new VlcEventArgs<MediaBase>(eventData.media_player_media_changed.new_media));
                break;

            case libvlc_event_e.MediaPlayerNothingSpecial:

                break;

            case libvlc_event_e.MediaPlayerOpening:
                break;

            case libvlc_event_e.MediaPlayerPausableChanged:
                EventsHelper.RaiseEvent(PausableChanged, this, new VlcEventArgs <int>(eventData.media_player_pausable_changed.new_pausable));
                break;

            case libvlc_event_e.MediaPlayerPaused:
                EventsHelper.RaiseEvent(Paused, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case libvlc_event_e.MediaPlayerPositionChanged:
                EventsHelper.RaiseEvent(PositionChanged, this, new VlcEventArgs <float>(eventData.media_player_position_changed.new_position));
                break;

            case libvlc_event_e.MediaPlayerSeekableChanged:
                EventsHelper.RaiseEvent(SeekableChanged, this, new VlcEventArgs <int>(eventData.media_player_seekable_changed.new_seekable));
                break;

            case libvlc_event_e.MediaPlayerSnapshotTaken:
                EventsHelper.RaiseEvent(SnapshotTaken, this, new VlcEventArgs <string>(IntPtrExtensions.ToStringAnsi(eventData.media_player_snapshot_taken.psz_filename)));
                break;

            case libvlc_event_e.MediaPlayerStopped:
                EventsHelper.RaiseEvent(Stopped, this, new VlcEventArgs <EventArgs>(EventArgs.Empty));
                break;

            case libvlc_event_e.MediaPlayerTimeChanged:
                EventsHelper.RaiseEvent(TimeChanged, this, new VlcEventArgs <long>(eventData.media_player_time_changed.new_time));
                break;

            case libvlc_event_e.MediaPlayerTitleChanged:
                EventsHelper.RaiseEvent(TitleChanged, this, new VlcEventArgs <long>(eventData.media_player_title_changed.new_title));
                break;
            }
        }