Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.stream.fmp4utils Namespace Reference

Functions

Generator[int] find_box (bytes mp4_bytes, bytes target_type, int box_start=0)
 
int find_moov (BufferedIOBase mp4_io)
 
str get_codec_string (bytes mp4_bytes)
 
bytes read_init (BufferedIOBase bytes_io)
 
bytes transform_init (bytes init, Orientation orientation)
 

Variables

tuple FLIP = (ONE32 + ZERO32 + ZERO32) + (ZERO32 + NEGONE32 + ZERO32)
 
tuple MIRROR = (NEGONE32 + ZERO32 + ZERO32) + (ZERO32 + ONE32 + ZERO32)
 
string NEGONE32 = b"\xff\xff\x00\x00"
 
string ONE32 = b"\x00\x01\x00\x00"
 
tuple ROTATE_180 = (NEGONE32 + ZERO32 + ZERO32) + (ZERO32 + NEGONE32 + ZERO32)
 
tuple ROTATE_LEFT = (ZERO32 + NEGONE32 + ZERO32) + (ONE32 + ZERO32 + ZERO32)
 
tuple ROTATE_LEFT_FLIP = (ZERO32 + NEGONE32 + ZERO32) + (NEGONE32 + ZERO32 + ZERO32)
 
tuple ROTATE_RIGHT = (ZERO32 + ONE32 + ZERO32) + (NEGONE32 + ZERO32 + ZERO32)
 
tuple ROTATE_RIGHT_FLIP = (ZERO32 + ONE32 + ZERO32) + (ONE32 + ZERO32 + ZERO32)
 
tuple TRANSFORM_MATRIX_TOP
 
string XYW_ROW = ZERO32 + ZERO32 + b"\x40\x00\x00\x00"
 
string ZERO32 = b"\x00\x00\x00\x00"
 

Detailed Description

Utilities to help convert mp4s to fmp4s.

Function Documentation

◆ find_box()

Generator[int] homeassistant.components.stream.fmp4utils.find_box ( bytes  mp4_bytes,
bytes  target_type,
int   box_start = 0 
)
Find location of first box (or sub box if box_start provided) of given type.

Definition at line 16 of file fmp4utils.py.

◆ find_moov()

int homeassistant.components.stream.fmp4utils.find_moov ( BufferedIOBase  mp4_io)
Find location of moov atom in a BufferedIOBase mp4.

Definition at line 149 of file fmp4utils.py.

◆ get_codec_string()

str homeassistant.components.stream.fmp4utils.get_codec_string ( bytes  mp4_bytes)
Get RFC 6381 codec string.

Definition at line 37 of file fmp4utils.py.

◆ read_init()

bytes homeassistant.components.stream.fmp4utils.read_init ( BufferedIOBase  bytes_io)
Read the init from a mp4 file.

Definition at line 163 of file fmp4utils.py.

◆ transform_init()

bytes homeassistant.components.stream.fmp4utils.transform_init ( bytes  init,
Orientation  orientation 
)
Change the transformation matrix in the header.

Definition at line 201 of file fmp4utils.py.

Variable Documentation

◆ FLIP

tuple homeassistant.components.stream.fmp4utils.FLIP = (ONE32 + ZERO32 + ZERO32) + (ZERO32 + NEGONE32 + ZERO32)

Definition at line 180 of file fmp4utils.py.

◆ MIRROR

tuple homeassistant.components.stream.fmp4utils.MIRROR = (NEGONE32 + ZERO32 + ZERO32) + (ZERO32 + ONE32 + ZERO32)

Definition at line 179 of file fmp4utils.py.

◆ NEGONE32

string homeassistant.components.stream.fmp4utils.NEGONE32 = b"\xff\xff\x00\x00"

Definition at line 174 of file fmp4utils.py.

◆ ONE32

string homeassistant.components.stream.fmp4utils.ONE32 = b"\x00\x01\x00\x00"

Definition at line 173 of file fmp4utils.py.

◆ ROTATE_180

tuple homeassistant.components.stream.fmp4utils.ROTATE_180 = (NEGONE32 + ZERO32 + ZERO32) + (ZERO32 + NEGONE32 + ZERO32)

Definition at line 178 of file fmp4utils.py.

◆ ROTATE_LEFT

tuple homeassistant.components.stream.fmp4utils.ROTATE_LEFT = (ZERO32 + NEGONE32 + ZERO32) + (ONE32 + ZERO32 + ZERO32)

Definition at line 177 of file fmp4utils.py.

◆ ROTATE_LEFT_FLIP

tuple homeassistant.components.stream.fmp4utils.ROTATE_LEFT_FLIP = (ZERO32 + NEGONE32 + ZERO32) + (NEGONE32 + ZERO32 + ZERO32)

Definition at line 182 of file fmp4utils.py.

◆ ROTATE_RIGHT

tuple homeassistant.components.stream.fmp4utils.ROTATE_RIGHT = (ZERO32 + ONE32 + ZERO32) + (NEGONE32 + ZERO32 + ZERO32)

Definition at line 176 of file fmp4utils.py.

◆ ROTATE_RIGHT_FLIP

tuple homeassistant.components.stream.fmp4utils.ROTATE_RIGHT_FLIP = (ZERO32 + ONE32 + ZERO32) + (ONE32 + ZERO32 + ZERO32)

Definition at line 183 of file fmp4utils.py.

◆ TRANSFORM_MATRIX_TOP

tuple homeassistant.components.stream.fmp4utils.TRANSFORM_MATRIX_TOP
Initial value:
1 = (
2  # The index into this tuple corresponds to the EXIF orientation tag
3  # Only index values of 2 through 8 are used
4  # The first two entries are just to keep everything aligned
5  b"", # 0
6  b"", # 1
7  MIRROR, # 2
8  ROTATE_180, # 3
9  FLIP, # 4
10  ROTATE_LEFT_FLIP, # 5
11  ROTATE_LEFT, # 6
12  ROTATE_RIGHT_FLIP, # 7
13  ROTATE_RIGHT, # 8
14 )

Definition at line 185 of file fmp4utils.py.

◆ XYW_ROW

string homeassistant.components.stream.fmp4utils.XYW_ROW = ZERO32 + ZERO32 + b"\x40\x00\x00\x00"

Definition at line 175 of file fmp4utils.py.

◆ ZERO32

string homeassistant.components.stream.fmp4utils.ZERO32 = b"\x00\x00\x00\x00"

Definition at line 172 of file fmp4utils.py.