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 LibvlcEventT libvlcEvent, IntPtr userData) { switch (libvlcEvent.type) { case LibvlcEventE.LibvlcMediaPlayerTimeChanged: RaiseTimeChanged(libvlcEvent.MediaDescriptor.media_player_time_changed.new_time); break; case LibvlcEventE.LibvlcMediaPlayerEndReached: RaiseMediaEnded(); break; case LibvlcEventE.LibvlcMediaPlayerMediaChanged: if (MMediaChanged != null) { var media = new BasicMedia(libvlcEvent.MediaDescriptor.media_player_media_changed.new_media, ReferenceCountAction.AddRef); MMediaChanged(MEventProvider, new MediaPlayerMediaChanged(media)); //media.Release(); } break; case LibvlcEventE.LibvlcMediaPlayerNothingSpecial: if (MNothingSpecial != null) { MNothingSpecial(MEventProvider, EventArgs.Empty); } break; case LibvlcEventE.LibvlcMediaPlayerOpening: if (MPlayerOpening != null) { MPlayerOpening(MEventProvider, EventArgs.Empty); } break; case LibvlcEventE.LibvlcMediaPlayerBuffering: if (MPlayerBuffering != null) { MPlayerBuffering(MEventProvider, EventArgs.Empty); } break; case LibvlcEventE.LibvlcMediaPlayerPlaying: if (MPlayerPlaying != null) { MPlayerPlaying(MEventProvider, EventArgs.Empty); } break; case LibvlcEventE.LibvlcMediaPlayerPaused: if (MPlayerPaused != null) { MPlayerPaused(MEventProvider, EventArgs.Empty); } break; case LibvlcEventE.LibvlcMediaPlayerStopped: if (MPlayerStopped != null) { MPlayerStopped(MEventProvider, EventArgs.Empty); } break; case LibvlcEventE.LibvlcMediaPlayerForward: if (MPlayerForward != null) { MPlayerForward(MEventProvider, EventArgs.Empty); } break; case LibvlcEventE.LibvlcMediaPlayerBackward: if (MPlayerPaused != null) { MPlayerPaused(MEventProvider, EventArgs.Empty); } break; case LibvlcEventE.LibvlcMediaPlayerEncounteredError: if (MPlayerEncounteredError != null) { MPlayerEncounteredError(MEventProvider, EventArgs.Empty); } break; case LibvlcEventE.LibvlcMediaPlayerPositionChanged: if (MPlayerPositionChanged != null) { MPlayerPositionChanged(MEventProvider, new MediaPlayerPositionChanged(libvlcEvent.MediaDescriptor.media_player_position_changed.new_position)); } break; case LibvlcEventE.LibvlcMediaPlayerSeekableChanged: if (MPlayerSeekableChanged != null) { MPlayerSeekableChanged(MEventProvider, new MediaPlayerSeekableChanged(libvlcEvent.MediaDescriptor.media_player_seekable_changed.new_seekable)); } break; case LibvlcEventE.LibvlcMediaPlayerPausableChanged: if (MPlayerPausableChanged != null) { MPlayerPausableChanged(MEventProvider, new MediaPlayerPausableChanged(libvlcEvent.MediaDescriptor.media_player_pausable_changed.new_pausable)); } break; case LibvlcEventE.LibvlcMediaPlayerTitleChanged: if (MPlayerTitleChanged != null) { MPlayerTitleChanged(MEventProvider, new MediaPlayerTitleChanged(libvlcEvent.MediaDescriptor.media_player_title_changed.new_title)); } break; case LibvlcEventE.LibvlcMediaPlayerSnapshotTaken: if (MPlayerSnapshotTaken != null) { MPlayerSnapshotTaken(MEventProvider, new MediaPlayerSnapshotTaken(Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.media_player_snapshot_taken.psz_filename))); } break; case LibvlcEventE.LibvlcMediaPlayerLengthChanged: if (MPlayerLengthChanged != null) { MPlayerLengthChanged(MEventProvider, new MediaPlayerLengthChanged(libvlcEvent.MediaDescriptor.media_player_length_changed.new_length)); } break; } }
protected abstract void MediaPlayerEventOccured(ref LibvlcEventT libvlcEvent, IntPtr userData);
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; } }
protected override void MediaPlayerEventOccured(ref LibvlcEventT libvlcEvent, IntPtr userData) { switch (libvlcEvent.type) { case LibvlcEventE.LibvlcVlmMediaAdded: if (MMediaAdded != null) { MMediaAdded(MEventProvider, new VlmEvent(Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_instance_name), Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_media_name))); } break; case LibvlcEventE.LibvlcVlmMediaRemoved: if (MMediaRemoved != null) { MMediaRemoved(MEventProvider, new VlmEvent(Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_instance_name), Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_media_name))); } break; case LibvlcEventE.LibvlcVlmMediaChanged: if (MMediaChanged != null) { MMediaChanged(MEventProvider, new VlmEvent(Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_instance_name), Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_media_name))); } break; case LibvlcEventE.LibvlcVlmMediaInstanceStarted: if (MMediaInstanceStarted != null) { MMediaInstanceStarted(MEventProvider, new VlmEvent(Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_instance_name), Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_media_name))); } break; case LibvlcEventE.LibvlcVlmMediaInstanceStopped: if (MMediaInstanceStopped != null) { MMediaInstanceStopped(MEventProvider, new VlmEvent(Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_instance_name), Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_media_name))); } break; case LibvlcEventE.LibvlcVlmMediaInstanceStatusInit: if (MMediaInstanceInit != null) { MMediaInstanceInit(MEventProvider, new VlmEvent(Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_instance_name), Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_media_name))); } break; case LibvlcEventE.LibvlcVlmMediaInstanceStatusOpening: if (MMediaInstanceOpening != null) { MMediaInstanceOpening(MEventProvider, new VlmEvent(Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_instance_name), Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_media_name))); } break; case LibvlcEventE.LibvlcVlmMediaInstanceStatusPlaying: if (MMediaInstancePlaying != null) { MMediaInstancePlaying(MEventProvider, new VlmEvent(Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_instance_name), Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_media_name))); } break; case LibvlcEventE.LibvlcVlmMediaInstanceStatusPause: if (MMediaInstancePause != null) { MMediaInstancePause(MEventProvider, new VlmEvent(Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_instance_name), Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_media_name))); } break; case LibvlcEventE.LibvlcVlmMediaInstanceStatusEnd: if (MMediaInstanceEnd != null) { MMediaInstanceEnd(MEventProvider, new VlmEvent(Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_instance_name), Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_media_name))); } break; case LibvlcEventE.LibvlcVlmMediaInstanceStatusError: if (MMediaInstanceError != null) { MMediaInstanceError(MEventProvider, new VlmEvent(Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_instance_name), Marshal.PtrToStringAuto(libvlcEvent.MediaDescriptor.vlm_media_event.psz_media_name))); } break; default: break; } }