Use dataclass for stream segment Part (#101128)

* Use data class for stream segement Part

* use slots
This commit is contained in:
Jan Bouwhuis 2023-09-29 21:07:30 +02:00 committed by GitHub
parent 1b05418647
commit 26ba10f4e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ from __future__ import annotations
import asyncio import asyncio
from collections import deque from collections import deque
from collections.abc import Callable, Coroutine, Iterable from collections.abc import Callable, Coroutine, Iterable
from dataclasses import dataclass
import datetime import datetime
from enum import IntEnum from enum import IntEnum
import logging import logging
@ -70,14 +71,14 @@ STREAM_SETTINGS_NON_LL_HLS = StreamSettings(
) )
@attr.s(slots=True) @dataclass(slots=True)
class Part: class Part:
"""Represent a segment part.""" """Represent a segment part."""
duration: float = attr.ib() duration: float
has_keyframe: bool = attr.ib() has_keyframe: bool
# video data (moof+mdat) # video data (moof+mdat)
data: bytes = attr.ib() data: bytes
@attr.s(slots=True) @attr.s(slots=True)