Package flumotion :: Package component :: Package consumers :: Package disker :: Module disker :: Class Index
[hide private]

Class Index

source code

extern.log.log.Loggable --+
                          |
                         Index

Creates an index of keyframes for a file, than can be used later for seeking in non indexed formats or whithout parsing the headers.

The format of the index is very similar to the AVI Index, but it can also include information about the real time of each entry in UNIX time. (see 'man aviindex')

If the index is for an indexed format, the offset of the first entry will not start from 0. This offset is the size of the headers.

Instance Methods [hide private]
 
__init__(self, component=None, location=None) source code
 
updateStart(self, timestamp)
Remove entries in the index older than this timestamp
source code
 
addEntry(self, offset, timestamp, keyframe, tdt=0, writeIndex=True)
Add a new entry to the the index and writes it to disk if writeIndex is True
source code
 
setLocation(self, location) source code
 
setHeadersSize(self, size)
Set the headers size in bytes.
source code
 
getHeaders(self)
Return an index entry corresponding to the headers, which is a chunk with 'offset' 0 and 'length' equals to the headers size
source code
 
getFirstTimestamp(self) source code
 
getFirstTDT(self) source code
 
clipTimestamp(self, start, stop)
Clip the current index to a start and stop time, returning all the entries matching the boundaries using the 'timestamp'
source code
 
clipTDT(self, start, stop)
Clip the current index to a start and stop time, returning all the entries matching the boundaries using the 'tdt'
source code
 
clear(self)
Clears the index
source code
 
save(self, start=None, stop=None)
Saves the index in a file, using the entries from 'start' to 'stop'
source code
 
loadIndexFile(self, location)
Loads the entries of the index from an index file
source code
 
_updateLastEntry(self, offset, timestamp, tdt) source code
 
_checkEntriesContinuity(self, offset, timestamp, tdt) source code
 
_clip(self, keyTS, keyDur, start, stop)
Clip the index to a start and stop time.
source code
 
_filter_index(self, start=None, stop=None)
Filter the index with a start and stop time.
source code
 
_write_index_headers(self, file) source code
 
_write_index_entry(self, file, entry, offset, count) source code
 
_write_index_entries(self, file, entries) source code

Inherited from extern.log.log.Loggable: __providedBy__, __provides__, debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure, writeMarker

Class Variables [hide private]
  INDEX_HEADER = 'FLUIDX1 #Flumotion\n'
  INDEX_KEYS = ['CHK', 'POS', 'LEN', 'TS', 'DUR', 'KF', 'TDT', '...
  INDEX_EXTENSION = 'index'
  logCategory = 'index'
Implementors can provide a category to log their messages under.

Inherited from extern.log.log.Loggable: __implemented__

Method Details [hide private]

setHeadersSize(self, size)

source code 

Set the headers size in bytes. Multifdsink append the stream headers to each client. This size is then used to adjust the offset of the index entries

_clip(self, keyTS, keyDur, start, stop)

source code 

Clip the index to a start and stop time. For an index with 10 entries of 10 seconds starting from 0, cliping from 15 to 35 will return the entries 1, 2, and 3.

_filter_index(self, start=None, stop=None)

source code 

Filter the index with a start and stop time. FIXME: Check performance difference with clipping


Class Variable Details [hide private]

INDEX_KEYS

Value:
['CHK', 'POS', 'LEN', 'TS', 'DUR', 'KF', 'TDT', 'TDUR']