VLCLibrary.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. @interface VLCLibrary : NSObject
  38. /**
  39. * Returns the library's shared instance
  40. * \return The library's shared instance
  41. */
  42. + (VLCLibrary *)sharedLibrary;
  43. /**
  44. * Returns an individual instance which can be customized with options
  45. * \param options NSArray with NSString instance containing the options
  46. * \return the individual library instance
  47. */
  48. - (instancetype)initWithOptions:(NSArray *)options;
  49. /**
  50. * Enables/disables debug logging to console
  51. * \note NSLog is used to log messages
  52. */
  53. @property (readwrite, nonatomic) BOOL debugLogging;
  54. /**
  55. * Gets/sets the debug logging level
  56. * \note Logging level ranges from 0 (just error messages) to 4 (everything)
  57. * \note values set here will be consired only when logging to console
  58. * \warning If an invalid level is provided, level defaults to 0
  59. */
  60. @property (readwrite, nonatomic) int debugLoggingLevel;
  61. /**
  62. * Activates debug logging to a file stream
  63. * If the file already exists, the log will be appended by the end. If it does not exist, will be created.
  64. * The file will continously updated with new messages from this library instance.
  65. * \note It is the client app's obligation to ensure that the target file path is writable and all subfolders exist
  66. * \warning when enabling this feature, logging to the console or an object target will be stopped automatically
  67. * \return Returns NO on failure
  68. */
  69. - (BOOL)setDebugLoggingToFile:(NSString *)filePath;
  70. /**
  71. * Activates debug logging to an object target following the VLCLibraryLogReceiverProtocol protocol
  72. * The target will be continously called as new messages arrive from this library instance.
  73. * \warning when enabling this feature, logging to the console or a file will be stopped automatically
  74. */
  75. @property (readwrite, nonatomic) id<VLCLibraryLogReceiverProtocol> debugLoggingTarget;
  76. /**
  77. * Returns the library's version
  78. * \return The library version example "0.9.0-git Grishenko"
  79. */
  80. @property (readonly, copy) NSString *version;
  81. /**
  82. * Returns the compiler used to build the libvlc binary
  83. * \return The compiler version string.
  84. */
  85. @property (readonly, copy) NSString *compiler;
  86. /**
  87. * Returns the library's changeset
  88. * \return The library version example "adfee99"
  89. */
  90. @property (readonly, copy) NSString *changeset;
  91. /**
  92. * Sets the application name and HTTP User Agent
  93. * libvlc will pass it to servers when required by protocol
  94. * \param readableName Human-readable application name, e.g. "FooBar player 1.2.3"
  95. * \param userAgent HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0"
  96. */
  97. - (void)setHumanReadableName:(NSString *)readableName withHTTPUserAgent:(NSString *)userAgent;
  98. /**
  99. * Sets meta-information about the application
  100. * \param identifier Java-style application identifier, e.g. "com.acme.foobar"
  101. * \param version Application version numbers, e.g. "1.2.3"
  102. * \param icon Application icon name, e.g. "foobar"
  103. */
  104. - (void)setApplicationIdentifier:(NSString *)identifier withVersion:(NSString *)version andApplicationIconName:(NSString *)icon;
  105. /**
  106. * libvlc instance wrapped by the VLCLibrary instance
  107. * \note If you want to use it, you are most likely wrong (or want to add a proper ObjC API)
  108. */
  109. @property (nonatomic, assign) void *instance;
  110. @end
  111. @protocol VLCLibraryLogReceiverProtocol <NSObject>
  112. @required
  113. /**
  114. * called when VLC wants to print a debug message
  115. * \param message the debug message
  116. * \param level the debug level
  117. */
  118. - (void)handleMessage:(NSString *)message
  119. debugLevel:(int)level;
  120. @end
  121. NS_ASSUME_NONNULL_END