Commit c5b9e0c5 authored by Felix Paul Kühne's avatar Felix Paul Kühne

VLCMedia: add preliminary cookie API

parent dc5c20a6
......@@ -28,6 +28,8 @@
#import "VLCMediaList.h"
#import "VLCTime.h"
NS_ASSUME_NONNULL_BEGIN
/* Meta Dictionary Keys */
/**
* Standard dictionary keys for retreiving meta data.
......@@ -503,14 +505,40 @@ typedef int VLCMediaParsingOptions;
* The options are detailed in vlc --long-help, for instance "--sout-all"
* And on the web: http://wiki.videolan.org/VLC_command-line_help
*/
- (void) addOptions:(NSDictionary*) options;
- (void)addOptions:(NSDictionary*)options;
/**
* Parse a value of an incoming Set-Cookie header (see RFC 6265) and append the
* cookie to the stored cookies if appropriate. The "secure" attribute can be added
* to cookie to limit the scope of the cookie to secured channels (https).
*
* \note must be called before the first call of play() to
* take effect. The cookie storage is only used for http/https.
*
* \param cookie header field value of Set-Cookie: "name=value<;attributes>"
* \param host host to which the cookie will be sent
* \param path scope of the cookie
*
* \return 0 on success, -1 on error.
*/
- (int)storeCookie:(NSString * _Nonnull)cookie
forHost:(NSString * _Nonnull)host
path:(NSString * _Nonnull)path;
/**
* Clear the stored cookies of a media.
*
* \note must be called before the first call of play() to
* take effect. The cookie jar is only used for http/https.
*/
- (void)clearStoredCookies;
/**
* Getter for statistics information
* Returns a NSDictionary with NSNumbers for values.
*
*/
@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSDictionary *stats;
@property (NS_NONATOMIC_IOSONLY, readonly, copy, nullable) NSDictionary *stats;
#pragma mark - individual stats
......@@ -598,3 +626,5 @@ typedef int VLCMediaParsingOptions;
@property (NS_NONATOMIC_IOSONLY, readonly) NSInteger numberOfDiscontinuties;
@end
NS_ASSUME_NONNULL_END
......@@ -46,6 +46,8 @@ New APIs:
parseWithOptions:
parseWithOptions:Timeout:
parsedStatus
storeCookie:forHost:path:
clearStoredCookies
- added enums: VLCMediaType, VLCMediaParsingOptions, VLCMediaParsedStatus
- changed behavior: media will no longer be parsed automatically if meta
data is requested prior to concluded parsing
......
......@@ -397,7 +397,30 @@ static void HandleMediaParsedChanged(const libvlc_event_t * event, void * self)
}
}
- (NSDictionary*) stats
- (int)storeCookie:(NSString * _Nonnull)cookie
forHost:(NSString *_Nonnull)host
path:(NSString *_Nonnull)path
{
if (!p_md || cookie == NULL || host == NULL || path == NULL) {
return -1;
}
return libvlc_media_cookie_jar_store(p_md,
[cookie UTF8String],
[host UTF8String],
[path UTF8String]);
}
- (void)clearStoredCookies
{
if (!p_md) {
return;
}
libvlc_media_cookie_jar_clear(p_md);
}
- (NSDictionary *)stats
{
if (!p_md)
return nil;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment