avifilelib.index module¶
AVI Index classes.
This module contains classes related to the index structures used
in AVI files. At present, the module provides the AviV1Index
class to represent the AVIOLDINDEX structure, and the
AviV1IndexEntry
class to represent entries in the
index.
-
class
avifilelib.index.
AviV1Index
(index=None)¶ Bases:
object
A class to represent the AVIOLDINDEX structure.
Parameters: index (list) – A list containing AviV1IndexEntry
objects.-
by_data_type
(data_type)¶ Get a new index structure containing entries only for data_type.
Parameters: data_type ( avifilelib.enums.AVIIF
) – The type of the data chunks that should be contained in the returned index.Returns: A new index containing entries only for stream_id. Return type: AviV1Index
-
by_stream
(stream_id)¶ Get a new index structure containing only entries for stream_id.
Parameters: stream_id (int) – The index number of stream for which an index should be returned. Returns: A new index containing entries only for stream_id. Return type: AviV1Index
-
classmethod
load
(file_like)¶ Create an AviV1Index structure.
This method creates an
AviV1Index
from the contents of an AVI ‘idx1’ list.Parameters: file_like (file-like) – A file-like object positioned at the start of a index structure. Returns: An AviV1Index that may be used to read the data for this chunk. Return type: AviV1Index
-
-
class
avifilelib.index.
AviV1IndexEntry
(chunk_id, flags, offset, size)¶ Bases:
object
A class to represent an AVIOLDINDEX_ENTRY.
Parameters: - chunk_id (str) – String version of the chunk identifier. This consists of two characters for the data type, and two characters for the stream id number.
- flags (
avifilelib.enum.AVIIF
) – Flags associated with a given chunk in the index. - offset (int) – Offset in bytes from the start of the ‘movi’ list to the start of the data chunk.
- size (int) – Size of the data in the chunk.
-
classmethod
load
(file_like)¶ Create an AviV1IndexEntry structure.
This method creates an
AviV1IndexEntry
from the contents of an AVI ‘idx1’ list.Parameters: file_like (file-like) – A file-like object positioned at the start of a index entry. Returns: An AviV1IndexEntry containing data for an index entry. Return type: AviV1IndexEntry