0013-libvlc-media_player-Add-record-method.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. From 10b2bba36b7f2b2d6756ae779f91cd79c2e23a64 Mon Sep 17 00:00:00 2001
  2. From: Soomin Lee <bubu@mikan.io>
  3. Date: Wed, 31 Oct 2018 10:08:55 +0100
  4. Subject: [PATCH 13/17] libvlc: media_player: Add record method
  5. ---
  6. include/vlc/libvlc_media_player.h | 13 +++++++++++++
  7. lib/media_player.c | 20 ++++++++++++++++++++
  8. 2 files changed, 33 insertions(+)
  9. diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
  10. index d4597e3353..fcb7e23ce6 100644
  11. --- a/include/vlc/libvlc_media_player.h
  12. +++ b/include/vlc/libvlc_media_player.h
  13. @@ -2480,6 +2480,19 @@ LIBVLC_API int libvlc_media_player_get_role(libvlc_media_player_t *p_mi);
  14. */
  15. LIBVLC_API int libvlc_media_player_set_role(libvlc_media_player_t *p_mi,
  16. unsigned role);
  17. +/**
  18. + * Start/stop recording
  19. + *
  20. + * \version LibVLC 4.0.0 and later.
  21. + *
  22. + * \param p_mi media player
  23. + * \param enable true to start recording, false to stop
  24. + * \param path the path of the recording directory
  25. + * \return 0 on success, -1 on error
  26. + */
  27. +LIBVLC_API int libvlc_media_player_record(libvlc_media_player_t *p_mi,
  28. + bool enable,
  29. + const char *path);
  30. /** @} audio */
  31. diff --git a/lib/media_player.c b/lib/media_player.c
  32. index ec56b4bc6a..58eec27ae9 100644
  33. --- a/lib/media_player.c
  34. +++ b/lib/media_player.c
  35. @@ -576,6 +576,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
  36. var_Create (mp, "rate", VLC_VAR_FLOAT|VLC_VAR_DOINHERIT);
  37. var_Create (mp, "sout", VLC_VAR_STRING);
  38. var_Create (mp, "demux-filter", VLC_VAR_STRING);
  39. + var_Create (mp, "input-record-path", VLC_VAR_STRING|VLC_VAR_DOINHERIT);
  40. var_Create (mp, "http-cookies", VLC_VAR_ADDRESS);
  41. /* Video */
  42. @@ -1907,6 +1908,25 @@ int libvlc_media_player_get_role(libvlc_media_player_t *mp)
  43. return ret;
  44. }
  45. +int libvlc_media_player_record( libvlc_media_player_t *p_mi,
  46. + bool enable,
  47. + const char *path)
  48. +{
  49. + vlc_player_t *player = p_mi->player;
  50. + vlc_player_Lock(player);
  51. +
  52. + vlc_value_t val = { .psz_string = (char *)path };
  53. +
  54. + if(enable)
  55. + var_Set(p_mi, "input-record-path", val);
  56. +
  57. + vlc_player_SetRecordingEnabled(player, enable);
  58. +
  59. + vlc_player_Unlock(player);
  60. +
  61. + return VLC_SUCCESS;
  62. +}
  63. +
  64. #include <vlc_vout_display.h>
  65. /* make sure surface structures from libvlc can be passed as such to vlc
  66. --
  67. 2.21.1 (Apple Git-122.3)