瀏覽代碼

VLCLibrary: expose 'compiler' property and add helpers to set user-agent and app-id

Felix Paul Kühne 12 年之前
父節點
當前提交
f8d9fcc4c2
共有 2 個文件被更改,包括 41 次插入0 次删除
  1. 24 0
      Headers/Public/VLCLibrary.h
  2. 17 0
      Sources/VLCLibrary.m

+ 24 - 0
Headers/Public/VLCLibrary.h

@@ -65,10 +65,34 @@
 @property (readonly) NSString * version;
 
 /**
+ * Returns the compiler used to build the libvlc binary
+ * \return The compiler version string.
+ */
+
+@property (readonly) NSString * compiler;
+
+/**
  * Returns the library's changeset
  * \return The library version example "adfee99".
  */
 
 @property (readonly) NSString * changeset;
 
+/**
+ * sets the application name and HTTP User Agend
+ * libvlc will pass it to servers when required by protocol
+ * \param readableName human-readable application name, e.g. "FooBar player 1.2.3"
+ * \param userAgent HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0"
+ */
+- (void)setHumanReadableName:(NSString *)readableName withHTTPUserAgent:(NSString *)userAgent;
+
+/**
+ * Sets some meta-information about the application.
+ *
+ * \param identifier Java-style application identifier, e.g. "com.acme.foobar"
+ * \param version application version numbers, e.g. "1.2.3"
+ * \param icon application icon name, e.g. "foobar"
+ */
+- (void)setApplicationIdentifier:(NSString *)identifier withVersion:(NSString *)version andApplicationIconName:(NSString *)icon;
+
 @end

+ 17 - 0
Sources/VLCLibrary.m

@@ -137,11 +137,28 @@ static VLCLibrary * sharedLibrary = nil;
     return @(libvlc_get_version());
 }
 
+- (NSString *)compiler
+{
+    return @(libvlc_get_compiler());
+}
+
 - (NSString *)changeset
 {
     return @(libvlc_get_changeset());
 }
 
+- (void)setHumanReadableName:(NSString *)readableName withHTTPUserAgent:(NSString *)userAgent
+{
+    if (instance)
+        libvlc_set_user_agent(instance, [readableName UTF8String], [userAgent UTF8String]);
+}
+
+- (void)setApplicationIdentifier:(NSString *)identifier withVersion:(NSString *)version andApplicationIconName:(NSString *)icon
+{
+    if (instance)
+        libvlc_set_app_id(instance, [identifier UTF8String], [version UTF8String], [icon UTF8String]);
+}
+
 - (void)dealloc
 {
     if (instance)