29 - (instancetype)initWithRequest:(const
shaka::Request &)request {
30 if ((
self = [super init])) {
34 if (request.body_size() != 0)
35 body = [[NSData alloc] initWithBytes:request.body() length:request.body_size()];
42 - (void)finalize:(
shaka::Request *)request {
47 request->SetBodyCopy(reinterpret_cast<const uint8_t *>([
body bytes]), [
body length]);
49 request->SetBodyCopy(
nullptr, 0);
64 - (instancetype)initWithResponse:(const
shaka::Response &)response {
65 if ((
self = [super init])) {
69 fromCache = response.fromCache.value_or(
false);
70 if (response.timeMs.has_value())
71 timeMs = [[NSNumber alloc] initWithDouble:*response.timeMs];
74 if (response.data_size() != 0)
75 data = [[NSData alloc] initWithBytes:response.data() length:response.data_size()];
82 - (void)finalize:(
shaka::Response *)response {
89 response->timeMs = [timeMs doubleValue];
91 response->timeMs = {};
93 response->SetDataCopy(reinterpret_cast<const uint8_t *>([
data bytes]), [
data length]);
95 response->SetDataCopy(
nullptr, 0);
NSMutableDictionary< NSString *, NSString * > * headers
NSMutableArray< NSString * > * uris