123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- From 5631f226a156cea1838213ebbbf49bcf15f96d50 Mon Sep 17 00:00:00 2001
- From: Soomin Lee <bubu@mikan.io>
- Date: Thu, 27 Sep 2018 18:40:39 +0200
- Subject: [PATCH 23/26] libvlc: events: Add callbacks for record
- ---
- include/vlc/libvlc_events.h | 9 +++++++++
- lib/media_player.c | 16 ++++++++++++++++
- 2 files changed, 25 insertions(+)
- diff --git a/include/vlc/libvlc_events.h b/include/vlc/libvlc_events.h
- index f8b0e9b5b2..bbc6bc0eec 100644
- --- a/include/vlc/libvlc_events.h
- +++ b/include/vlc/libvlc_events.h
- @@ -32,6 +32,8 @@
-
- # ifdef __cplusplus
- extern "C" {
- +# else
- +# include <stdbool.h>
- # endif
-
- typedef struct libvlc_renderer_item_t libvlc_renderer_item_t;
- @@ -86,6 +88,7 @@ enum libvlc_event_e {
- libvlc_MediaPlayerAudioVolume,
- libvlc_MediaPlayerAudioDevice,
- libvlc_MediaPlayerChapterChanged,
- + libvlc_MediaPlayerRecordChanged,
-
- libvlc_MediaListItemAdded=0x200,
- libvlc_MediaListWillAddItem,
- @@ -275,6 +278,12 @@ typedef struct libvlc_event_t
- const char *device;
- } media_player_audio_device;
-
- + struct
- + {
- + const char *file_path;
- + bool recording;
- + } media_player_record_changed;
- +
- struct
- {
- libvlc_renderer_item_t *item;
- diff --git a/lib/media_player.c b/lib/media_player.c
- index 7e714d247b..d76ed7ca56 100644
- --- a/lib/media_player.c
- +++ b/lib/media_player.c
- @@ -447,6 +447,22 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
- }
- }
- }
- + else if ( newval.i_int == INPUT_EVENT_RECORD )
- + {
- + bool recording = var_GetBool( p_input, "record" );
- + char *file_path = NULL;
- +
- + if ( !recording )
- + file_path = var_GetString( p_mi->obj.libvlc, "record-file" );
- +
- + event.type = libvlc_MediaPlayerRecordChanged;
- + event.u.media_player_record_changed.file_path = file_path;
- + event.u.media_player_record_changed.recording = recording;
- +
- + libvlc_event_send( &p_mi->event_manager, &event );
- +
- + free( file_path );
- + }
-
- return VLC_SUCCESS;
- }
- --
- 2.20.1
|