Package com.wowza.wms.stream
Interface IMediaReader
- All Known Subinterfaces:
IMediaReaderCupertino
,IMediaReaderMPEGDash
public interface IMediaReader
IMediaReader: generic media reader interface. All media types implement this interface to interact with PlaylistPlayer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final String
static final String
static final int
static final int
static final int
static final int
static final int
static final int
Seek direction: closest frame (audio, video) (key, no-key)static final int
Seek direction: closest key framestatic final int
Seek direction: down to closets key framestatic final int
Seek direction: up to closets key framestatic final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
close filelong
Get duration or time (milliseconds) of the media filelong
Get the stream length in bytesGet media extensionGet a collection of metadata packets in ByteBuffers for this file.getPath()
Get abstract path to the media itemGet a reference to the current stream positionvoid
init
(IApplicationInstance appInstance, IMediaStream stream, String mediaReadType, String basePath, String mediaName) Initialize mediaReaderboolean
isOpen()
is file openvoid
Open the file for readingvoid
rewind()
rewind file to startcom.wowza.wms.stream.PlaylistSeekResult
seek
(long timecode, int seektype) seek to timecode in fileint
sendZeroLengthPacket
(int type, int timecode, boolean isAbsolute, IMediaStream stream, OutputStream out, AMFObj wmsObj, com.wowza.wms.stream.file.PlaylistCursor flvCursor, com.wowza.wms.stream.file.PlaylistWriteControl control, com.wowza.wms.stream.file.PlaylistReaderWriteResults results, long[] sizes, boolean isForceTCZero) void
setMediaReaderItem
(com.wowza.wms.stream.MediaReaderItem mediaReaderItem) Set the mediaReader item definitionvoid
setProperties
(WMSProperties properties) Set the properties for this media readervoid
Set the file position within the media filevoid
Called each time the player being playback (before the buffer it filled)int
writeGeneratedKeyFrame
(IMediaStream stream, OutputStream out, AMFObj wmsObjAudio, AMFObj wmsObjVideo, AMFObj wmsObjData, com.wowza.wms.stream.file.PlaylistCursor flvCursor, com.wowza.wms.stream.file.PlaylistWriteControl control, com.wowza.wms.stream.file.PlaylistReaderWriteResults results, long[] sizes, com.wowza.wms.stream.FastPlaySettings fastPlaySettings, boolean isForceTCZero) From current location in file generate a key frame (enhanced seek) and write it to outint
writePackets
(IMediaStream stream, OutputStream out, AMFObj wmsObjAudio, AMFObj wmsObjVideo, AMFObj wmsObjData, com.wowza.wms.stream.file.PlaylistCursor flvCursor, com.wowza.wms.stream.file.PlaylistWriteControl control, com.wowza.wms.stream.file.PlaylistReaderWriteResults results, long[] sizes, com.wowza.wms.stream.FastPlaySettings fastPlaySettings, boolean isForceTCZero) From current location in file write packets to outputint
writePackets
(List<AMFPacket> packetList, com.wowza.wms.stream.file.PlaylistCursor flvCursor, com.wowza.wms.stream.file.PlaylistWriteControl control, com.wowza.wms.stream.file.PlaylistReaderWriteResults results, long[] sizes, com.wowza.wms.stream.FastPlaySettings fastPlaySettings) Write packets to the packetList as AMFPackets
-
Field Details
-
CONTENTTYPE_MEDIA
static final int CONTENTTYPE_MEDIA- See Also:
-
CONTENTTYPE_MEDIALIST
static final int CONTENTTYPE_MEDIALIST- See Also:
-
DEFAULT_RANDOMACCESSREADER
- See Also:
-
DEFAULT_RANDOMACCESSREADEROPTIMIZER
- See Also:
-
SEEKTARGET_VIDEOKEYFRAME
static final int SEEKTARGET_VIDEOKEYFRAME- See Also:
-
SEEKTARGET_AUDIO
static final int SEEKTARGET_AUDIO- See Also:
-
SEEKTARGET_ENHANCED
static final int SEEKTARGET_ENHANCED- See Also:
-
PLAYEVENT_STARTPLAYBACK
static final int PLAYEVENT_STARTPLAYBACK- See Also:
-
PLAYEVENT_BEFOREMETADATA
static final int PLAYEVENT_BEFOREMETADATA- See Also:
-
PLAYEVENT_AFTERMETADATA
static final int PLAYEVENT_AFTERMETADATA- See Also:
-
PLAYEVENT_BEFOREBUFFERFILL
static final int PLAYEVENT_BEFOREBUFFERFILL- See Also:
-
PLAYEVENT_AFTERBUFFERFILL
static final int PLAYEVENT_AFTERBUFFERFILL- See Also:
-
SEEK_KEYUP
static final int SEEK_KEYUPSeek direction: up to closets key frame- See Also:
-
SEEK_KEYDOWN
static final int SEEK_KEYDOWNSeek direction: down to closets key frame- See Also:
-
SEEK_KEYCLOSE
static final int SEEK_KEYCLOSESeek direction: closest key frame- See Also:
-
SEEK_EXACT
static final int SEEK_EXACTSeek direction: closest frame (audio, video) (key, no-key)- See Also:
-
-
Method Details
-
init
void init(IApplicationInstance appInstance, IMediaStream stream, String mediaReadType, String basePath, String mediaName) Initialize mediaReader- Parameters:
stream
- parent streammediaReadType
- media reader type id. Example: flvbasePath
- Base path for application instancemediaName
- name of the media item
-
setMediaReaderItem
void setMediaReaderItem(com.wowza.wms.stream.MediaReaderItem mediaReaderItem) Set the mediaReader item definition- Parameters:
mediaReaderItem
-
-
open
Open the file for reading- Parameters:
basePath
- base path to filename
- file name without extension
-
getMetadata
List getMetadata()Get a collection of metadata packets in ByteBuffers for this file. You can use 'new AMFDataList(data)' to convert to AMF objects.- Returns:
- collection of metadata packets in ByteBuffers
-
rewind
void rewind()rewind file to start -
close
void close()close file -
isOpen
boolean isOpen()is file open- Returns:
- is file open
-
seek
com.wowza.wms.stream.PlaylistSeekResult seek(long timecode, int seektype) seek to timecode in file- Parameters:
timecode
- timecode (milliseconds) to seek toseektype
- seek type IMediaReader.SEEK_*- Returns:
- detailed results object of seek or null if failure
-
writePackets
int writePackets(IMediaStream stream, OutputStream out, AMFObj wmsObjAudio, AMFObj wmsObjVideo, AMFObj wmsObjData, com.wowza.wms.stream.file.PlaylistCursor flvCursor, com.wowza.wms.stream.file.PlaylistWriteControl control, com.wowza.wms.stream.file.PlaylistReaderWriteResults results, long[] sizes, com.wowza.wms.stream.FastPlaySettings fastPlaySettings, boolean isForceTCZero) From current location in file write packets to output- Parameters:
stream
- parent mediaStreamout
- output streamwmsObjAudio
- audio channel amfObjwmsObjVideo
- video channel amfObjwmsObjData
- data channel amfObjflvCursor
- current cursor that keeps track of timecodes and flags indicating position in media filecontrol
- write control flags. Mainly used to control when it should stop writingresults
- write results returned from this routinesizes
- array of values that keep track of number of bytes written and number of packets for each data type (audio, video, data). See IMediaStreamPlay.PLAYSIZES_*fastPlaySettings
- current fastPlay settings for the streamisForceTCZero
- are we forcing all timecodes to zero- Returns:
- number of bytes written
-
writePackets
int writePackets(List<AMFPacket> packetList, com.wowza.wms.stream.file.PlaylistCursor flvCursor, com.wowza.wms.stream.file.PlaylistWriteControl control, com.wowza.wms.stream.file.PlaylistReaderWriteResults results, long[] sizes, com.wowza.wms.stream.FastPlaySettings fastPlaySettings) Write packets to the packetList as AMFPackets- Parameters:
packetList
- list to which to write packetsflvCursor
- current cursor that keeps track of timecodes and flags indicating position in media filecontrol
- write control flags. Mainly used to control when it should stop writingresults
- write results returned from this routinesizes
- array of values that keep track of number of bytes written and number of packets for each data type (audio, video, data). See IMediaStreamPlay.PLAYSIZES_*fastPlaySettings
- current fastPlay settings for the stream- Returns:
- number of bytes written
-
writeGeneratedKeyFrame
int writeGeneratedKeyFrame(IMediaStream stream, OutputStream out, AMFObj wmsObjAudio, AMFObj wmsObjVideo, AMFObj wmsObjData, com.wowza.wms.stream.file.PlaylistCursor flvCursor, com.wowza.wms.stream.file.PlaylistWriteControl control, com.wowza.wms.stream.file.PlaylistReaderWriteResults results, long[] sizes, com.wowza.wms.stream.FastPlaySettings fastPlaySettings, boolean isForceTCZero) From current location in file generate a key frame (enhanced seek) and write it to out- Parameters:
stream
- parent mediaStreamout
- output streamwmsObjAudio
- audio channel amfObjwmsObjVideo
- video channel amfObjwmsObjData
- data channel amfObjflvCursor
- current cursor that keeps track of timecodes and flags indicating position in media filecontrol
- write control flags. Mainly used to control when it should stop writingresults
- write results returned from this routinesizes
- array of values that keep track of number of bytes written and number of packets for each data type (audio, video, data). See IMediaStreamPlay.PLAYSIZES_*fastPlaySettings
- current fastPlay settings for the streamisForceTCZero
- are we forcing all timecodes to zero- Returns:
- number of bytes written
-
sendZeroLengthPacket
int sendZeroLengthPacket(int type, int timecode, boolean isAbsolute, IMediaStream stream, OutputStream out, AMFObj wmsObj, com.wowza.wms.stream.file.PlaylistCursor flvCursor, com.wowza.wms.stream.file.PlaylistWriteControl control, com.wowza.wms.stream.file.PlaylistReaderWriteResults results, long[] sizes, boolean isForceTCZero) -
startPlayback
void startPlayback()Called each time the player being playback (before the buffer it filled) -
getDuration
long getDuration()Get duration or time (milliseconds) of the media file- Returns:
- duration or time (milliseconds) of the media file
-
getLength
long getLength()Get the stream length in bytes- Returns:
- stream length in bytes
-
getPath
String getPath()Get abstract path to the media item- Returns:
- abstract path to the media item
-
getMediaExtension
String getMediaExtension()Get media extension- Returns:
- media extension
-
getStreamPosition
IMediaReaderStreamPosition getStreamPosition()Get a reference to the current stream position- Returns:
- stream position
-
setStreamPosition
Set the file position within the media file- Parameters:
pos
- stream position
-
setProperties
Set the properties for this media reader- Parameters:
properties
- properties
-