Menu

[r29]: / libs / OSMF / org / osmf / net / httpstreaming / HTTPStreamingFileHandlerBase.as  Maximize  Restore  History

Download this file

173 lines (164 with data), 6.0 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
/*****************************************************
*
* 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
{
import flash.errors.IllegalOperationError;
import flash.events.EventDispatcher;
import flash.utils.ByteArray;
import flash.utils.IDataInput;
/**
* Dispatched when the segment duration value becomes available, after
* beginProcessFile has been invoked.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
[Event(name="notifySegmentDuration", type="org.osmf.events.HTTPStreamingFileHandlerEvent")]
/**
* Dispatched when the time bias value becomes available, after beginProcessFile
* has been invoked.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
[Event(name="notifyTimeBias", type="org.osmf.events.HTTPStreamingFileHandlerEvent")]
[ExcludeClass]
/**
* @private
*
* This class serves as the interface of http streaming file handler. The responsibility
* of file hanlder is to parse downloaded bytes of the file as well as processing the
* bytes according to the protocol between file handler and http net stream.
*/
public class HTTPStreamingFileHandlerBase extends EventDispatcher
{
/**
* Constructor.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function HTTPStreamingFileHandlerBase()
{
}
/**
* Begins the processing of a file.
*
* Subclasses must override to provide a specific implementation.
*
* @param seek Indicates whether this requested was prompted by a seek.
* @param seekTime Indicates the requested seek time. Only valid if the
* seek param is true.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function beginProcessFile(seek:Boolean, seekTime:Number):void
{
throw new IllegalOperationError("The beginProcessFile() method must be overridden by HttpStreamingFileHandlerBase's derived class.");
}
/**
* The minimum number of bytes that must be retrieved from the file.
*
* Subclasses must override to provide a specific implementation.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function get inputBytesNeeded():Number
{
throw new IllegalOperationError("The inputBytesNeeded() method must be overridden by HttpStreamingFileHandlerBase's derived class.");
}
/**
* Processes a segment of the file.
*
* Subclasses must override to provide a specific implementation.
* Note that if the input has a large number of available bytes, you
* MUST process only a reasonable number of them (e.g., 5000 at
* a time), or else there may be significant frame drop.
*
* @param input An interface that gives access to the bytes of the file.
*
* @return A ByteArray containing the bytes that should be fed to the
* NetStream.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function processFileSegment(input:IDataInput):ByteArray
{
throw new IllegalOperationError("The processFileSegment() method must be overridden by HttpStreamingFileHandlerBase's derived class.");
}
/**
* Ends the processing of the file.
*
* Subclasses must override to provide a specific implementation.
*
* @param input An interface that gives access to the remaining bytes of the file.
*
* @return A ByteArray containing the remaining bytes of the file, that should be
* fed to the NetStream.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function endProcessFile(input:IDataInput):ByteArray
{
throw new IllegalOperationError("The endProcessFile() method must be overridden by HttpStreamingFileHandlerBase's derived class.");
}
/**
* Flushes a segment of the file. This method is called if the next call
* to beginProcessFile is for a seek operation, or to the "next" segment
* but with a different quality level.
*
* Subclasses must override to provide a specific implementation.
*
* @param input An interface that gives access to the remaining bytes of the file.
*
* @return A ByteArray containing the remaining bytes of the file, that should be
* fed to the NetStream.
*
* @langversion 3.0
* @playerversion Flash 10
* @playerversion AIR 1.5
* @productversion OSMF 1.0
*/
public function flushFileSegment(input:IDataInput):ByteArray
{
throw new IllegalOperationError("The flushFileSegment() method must be overridden by HttpStreamingFileHandlerBase's derived class.");
}
}
}
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.