0023-libvlc-events-Add-callbacks-for-record.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. From 5631f226a156cea1838213ebbbf49bcf15f96d50 Mon Sep 17 00:00:00 2001
  2. From: Soomin Lee <bubu@mikan.io>
  3. Date: Thu, 27 Sep 2018 18:40:39 +0200
  4. Subject: [PATCH 23/26] libvlc: events: Add callbacks for record
  5. ---
  6. include/vlc/libvlc_events.h | 9 +++++++++
  7. lib/media_player.c | 16 ++++++++++++++++
  8. 2 files changed, 25 insertions(+)
  9. diff --git a/include/vlc/libvlc_events.h b/include/vlc/libvlc_events.h
  10. index f8b0e9b5b2..bbc6bc0eec 100644
  11. --- a/include/vlc/libvlc_events.h
  12. +++ b/include/vlc/libvlc_events.h
  13. @@ -32,6 +32,8 @@
  14. # ifdef __cplusplus
  15. extern "C" {
  16. +# else
  17. +# include <stdbool.h>
  18. # endif
  19. typedef struct libvlc_renderer_item_t libvlc_renderer_item_t;
  20. @@ -86,6 +88,7 @@ enum libvlc_event_e {
  21. libvlc_MediaPlayerAudioVolume,
  22. libvlc_MediaPlayerAudioDevice,
  23. libvlc_MediaPlayerChapterChanged,
  24. + libvlc_MediaPlayerRecordChanged,
  25. libvlc_MediaListItemAdded=0x200,
  26. libvlc_MediaListWillAddItem,
  27. @@ -275,6 +278,12 @@ typedef struct libvlc_event_t
  28. const char *device;
  29. } media_player_audio_device;
  30. + struct
  31. + {
  32. + const char *file_path;
  33. + bool recording;
  34. + } media_player_record_changed;
  35. +
  36. struct
  37. {
  38. libvlc_renderer_item_t *item;
  39. diff --git a/lib/media_player.c b/lib/media_player.c
  40. index 7e714d247b..d76ed7ca56 100644
  41. --- a/lib/media_player.c
  42. +++ b/lib/media_player.c
  43. @@ -447,6 +447,22 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
  44. }
  45. }
  46. }
  47. + else if ( newval.i_int == INPUT_EVENT_RECORD )
  48. + {
  49. + bool recording = var_GetBool( p_input, "record" );
  50. + char *file_path = NULL;
  51. +
  52. + if ( !recording )
  53. + file_path = var_GetString( p_mi->obj.libvlc, "record-file" );
  54. +
  55. + event.type = libvlc_MediaPlayerRecordChanged;
  56. + event.u.media_player_record_changed.file_path = file_path;
  57. + event.u.media_player_record_changed.recording = recording;
  58. +
  59. + libvlc_event_send( &p_mi->event_manager, &event );
  60. +
  61. + free( file_path );
  62. + }
  63. return VLC_SUCCESS;
  64. }
  65. --
  66. 2.20.1