Find file
Fetching contributors…
Cannot retrieve contributors at this time
61 lines (33 sloc) 1.84 KB
@author Max Lapshin <> []
@copyright 2009 Max Lapshin
@reference See <a href="" target="_top"></a> for more information
@title Media structure in Erlyvideo
@doc Erlyvideo has non-trivial structure of media delivery.
Media provider.
Central point is media_provider server. Basically it provides two functions:
create media and play media. It's use is to cache opened streams and files.
Opening new file is a rather expensive procedure, but its caching is very cheap.
So, media_provider has a map of name -> instance of media entries.
Media entry.
All media entries are immutable across clients, i.e. they don't know what point
of video user is watching now. Client adapters know this. Also, file entries
are immutable in time: client adapter must track timer and send data to client.
In any case, client code may just ask media_provider to subscribe him to media stream.
Currently there are two kind of media entries: media_file and media_stream.
File entry.
Media_file detects whether it is mp4 or flv one.
Stream entry.
Media_stream may be a client of recorded stream from web camera or client of decoded MPEG TS.
Media playing:
1. media_provider makes lookup in table.
2. if media is not found, reader is started, according to requested type. It is possible
to open file or external stream, like MPEG TS.
3. If media is found, it is asked to return a client adapter.
File entry create file reader, that keeps track of user position in file and read frames at proper time.
Stream entry create stream reader, that keeps track of user play/pause.
Video stream creating:
1. media_provider makes lookup in table
2. if media is found, error is returned
3. If media is not found, video stream is created with owner, set to creator.