VLCLibrary.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*****************************************************************************
  2. * VLCLibrary.h: VLCKit.framework VLCLibrary header
  3. *****************************************************************************
  4. * Copyright (C) 2007 Pierre d'Herbemont
  5. * Copyright (C) 2007-2019 VLC authors and VideoLAN
  6. * $Id$
  7. *
  8. * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
  9. * Felix Paul Kühne <fkuehne # videolan.org>
  10. *
  11. * This program is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU Lesser General Public License as published by
  13. * the Free Software Foundation; either version 2.1 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Lesser General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Lesser General Public License
  22. * along with this program; if not, write to the Free Software Foundation,
  23. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  24. *****************************************************************************/
  25. #import <Foundation/Foundation.h>
  26. NS_ASSUME_NONNULL_BEGIN
  27. @protocol VLCLibraryLogReceiverProtocol;
  28. /**
  29. * The VLCLibrary is the base library of VLCKit.framework. This object provides a shared instance that exposes the
  30. * internal functionalities of libvlc and libvlc-control. The VLCLibrary object is instantiated automatically when
  31. * VLCKit.framework is loaded into memory. Also, it is automatically destroyed when VLCKit.framework is unloaded
  32. * from memory.
  33. *
  34. * Currently, the framework does not support multiple instances of VLCLibrary.
  35. * Furthermore, you cannot destroy any instance of VLCLibrary; this is done automatically by the dynamic link loader.
  36. */
  37. OBJC_VISIBLE
  38. @interface VLCLibrary : NSObject
  39. /**
  40. * Returns the library's shared instance
  41. * \return The library's shared instance
  42. */
  43. + (VLCLibrary *)sharedLibrary;
  44. /**
  45. * Returns an individual instance which can be customized with options
  46. * \param options NSArray with NSString instance containing the options
  47. * \return the individual library instance
  48. */
  49. - (instancetype)initWithOptions:(NSArray *)options;
  50. /**
  51. * Enables/disables debug logging to console
  52. * \note NSLog is used to log messages
  53. */
  54. @property (readwrite, nonatomic) BOOL debugLogging;
  55. /**
  56. * Gets/sets the debug logging level
  57. * \note Logging level
  58. * 0: info/notice
  59. * 1: error
  60. * 2: warning
  61. * 3-4: debug
  62. * \note values set here will be consired only when logging to console
  63. * \warning If an invalid level is provided, level defaults to 0
  64. */
  65. @property (readwrite, nonatomic) int debugLoggingLevel;
  66. /**
  67. * Activates debug logging to a file stream
  68. * If the file already exists, the log will be appended by the end. If it does not exist, will be created.
  69. * The file will continously updated with new messages from this library instance.
  70. * \note It is the client app's obligation to ensure that the target file path is writable and all subfolders exist
  71. * \warning when enabling this feature, logging to the console or an object target will be stopped automatically
  72. * \return Returns NO on failure
  73. */
  74. - (BOOL)setDebugLoggingToFile:(NSString *)filePath;
  75. /**
  76. * Activates debug logging to an object target following the VLCLibraryLogReceiverProtocol protocol
  77. * The target will be continously called as new messages arrive from this library instance.
  78. * \warning when enabling this feature, logging to the console or a file will be stopped automatically
  79. */
  80. @property (readwrite, nonatomic) id<VLCLibraryLogReceiverProtocol> debugLoggingTarget;
  81. /**
  82. * Returns the library's version
  83. * \return The library version example "0.9.0-git Grishenko"
  84. */
  85. @property (readonly, copy) NSString *version;
  86. /**
  87. * Returns the compiler used to build the libvlc binary
  88. * \return The compiler version string.
  89. */
  90. @property (readonly, copy) NSString *compiler;
  91. /**
  92. * Returns the library's changeset
  93. * \return The library version example "adfee99"
  94. */
  95. @property (readonly, copy) NSString *changeset;
  96. /**
  97. * Sets the application name and HTTP User Agent
  98. * libvlc will pass it to servers when required by protocol
  99. * \param readableName Human-readable application name, e.g. "FooBar player 1.2.3"
  100. * \param userAgent HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0"
  101. */
  102. - (void)setHumanReadableName:(NSString *)readableName withHTTPUserAgent:(NSString *)userAgent;
  103. /**
  104. * Sets meta-information about the application
  105. * \param identifier Java-style application identifier, e.g. "com.acme.foobar"
  106. * \param version Application version numbers, e.g. "1.2.3"
  107. * \param icon Application icon name, e.g. "foobar"
  108. */
  109. - (void)setApplicationIdentifier:(NSString *)identifier withVersion:(NSString *)version andApplicationIconName:(NSString *)icon;
  110. /**
  111. * libvlc instance wrapped by the VLCLibrary instance
  112. * \note If you want to use it, you are most likely wrong (or want to add a proper ObjC API)
  113. */
  114. @property (nonatomic, assign) void *instance;
  115. @end
  116. @protocol VLCLibraryLogReceiverProtocol <NSObject>
  117. @required
  118. /**
  119. * called when VLC wants to print a debug message
  120. * \param message the debug message
  121. * \param level the debug level
  122. */
  123. - (void)handleMessage:(NSString *)message
  124. debugLevel:(int)level;
  125. @end
  126. NS_ASSUME_NONNULL_END