mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-03 06:25:10 +00:00
feat(hls): carry a held media playlist over --remote and export, inflate gzip segments, add own_stream_only mux opt-in
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""A segment whose body is gzip with no Content-Encoding header is inflated before the merge; no other body is."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import gzip
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.core.test_rolling_merge_hls_ism import INIT, PARTS, hls_track, make_ctx, no_cancel, server # noqa: F401
|
||||
from unshackle.core.manifests import HLS
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"body, expected",
|
||||
[
|
||||
pytest.param(gzip.compress, lambda part: part, id="gzip"),
|
||||
pytest.param(lambda part: b"\x1f\x8b\x08" + part, lambda part: b"\x1f\x8b\x08" + part, id="gzip-magic-only"),
|
||||
pytest.param(lambda part: gzip.compress(part)[:-4], lambda part: gzip.compress(part)[:-4], id="cut-gzip"),
|
||||
],
|
||||
)
|
||||
def test_only_a_whole_gzip_segment_is_inflated(body, expected, server, tmp_path): # noqa: F811
|
||||
for i, part in enumerate(PARTS):
|
||||
server.routes[f"/part{i}.m4s"] = body(part)
|
||||
ctx = make_ctx(tmp_path, "out.mp4")
|
||||
HLS.download_track(hls_track(server, False), ctx)
|
||||
assert ctx.save_path.read_bytes() == INIT + b"".join(map(expected, PARTS))
|
||||
Reference in New Issue
Block a user