Menu

[r28]: / libs / OSMF / org / osmf / net / httpstreaming / f4f / AdobeBootstrapBox.as  Maximize  Restore  History

Download this file

406 lines (365 with data), 10.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
/*****************************************************
*
* Copyright 2009 Adobe Systems Incorporated. All Rights Reserved.
*
*****************************************************
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
*
* The Initial Developer of the Original Code is Adobe Systems Incorporated.
* Portions created by Adobe Systems Incorporated are Copyright (C) 2009 Adobe Systems
* Incorporated. All Rights Reserved.
*
*****************************************************/
package org.osmf.net.httpstreaming.f4f
{
import __AS3__.vec.Vector;
[ExcludeClass]
/**
* @private
*
* This is the bootstrap information data structure.
*/
public class AdobeBootstrapBox extends FullBox
{
/**
* Constructor.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function AdobeBootstrapBox()
{
super();
}
/**
* Indicates the version number of the bootstrap information. When the
* update field is set, this indicates the version number that is being
* updated.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get bootstrapVersion():uint
{
return _bootstrapVersion;
}
public function set bootstrapVersion(value:uint):void
{
_bootstrapVersion = value;
}
/**
* Indicates if it is the Named Access (0) or the Range Access (1) Profile. One bit reserved
* for future profiles.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get profile():uint
{
return _profile;
}
public function set profile(value:uint):void
{
_profile = value;
}
/**
* Indicates if the media presentation is live (1) or not.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get live():Boolean
{
return _live;
}
public function set live(value:Boolean):void
{
_live = value;
}
/**
* Indicates if this table is an update (1) to a previously defined (sent) version of the
* bootstrap box (or file). Updates are not complete replacement and MAY contain only the
* changed elements and are sent only when there are changes to the bootstrap information.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get update():Boolean
{
return _update;
}
public function set update(value:Boolean):void
{
_update = value;
}
/**
* The number of time units in one second which the currentMediaTime and smpteTimeCodeOffset
* use to represent time. By default, 1000 is for milliseconds.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get timeScale():uint
{
return _timeScale;
}
public function set timeScale(value:uint):void
{
_timeScale = value;
}
/**
* Indicates the timestamp of the latest available Fragment in the media presentation
* represented in timescale units (default is milliseconds for the live scenario.
* This is used by the client to request the right fragment number - it MAY be set to the total
* duration or 0 for non-live cases.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get currentMediaTime():Number
{
return _currentMediaTime;
}
public function set currentMediaTime(value:Number):void
{
_currentMediaTime = value;
}
/**
* The offset of the media time from the SMPTE time code converted to milliseconds.
* This field could be set to zero when not used. The SMPTE time code modulo 24 hours is used to
* make the offset positive.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get smpteTimeCodeOffset():Number
{
return _smpteTimeCodeOffset;
}
public function set smpteTimeCodeOffset(value:Number):void
{
_smpteTimeCodeOffset = value;
}
/**
* The identifier of this presentation in the form of a NULL terminated string.
* This could be a file or pathname in a URL.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get movieIdentifier():String
{
return _movieIdentifier;
}
public function set movieIdentifier(value:String):void
{
_movieIdentifier = value;
}
/**
* The list of server base URLs.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get serverBaseURLs():Vector.<String>
{
return _serverBaseURLs;
}
public function set serverBaseURLs(value:Vector.<String>):void
{
_serverBaseURLs = value;
}
/**
* The list of quality segment URL modifiers.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get qualitySegmentURLModifiers():Vector.<String>
{
return _qualitySegmentURLModifiers;
}
public function set qualitySegmentURLModifiers(value:Vector.<String>):void
{
_qualitySegmentURLModifiers = value;
}
/**
* DRM metadata required for encrypted files to obtain the necessary keys/license
* for decryption and playback..
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get drmData():String
{
return _drmData;
}
public function set drmData(value:String):void
{
_drmData = value;
}
/**
* Metadata.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get metadata():String
{
return _metadata;
}
public function set metadata(value:String):void
{
_metadata = value;
}
/**
* The list of segment run tables. Normally there should be only one.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get segmentRunTables():Vector.<AdobeSegmentRunTable>
{
return _segmentRunTables;
}
public function set segmentRunTables(value:Vector.<AdobeSegmentRunTable>):void
{
_segmentRunTables = value;
}
/**
* The list of fragment run tables. Normally there should be only one.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get fragmentRunTables():Vector.<AdobeFragmentRunTable>
{
return _fragmentRunTables;
}
public function set fragmentRunTables(value:Vector.<AdobeFragmentRunTable>):void
{
_fragmentRunTables = value;
if (value != null && value.length > 0)
{
var frt:AdobeFragmentRunTable = value[value.length - 1];
frt.adjustEndEntryDurationAccrued(_currentMediaTime);
}
}
/**
* Given a fragment number, returns the corresponding Id of the segment
* that contains the fragment.
*
* @param fragmentId The Id of the fragment whose containing segment to be found.
*
* @return the Id of the segment that contains the segment.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function findSegmentId(fragmentId:uint):uint
{
return _segmentRunTables[0].findSegmentIdByFragmentId(fragmentId);
}
/**
* The total number of fragments in the movie.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get totalFragments():uint
{
var afrt:AdobeFragmentRunTable = _fragmentRunTables[_fragmentRunTables.length - 1];
var fdps:Vector.<FragmentDurationPair> = afrt.fragmentDurationPairs;
var lastValidFdp:FragmentDurationPair = fdps[fdps.length - 1];
if (lastValidFdp.duration == 0)
{
lastValidFdp = fdps[fdps.length - 2];
}
var deltaTime:Number = _currentMediaTime - lastValidFdp.durationAccrued;
var fragCount:uint = (deltaTime <= 0)? 0: deltaTime / lastValidFdp.duration;
return lastValidFdp.firstFragment + fragCount - 1;
}
/**
* The total duration of the movie.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get totalDuration():uint
{
if (_fragmentRunTables == null || _fragmentRunTables.length < 1)
{
return 0;
}
var frt:AdobeFragmentRunTable = _fragmentRunTables[0];
return _currentMediaTime - (frt.fragmentDurationPairs)[0].durationAccrued;
}
public function contentComplete():Boolean
{
var frt:AdobeFragmentRunTable = _fragmentRunTables[_fragmentRunTables.length - 1];
return frt.tableComplete();
}
// Internal
//
private var _bootstrapVersion:uint;
private var _profile:uint;
private var _live:Boolean;
private var _update:Boolean;
private var _timeScale:uint;
private var _currentMediaTime:Number;
private var _smpteTimeCodeOffset:Number;
private var _movieIdentifier:String;
private var _serverEntryCount:uint;
private var _serverBaseURLs:Vector.<String>;
private var _qualitySegmentURLModifiers:Vector.<String>;
private var _drmData:String;
private var _metadata:String;
private var _segmentRunTables:Vector.<AdobeSegmentRunTable>;
private var _fragmentRunTables:Vector.<AdobeFragmentRunTable>;
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.