mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-17 06:25:07 +00:00
Compare commits
62
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65e807bf5f | ||
|
|
c6c0331007 | ||
|
|
b3c86413d5 | ||
|
|
f2747076a6 | ||
|
|
cbeff379fb | ||
|
|
0c45195fe2 | ||
|
|
97711e799c | ||
|
|
23545b6c92 | ||
|
|
7898ff6dd6 | ||
|
|
b493c9cd52 | ||
|
|
b0f96cdee9 | ||
|
|
e6a627118f | ||
|
|
5206b3cab6 | ||
|
|
47f88b1b65 | ||
|
|
17d4905577 | ||
|
|
d4abcb51d9 | ||
|
|
bd64f3a8c4 | ||
|
|
7b927934e0 | ||
|
|
d12a943d96 | ||
|
|
b0c006d7f6 | ||
|
|
2e75cc35a1 | ||
|
|
88f9af2af6 | ||
|
|
9f86464826 | ||
|
|
756c2ce2b5 | ||
|
|
9017ab95b7 | ||
|
|
0440f2ba54 | ||
|
|
84fd0a4bee | ||
|
|
8454f40929 | ||
|
|
06f87dafa3 | ||
|
|
ffeb58f808 | ||
|
|
a7f77dea42 | ||
|
|
af2ec8112c | ||
|
|
8151946ec0 | ||
|
|
0c58575a5b | ||
|
|
43fcb030f8 | ||
|
|
2dc458f8b4 | ||
|
|
cb2ffdb55a | ||
|
|
cc33600cc7 | ||
|
|
80bda08f36 | ||
|
|
7832c4dbe4 | ||
|
|
d0f9307506 | ||
|
|
fdb5369534 | ||
|
|
34e8e37fdc | ||
|
|
cd9785d406 | ||
|
|
866420ed67 | ||
|
|
0de069f35a | ||
|
|
bcef9ff87a | ||
|
|
1036528fa3 | ||
|
|
ecf17baffe | ||
|
|
1175035317 | ||
|
|
83514d12fe | ||
|
|
dfc99783b5 | ||
|
|
d8663b0dad | ||
|
|
9f054269db | ||
|
|
3345422790 | ||
|
|
cc4bf19706 | ||
|
|
eeaf16cd83 | ||
|
|
af69e8aad4 | ||
|
|
71f293161e | ||
|
|
3e9c26bd46 | ||
|
|
9dd97bcd25 | ||
|
|
f83a594c91 |
@@ -1 +1,2 @@
|
||||
* text=auto eol=lf
|
||||
tests/fixtures/manifests/** -text
|
||||
|
||||
@@ -35,6 +35,11 @@ jobs:
|
||||
run: uv run ruff format --check .
|
||||
- name: Import order
|
||||
run: uv run isort --check-only unshackle tests --skip-glob "*/services/*"
|
||||
- name: Type check
|
||||
run: |
|
||||
out=$(uv run mypy unshackle) || true
|
||||
echo "$out"
|
||||
echo "$out" | sed -nE 's/^([^:]+):([0-9]+): error: (.*)$/::warning file=\1,line=\2::\3/p'
|
||||
|
||||
test:
|
||||
strategy:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
|
||||
exclude: ^tests/fixtures/manifests/
|
||||
repos:
|
||||
- repo: https://github.com/compilerla/conventional-pre-commit
|
||||
rev: v4.4.0
|
||||
@@ -32,3 +33,12 @@ repos:
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
args: [--markdown-linebreak-ext=md]
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: mypy
|
||||
name: mypy
|
||||
entry: uv run mypy unshackle
|
||||
language: system
|
||||
types: [python]
|
||||
files: ^unshackle/
|
||||
pass_filenames: false
|
||||
|
||||
@@ -491,6 +491,25 @@ def get_tracks(self, title: Title_T) -> Tracks:
|
||||
return self.get_tracks_for_variants(title, fetch_variant)
|
||||
```
|
||||
|
||||
!!! note "What the helper merges"
|
||||
The helper adds the video, audio and subtitle tracks of every manifest.
|
||||
From a later manifest, it skips a track that has the ID of a held track. It
|
||||
also skips a track whose `Tracks.signature` matches a held track, because
|
||||
the same track can have a different ID in each manifest. Chapters and
|
||||
attachments come from the first manifest only.
|
||||
|
||||
- `signature` holds the attributes that the track list and selection
|
||||
read: codec, range, resolution, frame rate, bitrate and name for video;
|
||||
language, codec, channels, JOC, descriptive, bitrate and name for audio;
|
||||
language, codec, flags and name for subtitles.
|
||||
- The helper does not remove copies inside one manifest. To remove them,
|
||||
call `tracks.dedupe()`. Two tracks that differ only in a value outside
|
||||
the signature, such as a dialogue-boost mix, become one track, so remove the
|
||||
track you do not want before you call it.
|
||||
- The audio that `dl` selects can come from a different manifest than the
|
||||
video. Keep licence data on each track (`track.data`), not in one value
|
||||
per title that the next fetch overwrites.
|
||||
|
||||
After parsing, you may **correct** track metadata the manifest gets wrong:
|
||||
stamp the real `video.range`, fix odd audio channel counts, mark descriptive
|
||||
audio, add hand-built subtitles or an `Attachment` (e.g. cover art). Do *not*
|
||||
@@ -595,7 +614,7 @@ def get_widevine_license(self, *, challenge: bytes, title, track):
|
||||
`get_clearkey_license` to do the POST yourself.
|
||||
3. **Keys arrive obfuscated or through a bespoke channel**: fetch and unwrap
|
||||
the content key in `get_tracks` and pre-populate
|
||||
`drm.content_keys[kid] = key_hex` on the track's `ClearKeyCENC`. The
|
||||
`drm.signatures[kid] = key_hex` on the track's `ClearKeyCENC`. The
|
||||
non-obvious payoff: when every KID is already keyed, the framework skips
|
||||
the license round-trip entirely.
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ This value becomes the one and only API key that the server accepts. The server
|
||||
If you start `unshackle serve` with no `api_secret` configured, and you have *not* passed `--no-key`, the command fails immediately with:
|
||||
|
||||
```
|
||||
API secret key is not configured. Please add 'api_secret' to the 'serve' section in your config.
|
||||
No 'api_secret' in the 'serve' section of your config
|
||||
```
|
||||
|
||||
Choose a long, unpredictable value. The API key is the only thing standing between the internet and your CDM and download endpoints.
|
||||
|
||||
@@ -45,6 +45,7 @@ Health check. **This is the only route exempt from authentication**: you can cal
|
||||
"status": "ok",
|
||||
"version": "5.3.0",
|
||||
"code_hash": "1d22a1e",
|
||||
"draining": false,
|
||||
"update_check": {
|
||||
"update_available": false,
|
||||
"current_version": "5.3.0",
|
||||
@@ -55,6 +56,10 @@ Health check. **This is the only route exempt from authentication**: you can cal
|
||||
|
||||
`code_hash` fingerprints the framework source the server operates, so it names the code itself rather than the release. It is the same value for a git checkout and for an installed package built from that checkout. It changes when you edit anything under `unshackle/core`, `unshackle/commands`, `unshackle/utils`, or `unshackle/vaults`. Service modules are not included. unshackle sets the value to `null` only when it cannot read the source files.
|
||||
|
||||
`draining` is `true` while the server refuses new remote sessions and jobs before a restart.
|
||||
|
||||
The server asks GitHub for the latest release at most once per [`update_check_interval`](../../reference/configuration/misc.md#caching-updates) hours and answers from its cache between checks.
|
||||
|
||||
If the update check fails (for example, no network), `update_available` and `latest_version` are `null` while `current_version` still reports the installed version.
|
||||
|
||||
| Status | Meaning |
|
||||
@@ -200,7 +205,8 @@ Get the list of titles behind a title ID, for example episodes or a movie, witho
|
||||
| `cdm_type` | string | no | Preferred CDM type. |
|
||||
| `credentials`, `cookies`, `cache` | - | no | Your own login material, on a `--remote-only` server only. See [Client cache on a remote-only server](#client-cache-on-a-remote-only-server). |
|
||||
|
||||
You can also pass service-specific CLI options as additional keys.
|
||||
You can also pass a service's own CLI options, in a nested `service_params` object or as
|
||||
additional keys. When the body has `service_params`, the server reads service options only from it.
|
||||
|
||||
#### Logins that need the user
|
||||
|
||||
@@ -317,7 +323,7 @@ Show the video, audio, and subtitle tracks for a title. For series, you can scop
|
||||
| `part` | int/string | no | Part index of a split episode (combined with `season` and `episode`). |
|
||||
| `profile`, `proxy`, `no_proxy`, `cdm_type` | - | no | As on `list-titles`. |
|
||||
| `credentials`, `cookies`, `cache` | - | no | As on `list-titles`. |
|
||||
| `dl_params` | object | no | The `dl` track selection that the service reads from `ctx.parent.params`: `lang`, `v_lang`, `a_lang`, `acodec`, `forced_subs` and `exact_lang`, as on [`POST /api/session/create`](#post-apisessioncreate). Some services select the manifests they fetch from these values. |
|
||||
| `dl_params` | object | no | The `dl` track selection that the service reads from `ctx.parent.params`: `lang`, `v_lang`, `a_lang`, `s_lang`, `acodec`, `forced_subs` and `exact_lang`, as on [`POST /api/session/create`](#post-apisessioncreate). Some services select the manifests they fetch from these values. |
|
||||
|
||||
When you give both `season` and `episode`, the server combines them into a `"{season}x{episode}"` selector. `part` narrows that to `"{season}x{episode}.{part}"`, one part of a [split episode](../creating-a-service.md#split-episodes). Without `part` you get every part of the episode. The server reads `part` only when you give both `season` and `episode`, and `wanted` takes precedence over all three. To scope a part by range, put it in `wanted` instead (`"S01E01.2"`).
|
||||
|
||||
@@ -328,28 +334,29 @@ When you give both `season` and `episode`, the server combines them into a `"{se
|
||||
"title": { "type": "movie", "name": "Example Movie", "id": "12345", "year": 2021 },
|
||||
"video": [
|
||||
{
|
||||
"id": "v-1", "codec": "H265", "codec_display": "HEVC",
|
||||
"id": "v-1", "codec": "HEVC", "codec_display": "H.265",
|
||||
"bitrate": 8000, "bitrate_bps": 8000000, "width": 3840, "height": 2160,
|
||||
"resolution": "2160p", "fps": "24", "range": "HDR10",
|
||||
"range_display": "HDR10", "scan_type": null, "closed_captions": [],
|
||||
"dv_compatible_bitstream": false, "hdr10plus": false, "language": "en", "is_original_lang": true,
|
||||
"name": null, "needs_repack": false, "edition": [], "data": null,
|
||||
"range_display": "HDR", "scan_type": null, "closed_captions": [],
|
||||
"dv_compatible_bitstream": false, "hdr10plus": false, "hdr10_base": false, "language": "en",
|
||||
"is_original_lang": true,
|
||||
"name": null, "track_name": "English", "needs_repack": false, "edition": [], "note": null, "data": null,
|
||||
"drm": [], "descriptor": "DASH"
|
||||
}
|
||||
],
|
||||
"audio": [
|
||||
{
|
||||
"id": "a-1", "codec": "EC3", "codec_display": "DD+",
|
||||
"id": "a-1", "codec": "EC3", "codec_display": "DDP",
|
||||
"bitrate": 640, "bitrate_bps": 640000, "channels": "5.1", "language": "en",
|
||||
"is_original": true, "is_original_lang": true, "atmos": false, "joc": 0,
|
||||
"descriptive": false, "name": null, "needs_repack": false, "edition": [],
|
||||
"data": null, "drm": [], "descriptor": "DASH"
|
||||
"descriptive": false, "name": null, "track_name": "English", "needs_repack": false, "edition": [],
|
||||
"note": null, "data": null, "drm": [], "descriptor": "DASH"
|
||||
}
|
||||
],
|
||||
"subtitles": [
|
||||
{ "id": "s-1", "codec": "vtt", "language": "en",
|
||||
"forced": false, "sdh": false, "cc": false, "is_original_lang": false,
|
||||
"name": null, "needs_repack": false, "edition": [], "data": null,
|
||||
"name": null, "track_name": "English", "needs_repack": false, "edition": [], "note": null, "data": null,
|
||||
"drm": [], "descriptor": "DASH" }
|
||||
]
|
||||
}
|
||||
@@ -377,7 +384,7 @@ The server sorts tracks by bitrate, descending. Episodes the server cannot get g
|
||||
|
||||
The `drm` array on a track is a list of `{type, pssh?, kids?, content_keys?, license_url?}` objects.
|
||||
|
||||
Every track carries the same fields as a local track: `is_original_lang`, `name`, `needs_repack`, `edition`, and `data`. `bitrate` is in kb/s, and `bitrate_bps` gives the exact bits/s. `data` holds the part of the service-set `track.data` that fits in JSON, without the `hls`, `dash`, and `ism` parser keys. Audio keeps `is_original` and `atmos` for clients that read them, and adds the exact `joc` object count.
|
||||
Every track carries the same fields as a local track: `is_original_lang`, `name`, `needs_repack`, `edition`, `note`, and `data`. `name` is the name the service set, or null. `note` is display text the service set, such as an encoding profile, or null: `--list` shows it, but the filename and the mux do not use it. `track_name` is the name `--list` shows and the mux writes to an audio or subtitle track: `name` when the service set one, else the name of the language (English, or in the language itself when the server sets `muxing.track_names: native`, or no name when it sets `none`), then the server's `muxing.original_label` on an original-language track, then the SDH, CC, Forced or Descriptive label. `bitrate` is in kb/s, and `bitrate_bps` gives the exact bits/s. `data` holds the part of the service-set `track.data` that fits in JSON, without the `hls`, `dash`, and `ism` parser keys. Audio keeps `is_original` and `atmos` for clients that read them, and adds the exact `joc` object count.
|
||||
|
||||
| Status | Error code | Meaning |
|
||||
| --- | --- | --- |
|
||||
@@ -484,9 +491,10 @@ Make a download job. It requires `service` and `title_id`. Every other field is
|
||||
**Validation.** Invalid values return `400 INVALID_PARAMETERS`. `vcodec`, `acodec` and `sub_format` take the same spellings as the CLI options of the same name (`unshackle dl --help` prints each list). The API and the CLI read one list, so they cannot disagree. `range` must be one of SDR/HDR10/HDR10P/DV/HLG/HYBRID, and `HDR10+` is also valid. The bitrate, download worker, and download counts must be positive integers. You may set at most one of the `*_only` flags. You cannot combine `no_subs` with `subs_only`, or `no_audio` with `audio_only`.
|
||||
|
||||
**Service options.** A service's own CLI options travel in the same body. Send them in a nested
|
||||
`service_params` object, or as flat top-level keys. `service_params` wins over a flat key of the
|
||||
same name. An option you leave out takes the default declared on the service's `cli` command, so
|
||||
the job matches the equivalent `dl` run. `profile` at the top level always means the credential
|
||||
`service_params` object, or as flat top-level keys. When the body has `service_params`, the server
|
||||
reads service options only from it, and every flat key is a `dl` value. An option you leave out
|
||||
takes the default declared on the service's `cli` command, so the job matches the equivalent `dl`
|
||||
run. `profile` at the top level always means the credential
|
||||
profile, never a service's own `--profile` option.
|
||||
|
||||
=== "Request"
|
||||
@@ -961,9 +969,9 @@ the newlines must go out at once.
|
||||
|
||||
Make a remote session for a service and title. Authentication runs asynchronously in the background. This call returns immediately with `status: "authenticating"`, and you then poll the prompt endpoint. The body accepts `service` and `title_id` (both required). It also accepts a broad set of optional keys, because the body allows `additionalProperties`. These are `credentials` (`{username, password, extra?}`), `cookies` (base64 of zlib-compressed Netscape cookie file), `proxy`, `no_proxy`, `profile`, `cache` (map of forwarded cache files, keyed by the file path relative to the service cache directory with `/` separators and no `.json` suffix, so a nested key such as `session_web/<sha1>` lands in a subdirectory), `client_region`, `proxy_region`, `cdm_type`, `range_`, `vcodec`, `quality`, `best_available`, `dl_params`, `client`, and any service CLI options. `proxy_region` is the country code the client resolved `proxy` from; the server matches it against its own accounts. `client` is a freeform object the dashboard shows as sent (the CLI puts `version`, `code_hash`, `platform` and a redacted `argv` in it); the server ignores it above 4096 bytes of JSON.
|
||||
|
||||
`dl_params` is an object with the `dl` track selection: `lang`, `v_lang` and `a_lang` (arrays of language strings), `acodec` (an array of audio codec names or `dl -a` aliases such as `ddp`), and `forced_subs` and `exact_lang` (booleans). The service reads these values from `ctx.parent.params`. The server uses the `dl` default for each absent or malformed value, and drops an unknown codec name.
|
||||
`dl_params` is an object with the `dl` track selection: `lang`, `v_lang`, `a_lang` and `s_lang` (arrays of language strings), `acodec` (an array of audio codec names or `dl -a` aliases such as `ddp`), and `forced_subs` and `exact_lang` (booleans). The service reads these values from `ctx.parent.params`. The server uses the `dl` default for each absent or malformed value, and drops an unknown codec name.
|
||||
|
||||
Service CLI options also travel in a nested `service_params` object, which wins over a flat key with the same name. `profile` at the top level always means the credentials profile, never a service's own `--profile` option.
|
||||
Service CLI options also travel in a nested `service_params` object. When the body has `service_params`, the server reads service options only from it, and a flat key with the same name stays a `dl` value. `profile` at the top level always means the credentials profile, never a service's own `--profile` option.
|
||||
|
||||
The `proxy` value must be a full proxy URI, unless the operator gives your API key `server_proxy` in the `serve.users` config. Without `server_proxy`, the server does not resolve country codes with its own proxy providers. It rejects the request with `INVALID_PROXY` when no `proxy` is set and the reported `client_region` differs from the server's region. A request that reports no `client_region` is not blocked. Pass `proxy` with your own proxy, or `no_proxy` to accept the server's own connection. With `server_proxy`, the server resolves a country code and picks a proxy for your `client_region` itself. A Control D resolver, `controld://<resolver>@dns.controld.com`, counts as a full proxy URI: the server runs a forwarder for it and needs no Control D configuration of its own.
|
||||
|
||||
@@ -1096,6 +1104,7 @@ Get tracks and chapters for a specific title within the remote session. Body: `{
|
||||
"track_manifests": [ { "track_id": "s-1", "type": "dash", "url": "https://...", "data": "<base64 zlib xml>" } ],
|
||||
"session_headers": { "User-Agent": "..." },
|
||||
"session_cookies": { "sid": "..." },
|
||||
"session_cookie_jar": [ { "name": "sid", "value": "...", "domain": ".example.com", "path": "/", "secure": true } ],
|
||||
"server_cdm_type": "widevine"
|
||||
}
|
||||
```
|
||||
@@ -1115,11 +1124,13 @@ Get the download URL, DRM info, headers, cookies, and raw track data for the sel
|
||||
```json
|
||||
{
|
||||
"tracks": {
|
||||
"v-1": { "descriptor": "DASH", "url": "https://...", "drm": [ ... ], "headers": { ... }, "cookies": { ... }, "data": { ... } }
|
||||
"v-1": { "descriptor": "DASH", "url": "https://...", "drm": [ ... ], "headers": { ... }, "cookies": { ... }, "cookie_jar": [ ... ], "data": { ... } }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`cookies` gives names and values only. `cookie_jar` gives the same cookies with their domain, path and `secure` flag, in the `session_cookie_jar` form of the tracks response.
|
||||
|
||||
| Status | Error code | Meaning |
|
||||
| --- | --- | --- |
|
||||
| `200` | - | Segment info returned. |
|
||||
@@ -1215,7 +1226,7 @@ A slow answer arrives as a [slow response](#slow-responses).
|
||||
|
||||
### `POST /api/session/{session_id}/keys/bad`
|
||||
|
||||
Report a content key from `vault_keys` that did not decrypt the track. The server flags the pair in its local vaults and reports it to the vault that served it, and the next licence for that KID reaches the CDM. The client never learns the server vault names.
|
||||
Report a content key from `vault_keys` that did not decrypt the track. The server flags the pair in its local vaults and reports it to the vault that served it, and the next licence for that KID reaches the CDM. When the CDM returns the same pair, the server removes the flag. The client never learns the server vault names.
|
||||
|
||||
```json
|
||||
{ "kid": "<kid_hex>", "key": "<key_hex>" }
|
||||
@@ -1223,7 +1234,7 @@ Report a content key from `vault_keys` that did not decrypt the track. The serve
|
||||
|
||||
| Status | Error code | Meaning |
|
||||
| --- | --- | --- |
|
||||
| `200` | - | The pair is flagged. |
|
||||
| `200` | - | `{"flagged": true}`: the pair is flagged. `{"flagged": false}`: the CDM licensed the pair, so it is not flagged. |
|
||||
| `400` | `INVALID_INPUT` | This remote session was not served that pair. |
|
||||
| `404` | `SESSION_NOT_FOUND` | Unknown remote session. |
|
||||
|
||||
@@ -1239,6 +1250,7 @@ Return remote session metadata and validity.
|
||||
"service": "EXAMPLE",
|
||||
"valid": true,
|
||||
"expires_in": 300,
|
||||
"draining": false,
|
||||
"track_count": 4,
|
||||
"title_count": 10
|
||||
}
|
||||
|
||||
@@ -126,8 +126,8 @@ while the server restarts.
|
||||
| `SESSION_NOT_FOUND` | 404 | The remote-dl session does not exist or has expired. |
|
||||
| `TRACK_NOT_FOUND` | 404 | A referenced track ID is not present in the remote session. |
|
||||
| `CONFLICT` | 409 | The target resource is in a state that disallows the action (retrying a running job, prioritising a non-queued job, clearing cache during an active download). |
|
||||
| `SERVER_DRAINING` | 409 | The server is about to restart and starts no new remote session or download job. Open work continues. Retryable after the restart. |
|
||||
| `SERVICE_ERROR` | 422 | The streaming service's API returned an error, or the service does not support the requested operation. |
|
||||
| `SERVER_DRAINING` | 409 | The server is about to restart and starts no new remote session or download job. Open work continues. Retryable after the restart. A `dl --remote` client waits for the restart and opens a new remote session. |
|
||||
| `SERVICE_ERROR` | 422 | The streaming service's API returned an error, or the service does not support the requested operation, or the service code exited (`sys.exit`). |
|
||||
| `DRM_ERROR` | 422 | DRM or license acquisition failed. |
|
||||
| `RATE_LIMITED` | 429 | The streaming service is rate-limiting requests. Retryable. |
|
||||
|
||||
|
||||
@@ -62,10 +62,11 @@ remote_services:
|
||||
url: "https://my-box.example:8786"
|
||||
api_key: "your-api-key"
|
||||
# Optional: let the server's CDM do the licensing instead of a local CDM
|
||||
server_cdm: false
|
||||
# Optional: per-service config overrides applied locally (title_map, cdm, etc.)
|
||||
server_cdm: true
|
||||
# Optional: per-service config overrides applied locally (title_map, cdm, server_cdm, etc.)
|
||||
services:
|
||||
EXAMPLE:
|
||||
server_cdm: false # this service licenses with your local CDM
|
||||
title_map:
|
||||
"0ABCDEF": "The Show (Renamed Locally)"
|
||||
```
|
||||
@@ -74,8 +75,8 @@ remote_services:
|
||||
|---|---|---|
|
||||
| `url` | yes | Base URL of the `unshackle serve` instance (no trailing slash needed) |
|
||||
| `api_key` | no | Sent as the `X-Secret-Key` header on every request |
|
||||
| `server_cdm` | no | When `true`, DRM keys are resolved by the server's CDM rather than a local device (default `false`) |
|
||||
| `services` | no | Per-service local config overrides, keyed by service tag |
|
||||
| `server_cdm` | no | `true` asks for the server's CDM, `false` uses your local device; unset follows the API key's server CDM grant |
|
||||
| `services` | no | Per-service local config overrides, keyed by service tag in any case; a `server_cdm` here replaces the server entry's value for that service |
|
||||
|
||||
!!! warning "Port default"
|
||||
The `unshackle serve` default port is **`8786`** (not `8080`). Use the port
|
||||
@@ -214,8 +215,10 @@ hood the client walks a remote session through its lifecycle.
|
||||
downloading. A service can build an AdaptationSet of its own that the served
|
||||
manifest does not contain. Each such track gets a one-AdaptationSet MPD in
|
||||
`track_manifests`, and the client re-parses that instead. Any
|
||||
`session_headers` / `session_cookies` the server used are merged into the
|
||||
client's local HTTP session.
|
||||
`session_headers` and cookies the server used are merged into the
|
||||
client's local HTTP session. Each cookie in `session_cookie_jar` keeps its
|
||||
domain, path and `secure` flag, so it goes only to its own hosts. `session_cookies` carries
|
||||
the same cookies as names and values only, for older clients.
|
||||
|
||||
The tracks response repeats the title. A service can rewrite title fields inside
|
||||
`get_tracks`, so the client takes this copy in place of the one from the title
|
||||
@@ -265,22 +268,23 @@ hood the client walks a remote session through its lifecycle.
|
||||
|
||||
There are two ways DRM keys get resolved, chosen by the client's `server_cdm` flag.
|
||||
|
||||
=== "Proxied CDM (default)"
|
||||
=== "Proxied CDM (server_cdm: false)"
|
||||
|
||||
Your **local CDM** builds the license challenge. The client sends that challenge
|
||||
to `POST /api/session/{id}/license`, the server forwards it to the service, and
|
||||
the raw license bytes come back for your local CDM to parse.
|
||||
|
||||
- Keeps your CDM local. The server only relays the license request.
|
||||
- Used when `server_cdm` is `false` (the default).
|
||||
- Also used for a run with `dl --cdm <name>`, and for a service whose own entry in
|
||||
your `cdm` config named the loaded device. In each case the client sends
|
||||
- Used when `server_cdm` is `false`, or when it is unset and the API key has no server
|
||||
CDM for the service.
|
||||
- Also used for a run with `dl --cdm <name>`, and, when `server_cdm` is unset, for a
|
||||
service whose own entry in your `cdm` config named the loaded device. In each case the client sends
|
||||
`server_cdm: false` when it creates the remote session, and the server builds the
|
||||
service on your device even when the API key has the server CDM.
|
||||
- A service option that the service lists in `SERVER_DEVICE_OPTIONS` keeps the server
|
||||
CDM. The server reads the option from `service_params`, then from the top level of
|
||||
the request. The create response gives the result in `server_cdm`, and the client
|
||||
shows a warning when the server did not apply its choice.
|
||||
CDM. The server reads the option from `service_params`, or from the top level of
|
||||
a request that has no `service_params`. The create response gives the result in
|
||||
`server_cdm`, and the client shows a warning when the server did not apply its choice.
|
||||
- The service on the server sees your device, not the server's: its DRM system,
|
||||
security level, system ID and device type. A CDM call that the service makes
|
||||
(for example a session-key exchange at login) goes to your client as a `cdm_call`,
|
||||
@@ -301,9 +305,11 @@ There are two ways DRM keys get resolved, chosen by the client's `server_cdm` fl
|
||||
decodes, and a wrong pair goes back to `POST /api/session/{id}/keys/bad`. The
|
||||
server flags the pair in every local vault it holds, reports it to the vault
|
||||
that served it, and the next licence for that KID skips the pair and reaches
|
||||
the CDM. A server with no local SQLite vault cannot store the flag. The
|
||||
server accepts a report only for a pair it served to that remote session. The
|
||||
client never learns the server vault names.
|
||||
the CDM. When the CDM returns the same pair, the server removes the flag,
|
||||
because then the client's check was wrong. A server with no local SQLite
|
||||
vault cannot store the flag. The server accepts a report only for a pair it
|
||||
served to that remote session, and does not flag a pair its CDM licensed.
|
||||
The client never learns the server vault names.
|
||||
- A content key in the client's own vaults goes first, even when the server
|
||||
already answered. The client proves it, and a server key waits as the next
|
||||
candidate.
|
||||
@@ -463,7 +469,7 @@ object the dashboard shows as sent), and the track-selection hints `range_`, `vc
|
||||
`quality`, `best_available`, `generate_dv`, plus arbitrary service CLI options
|
||||
(`additionalProperties: true`).
|
||||
|
||||
`dl_params` holds the `dl` track selection: `lang`, `v_lang` and `a_lang`
|
||||
`dl_params` holds the `dl` track selection: `lang`, `v_lang`, `a_lang` and `s_lang`
|
||||
(arrays of language strings), `acodec` (an array of audio codec names, such as
|
||||
`EC3`), and `forced_subs` and `exact_lang` (booleans). The server gives these values to the
|
||||
service in `ctx.parent.params`, never as service options, so a service option
|
||||
@@ -621,11 +627,15 @@ existing file as a directory, and logs a warning.
|
||||
"service": "EXAMPLE",
|
||||
"valid": true,
|
||||
"expires_in": 300,
|
||||
"draining": false,
|
||||
"track_count": 12,
|
||||
"title_count": 40
|
||||
}
|
||||
```
|
||||
|
||||
`draining` is `true` after the operator starts a drain before a restart. The client reads
|
||||
it before each title, so it knows of the restart before it occurs.
|
||||
|
||||
!!! warning "`expires_in` is the configured TTL, not time remaining"
|
||||
The `expires_in` value reports the store's configured `session_ttl`, not the
|
||||
seconds left before this specific remote session expires.
|
||||
@@ -653,9 +663,29 @@ remote session API and a good template for any client.
|
||||
- **Flow.** `authenticate()` → `create` (+ poll `prompt` every 2s up to a 600s
|
||||
deadline, answering `pending_input` prompts. With stdin closed the client logs an
|
||||
error and raises `SystemExit(1)` instead of posting an empty answer) → `get_titles()` → `get_tracks()`
|
||||
(merging returned `session_headers`/`session_cookies`, re-parsing `manifests`) →
|
||||
(merging returned `session_headers`/`session_cookie_jar`, re-parsing `manifests`) →
|
||||
get the licence in proxy mode or `server_cdm` mode → `close()` (`DELETE`, saving any returned
|
||||
`cache`).
|
||||
- **Server restarts.** The server keeps remote sessions in memory only, so a restart
|
||||
loses them all. The client recovers in two ways:
|
||||
- A drain announced through `draining`: the client finishes the current title, then
|
||||
closes its remote session, so the drain can end and the refreshed cache comes back.
|
||||
It waits until `/api/health` reports the restarted server without `draining`,
|
||||
opens a new remote session, and continues with the next title.
|
||||
- A lost remote session (`SESSION_NOT_FOUND`, a connection error, a timeout, a closed
|
||||
tunnel or a gateway error page): the client waits for `/api/health`, then checks the
|
||||
old remote session. A live remote session takes the call again only after a connection
|
||||
error, because a timed-out call can already have run. A lost one is replaced: the
|
||||
client opens a new remote session, sends `titles` and the current title's `tracks`
|
||||
again, and then sends the failed call again. A title or track that the new remote
|
||||
session gives another ID keeps its old ID on the client, and the client sends the
|
||||
new ID. The client matches a title by season and episode number, and a track by its
|
||||
attributes.
|
||||
|
||||
The client waits up to 30 minutes for the server, which covers a deploy's drain. It
|
||||
stops with an error if the new remote session licenses differently from the old one,
|
||||
for example after a change to the API key's `server_cdm` grant. An interactive login
|
||||
asks for its input again.
|
||||
- **Server resolution.** `resolve_server()` reads `config.remote_services.<name>`
|
||||
into `{url, api_key, services, server_cdm}`, injecting the `server_cdm` flag into
|
||||
the services map as `_server_cdm`.
|
||||
@@ -664,7 +694,7 @@ remote session API and a good template for any client.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
!!! example "\"Could not connect to remote server ... Is it running?\""
|
||||
!!! example "\"Could not connect to remote server at ...\""
|
||||
The client could not reach the URL. Make sure that `unshackle serve` operates on
|
||||
the server, the `url`/port in `remote_services` are correct (default port `8786`),
|
||||
and any firewall or reverse proxy allows the connection.
|
||||
|
||||
@@ -284,7 +284,7 @@ do not give a `name`, unshackle derives a human-readable name from the language.
|
||||
`Video` adds `codec`, `range`, `bitrate`, `width`, `height`, `fps`, `scan_type`, and
|
||||
closed-caption descriptors. The relevant enums:
|
||||
|
||||
- **`Video.Codec`**: `AVC` (H.264), `HEVC` (H.265), `VC1`, `VP8`, `VP9`, `AV1`.
|
||||
- **`Video.Codec`**: `AVC` (H.264), `HEVC` (H.265), `VC1`, `VP8`, `VP9`, `AV1`, `LCEVC`.
|
||||
- **`Video.Range`**: `SDR`, `HLG`, `HDR10`, `HDR10P` (HDR10+), `DV` (Dolby Vision), and
|
||||
`HYBRID`. `HYBRID` is special: it tells the pipeline to select both an HDR10(+) base and
|
||||
a DV track and merge the DV RPU onto the HDR10 track with `dovi_tool` (see
|
||||
@@ -298,7 +298,7 @@ closed-caption descriptors. The relevant enums:
|
||||
|
||||
`Audio` adds `bitrate`, `channels`, `joc` (Joint Object Coding, the Atmos indicator),
|
||||
and `descriptive`. `Audio.Codec` covers `AAC`, `AC3` (`DD`), `EC3` (`DD+`), `AC4`,
|
||||
`OPUS`, `OGG` (Vorbis), `DTS`, `DTSX`, `ALAC`, and `FLAC`. The `atmos` property is `True` when
|
||||
`OPUS`, `OGG` (Vorbis), `DTS`, `DTSX`, `DTSHD`, `MPEGH`, `ALAC`, `FLAC`, and `MP3`. The `atmos` property is `True` when
|
||||
`joc` is set (or when `extra` flags it).
|
||||
|
||||
### `Subtitle`
|
||||
@@ -388,7 +388,7 @@ A typical `get_tracks` therefore looks like fetching the manifest text with
|
||||
## DRM hooks
|
||||
|
||||
If a track carries DRM, the framework licenses and decrypts it, but it needs your
|
||||
service to talk to the platform's license server. unshackle recognizes five DRM systems:
|
||||
service to talk to the platform's license server. unshackle recognizes six DRM systems:
|
||||
|
||||
| DRM class | System | License flow |
|
||||
|---|---|---|
|
||||
@@ -397,6 +397,7 @@ service to talk to the platform's license server. unshackle recognizes five DRM
|
||||
| `ClearKeyCENC` | W3C `org.w3.clearkey` over CENC | JSON KID request → JWK set; no CDM |
|
||||
| `ClearKey` | HLS AES-128 | content key fetched directly from a URI; no CDM, no challenge |
|
||||
| `MonaLisa` | Proprietary WASM DRM | keys extracted locally; no license server |
|
||||
| `BlowfishStripe` | Blowfish CBC stripe cipher | the service gives the per-track key; no CDM, no license server |
|
||||
|
||||
!!! warning "`ClearKey` vs `ClearKeyCENC`"
|
||||
Despite the shared prefix these are entirely different systems. `ClearKey` is HLS
|
||||
@@ -456,6 +457,7 @@ the API surface.
|
||||
Two DV mechanisms sit on top of the track model. **DV fixup** re-exposes DV signalling on
|
||||
HLS and DASH streams that carry a valid DV RPU but advertise plain HEVC, with DV only in the
|
||||
supplemental codecs (`dv_compatible_bitstream`). `--list` shows such a track as `HDR10+DV` or `HDR10P+DV`.
|
||||
A service sets `hdr10_base` on a DV track that has an HDR10 base layer (DV profile 8.1), and `--list` shows it as `DV+HDR10`.
|
||||
**Hybrid** processing (`Video.Range.HYBRID`) selects an HDR10(+) base and a DV donor,
|
||||
extracts the RPU with `dovi_tool`, and injects it onto the base layer, to make a single
|
||||
track that carries both HDR10 metadata and the DV RPU. Both are automatic once the
|
||||
|
||||
@@ -268,7 +268,7 @@ download. For example, `dovi_tool` only matters if you download Dolby Vision vid
|
||||
| Tool | Binary looked up | Why it is needed |
|
||||
| --- | --- | --- |
|
||||
| Bento4 (`mp4decrypt`) | `mp4decrypt` | Alternative DRM decryptor to shaka-packager |
|
||||
| MP4Box (GPAC) | `MP4Box` | Muxing DTS:X Profile 2 (DTS-UHD) audio |
|
||||
| MP4Box (GPAC) | `MP4Box` | Muxing DTS:X Profile 2 (DTS-UHD) and MPEG-H audio |
|
||||
| dovi_tool | `dovi_tool` | Dolby Vision metadata handling |
|
||||
| HDR10Plus_tool | `hdr10plus_tool` | HDR10+ metadata handling |
|
||||
| SubtitleEdit | `seconv`, `SubtitleEdit` | Subtitle conversion (the `SeConv` CLI from 5.x) |
|
||||
@@ -280,8 +280,8 @@ download. For example, `dovi_tool` only matters if you download Dolby Vision vid
|
||||
| Docker | `docker` | Gluetun VPN proxy support |
|
||||
| Git | `git` | Fetching and updating remote service repositories |
|
||||
|
||||
!!! info "MP4Box is only used for DTS:X Profile 2"
|
||||
Titles with DTS:X Profile 2 (DTS-UHD) audio mux to MP4; everything else muxes to MKV
|
||||
!!! info "MP4Box is only used for DTS:X Profile 2 and MPEG-H"
|
||||
Titles with DTS:X Profile 2 (DTS-UHD) or MPEG-H audio mux to MP4; everything else muxes to MKV
|
||||
with `mkvmerge`. Install with `apt install gpac`.
|
||||
|
||||
!!! tip "SubtitleEdit specifics"
|
||||
|
||||
@@ -74,7 +74,7 @@ unshackle dl [OPTIONS] SERVICE [SERVICE ARGS...]
|
||||
| `-p`, `--profile` | - | Profile for credentials and cookies. |
|
||||
| `-q`, `--quality` | best | Resolution(s), comma-separated, e.g. `1080,720`. `-q 1080` also matches anamorphic tracks by 16:9 canvas. |
|
||||
| `-v`, `--vcodec` | any | Video codec(s). Accepts names or values: `AVC`/`H.264`/`H264`, `HEVC`/`H.265`/`H265`, `VC1`/`VC-1`, `VP8`, `VP9`, `AV1`. |
|
||||
| `-a`, `--acodec` | any | Audio codec(s), comma-separated. Accepts `AAC`, `AC3`/`DD`, `EC3`/`DD+`/`eac3`/`ddp`, `AC4`/`AC-4`, `OPUS`, `OGG`/`VORB`/`vorbis`, `DTS`, `DTSX`/`DTS-X`, `ALAC`, `FLAC`. |
|
||||
| `-a`, `--acodec` | any | Audio codec(s), comma-separated. Accepts `AAC`, `AC3`/`DD`, `EC3`/`DD+`/`eac3`/`ddp`, `AC4`/`AC-4`, `OPUS`, `OGG`/`VORB`/`vorbis`, `DTS`, `DTSX`/`DTS-X`, `ALAC`, `FLAC`, `MP3`. |
|
||||
| `-vb`, `--vbitrate` | highest | Exact video bitrate in kbps. |
|
||||
| `-ab`, `--abitrate` | highest | Exact audio bitrate in kbps. |
|
||||
| `-vb-range`, `--vbitrate-range` | - | Video bitrate range in kbps, e.g. `6000-7000`; picks highest within. Mutually exclusive with `--vbitrate`. |
|
||||
@@ -339,7 +339,7 @@ unshackle cfg [KEY] [VALUE] [OPTIONS]
|
||||
| `--list` | List all set configuration values. |
|
||||
|
||||
!!! warning "Comments are stripped"
|
||||
Writing a value through `cfg` rewrites the configuration file and **removes all comments** from it. If your config relies on comments, edit it by hand instead. Setting a value and using `--unset` together is an error.
|
||||
Writing a value through `cfg` rewrites the configuration file and **removes all comments** from it. If your config relies on comments, edit it by hand instead. Setting a value and using `--unset` together is an error. If a config key is set twice in the same block, every command warns with the line numbers of the two copies and uses the later copy. `cfg` stops without a change.
|
||||
|
||||
!!! example
|
||||
```shell
|
||||
@@ -429,6 +429,8 @@ unshackle kv COMMAND [ARGS]...
|
||||
|
||||
Copy content keys from one or more source vaults into a destination vault. unshackle skips rows whose KIDs match, unless the existing row has no content key. unshackle never alters or deletes existing data.
|
||||
|
||||
A vault argument is the name of a vault in the config, or the path to an SQLite vault file. Use a path to import a vault file that is not in the config.
|
||||
|
||||
| Option | Description |
|
||||
|---|---|
|
||||
| `-s`, `--service` | Only copy data for a specific service. |
|
||||
@@ -462,6 +464,7 @@ Make service tables on vaults that use tables, for every installed service, wher
|
||||
```shell
|
||||
unshackle kv copy main backup1 backup2
|
||||
unshackle kv copy main backup -s EXAMPLE
|
||||
unshackle kv copy main ~/Downloads/key_store.db -s EXAMPLE
|
||||
unshackle kv sync main mysql_vault
|
||||
unshackle kv add keys.txt EXAMPLE main backup
|
||||
unshackle kv search 0123456789abcdef0123456789abcdef -s EXAMPLE -v main
|
||||
|
||||
@@ -119,9 +119,13 @@ either enum **names** or their **values**, comma-separated.
|
||||
| `VP8` | `VP8` |
|
||||
| `VP9` | `VP9` |
|
||||
| `AV1` | `AV1` |
|
||||
| `LCEVC` | `LCEVC` |
|
||||
|
||||
`H264` and `H265` are aliases of `AVC` and `HEVC`.
|
||||
|
||||
An LCEVC (MPEG-5 Part 2) track only adds detail on top of its base video track and cannot play
|
||||
alone, so unshackle selects it only when you ask for it with `-v LCEVC`.
|
||||
|
||||
```shell title="Either spelling works"
|
||||
unshackle dl -v HEVC EXAMPLE 81234567
|
||||
unshackle dl -v H.265 EXAMPLE 81234567
|
||||
@@ -280,8 +284,11 @@ bitrate for the top renditions, overriding the manifest value:
|
||||
| `OGG` | `VORB` | Vorbis |
|
||||
| `DTS` | `DTS` | DTS |
|
||||
| `DTSX` | `DTS-X` | DTS:X Profile 2 (DTS-UHD) |
|
||||
| `DTSHD` | `DTS-HD` | DTS-HD High Resolution, Master Audio and Express |
|
||||
| `MPEGH` | `MPEG-H` | MPEG-H 3D Audio |
|
||||
| `ALAC` | `ALAC` | Apple Lossless |
|
||||
| `FLAC` | `FLAC` | FLAC |
|
||||
| `MP3` | `MP3` | MPEG-1 Audio Layer III |
|
||||
|
||||
unshackle accepts names, values, and a few aliases: `eac3` and `ddp` both give `EC3`,
|
||||
and `vorbis` gives `OGG`.
|
||||
|
||||
@@ -41,7 +41,7 @@ then decrypts the file with those keys.
|
||||
|
||||
## Supported DRM systems
|
||||
|
||||
unshackle implements five DRM systems. Only the first two need a device file and a
|
||||
unshackle implements six DRM systems. Only the first two need a device file and a
|
||||
license-server handshake. The rest are special cases.
|
||||
|
||||
| System | Device file | License flow | Decryption |
|
||||
@@ -51,6 +51,7 @@ license-server handshake. The rest are special cases.
|
||||
| **ClearKey (CENC)**, W3C EME `org.w3.clearkey` | none | JSON `{"kids":[...],"type":"temporary"}` → license server returns a JWK Set. No CDM. | shaka-packager / mp4decrypt |
|
||||
| **ClearKey (HLS)**, AES-128 `EXT-X-KEY` | none | Key fetched directly from a URI or `data:` URL. No CDM, no challenge. | in-process AES-CBC |
|
||||
| **MonaLisa** (proprietary, WASM) | `.mld` | Ticket from the service API; keys extracted locally via WASM. No license server. | ML-Worker binary + AES-ECB, per segment |
|
||||
| **Blowfish stripe** | none | The service gives the per-track key. No CDM, no license server. | in-process Blowfish-CBC on every third 2048-byte chunk |
|
||||
|
||||
!!! warning "Two different ClearKeys"
|
||||
"ClearKey (HLS)" and "ClearKey (CENC)" are entirely different systems that happen
|
||||
|
||||
@@ -15,7 +15,7 @@ When a download finishes, unshackle builds the final path from three pieces:
|
||||
- **Output directory**: `directories.downloads` from your config, or whatever you pass to `-o/--output` on the command line for a single run.
|
||||
- **Folder template**: an optional per-title subfolder. unshackle **always** puts TV episodes and songs in a folder. Movies only get one if you define a `movies` folder template, or a single-string `folder` template that applies to all title kinds (see [Folder templates](#folder-templates)).
|
||||
- **Filename template**: the `output_template` for the title kind (movie, series, or song).
|
||||
- **Extension**: chosen by the muxer for a movie or an episode: `.mkv` for video, `.mka` for audio-only, `.mks` for subtitle-only, `.mp4` for [DTS:X Profile 2 audio](#dtsx-profile-2-output). unshackle does not mux a song. It remuxes a song into the container of its codec, such as `.flac`, `.opus`, or `.m4a`. Read [Music output files](#music-output-files).
|
||||
- **Extension**: chosen by the muxer for a movie or an episode: `.mkv` for video, `.mka` for audio-only, `.mks` for subtitle-only, `.mp4` for [DTS:X Profile 2 and MPEG-H audio](#dtsx-profile-2-and-mpeg-h-output). unshackle does not mux a song. It remuxes a song into the container of its codec, such as `.flac`, `.opus`, or `.m4a`. Read [Music output files](#music-output-files).
|
||||
|
||||
!!! example "A typical episode path"
|
||||
```text
|
||||
@@ -163,9 +163,9 @@ For custom templates there is also a standalone [`{part}`](../reference/configur
|
||||
|
||||
| Variable | Meaning | Example |
|
||||
|---|---|---|
|
||||
| `audio` | Audio codec | `DDP`, `DD`, `AAC`, `DTS-X` |
|
||||
| `audio` | Audio codec; rename it with [`codec_names`](../reference/configuration/output.md#codec_names) | `DDP`, `DD`, `AAC`, `DTS-X` |
|
||||
| `audio_channels` | Channel layout; bed.LFE.heights when the track has height channels | `5.1`, `2.0`, `5.1.4` |
|
||||
| `audio_full` | Codec + channels combined | `DDP5.1`, `DTS-X.5.1.4` |
|
||||
| `audio_full` | Codec + channels combined; a name that ends in a digit gets a separator | `DDP5.1`, `DTS-X.5.1.4`, `AC-4.2.0` |
|
||||
| `atmos` | `Atmos` when any track carries JOC | `Atmos` |
|
||||
| `dual` | `DUAL` for two audio languages (see [`dual_multi_mode`](../reference/configuration/download.md#dual_multi_mode)) | `DUAL` |
|
||||
| `multi` | `MULTi` for more than two audio languages | `MULTi` |
|
||||
@@ -236,6 +236,7 @@ final path.
|
||||
| FLAC | `.flac` |
|
||||
| Opus | `.opus` |
|
||||
| Vorbis | `.ogg` |
|
||||
| MP3 | `.mp3` |
|
||||
| AAC, ALAC, and all other codecs | `.m4a` |
|
||||
|
||||
unshackle re-encodes FLAC in this step. The audio does not change, but the new file states its
|
||||
@@ -284,11 +285,104 @@ warning and continues.
|
||||
!!! note "Height channels"
|
||||
A track with height channels is named bed.LFE.heights, such as `5.1.4`.
|
||||
|
||||
### DTS:X Profile 2 output
|
||||
### Track names and language tags
|
||||
|
||||
A title whose audio holds a `dtsx` or `dtsy` sample entry (DTS:X Profile 2, DTS-UHD) muxes
|
||||
to MP4 with [MP4Box](../getting-started/installation.md), because Matroska has no CodecID
|
||||
for it. Without MP4Box installed the mux stops.
|
||||
When the service gives a track no name, unshackle names it with the English name of its language,
|
||||
such as `English`, `Portuguese (Portugal)` or `Spanish (Latin America)`. The name leaves out the
|
||||
region that is the default for the language, so `en-US` is `English` and `pt-BR` is `Portuguese`,
|
||||
but `en-GB` is `English (United Kingdom)`. A name from the service is kept as is. unshackle adds the SDH, CC, Forced or Descriptive label after either name.
|
||||
|
||||
A subtitle in a language with more than one script gets the script from its region:
|
||||
|
||||
| Service tag | Tag in the file | Track name |
|
||||
|-------------|-----------------|------------|
|
||||
| `zh-TW` | `zh-Hant-TW` | Chinese (Traditional) |
|
||||
| `zh-HK` | `zh-Hant-HK` | Chinese (Traditional, Hong Kong) |
|
||||
| `zh-CN` | `zh-Hans-CN` | Chinese (Simplified) |
|
||||
| `sr-ME` | `sr-Latn-ME` | Serbian (Latin, Montenegro) |
|
||||
| `zh` | `zh` | Chinese |
|
||||
|
||||
A tag without a region, such as `zh`, gets no script because the region is what tells the script.
|
||||
unshackle writes audio tags as the service gives them, because a script applies only to written text.
|
||||
Track selection, `--list` tags and file names use the service tag.
|
||||
|
||||
A service that knows the spoken language, such as Mandarin or Cantonese, gives the title language and
|
||||
the audio a region and no script, and gives the subtitles a script:
|
||||
|
||||
| Tracks | Mandarin, Taiwan | Cantonese, Hong Kong |
|
||||
|--------|------------------|----------------------|
|
||||
| Title language and audio | `cmn-TW` | `yue-HK` |
|
||||
| Subtitles | `zh-Hant` or `cmn-Hant` | `yue-Hant` |
|
||||
|
||||
With these tags, `-l orig` selects the audio and `-sl orig` selects the Traditional subtitles. Do not
|
||||
mix the forms. A bare `cmn` implies Simplified Chinese, so a `cmn` title language makes `-sl orig`
|
||||
select Simplified subtitles. A `zh-TW` title language with `cmn` audio selects no audio, because
|
||||
`zh-TW` implies Traditional Chinese. Cantonese and Chinese never match, so `-sl orig` on a `yue-HK`
|
||||
title does not select `zh-Hant` subtitles; select them with `-sl zh-Hant`.
|
||||
|
||||
The `{dual}`, `{multi}` and `{dubbed}` file name tags count `cmn` as `zh` and keep `yue` separate
|
||||
(see [`dual_multi_mode`](../reference/configuration/download.md#dual_multi_mode)).
|
||||
|
||||
Set `muxing.track_names` to `native` to name each track in its own language. The same rules apply
|
||||
to the script and the region:
|
||||
|
||||
```yaml title="unshackle.yaml"
|
||||
muxing:
|
||||
track_names: native
|
||||
```
|
||||
|
||||
| Service tag | Track name |
|
||||
|-------------|------------|
|
||||
| `zh-TW` subtitle | 中文(繁體) |
|
||||
| `zh-HK` subtitle | 中文(繁體,香港) |
|
||||
| `pt-PT` | Português (Portugal) |
|
||||
| `es-419` | Español (Latinoamérica) |
|
||||
| `ja-JP` | 日本語 |
|
||||
|
||||
Set `muxing.track_names` to `none` to leave a track unnamed when the service gives it no name. An
|
||||
SDH, CC, Forced or Descriptive track then has only that label as its name.
|
||||
|
||||
The option also changes the names in `--list` and in the `track_name` field of the REST API.
|
||||
|
||||
Set `muxing.original_label` to add a label after the name of each audio and subtitle track in the
|
||||
title's original language. unshackle also sets the Matroska original flag on these tracks, but some
|
||||
players show only the name. MP4 output has no original flag, so there the label is the only marker:
|
||||
|
||||
```yaml title="unshackle.yaml"
|
||||
muxing:
|
||||
original_label: "[Original]"
|
||||
```
|
||||
|
||||
| Track | Track name |
|
||||
|-------|------------|
|
||||
| Japanese audio, original language | Japanese [Original] |
|
||||
| Japanese SDH subtitle, original language | Japanese [Original] (SDH) |
|
||||
| Korean subtitle | Korean |
|
||||
|
||||
The label can be any text, for example `"| Original"` or a label in another language. Put it in
|
||||
quotes: YAML reads an unquoted `[Original]` as a list, and an unquoted `| Original` stops the config
|
||||
from loading. unshackle ignores a value that is not text.
|
||||
|
||||
The label also applies to a name that the service sets, and to audio that a service keeps inside the
|
||||
video file. unshackle does not add the label when the name already contains its words, so a service
|
||||
name `Original` or `Japanese (original)` stays as it is.
|
||||
|
||||
!!! tip "Use an English label with Jellyfin 12"
|
||||
Jellyfin 12 adds its own "Original" to an original-language audio track from the flag, unless the
|
||||
name already contains the word. It adds none to a subtitle. A label in another language, such as `[원어]`, then shows next to Jellyfin's
|
||||
"Original".
|
||||
|
||||
!!! note "Players that show the language next to the name"
|
||||
Some players, such as Jellyfin, show the track name and the language name together. They leave
|
||||
out the language when the name already contains it, so an English name shows once. A native name
|
||||
such as `日本語` shows next to `Japanese` in an English interface.
|
||||
|
||||
### DTS:X Profile 2 and MPEG-H output
|
||||
|
||||
A title whose audio holds a `dtsx` or `dtsy` sample entry (DTS:X Profile 2, DTS-UHD), or an
|
||||
MPEG-H sample entry (`mha1`, `mha2`, `mhm1`, `mhm2`), muxes to MP4 with
|
||||
[MP4Box](../getting-started/installation.md), because Matroska has no CodecID for it.
|
||||
Without MP4Box installed the mux stops.
|
||||
|
||||
DTS:X Profile 1 is DTS-HD Master Audio and muxes to MKV as usual.
|
||||
|
||||
|
||||
@@ -125,14 +125,18 @@ forwarder for it. See [Control D](#control-d).
|
||||
### Provider load order
|
||||
|
||||
When you do a download without `--no-proxy`, unshackle instantiates every configured
|
||||
proxy provider once, in this fixed order. It uses that same order for bare-query
|
||||
resolution:
|
||||
proxy provider once. It uses that same order for bare-query resolution:
|
||||
|
||||
**Basic → ExpressVPN → NordVPN → Proton VPN → Surfshark → Windscribe → Gluetun → Hola → Control D**
|
||||
1. Basic is always first, so your own proxies win.
|
||||
2. The other proxy providers follow in the order of their keys under `proxy_providers` in
|
||||
`unshackle.yaml`. Proxy providers that load without a config key, such as Hola, come
|
||||
after the listed ones in this default order:
|
||||
**ExpressVPN → NordVPN → Proton VPN → Surfshark → Windscribe → Gluetun → Hola**
|
||||
3. Control D is always last.
|
||||
|
||||
So if you have both Basic and NordVPN configured and use `--proxy us`, a `us` entry in
|
||||
your Basic config wins, because unshackle tries Basic first. To skip ahead to a specific
|
||||
proxy provider, prefix the query (`--proxy nordvpn:us`).
|
||||
So if you list `windscribevpn` above `nordvpn` and use `--proxy us`, a `us` entry in your
|
||||
Basic config answers first, then Windscribe. To skip ahead to a specific proxy provider,
|
||||
prefix the query (`--proxy nordvpn:us`).
|
||||
|
||||
If a proxy provider cannot load, for example because its server list cannot be fetched
|
||||
or its config is not valid, unshackle logs a warning and continues with the other proxy
|
||||
@@ -311,9 +315,17 @@ machine opens none, because the client opens the connection to the server. A NAT
|
||||
firewall, or a Cloudflare tunnel in front of the server does not stop it.
|
||||
|
||||
The service traffic stays encrypted from the server to the service, so the client relays only
|
||||
encrypted bytes. The client refuses to connect to `localhost`, and to a host name or IP address
|
||||
that resolves only to a loopback, private or link-local address, so the server cannot reach
|
||||
your local network.
|
||||
encrypted bytes. The client refuses to connect to `localhost`, and to a host name that resolves
|
||||
only to an address on your machine or local network: loopback, private, link-local, CGNAT
|
||||
(`100.64.0.0/10`) or multicast. An IP address that the server sends must also be public, and
|
||||
the client closes a connection that reaches one of its own addresses. Other devices on your
|
||||
network that have a public IPv6 address, and your router's public address, are not blocked.
|
||||
|
||||
Some VPN and proxy apps answer a host name with a synthetic address, for example fake-IP DNS in
|
||||
TUN mode (`198.18.0.0/15`), and map it back to the real host. The client accepts any such
|
||||
address for a host name, so `--local-proxy` works with these apps. The client cannot see the
|
||||
real address behind a synthetic one, so it cannot stop a host name that points into your local
|
||||
network.
|
||||
|
||||
!!! note "Each request crosses the tunnel twice"
|
||||
A request from the server goes to your machine and then to the service, so it takes
|
||||
@@ -555,8 +567,7 @@ in unshackle itself.
|
||||
|
||||
!!! warning "Docker is required"
|
||||
Gluetun needs a working [Docker](https://docs.docker.com/get-docker/) installation on
|
||||
your `PATH`. If Docker is not found, the proxy provider fails to load with an error linking
|
||||
to the install docs. The container also needs the `NET_ADMIN` capability and access
|
||||
your `PATH`. If Docker is not found, the proxy provider fails to load. The container also needs the `NET_ADMIN` capability and access
|
||||
to `/dev/net/tun` to bring up the tunnel. unshackle requests both automatically.
|
||||
|
||||
### Query format
|
||||
@@ -639,6 +650,7 @@ proxy_providers:
|
||||
- `surfshark`, `mullvad`, and `ivpn` also require `addresses`.
|
||||
- `windscribe` additionally requires **both** `addresses` and `preshared_key`
|
||||
(`preshared_key` may be an empty string, but the config key must be present).
|
||||
Get both from the [Windscribe WireGuard config generator](https://windscribe.com/getconfig/wireguard).
|
||||
- NordVPN and Proton VPN need only `private_key`.
|
||||
|
||||
=== "OpenVPN"
|
||||
@@ -1025,21 +1037,14 @@ The returned proxy is HTTPS on **port 443**.
|
||||
|
||||
## Developer notes
|
||||
|
||||
!!! note "Two resolution paths (developers)"
|
||||
unshackle has **two** proxy-resolution code paths that are intentionally not
|
||||
identical:
|
||||
|
||||
- `unshackle/commands/dl.py` inlines its own logic and loads **all nine** providers,
|
||||
including Windscribe and Gluetun.
|
||||
- `unshackle/core/proxies/resolve.py::initialize_proxy_providers()` is the shared
|
||||
resolver used by the REST API handlers and the remote-service client. It **omits**
|
||||
Windscribe and Gluetun.
|
||||
|
||||
Both paths accept the same query grammar (a direct URI, a `provider:query`, a bare
|
||||
country query tried against providers in order, or a `controld://` resolver), but the
|
||||
set of available providers differs. Keep this in mind when you add a proxy provider:
|
||||
an entry in `dl.py` does not make it available over the API, and the opposite is also
|
||||
true.
|
||||
!!! note "One resolution path (developers)"
|
||||
`dl`, `search`, the REST API handlers and the remote-service client all load proxy
|
||||
providers through `load_proxy_providers()` in `unshackle/core/proxies/resolve.py`.
|
||||
The REST API and the remote-service client call it through
|
||||
`initialize_proxy_providers()`, which leaves out Gluetun because Gluetun starts a
|
||||
local Docker container. All paths accept the same query grammar: a direct URI, a
|
||||
`provider:query`, a bare query tried against providers in order, or a `controld://`
|
||||
resolver.
|
||||
|
||||
The remote-service client resolves `--proxy` with its own
|
||||
`resolve_remote_proxy_arg()`. It changes a `controld:` query to a `controld://`
|
||||
|
||||
@@ -35,7 +35,10 @@ shown in track listings. The **Extension** column is the file extension used on
|
||||
`fTTML` (STPP) and `fVTT` (WVTT) are the fragmented, MP4-box-encapsulated forms that
|
||||
DASH and HLS deliver. You never keep these as-is: right after download they are
|
||||
unwrapped into their plain counterparts (`fTTML` becomes TTML and `fVTT` becomes
|
||||
WebVTT), so you always end up with an editable text subtitle. Note that this is a
|
||||
WebVTT), so you always end up with an editable text subtitle. For a DASH track, the
|
||||
unwrap also subtracts the manifest's `presentationTimeOffset` from the cue times, so the
|
||||
subtitles stay in sync with the video. For an ISM track whose cues count from the start of
|
||||
each fragment, the unwrap moves every cue onto the timeline of the track. Note that this is a
|
||||
one-way, source-only relationship: you can convert *from* these boxed formats, but no
|
||||
backend can write them as an output target, so they can never be a conversion
|
||||
destination.
|
||||
@@ -49,7 +52,7 @@ format-appropriate clean-up to make a single, valid file:
|
||||
`‎` / `‏` bidirectional entities.
|
||||
- **Segment merging**: when a WebVTT or boxed subtitle arrives as many DASH/HLS
|
||||
segments, unshackle merges the segments back into one continuous document with
|
||||
correct timing.
|
||||
correct timing. A cue that a segment boundary cuts in two comes out as one cue.
|
||||
- **WebVTT sanitization**: merged WebVTT runs through a repair pipeline that clamps
|
||||
negative timestamps to `00:00:00.000`, removes stray cue identifiers (like `Q0`, `Q1`)
|
||||
that confuse downstream parsers, and merges multi-line cues that a service split into
|
||||
|
||||
@@ -258,6 +258,11 @@ Each command reports how many files it removed and how much space it freed, then
|
||||
|
||||
**Inspect:** set `debug_requests: true` and operate unshackle with `-d` to show the underlying `urllib3` / `rnet` / `httpx` logs. In the JSON debug log, filter for `service_call` operations to see which request failed. If you use a proxy, also read [Proxies & VPN](proxies-and-vpn.md).
|
||||
|
||||
!!! example "A segment download fails after every retry"
|
||||
**Symptom:** the download stops with a line like `MaxRetriesError: GET <host> failed: RequestError (stream closed because of a broken pipe), gave up after 5 failed attempts over 30s`.
|
||||
|
||||
**Inspect:** the connection to the CDN host dropped on every attempt. This is almost always the network, the VPN, or the proxy, not the service. Run the download again: unshackle keeps the segments it already has. Over HTTP/2, all segments share one connection, so one drop fails every segment in flight. Set `network.http1_only: true` (see [Network & proxy](../reference/configuration/network.md)) to spread them over separate connections. Operate unshackle with `-d` to see each retry as a `segment_retry` entry in the JSON debug log.
|
||||
|
||||
!!! example "The wrong titles/metadata keep coming back"
|
||||
**Symptom:** a service returns outdated titles even after the source changed.
|
||||
|
||||
|
||||
+12
-2
@@ -34,11 +34,11 @@ unshackle pushes keys from every source, not only a local CDM. A run against a r
|
||||
|
||||
### Wrong keys from a poisoned vault
|
||||
|
||||
A public vault can return the right KID with a wrong content key. The decrypters accept a wrong content key and write noise. unshackle therefore trusts a content key from a vault only after FFmpeg decodes the decrypted track with strict error detection. For a fragmented MP4, unshackle reads from the encrypted file which fragments each KID encrypts, and FFmpeg decodes up to three windows of each KID: from its first, middle and last fragment on through the next fragments of that KID, for up to 4 seconds. A window never runs into a fragment of another KID or a clear fragment. A clear lead or a lead under another KID therefore cannot hide a wrong content key, and only the KID that fails is flagged. A KID that is not in this map, and every KID of any other file, gets one check of the whole file. FFmpeg decodes the first seconds and the last seconds. A failure there flags each of those KIDs. When a mapped KID fails, the KIDs that are not in the map get no verdict from that pass; the retry with the replaced key judges them. Content keys from a licence skip this check. A file this FFmpeg build cannot judge counts as a pass, never as a wrong content key: a codec it has no decoder for, or a header it cannot read. A pass is not proof. A wrong content key for HEVC video can decode without an error for some seconds, most often at a low resolution, and that content key passes the check. Without FFmpeg there is no check at all.
|
||||
A public vault can return the right KID with a wrong content key. The decrypters accept a wrong content key and write noise. unshackle therefore trusts a content key from a vault only after FFmpeg decodes the decrypted track with strict error detection. For a fragmented MP4, unshackle reads from the encrypted file which fragments each KID encrypts, and FFmpeg decodes up to three windows of each KID: from its first, middle and last fragment on through the next fragments of that KID, for up to 4 seconds. A window never runs into a fragment of another KID or a clear fragment. A clear lead or a lead under another KID therefore cannot hide a wrong content key, and only the KID that fails is flagged. When every KID in the map has a content key, the map is complete, and a KID that is not in it does not encrypt this file. This file does not judge that KID; the file of its own track judges it. A file with no encrypted sample entry and no encrypted fragment, for example a clear audio track, judges no KID, so it neither flags nor copies a content key. A KID that is not in an incomplete map, for example one with an all-zero KID, and every KID of any other file, gets one check of the whole file. FFmpeg decodes the first seconds and the last seconds. A failure there flags each of those KIDs. When a mapped KID fails, the KIDs that are not in the map get no verdict from that pass; the retry with the replaced key judges them. Content keys from a licence skip this check. A file this FFmpeg build cannot judge counts as a pass, never as a wrong content key: a codec it has no decoder for, or a header it cannot read. A pass is not proof. A wrong content key for HEVC video can decode without an error for some seconds, most often at a low resolution, and that content key passes the check. Without FFmpeg there is no check at all.
|
||||
|
||||
When the decode fails, unshackle:
|
||||
|
||||
1. Flags the KID:KEY in the `bad_keys` table of every local SQLite vault, with the service and the name of the vault it came from. The pair also goes out of the service table, except in a vault marked `no_push`, where only the flag is written. A flagged pair cannot go back into a local vault from another vault, a later run, or `kv copy`. A licence that returns the pair clears the flag and stores it. An `API` vault that served the pair also gets a report; `HTTP` and `MySQL` vaults have no report route. A pair from a local vault goes to no remote vault, even when a remote vault holds the same pair.
|
||||
1. Flags the KID:KEY in the `bad_keys` table of every local SQLite vault, with the service and the name of the vault it came from. The pair also goes out of the service table, except in a vault marked `no_push`, where only the flag is written. A flagged pair cannot go back into a local vault from another vault, a later run, or `kv copy`. A licence that returns the pair clears the flag and stores it. An `API` vault that served the pair gets a report only when a different content key for that KID is accepted. When the CDM returns the same content key, that vault gets no report. `HTTP` and `MySQL` vaults have no report route. A pair from a local vault goes to no remote vault, even when a remote vault holds the same pair.
|
||||
2. Restores the ciphertext from a hard link it made before decryption, then asks for the content key again. Every vault lookup skips a flagged pair, so the request reaches the remaining vaults and then the CDM. A remote answer that arrived after the winning one is reused instead of queried again.
|
||||
3. Removes the flag when the CDM returns the same content key, because then the decode check was wrong, not the content key. A content key from another vault is checked in its turn, and flagged as well if it also fails.
|
||||
|
||||
@@ -317,6 +317,16 @@ $ unshackle kv copy local shared community
|
||||
|
||||
`--service` and `--local-only` are mutually exclusive.
|
||||
|
||||
To import an SQLite vault file that is not in the config, give its path as the source:
|
||||
|
||||
```console
|
||||
$ unshackle kv copy local ~/Downloads/key_store.db -s EXAMPLE
|
||||
```
|
||||
|
||||
`kv copy` only reads from a source, so the file stays unchanged. `kv sync` also accepts a path, but it writes content keys into that file.
|
||||
|
||||
With `--service`, `kv copy` reads the table named by the service's vault tag and the table named by its plain tag. It writes both into the vault-tag table, which is the table a download reads. Without `--service`, each table keeps its name.
|
||||
|
||||
A pair the destination vault has flagged in `bad_keys` is left behind, so a copy does not undo a flag. `bad_keys` is never treated as a service, so its rows are never copied into a service table.
|
||||
|
||||
### `kv sync`: mirror vaults both ways
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ at a title and it will:
|
||||
| Manifests | DASH, HLS, and Smooth Streaming (ISM) |
|
||||
| DRM | Widevine and PlayReady, with ClearKey support |
|
||||
| Video | AVC, HEVC, VC-1, VP8, VP9, AV1; SDR, HLG, HDR10, HDR10+, Dolby Vision, and Dolby Vision **hybrid** merging |
|
||||
| Audio | AAC, AC-3, E-AC-3, AC-4, Opus, Vorbis, DTS, DTS-X, ALAC, FLAC; Dolby Atmos handling; per-channel-layout selection |
|
||||
| Audio | AAC, AC-3, E-AC-3, AC-4, Opus, Vorbis, DTS, DTS-X, ALAC, FLAC, MP3; Dolby Atmos handling; per-channel-layout selection |
|
||||
| Subtitles | SRT, WebVTT, ASS/SSA, TTML and more, with optional SDH stripping and format conversion |
|
||||
| Key vaults | SQLite, MySQL, and HTTP/API vaults to store and share content keys |
|
||||
| Proxies | Basic proxies plus Control D, NordVPN, ProtonVPN, Surfshark, Windscribe, ExpressVPN, Gluetun, and Hola providers |
|
||||
|
||||
@@ -63,7 +63,8 @@ directories:
|
||||
The **automatic** 24 h-TTL refresh that happens during a normal `dl`/`search` run
|
||||
**refuses to refresh and exits** (naming the offending clone) if that clone has
|
||||
uncommitted changes to tracked files or unpushed local commits. Untracked files (new
|
||||
service folders, `__pycache__`) never block it. The **manual**
|
||||
service folders, `__pycache__`), Python bytecode (`.pyc`, `.pyo`, also when the repo
|
||||
commits it) and `.DS_Store` never block it. The **manual**
|
||||
`unshackle util refresh-services` command instead **hard-resets** the clone to upstream,
|
||||
discarding any local edits.
|
||||
|
||||
|
||||
@@ -288,6 +288,8 @@ Matroska (MKV) muxing options.
|
||||
| `default_language` | dict | `{}` | Force which language is flagged *default* per track type, e.g. `{audio: en, subtitle: en}`. A tag with a region, such as `en-US`, matches only that variant. |
|
||||
| `merge_audio` | bool | `true` | Merge all audio into one file. `--split-audio` on the CLI flips this off. |
|
||||
| `merge_video` | bool | `false` | Merge video tracks that share height, range, and codec into one file, so only language varies inside a file. `--merge-video` on the CLI flips this on. |
|
||||
| `track_names` | str | `english` | The language of the name unshackle gives a track that the service left unnamed: `english` (`Chinese (Traditional)`), `native`, the name in the language itself (`中文(繁體)`), or `none`, which leaves the track unnamed. Read [Track names and language tags](../../guide/output-and-naming.md#track-names-and-language-tags). |
|
||||
| `original_label` | str | unset | Text that unshackle adds after the name of an audio or subtitle track in the title's original language, such as `[Original]`. Read [Track names and language tags](../../guide/output-and-naming.md#track-names-and-language-tags). |
|
||||
| `concurrency` | int | `4` | How many mkvmerge processes run at the same time when a title muxes more than one output file (one per video variant or audio codec). Each process uses one CPU core, so this shortens the mux step on an SSD. Set it to `1` on a hard disk, where parallel writes are slower. |
|
||||
|
||||
```yaml
|
||||
@@ -310,17 +312,18 @@ Language-tag remapping and the rule engine behind the `{lang_tag}` filename vari
|
||||
| Condition | Meaning |
|
||||
|-----------|---------|
|
||||
| `audio` | At least one audio language matches. |
|
||||
| `audio_contain_all` | Every listed language must be present in the audio. |
|
||||
| `subs_contain` | At least one subtitle language matches. |
|
||||
| `subs_contain_all` | Every listed language must be present. |
|
||||
| `subs_contain_all` | Every listed language must be present in the subtitles. |
|
||||
| `dual` / `multi` / `dubbed` | `true` matches when that filename variable is set, `false` when it is not. |
|
||||
|
||||
Each language condition takes one language tag or a list of them. A list matches when **any**
|
||||
entry matches, except `subs_contain_all`, which needs them all. An entry that is not a valid
|
||||
language tag (for example `japanese`) never matches. A tag with a region matches only that
|
||||
variant, so `audio: es-419` does not match `es-ES` audio. `dual`, `multi` and `dubbed` take a bare
|
||||
`true` or `false`, not a quoted string. unshackle skips a rule with a condition name it does
|
||||
not know, or with any other value in a boolean condition. It logs a warning in each of these
|
||||
cases and tries the next rule.
|
||||
entry matches, except `audio_contain_all` and `subs_contain_all`, which need them all. An empty
|
||||
list never matches. An entry that is not a valid language tag (for example `japanese`) never
|
||||
matches. A tag with a region matches only that variant, so `audio: es-419` does not match
|
||||
`es-ES` audio. `dual`, `multi` and `dubbed` take a bare `true` or `false`, not a quoted string.
|
||||
unshackle skips a rule with a condition name it does not know, or with any other value in a
|
||||
boolean condition. It logs a warning in each of these cases and tries the next rule.
|
||||
|
||||
`dual`, `multi` and `dubbed` carry the same meaning as the
|
||||
[filename variables of those names](#dual_multi_mode). Pair one with a language to name a
|
||||
@@ -341,6 +344,24 @@ language_tags:
|
||||
tag: "THAIDUAL"
|
||||
```
|
||||
|
||||
unshackle examines the rules in order, so put a rule that needs more languages before a rule that
|
||||
needs fewer. Here, a release with both French dubs gets `VF2`, not `VFQ`:
|
||||
|
||||
```yaml
|
||||
language_tags:
|
||||
rules:
|
||||
- audio_contain_all: [fr-FR, fr-CA]
|
||||
tag: "VF2"
|
||||
- audio: fr-CA
|
||||
tag: "VFQ"
|
||||
- audio: fr-FR
|
||||
tag: "VFF"
|
||||
```
|
||||
|
||||
!!! tip "Give regional tags in an `_all` list"
|
||||
A tag without a region also matches a regional track, so one `fr-CA` track satisfies both
|
||||
entries of `[fr, fr-CA]`. Use `[fr-FR, fr-CA]` to require two different tracks.
|
||||
|
||||
!!! note "Put `{lang_tag}` where you want the name"
|
||||
These rules fill `{lang_tag}`. To use your own name in place of the fixed text, keep
|
||||
`{lang_tag?}` in the template and leave out `{dual?}`, `{multi?}` and `{dubbed?}`.
|
||||
@@ -373,7 +394,10 @@ dual_multi_mode: strict
|
||||
|
||||
!!! note "Dialects count as one language"
|
||||
Regional variants of the same base language (e.g. `en-US` and `en-GB`) collapse to a single
|
||||
language in both modes, so they never trigger `{dual}` on their own.
|
||||
language in both modes, so they never trigger `{dual}` on their own. An individual language
|
||||
counts as its macrolanguage: `cmn` and `zh` are one language, and so are `arb` and `ar`.
|
||||
Norwegian `nb` (Bokmål) and `nn` (Nynorsk) count as `no`.
|
||||
Cantonese (`yue`) stays separate, so `cmn` and `yue` audio give `{dual}`.
|
||||
|
||||
## `hdr10plus_probe`
|
||||
|
||||
|
||||
@@ -17,8 +17,10 @@ Over `--remote`, an override also makes your device license the remote session,
|
||||
CDM. A per-service entry does the same when it names a device without a quality: a device name,
|
||||
a `widevine` or `playready` sub-entry, or a profile or `default` sub-entry. A per-service entry
|
||||
that selects only by quality, or only for a different profile, loads no device when the run
|
||||
starts. unshackle then shows a warning, and the server decides who licenses the remote session.
|
||||
With only the top-level `default` entry, the server CDM licenses when the API key has it. See
|
||||
starts. When `server_cdm` is unset, unshackle then shows a warning, and the server decides who
|
||||
licenses the remote session.
|
||||
With only the top-level `default` entry, the server CDM licenses when the API key has it. Set
|
||||
`server_cdm: true` on the server entry to keep a per-service entry for local runs only. See
|
||||
[`remote_services`](services.md#remote_services).
|
||||
|
||||
```yaml
|
||||
|
||||
@@ -32,7 +32,7 @@ Where the file lives, how unshackle discovers it, and how to edit it:
|
||||
| [Directories](directories.md) | `directories`, `filenames`, `services_repo_force` |
|
||||
| [Services & authentication](services.md) | `services`, `credentials`, `firefox_cookies`, `remote_services`, `serve` |
|
||||
| [Download & processing](download.md) | `dl`, `continue_downloads`, `merge_segments`, `subtitle`, `audio`, `muxing`, `language_tags`, `dual_multi_mode`, `generate_dv_mode`, `hdr10plus_probe` |
|
||||
| [Output & naming](output.md) | `output_template`, `tag`, `tag_rules`, `tag_group_name`, `tag_imdb_tmdb`, `chapter_fallback_name`, `unicode_filenames` |
|
||||
| [Output & naming](output.md) | `output_template`, `tag`, `tag_rules`, `codec_names`, `tag_group_name`, `tag_imdb_tmdb`, `chapter_fallback_name`, `unicode_filenames` |
|
||||
| [DRM & CDM](drm.md) | `cdm`, `remote_cdm`, `decryption` |
|
||||
| [Network & proxy](network.md) | `network`, `headers`, `proxy_providers` |
|
||||
| [Key vaults](vaults.md) | `key_vaults`, `vault_timeout` |
|
||||
|
||||
@@ -61,8 +61,11 @@ headers:
|
||||
- **Type:** `dict` · **Default:** `{}`
|
||||
|
||||
Proxy/VPN provider configuration. Each sub-key names a proxy provider, and unshackle passes its
|
||||
block straight to that provider's constructor. See [Proxies & VPN](../../guide/proxies-and-vpn.md)
|
||||
for the full proxy provider guide. Recognised proxy providers and their exit ports:
|
||||
block straight to that provider's constructor. A bare `--proxy` query tries Basic first, then
|
||||
the other proxy providers in the order of their sub-keys, and Control D last (see
|
||||
[Provider load order](../../guide/proxies-and-vpn.md#provider-load-order)). See
|
||||
[Proxies & VPN](../../guide/proxies-and-vpn.md) for the full proxy provider guide. Recognised proxy
|
||||
providers and their exit ports:
|
||||
|
||||
| Provider | Config key | Credentials | Proxy scheme/port |
|
||||
|----------|-----------|-------------|-------------------|
|
||||
|
||||
@@ -69,6 +69,35 @@ folder-kind keys.
|
||||
| `chapter_fallback_name` | str | `""` | Fallback template for chapter names, e.g. `"Chapter {i:02}"`. |
|
||||
| `unicode_filenames` | bool | `false` | Allow Unicode in filenames; when `false`, names are ASCII-sanitised. |
|
||||
|
||||
## `codec_names`
|
||||
|
||||
- **Type:** `dict` · **Default:** `{}`
|
||||
|
||||
Renames the codec and HDR names in the filename. Each map key is a name that unshackle writes by
|
||||
default, and its value is the name to write instead. The map applies to the `video`, `audio`,
|
||||
and `hdr` [template variables](../../guide/output-and-naming.md#template-variables), and so
|
||||
also to `audio_full`. A name that is not in the map stays as it is, and an empty value removes
|
||||
the name. You can also set `codec_names` for one service under `services`.
|
||||
|
||||
```yaml title="unshackle.yaml"
|
||||
codec_names:
|
||||
DDP: EAC3 # DDP5.1 -> EAC3.5.1
|
||||
DD: AC3 # DD5.1 -> AC3.5.1
|
||||
H.265: HEVC # H.265 -> HEVC
|
||||
HDR10P: HDR10+ # DV.HDR10P -> DV.HDR10+
|
||||
```
|
||||
|
||||
For `hdr`, unshackle renames each part of a Dolby Vision label separately, so `HDR10P` also
|
||||
changes `DV.HDR10P` to `DV.HDR10+`. When an audio name ends in a digit, `audio_full` puts a
|
||||
separator before the channels: `EAC3.5.1`, not `EAC35.1`.
|
||||
|
||||
The REST API fields `codec_display` and `range_display` use the same names and the same map.
|
||||
The `dl --export` file name does not use `codec_names`.
|
||||
|
||||
!!! note "`tag_rules` see the new names"
|
||||
unshackle evaluates [`tag_rules`](#tag_rules) after the rename. With the example above, a
|
||||
rule must match `audio: EAC3`, not `audio: DDP`.
|
||||
|
||||
## `tag_rules`
|
||||
|
||||
- **Type:** `list` · **Default:** `[]`
|
||||
|
||||
@@ -89,16 +89,35 @@ Definitions of remote unshackle service servers, used by the `--remote` mode. Ea
|
||||
named by you (pick it with `--server`, or do not write that flag when you configure only one) and gives
|
||||
the server's `url` (required), an optional `api_key`, an optional `auth_headers` list, an
|
||||
optional `server_cdm` boolean, an optional `timeout` in seconds, and an optional `services` sub-dict of per-service local
|
||||
overrides such as `title_map`.
|
||||
overrides such as `title_map`, keyed by service tag in any case. A `server_cdm` in a `services` entry replaces the `server_cdm` of
|
||||
the server entry for that service.
|
||||
|
||||
Leave `server_cdm` unset and the client follows the server: it uses the server CDM for each
|
||||
service the API key has it on, and the local CDM for the others. `true` asks for the server CDM
|
||||
and falls back to the local CDM when the server refuses; `false` always uses the local CDM.
|
||||
`dl --cdm <name>` on a remote run has the same effect as `false` for that run: the device you
|
||||
name licenses the remote session. A [`cdm`](drm.md#cdm) entry for the service has the same
|
||||
effect for that service when it names the device that unshackle loaded. Both take priority over
|
||||
`server_cdm: true`. Remove the entry to use the server CDM for that service. The `default`
|
||||
entry does not count.
|
||||
name licenses the remote session, and it takes priority over `server_cdm: true`. When
|
||||
`server_cdm` is unset, a [`cdm`](drm.md#cdm) entry for the service has the same effect for that
|
||||
service when it names the device that unshackle loaded. The `default` entry does not count.
|
||||
With `server_cdm: true`, the server CDM licenses the remote session, and the device of the entry
|
||||
licenses only when the server refuses. Thus the entry applies to local runs and the server CDM
|
||||
applies to remote runs:
|
||||
|
||||
```yaml
|
||||
cdm:
|
||||
EXAMPLE1: my_device # local runs of EXAMPLE1
|
||||
|
||||
remote_services:
|
||||
my_server:
|
||||
url: https://example.com
|
||||
server_cdm: true # remote runs of EXAMPLE1 use the server CDM
|
||||
services:
|
||||
EXAMPLE2:
|
||||
server_cdm: false # remote runs of EXAMPLE2 use your own device
|
||||
```
|
||||
|
||||
When the server refuses the server CDM for a service whose `cdm` entry loaded the device,
|
||||
unshackle logs the fallback to that device as info, not as a warning.
|
||||
|
||||
The server has the last word. When it keeps the server CDM for a remote session that your
|
||||
device was to license, unshackle shows a warning. This occurs with a server that does not read
|
||||
@@ -180,8 +199,8 @@ an API key without `server_cdm` for that service also cannot submit or retry `/a
|
||||
jobs. Keys that have no `users` entry, such as `api_secret`, keep server CDM access.
|
||||
|
||||
A remote client that picks its own device licenses the remote session with that device. It picks
|
||||
with `dl --cdm`, with a `cdm` entry for the service, or with `server_cdm: false` in its
|
||||
`remote_services` entry. The server CDM makes no licence for that remote session, with or without
|
||||
with `dl --cdm`, with `server_cdm: false` in its `remote_services` entry or in the `services`
|
||||
entry for the service, or with a `cdm` entry for the service when `server_cdm` is unset. The server CDM makes no licence for that remote session, with or without
|
||||
a limit. A service option that runs the remote session on the server's device, such as a
|
||||
server-identity flag, keeps the server CDM.
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ dev = [
|
||||
"types-requests>=2.31.0.20240406,<3",
|
||||
"isort>=5.13.2,<8",
|
||||
"ruff>=0.15.12,<0.16",
|
||||
"types-pyyaml>=6.0,<7",
|
||||
]
|
||||
test = [
|
||||
"pytest>=8.3.0,<9",
|
||||
@@ -160,6 +161,7 @@ line_length = 118
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
explicit_package_bases = true
|
||||
exclude = ["^unshackle/services/_repos/"]
|
||||
disallow_untyped_defs = true
|
||||
follow_imports = "silent"
|
||||
ignore_missing_imports = true
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
"""Download public DASH, HLS and ISM test manifests into tests/fixtures/manifests.
|
||||
|
||||
Sources: the DASH-IF test vector database (with the stream counts and codecs it expects),
|
||||
the example MPDs of the MPEG DASH spec (ISO/IEC 23009-1), the yt-dlp test data, and the
|
||||
stream lists of the dash.js reference player, the Shaka Player demo and the hls.js tests.
|
||||
Only the manifest text is stored; index.json maps each file to its source URL, which the
|
||||
parser needs to resolve relative URLs. A manifest that fails to download keeps its previous
|
||||
copy. An HLS media playlist is left out, since HLS parses only multivariant playlists.
|
||||
Run again to refresh: uv run python scripts/fetch_manifest_corpus.py
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
import time
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from pathlib import Path
|
||||
from typing import Any, Optional
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import requests
|
||||
|
||||
DASHIF_VECTORS = (
|
||||
"https://raw.githubusercontent.com/Dash-Industry-Forum/Test-Assets-Dataset-Public/master/"
|
||||
"dataset/data/testvector.json"
|
||||
)
|
||||
MPEG_EXAMPLES = "https://api.github.com/repos/MPEGGroup/DASHSchema/git/trees/6th-Ed"
|
||||
MPEG_RAW = "https://raw.githubusercontent.com/MPEGGroup/DASHSchema/6th-Ed/"
|
||||
DASHJS_SOURCES = (
|
||||
"https://raw.githubusercontent.com/Dash-Industry-Forum/dash.js/development/"
|
||||
"samples/dash-if-reference-player/app/data/sources.json"
|
||||
)
|
||||
YTDLP_TESTDATA = "https://api.github.com/repos/yt-dlp/yt-dlp/contents/test/testdata/"
|
||||
HLSJS_STREAMS = "https://raw.githubusercontent.com/video-dev/hls.js/master/tests/test-streams.js"
|
||||
SHAKA_ASSETS = "https://raw.githubusercontent.com/shaka-project/shaka-player/main/demo/common/assets.js"
|
||||
OUT = Path(__file__).resolve().parent.parent / "tests" / "fixtures" / "manifests"
|
||||
MAX_BYTES = 500_000
|
||||
DEADLINE = 60
|
||||
EXTENSIONS = {"dash": "mpd", "hls": "m3u8", "ism": "ism.xml"}
|
||||
|
||||
# url -> reason; manifests the parsers do not support yet, left out until a live service needs them
|
||||
EXCLUDED: dict[str, str] = {
|
||||
"https://playertest.longtailvideo.com/adaptive/vod-with-mp3/manifest.m3u8": "the same variant listed twice gives a duplicate track ID",
|
||||
"https://raw.githubusercontent.com/MPEGGroup/DASHSchema/6th-Ed/example_G29-2.mpd": "spec example fragment with no playable Representation",
|
||||
"https://raw.githubusercontent.com/MPEGGroup/DASHSchema/6th-Ed/example_K6.4.mpd": "spec example fragment with no playable Representation",
|
||||
"https://raw.githubusercontent.com/MPEGGroup/DASHSchema/6th-Ed/example_G4.mpd": "two Representations share an id inside one Period",
|
||||
"https://raw.githubusercontent.com/MPEGGroup/DASHSchema/6th-Ed/example_G8.mpd": "Representations with no codecs attribute",
|
||||
"https://raw.githubusercontent.com/MPEGGroup/DASHSchema/6th-Ed/example_H3.mpd": "metadata Representation with no mimeType or contentType",
|
||||
"https://storage.googleapis.com/shaka-demo-assets/heliocentrism-xlink/heliocentrism.mpd": "xlink:href remote Periods are not resolved",
|
||||
}
|
||||
|
||||
Stream = tuple[str, str, str, Optional[dict[str, Any]]]
|
||||
|
||||
|
||||
def dashif_streams() -> list[Stream]:
|
||||
"""Return the DASH-IF test vectors; a static one-Period vector also carries what it should parse to.
|
||||
|
||||
The vector's max_num_video and max_num_audio count the Representations of its largest AdaptationSet.
|
||||
"""
|
||||
streams: list[Stream] = []
|
||||
for vector in requests.get(DASHIF_VECTORS, timeout=30).json():
|
||||
if not vector.get("url"):
|
||||
continue
|
||||
expect = None
|
||||
if vector.get("mpd_type") == "static" and vector.get("num_periods") == 1:
|
||||
expect = {k: vector.get(k) for k in ("max_num_video", "max_num_audio", "video_codec", "audio_codec")}
|
||||
# the vector names are only "Test Vector N", the URL path says what the vector covers
|
||||
name = "/".join(urlparse(vector["url"]).path.split("/")[-3:]).removesuffix(".mpd")
|
||||
streams.append(("dashif", name, vector["url"], expect))
|
||||
return streams
|
||||
|
||||
|
||||
def mpeg_streams() -> list[Stream]:
|
||||
"""Return the example MPDs that ship with the MPEG DASH schema."""
|
||||
tree = requests.get(MPEG_EXAMPLES, timeout=30).json()["tree"]
|
||||
return [
|
||||
("mpeg", item["path"].removesuffix(".mpd"), MPEG_RAW + item["path"], None)
|
||||
for item in tree
|
||||
if re.fullmatch(r"example_.+\.mpd", item["path"])
|
||||
]
|
||||
|
||||
|
||||
def ytdlp_streams() -> list[Stream]:
|
||||
"""Return the manifests yt-dlp keeps as parser test data."""
|
||||
return [
|
||||
("ytdlp", f"{folder}/{item['name']}", item["download_url"], None)
|
||||
for folder in ("mpd", "m3u8", "ism")
|
||||
for item in requests.get(YTDLP_TESTDATA + folder, timeout=30).json()
|
||||
]
|
||||
|
||||
|
||||
def hlsjs_streams() -> list[Stream]:
|
||||
"""Return every URL in the hls.js test stream list, named by the key of its entry."""
|
||||
text = requests.get(HLSJS_STREAMS, timeout=30).text
|
||||
streams: list[Stream] = []
|
||||
for match in re.finditer(r"'(https?://[^']+)'", text):
|
||||
keys = re.findall(r"^ (\w+): ", text[: match.start()], re.M)
|
||||
streams.append(("hlsjs", keys[-1] if keys else "stream", match.group(1), None))
|
||||
return streams
|
||||
|
||||
|
||||
def dashjs_streams() -> list[Stream]:
|
||||
data = requests.get(DASHJS_SOURCES, timeout=30).json()
|
||||
return [
|
||||
("dashjs", f"{group['name']}/{item['name']}", item["url"], None)
|
||||
for group in data["items"]
|
||||
for item in group["submenu"]
|
||||
if item.get("url")
|
||||
]
|
||||
|
||||
|
||||
def shaka_streams() -> list[Stream]:
|
||||
text = requests.get(SHAKA_ASSETS, timeout=30).text
|
||||
pattern = re.compile(r"/\* name= \*/\s*'((?:[^'\\]|\\.)*)'.*?/\* manifestUri= \*/\s*'([^']+)'", re.S)
|
||||
return [("shaka", name.replace("\\'", "'"), url, None) for name, url in pattern.findall(text)]
|
||||
|
||||
|
||||
def kind_of(head: bytes) -> Optional[str]:
|
||||
"""Tell the manifest type from the first bytes, since many manifest URLs have no telling extension."""
|
||||
text = head.lstrip(b"\xef\xbb\xbf").lstrip()
|
||||
if text.startswith(b"#EXTM3U"):
|
||||
return "hls"
|
||||
if re.search(rb"<MPD[\s>]", text):
|
||||
return "dash"
|
||||
if re.search(rb"<SmoothStreamingMedia[\s>]", text):
|
||||
return "ism"
|
||||
return None
|
||||
|
||||
|
||||
def file_name(source: str, name: str, url: str, kind: str) -> str:
|
||||
slug = re.sub(r"[^a-z0-9]+", "-", name.lower())[:60].strip("-")
|
||||
return f"{kind}/{source}-{slug}-{hashlib.sha1(url.encode()).hexdigest()[:8]}.{EXTENSIONS[kind]}"
|
||||
|
||||
|
||||
def fetch(stream: Stream) -> Optional[dict[str, Any]]:
|
||||
"""Download one manifest into OUT and return its index entry, or None when it is not a manifest."""
|
||||
source, name, url, expect = stream
|
||||
try:
|
||||
with requests.get(url, timeout=20, stream=True) as res:
|
||||
res.raise_for_status()
|
||||
deadline = time.monotonic() + DEADLINE
|
||||
body = b""
|
||||
for chunk in res.iter_content(65536):
|
||||
body += chunk
|
||||
if len(body) >= 4096 and not kind_of(body[:4096]):
|
||||
return None
|
||||
if len(body) > MAX_BYTES or time.monotonic() > deadline:
|
||||
print(f"skip {url}: over {MAX_BYTES} bytes or {DEADLINE}s")
|
||||
return None
|
||||
final_url = res.url
|
||||
except requests.RequestException as e:
|
||||
print(f"skip {url}: {e}")
|
||||
return None
|
||||
kind = kind_of(body)
|
||||
if not kind or (kind == "hls" and b"#EXT-X-STREAM-INF" not in body):
|
||||
return None
|
||||
file = file_name(source, name, url, kind)
|
||||
(OUT / file).write_bytes(body)
|
||||
# a redirect moves the base that relative segment URLs resolve against
|
||||
entry: dict[str, Any] = {"file": file, "kind": kind, "source": source, "name": name, "url": final_url}
|
||||
if expect and kind == "dash":
|
||||
entry["expect"] = expect
|
||||
return entry
|
||||
|
||||
|
||||
def main() -> None:
|
||||
streams: dict[str, Stream] = {}
|
||||
lists = dashif_streams() + mpeg_streams() + ytdlp_streams() + dashjs_streams() + shaka_streams() + hlsjs_streams()
|
||||
for source, name, url, expect in lists:
|
||||
url = f"https:{url}" if url.startswith("//") else url
|
||||
if url not in EXCLUDED:
|
||||
streams.setdefault(url, (source, name, url, expect))
|
||||
|
||||
index_path = OUT / "index.json"
|
||||
old = (
|
||||
{(e["source"], e["name"]): e for e in json.loads(index_path.read_text("utf-8"))} if index_path.exists() else {}
|
||||
)
|
||||
for kind in EXTENSIONS:
|
||||
(OUT / kind).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with ThreadPoolExecutor(16) as pool:
|
||||
results = list(pool.map(fetch, streams.values()))
|
||||
index = [entry for entry in results if entry]
|
||||
missing = {(source, name) for source, name, _, _ in streams.values()} - {(e["source"], e["name"]) for e in index}
|
||||
kept = [e for key, e in old.items() if key in missing and (OUT / e["file"]).exists()]
|
||||
index += kept
|
||||
|
||||
keep = {e["file"] for e in index}
|
||||
for kind in EXTENSIONS:
|
||||
for path in (OUT / kind).iterdir():
|
||||
if f"{kind}/{path.name}" not in keep:
|
||||
path.unlink()
|
||||
index.sort(key=lambda entry: entry["file"])
|
||||
index_path.write_text(json.dumps(index, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
|
||||
print(f"{len(index) - len(kept)} manifests fetched, {len(kept)} kept from the last run, saved to {OUT}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -34,7 +34,7 @@ STREAMS: list[tuple[str, str]] = [
|
||||
("sony-1a", "https://dash.akamaized.net/dash264/TestCases/1a/sony/SNE_DASH_SD_CASE1A_REVISED.mpd"),
|
||||
]
|
||||
|
||||
guard_results: list[bool] = []
|
||||
guard_results: list[Optional[tuple[int, int]]] = []
|
||||
|
||||
|
||||
def install_guard_spy() -> bool:
|
||||
@@ -43,7 +43,7 @@ def install_guard_spy() -> bool:
|
||||
if orig is None:
|
||||
return False
|
||||
|
||||
def spy(is_subtitle: bool, segments: Any, init_len: Optional[int]) -> bool:
|
||||
def spy(is_subtitle: bool, segments: Any, init_len: int) -> Optional[tuple[int, int]]:
|
||||
result = orig(is_subtitle, segments, init_len)
|
||||
guard_results.append(result)
|
||||
return result
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from click.testing import CliRunner
|
||||
|
||||
from unshackle.commands import cfg as cfg_module
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def config_file(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
|
||||
path = tmp_path / "unshackle.yaml"
|
||||
monkeypatch.setattr(cfg_module, "get_config_path", lambda: path)
|
||||
return path
|
||||
|
||||
|
||||
def test_a_duplicate_key_logs_its_lines_once_and_names_no_key_or_value(
|
||||
config_file: Path, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
config_file.write_text(
|
||||
"theme: rainbow\ncredentials:\n EXAMPLE: first-secret\n OTHER: other\n EXAMPLE: second-secret\n"
|
||||
"serve:\n users:\n key-secret: {tier: a}\n key-secret: {tier: b}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
with caplog.at_level(logging.WARNING, logger="config"):
|
||||
result = CliRunner().invoke(cfg_module.cfg, ["theme"])
|
||||
CliRunner().invoke(cfg_module.cfg, ["theme"])
|
||||
assert isinstance(result.exception, SystemExit), result.exception
|
||||
assert result.exit_code == 1
|
||||
assert caplog.messages == [
|
||||
f"{config_file}: duplicate key on lines 3 and 5, lines 8 and 9. Unshackle uses the later one."
|
||||
]
|
||||
assert "Error" not in result.output and "lines" not in result.output
|
||||
for output in (result.output, caplog.text):
|
||||
assert "secret" not in output and "EXAMPLE" not in output
|
||||
|
||||
|
||||
def test_a_duplicate_key_blocks_a_write(config_file: Path) -> None:
|
||||
original = "theme: rainbow\ncredentials:\n EXAMPLE: a\n EXAMPLE: b\n"
|
||||
config_file.write_text(original, encoding="utf-8")
|
||||
result = CliRunner().invoke(cfg_module.cfg, ["theme", "plain"])
|
||||
assert result.exit_code == 1
|
||||
assert config_file.read_text(encoding="utf-8") == original
|
||||
|
||||
|
||||
def test_a_valid_config_still_reads_a_key(config_file: Path) -> None:
|
||||
config_file.write_text("theme: rainbow\n", encoding="utf-8")
|
||||
result = CliRunner().invoke(cfg_module.cfg, ["theme"])
|
||||
assert result.exit_code == 0, result.output
|
||||
assert "rainbow" in result.output
|
||||
|
||||
|
||||
def test_a_duplicate_only_ruamel_sees_still_gives_its_line(config_file: Path, caplog: pytest.LogCaptureFixture) -> None:
|
||||
config_file.write_text("a: 1\n1: x\n0x1: y\n", encoding="utf-8")
|
||||
with caplog.at_level(logging.WARNING):
|
||||
result = CliRunner().invoke(cfg_module.cfg, ["a"])
|
||||
assert result.exit_code == 1
|
||||
assert caplog.messages == [f"{config_file}: duplicate key on line 3. Unshackle uses the later one."]
|
||||
@@ -0,0 +1,38 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from click.testing import CliRunner
|
||||
|
||||
from unshackle.commands import kv as kv_module
|
||||
from unshackle.vaults.SQLite import SQLite
|
||||
|
||||
KID = "0" * 31 + "1"
|
||||
KEY = "a" * 32
|
||||
|
||||
|
||||
def test_kv_copy_moves_a_plain_tag_table_from_a_file_into_the_vault_tag_table(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
source = tmp_path / "key_store.db"
|
||||
SQLite("seed", source).add_key("TESTSVC", KID, KEY)
|
||||
dest = tmp_path / "local.db"
|
||||
monkeypatch.setattr(kv_module.config, "key_vaults", [{"type": "SQLite", "name": "local", "path": str(dest)}])
|
||||
monkeypatch.setattr(kv_module.Services, "get_vault_tag", lambda name: "Shared" if name == "TESTSVC" else name)
|
||||
|
||||
result = CliRunner().invoke(kv_module.kv, ["copy", "local", str(source), "-s", "TESTSVC"])
|
||||
|
||||
assert result.exit_code == 0, result.output
|
||||
check = SQLite("check", dest)
|
||||
assert check.get_key(KID, "Shared") == KEY
|
||||
assert check.get_key(KID, "TESTSVC") is None
|
||||
|
||||
|
||||
def test_kv_copy_rejects_a_name_that_is_neither_configured_nor_a_file(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(kv_module.config, "key_vaults", [])
|
||||
|
||||
result = CliRunner().invoke(kv_module.kv, ["copy", "local", "nowhere.db"])
|
||||
|
||||
assert result.exit_code != 0
|
||||
assert "not defined in the config" in result.output
|
||||
+40
-4
@@ -4,10 +4,13 @@ from __future__ import annotations
|
||||
|
||||
import socket
|
||||
import socketserver
|
||||
from typing import Any
|
||||
from pathlib import Path
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
import pytest
|
||||
|
||||
from unshackle.core import binaries
|
||||
from unshackle.core.config import config
|
||||
from unshackle.core.update_checker import UpdateChecker
|
||||
|
||||
# shutdown() blocks until the serve loop polls again, and the 0.5s default is paid by every
|
||||
@@ -34,7 +37,40 @@ def loopback_only(request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatc
|
||||
def no_update_check(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Keep the release lookup of the health route off the network."""
|
||||
|
||||
async def no_release(*args: Any, **kwargs: Any) -> None:
|
||||
return None
|
||||
monkeypatch.setattr(UpdateChecker, "check_for_updates_sync", lambda *args, **kwargs: None)
|
||||
|
||||
monkeypatch.setattr(UpdateChecker, "check_for_updates", no_release)
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def default_muxing(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Mux with the default options, whatever the muxing block of the local unshackle.yaml sets."""
|
||||
monkeypatch.setattr(config, "muxing", {})
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def default_codec_names(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Name codecs with the built-in labels, whatever codec_names the local unshackle.yaml sets."""
|
||||
monkeypatch.setattr(config, "codec_names", {})
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mux_args(monkeypatch: pytest.MonkeyPatch) -> Callable[..., list[str]]:
|
||||
"""Run Tracks.mux up to mkvmerge and return its arguments; ``ids`` is what the track ID probe reports."""
|
||||
|
||||
class Stop(Exception):
|
||||
pass
|
||||
|
||||
def run(tracks: Any, ids: Optional[dict[str, int]] = None, **kwargs: Any) -> list[str]:
|
||||
captured: list[list[str]] = []
|
||||
|
||||
def fake_popen(args: list[str], **_: object) -> None:
|
||||
captured.append(args)
|
||||
raise Stop
|
||||
|
||||
monkeypatch.setattr("unshackle.core.tracks.tracks.subprocess.Popen", fake_popen)
|
||||
monkeypatch.setattr("unshackle.core.tracks.tracks.file_track_ids", lambda path: ids or {"video": 0})
|
||||
monkeypatch.setattr(binaries, "MKVToolNix", Path("mkvmerge"))
|
||||
with pytest.raises(Stop):
|
||||
tracks.mux("Title", delete=False, **kwargs)
|
||||
return captured[0]
|
||||
|
||||
return run
|
||||
|
||||
@@ -6,6 +6,7 @@ import types
|
||||
|
||||
import pytest
|
||||
|
||||
from unshackle.core.config import config
|
||||
from unshackle.core.titles.movie import Movie
|
||||
|
||||
|
||||
@@ -51,3 +52,42 @@ def test_a_height_layout_is_named_bed_lfe_heights() -> None:
|
||||
)
|
||||
def test_layouts_without_heights_are_unchanged(layout: str | None, expected: str) -> None:
|
||||
assert named("E-AC-3", layout)["audio_channels"] == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("fmt", "expected"),
|
||||
[("E-AC-3", "DDP5.1"), ("AC-3", "DD5.1"), ("AC-4", "AC-4 5.1"), ("AAC", "AAC5.1")],
|
||||
)
|
||||
def test_a_name_ending_in_a_digit_is_spaced_from_the_channels(fmt: str, expected: str) -> None:
|
||||
assert named(fmt, "L R C LFE Ls Rs")["audio_full"] == expected
|
||||
|
||||
|
||||
def test_codec_names_overrides_the_built_in_name(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""The override is keyed by the name the filename would carry, and AC3 still gets its separator."""
|
||||
monkeypatch.setattr(config, "codec_names", {"DDP": "EAC3", "DD": "AC3"})
|
||||
assert named("E-AC-3", "L R C LFE Ls Rs")["audio_full"] == "EAC3 5.1"
|
||||
assert named("AC-3", "L R C LFE Ls Rs")["audio"] == "AC3"
|
||||
|
||||
|
||||
def test_codec_names_renames_video_and_each_hdr_part(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(config, "codec_names", {"H.265": "HEVC", "HDR10P": "HDR10+", "DTS-X": "DTSX"})
|
||||
video = types.SimpleNamespace(
|
||||
width=3840,
|
||||
height=2160,
|
||||
format="HEVC",
|
||||
scan_type="Progressive",
|
||||
other_display_aspect_ratio=["16:9"],
|
||||
hdr_format_commercial="HDR10+",
|
||||
hdr_format="Dolby Vision, Version 1.0, Profile 8.1",
|
||||
transfer_characteristics=None,
|
||||
transfer_characteristics_original=None,
|
||||
frame_rate="23.976",
|
||||
)
|
||||
movie = Movie(id_="movie-0001", service=DummyService, name="The Film", year=2024, language="en")
|
||||
context = movie.build_base_template_context(types.SimpleNamespace(video_tracks=[video], audio_tracks=[]))
|
||||
assert (context["video"], context["hdr"]) == ("HEVC", "DV.HDR10+")
|
||||
assert named("DTS-UHD", "L C R LFE Ls Rs")["audio_full"] == "DTSX 5.1", "a renamed DTS-X keeps its separator"
|
||||
|
||||
|
||||
def test_a_missing_audio_format_does_not_break_naming() -> None:
|
||||
assert named(None, "L R", channel_s=2)["audio_full"] == "2.0" # type: ignore[arg-type]
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
"""Tests for the Blowfish CBC stripe cipher (``unshackle.core.drm.blowfish_stripe``)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from collections.abc import Iterator
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
from Cryptodome.Cipher import Blowfish
|
||||
|
||||
from unshackle.core.api.handlers import serialize_audio_track, serialize_drm
|
||||
from unshackle.core.config import config
|
||||
from unshackle.core.constants import DOWNLOAD_CANCELLED
|
||||
from unshackle.core.drm import BlowfishStripe
|
||||
from unshackle.core.remote_service import build_tracks, reconstruct_drm
|
||||
from unshackle.core.tracks import Audio, Track
|
||||
from unshackle.core.tracks import track as track_module
|
||||
|
||||
KEY = bytes.fromhex("00112233445566778899aabbccddeeff")
|
||||
CHUNK = BlowfishStripe.CHUNK
|
||||
|
||||
|
||||
def stripe_encrypt(data: bytes, key: bytes = KEY) -> bytes:
|
||||
"""Reference encryption: every third full chunk, each with a fresh CBC run."""
|
||||
out = bytearray(data)
|
||||
for offset in range(0, len(data), CHUNK * 3):
|
||||
chunk = data[offset : offset + CHUNK]
|
||||
if len(chunk) == CHUNK:
|
||||
out[offset : offset + CHUNK] = Blowfish.new(key, Blowfish.MODE_CBC, iv=BlowfishStripe.IV).encrypt(chunk)
|
||||
return bytes(out)
|
||||
|
||||
|
||||
def test_decrypt_round_trip(tmp_path: Path) -> None:
|
||||
plain = os.urandom(CHUNK * 10 + 123)
|
||||
path = tmp_path / "track.flac"
|
||||
path.write_bytes(stripe_encrypt(plain))
|
||||
assert path.read_bytes() != plain
|
||||
|
||||
BlowfishStripe(KEY).decrypt(path)
|
||||
|
||||
assert path.read_bytes() == plain
|
||||
assert list(tmp_path.iterdir()) == [path]
|
||||
|
||||
|
||||
def test_short_trailing_chunk_untouched(tmp_path: Path) -> None:
|
||||
# the last stripe starts at CHUNK * 3 and holds only 100 bytes, so it stays clear
|
||||
plain = os.urandom(CHUNK * 3 + 100)
|
||||
encrypted = stripe_encrypt(plain)
|
||||
assert encrypted[CHUNK * 3 :] == plain[CHUNK * 3 :]
|
||||
path = tmp_path / "track.mp3"
|
||||
path.write_bytes(encrypted)
|
||||
|
||||
BlowfishStripe(KEY).decrypt(path)
|
||||
|
||||
assert path.read_bytes() == plain
|
||||
|
||||
|
||||
def test_serialize_round_trip_keeps_key() -> None:
|
||||
serialized = serialize_drm([BlowfishStripe(KEY)])
|
||||
assert serialized == [{"type": "blowfishstripe", "key": KEY.hex()}]
|
||||
|
||||
rebuilt = reconstruct_drm(serialized)
|
||||
|
||||
assert len(rebuilt) == 1
|
||||
assert isinstance(rebuilt[0], BlowfishStripe)
|
||||
assert rebuilt[0].key == KEY
|
||||
|
||||
|
||||
def test_remote_tracks_keep_the_stripe_drm() -> None:
|
||||
track = Audio(
|
||||
id_="a1", url="https://example.test/a1", language="en", codec=Audio.Codec.FLAC, drm=[BlowfishStripe(KEY)]
|
||||
)
|
||||
|
||||
rebuilt = build_tracks({"audio": [serialize_audio_track(track, include_url=True)]})
|
||||
|
||||
assert isinstance(rebuilt.audio[0].drm[0], BlowfishStripe)
|
||||
assert rebuilt.audio[0].drm[0].key == KEY
|
||||
|
||||
|
||||
def test_url_download_decrypts_once_without_a_kid_probe(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(config.directories, "temp", tmp_path)
|
||||
monkeypatch.setattr(Track, "get_key_id", lambda *a, **k: pytest.fail("a stripe-cipher file has no KID to probe"))
|
||||
monkeypatch.setattr(
|
||||
track_module, "assert_fragments_decrypted", lambda path: pytest.fail("a stripe-cipher file has no fragments")
|
||||
)
|
||||
plain = os.urandom(CHUNK * 7 + 5)
|
||||
|
||||
def downloader(**kwargs: Any) -> Iterator[dict[str, Any]]:
|
||||
(Path(kwargs["output_dir"]) / kwargs["filename"]).write_bytes(stripe_encrypt(plain))
|
||||
yield {"file_downloaded": Path(kwargs["output_dir"]) / kwargs["filename"]}
|
||||
|
||||
track = Audio(
|
||||
id_="a1",
|
||||
url="https://example.test/a1.flac",
|
||||
language="en",
|
||||
codec=Audio.Codec.FLAC,
|
||||
drm=[BlowfishStripe(KEY)],
|
||||
downloader=downloader,
|
||||
)
|
||||
try:
|
||||
track.download(
|
||||
session=requests.Session(), prepare_drm=partial(lambda *a, **kw: None), progress=partial(lambda **kw: None)
|
||||
)
|
||||
finally:
|
||||
DOWNLOAD_CANCELLED.clear()
|
||||
|
||||
assert track.path is not None and track.path.read_bytes() == plain
|
||||
assert track.drm is None
|
||||
@@ -26,6 +26,8 @@ language_tags:
|
||||
rules:
|
||||
- audio: no
|
||||
tag: NORDIC
|
||||
- audio_contain_all: [no, da]
|
||||
tag: NORDIC2
|
||||
update_checks: no
|
||||
"""
|
||||
|
||||
@@ -57,6 +59,10 @@ def test_a_no_rule_tags_a_norwegian_track(tmp_path: Path) -> None:
|
||||
assert evaluate_language_tag(rules, [Language.get("no")], []) == "NORDIC"
|
||||
|
||||
|
||||
def test_a_no_entry_survives_in_an_audio_contain_all_list(tmp_path: Path) -> None:
|
||||
assert _load(tmp_path).language_tags["rules"][1]["audio_contain_all"] == ["no", "da"]
|
||||
|
||||
|
||||
def test_tag_rules_keep_their_own_booleans(tmp_path: Path) -> None:
|
||||
"""tag_rules matches text and warns about a bare bool itself."""
|
||||
path = tmp_path / "unshackle.yaml"
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
from unshackle.core.config import Config, duplicate_key_lines, load_yaml
|
||||
|
||||
ALIASES = "base: &b\n x: 1\n x: 2\n self: *b\nother: *b\nlist:\n - y: 1\n y: 2\n"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("compose", [yaml.compose, YAML().compose], ids=["pyyaml", "ruamel"])
|
||||
def test_duplicate_key_lines_follows_aliases_without_looping(compose) -> None:
|
||||
assert duplicate_key_lines(compose(ALIASES)) == [(2, 3), (7, 8)]
|
||||
|
||||
|
||||
def test_load_yaml_warns_once_with_lines_and_keeps_the_later_copy(
|
||||
tmp_path: Path, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
path = tmp_path / "unshackle.yaml"
|
||||
path.write_text("credentials:\n EXAMPLE: first-secret\n EXAMPLE: second-secret\n", encoding="utf-8")
|
||||
with caplog.at_level(logging.WARNING, logger="config"):
|
||||
data = load_yaml(path)
|
||||
load_yaml(path)
|
||||
assert data == {"credentials": {"EXAMPLE": "second-secret"}}
|
||||
assert caplog.messages == [f"{path}: duplicate key on lines 2 and 3. Unshackle uses the later one."]
|
||||
assert "EXAMPLE" not in caplog.text and "secret" not in caplog.text
|
||||
|
||||
|
||||
def test_config_from_yaml_warns_on_a_duplicate_key(tmp_path: Path, caplog: pytest.LogCaptureFixture) -> None:
|
||||
path = tmp_path / "unshackle.yaml"
|
||||
path.write_text("tag: first\ntag: second\n", encoding="utf-8")
|
||||
with caplog.at_level(logging.WARNING, logger="config"):
|
||||
assert Config.from_yaml(path).tag == "second"
|
||||
assert "duplicate key on lines 1 and 2" in caplog.text
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"text",
|
||||
["a: 1\nb: [1, 2]\n", "", "a: &a\n x: 1\nb: &b\n y: 2\nc:\n <<: *a\n <<: *b\n"],
|
||||
ids=["valid", "empty", "two-merges"],
|
||||
)
|
||||
def test_load_yaml_matches_safe_load_without_a_warning(
|
||||
tmp_path: Path, text: str, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
path = tmp_path / "config.yaml"
|
||||
path.write_text(text, encoding="utf-8")
|
||||
with caplog.at_level(logging.WARNING, logger="config"):
|
||||
assert load_yaml(path) == yaml.safe_load(text)
|
||||
assert not caplog.records
|
||||
@@ -22,3 +22,8 @@ def test_panel_pads_an_indic_label_to_the_border() -> None:
|
||||
Console(file=out, width=20, color_system=None).print(Panel("हिंदी"))
|
||||
|
||||
assert out.getvalue().splitlines()[1] == "│ हिंदी" + " " * 12 + " │"
|
||||
|
||||
|
||||
def test_a_virama_conjunct_shares_one_cell() -> None:
|
||||
assert cell_len("हिन्दी") == 4 # न्द is one conjunct
|
||||
assert cell_len("ಕನ್ನಡ") == 4 # a Kannada virama does not join, so ನ್ನ keeps two cells
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
from typing import Optional
|
||||
|
||||
import pytest
|
||||
|
||||
from unshackle.core.manifests.dash import DASH
|
||||
|
||||
COUNT = "urn:mpeg:dash:23003:3:audio_channel_configuration:2011"
|
||||
CICP = "urn:mpeg:mpegB:cicp:ChannelConfiguration"
|
||||
DOLBY = "tag:dolby.com,2014:dash:audio_channel_configuration:2011"
|
||||
DOLBY_LEGACY = "urn:dolby:dash:audio_channel_configuration:2011"
|
||||
|
||||
|
||||
def config(*descriptors: tuple[str, str], tag: str = "AdaptationSet") -> ET.Element:
|
||||
children = "".join(f'<AudioChannelConfiguration schemeIdUri="{s}" value="{v}"/>' for s, v in descriptors)
|
||||
return ET.fromstring(f"<{tag}>{children}</{tag}>")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("scheme", "value", "expected"),
|
||||
[
|
||||
(COUNT, "2", 2.0),
|
||||
(COUNT, "6", 5.1),
|
||||
(COUNT, "7", 6.1),
|
||||
(COUNT, "8", 7.1),
|
||||
("urn:dts:dash:audio_channel_configuration:2012", "6", 5.1),
|
||||
(CICP, "2", 2.0),
|
||||
(CICP, "6", 5.1),
|
||||
(CICP, "7", 7.1),
|
||||
(CICP, "8", 7.1),
|
||||
(CICP, "12", 7.1),
|
||||
(CICP, "16", "5.1.4"),
|
||||
(CICP, "17", "5.1.6"),
|
||||
(CICP, "18", "7.1.6"),
|
||||
(CICP, "19", "7.1.4"),
|
||||
(CICP, "20", "9.1.4"),
|
||||
(DOLBY, "F801", 5.1),
|
||||
(DOLBY_LEGACY, "FA01", 7.1),
|
||||
# an all-digit mask is still a mask under a Dolby scheme
|
||||
(DOLBY, "4000", 1.0),
|
||||
],
|
||||
)
|
||||
def test_a_channel_value_is_decoded_by_its_scheme(scheme: str, value: str, expected: object) -> None:
|
||||
assert DASH.get_audio_channels(config((scheme, value)), None) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("scheme", "value"),
|
||||
[
|
||||
("tag:dolby.com,2015:dash:audio_channel_configuration:2015", "000047"),
|
||||
("urn:mpeg:dash:outputChannelPositionList:2012", "L R C LFE"),
|
||||
(CICP, "13"),
|
||||
(COUNT, "x"),
|
||||
(DOLBY, "zz"),
|
||||
],
|
||||
)
|
||||
def test_an_unknown_scheme_or_value_gives_no_channels(scheme: str, value: str) -> None:
|
||||
assert DASH.get_audio_channels(config((scheme, value)), None) is None
|
||||
|
||||
|
||||
def test_the_first_decodable_descriptor_wins() -> None:
|
||||
element = config(("urn:example:unknown", "9"), (DOLBY, "F801"), (CICP, "2"))
|
||||
assert DASH.get_audio_channels(element, None) == 5.1
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("representation", "expected"), [(config((COUNT, "6"), tag="Representation"), 5.1), (None, 2.0)]
|
||||
)
|
||||
def test_the_representation_overrides_the_adaptation_set(representation: Optional[ET.Element], expected: float) -> None:
|
||||
assert DASH.get_audio_channels(config((COUNT, "2")), representation) == expected
|
||||
@@ -0,0 +1,19 @@
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from unshackle.core.manifests.dash import DASH
|
||||
|
||||
CAPTION = '<Role schemeIdUri="urn:mpeg:dash:role:2011" value="caption"/>'
|
||||
SDH = '<Accessibility schemeIdUri="urn:tva:metadata:cs:AudioPurposeCS:2007" value="2"/>'
|
||||
|
||||
|
||||
def test_caption_role_is_closed_caption() -> None:
|
||||
element = ET.fromstring(f"<AdaptationSet>{CAPTION}</AdaptationSet>")
|
||||
assert DASH.is_closed_caption(element) is True
|
||||
assert DASH.is_sdh(element) is False
|
||||
|
||||
|
||||
def test_caption_role_with_sdh_value_is_sdh_only() -> None:
|
||||
# a Subtitle cannot be both CC and SDH, so a set marked both used to fail the whole title
|
||||
element = ET.fromstring(f"<AdaptationSet>{CAPTION}{SDH}</AdaptationSet>")
|
||||
assert DASH.is_closed_caption(element) is False
|
||||
assert DASH.is_sdh(element) is True
|
||||
@@ -56,11 +56,8 @@ class RecordingLicence:
|
||||
drm.content_keys[kid] = KEY.hex()
|
||||
|
||||
|
||||
def test_download_track_licenses_clearkey_cenc(tmp_path, monkeypatch) -> None:
|
||||
track = DASH.from_text(MPD, MANIFEST_URL).to_tracks().videos[0]
|
||||
# KID normally comes from the init segment; short-circuit the probe (offline).
|
||||
monkeypatch.setattr(track, "get_key_id", lambda *args, **kwargs: KID)
|
||||
|
||||
def licence_only(track: Any, tmp_path: Any) -> RecordingLicence:
|
||||
"""Run download_track as far as licensing and return the licence callback it used."""
|
||||
licence = RecordingLicence()
|
||||
ctx = DownloadContext(
|
||||
save_path=tmp_path / "video.mp4",
|
||||
@@ -69,12 +66,20 @@ def test_download_track_licenses_clearkey_cenc(tmp_path, monkeypatch) -> None:
|
||||
license_widevine=licence,
|
||||
cdm=None,
|
||||
)
|
||||
|
||||
DOWNLOAD_LICENCE_ONLY.set()
|
||||
try:
|
||||
DASH.download_track(track=track, ctx=ctx)
|
||||
finally:
|
||||
DOWNLOAD_LICENCE_ONLY.clear()
|
||||
return licence
|
||||
|
||||
|
||||
def test_download_track_licenses_clearkey_cenc(tmp_path, monkeypatch) -> None:
|
||||
track = DASH.from_text(MPD, MANIFEST_URL).to_tracks().videos[0]
|
||||
# KID normally comes from the init segment; short-circuit the probe (offline).
|
||||
monkeypatch.setattr(track, "get_key_id", lambda *args, **kwargs: KID)
|
||||
|
||||
licence = licence_only(track, tmp_path)
|
||||
|
||||
assert len(licence.calls) == 1, "ClearKeyCENC track was never licensed"
|
||||
drm, track_kid = licence.calls[0]
|
||||
@@ -82,3 +87,17 @@ def test_download_track_licenses_clearkey_cenc(tmp_path, monkeypatch) -> None:
|
||||
assert track_kid == KID
|
||||
# with content keys populated, decrypt has what it needs
|
||||
assert drm.content_keys == {KID: KEY.hex()}
|
||||
|
||||
|
||||
def test_download_track_keeps_service_drm_when_manifest_has_none(tmp_path, monkeypatch) -> None:
|
||||
"""A service-set non-Widevine DRM survives a manifest with no ContentProtection, and is licensed."""
|
||||
service_drm = [ClearKeyCENC([KID], LAURL)]
|
||||
bare_mpd = MPD.split("<ContentProtection")[0] + MPD.split("</ContentProtection>")[1]
|
||||
track = DASH.from_text(bare_mpd, MANIFEST_URL).to_tracks().videos[0]
|
||||
track.drm = service_drm
|
||||
monkeypatch.setattr(track, "get_key_id", lambda *args, **kwargs: KID)
|
||||
|
||||
licence = licence_only(track, tmp_path)
|
||||
|
||||
assert track.drm == service_drm
|
||||
assert len(licence.calls) == 1
|
||||
|
||||
@@ -4,15 +4,13 @@ resource instead of per-segment files + merge."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from unshackle.core.manifests import DASH
|
||||
|
||||
URL = "https://cdn/media.mp4"
|
||||
|
||||
|
||||
def collapsible(segments, init_len: Optional[int], is_subtitle: bool = False) -> bool:
|
||||
return DASH.collapsible_single_url(is_subtitle, segments, init_len)
|
||||
def collapsible(segments, init_len: int, is_subtitle: bool = False) -> bool:
|
||||
return DASH.collapsible_single_url(is_subtitle, segments, init_len) is not None
|
||||
|
||||
|
||||
def test_segmentbase_single_range_eligible():
|
||||
@@ -29,10 +27,6 @@ def test_subtitle_never_eligible():
|
||||
assert collapsible([(URL, "863-999999")], init_len=863, is_subtitle=True) is False
|
||||
|
||||
|
||||
def test_missing_init_len_ineligible():
|
||||
assert collapsible([(URL, "863-999999")], init_len=None) is False
|
||||
|
||||
|
||||
def test_missing_range_ineligible():
|
||||
assert collapsible([(URL, None)], init_len=863) is False
|
||||
assert collapsible([(URL, "863-1999"), (URL, None)], init_len=863) is False
|
||||
@@ -43,9 +37,14 @@ def test_mixed_urls_ineligible():
|
||||
assert collapsible(segments, init_len=863) is False
|
||||
|
||||
|
||||
def test_first_segment_gap_after_init_ineligible():
|
||||
# first media byte does not immediately follow the init prefix
|
||||
assert collapsible([(URL, "900-1999")], init_len=863) is False
|
||||
def test_first_segment_gap_after_init_left_to_prefix_check():
|
||||
# the gap may be the sidx; single_url_prefix_matches decides from the bytes
|
||||
segments = [(URL, "900-1999"), (URL, "2000-2999")]
|
||||
assert DASH.collapsible_single_url(False, segments, 863) == (900, 2999)
|
||||
|
||||
|
||||
def test_first_segment_inside_init_ineligible():
|
||||
assert collapsible([(URL, "800-1999")], init_len=863) is False
|
||||
|
||||
|
||||
def test_gap_between_segments_ineligible():
|
||||
|
||||
@@ -9,6 +9,8 @@ localhost server, asserting that:
|
||||
- a SegmentList whose ranges collapse fetches the parent resource whole in one direct
|
||||
(Range-less) request and writes a byte-correct file at ``save_path``, leaving no
|
||||
segment dir or ``.!dev`` artifacts, and
|
||||
- a SegmentBase track writes the parent byte for byte, when the server sends its total
|
||||
length and when it sends an unknown (``*``) one, and
|
||||
- a track with mixed segment URLs still takes the per-segment download-and-merge path, and
|
||||
- that same segmented path raises ``DownloadCancelled`` when a sibling track's failure has
|
||||
already set ``DOWNLOAD_CANCELLED``, instead of treating the segments the cancel left
|
||||
@@ -18,6 +20,7 @@ localhost server, asserting that:
|
||||
from __future__ import annotations
|
||||
|
||||
import shutil
|
||||
import struct
|
||||
import threading
|
||||
from functools import partial
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
@@ -56,10 +59,12 @@ class _Handler(BaseHTTPRequestHandler):
|
||||
self.end_headers()
|
||||
return
|
||||
if rng:
|
||||
start, end = (int(x) for x in rng.removeprefix("bytes=").split("-"))
|
||||
first, _, last = rng.removeprefix("bytes=").partition("-")
|
||||
start, end = int(first), int(last) if last else len(body) - 1
|
||||
chunk = body[start : end + 1]
|
||||
self.send_response(206)
|
||||
self.send_header("Content-Range", f"bytes {start}-{end}/{len(body)}")
|
||||
total = "*" if server.unknown_total else len(body)
|
||||
self.send_header("Content-Range", f"bytes {start}-{end}/{total}")
|
||||
body = chunk
|
||||
else:
|
||||
self.send_response(200)
|
||||
@@ -77,6 +82,7 @@ def server():
|
||||
srv.lock = threading.Lock()
|
||||
srv.requests = []
|
||||
srv.routes = {}
|
||||
srv.unknown_total = False
|
||||
thread = threading.Thread(target=srv.serve_forever, daemon=True)
|
||||
thread.start()
|
||||
yield srv
|
||||
@@ -99,48 +105,6 @@ def base(srv) -> str:
|
||||
return f"http://127.0.0.1:{srv.server_address[1]}/"
|
||||
|
||||
|
||||
def collapse_mpd(srv) -> str:
|
||||
# SegmentList on one media.mp4: init is bytes [0, INIT_LEN), media ranges cover the rest
|
||||
# contiguously -> collapsible_single_url returns the URL and download_track collapses.
|
||||
return f"""<?xml version="1.0"?>
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" type="static" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
|
||||
<BaseURL>{base(srv)}</BaseURL>
|
||||
<Period id="0">
|
||||
<AdaptationSet contentType="video" mimeType="video/mp4" lang="en">
|
||||
<Representation id="v0" codecs="avc1.640028" bandwidth="1000000" width="1920" height="1080">
|
||||
<BaseURL>media.mp4</BaseURL>
|
||||
<SegmentList timescale="1">
|
||||
<Initialization range="0-{INIT_LEN - 1}"/>
|
||||
<SegmentURL mediaRange="{INIT_LEN}-5119"/>
|
||||
<SegmentURL mediaRange="5120-{len(PARENT) - 1}"/>
|
||||
</SegmentList>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>"""
|
||||
|
||||
|
||||
def clipped_mpd(srv) -> str:
|
||||
# same parent, but the ranges stop short of its end -> the collapsed file must be trimmed
|
||||
# to the last indexed byte, not left holding the parent's trailing bytes.
|
||||
return f"""<?xml version="1.0"?>
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" type="static" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
|
||||
<BaseURL>{base(srv)}</BaseURL>
|
||||
<Period id="0">
|
||||
<AdaptationSet contentType="video" mimeType="video/mp4" lang="en">
|
||||
<Representation id="v0" codecs="avc1.640028" bandwidth="1000000" width="1920" height="1080">
|
||||
<BaseURL>media.mp4</BaseURL>
|
||||
<SegmentList timescale="1">
|
||||
<Initialization range="0-{INIT_LEN - 1}"/>
|
||||
<SegmentURL mediaRange="{INIT_LEN}-5119"/>
|
||||
<SegmentURL mediaRange="5120-{CLIP_END}"/>
|
||||
</SegmentList>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>"""
|
||||
|
||||
|
||||
def mixed_mpd(srv) -> str:
|
||||
# Two SegmentURLs on distinct paths -> mixed URLs -> predicate False -> segmented path.
|
||||
return f"""<?xml version="1.0"?>
|
||||
@@ -160,6 +124,51 @@ def mixed_mpd(srv) -> str:
|
||||
</MPD>"""
|
||||
|
||||
|
||||
def sidx_box(sizes: list[int]) -> bytes:
|
||||
# version 0 sidx: one MEDIA reference per size, each starting with a SAP
|
||||
refs = b"".join(struct.pack(">III", size, 1, 0x90000000) for size in sizes)
|
||||
body = struct.pack(">IIIIIHH", 0, 1, 1, 0, 0, 0, len(sizes)) + refs
|
||||
return struct.pack(">I", 8 + len(body)) + b"sidx" + body
|
||||
|
||||
|
||||
def media_mpd(srv, segments: str) -> str:
|
||||
# one Representation on media.mp4, described by the given segment element
|
||||
return f"""<?xml version="1.0"?>
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" type="static" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
|
||||
<BaseURL>{base(srv)}</BaseURL>
|
||||
<Period id="0">
|
||||
<AdaptationSet contentType="video" mimeType="video/mp4" lang="en">
|
||||
<Representation id="v0" codecs="avc1.640028" bandwidth="1000000" width="1920" height="1080">
|
||||
<BaseURL>media.mp4</BaseURL>
|
||||
{segments}
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>"""
|
||||
|
||||
|
||||
def ranged_mpd(srv, ranges: list[tuple[int, int]], init: str = f'range="0-{INIT_LEN - 1}"') -> str:
|
||||
# SegmentList of byte ranges on one media.mp4, with the given Initialization attributes
|
||||
segment_urls = "\n".join(f' <SegmentURL mediaRange="{s}-{e}"/>' for s, e in ranges)
|
||||
return media_mpd(
|
||||
srv,
|
||||
f""" <SegmentList timescale="1">
|
||||
<Initialization {init}/>
|
||||
{segment_urls}
|
||||
</SegmentList>""",
|
||||
)
|
||||
|
||||
|
||||
def segment_base_mpd(srv) -> str:
|
||||
# the media range comes from the init response, not the manifest
|
||||
return media_mpd(
|
||||
srv,
|
||||
f""" <SegmentBase>
|
||||
<Initialization range="0-{INIT_LEN - 1}"/>
|
||||
</SegmentBase>""",
|
||||
)
|
||||
|
||||
|
||||
def make_track(mpd: str, srv):
|
||||
return DASH.from_text(mpd, url=f"{base(srv)}manifest.mpd").to_tracks(language="en").videos[0]
|
||||
|
||||
@@ -174,7 +183,7 @@ def make_ctx(tmp_path, name="out.mp4"):
|
||||
|
||||
def test_collapse_downloads_parent_whole_in_one_direct_request(server, tmp_path):
|
||||
server.routes["/media.mp4"] = PARENT
|
||||
track = make_track(collapse_mpd(server), server)
|
||||
track = make_track(ranged_mpd(server, [(INIT_LEN, 5119), (5120, len(PARENT) - 1)]), server)
|
||||
ctx = make_ctx(tmp_path, "collapsed.mp4")
|
||||
|
||||
DASH.download_track(track, ctx)
|
||||
@@ -194,7 +203,8 @@ def test_collapse_downloads_parent_whole_in_one_direct_request(server, tmp_path)
|
||||
|
||||
def test_collapse_trims_parent_bytes_past_the_last_segment(server, tmp_path):
|
||||
server.routes["/media.mp4"] = PARENT
|
||||
track = make_track(clipped_mpd(server), server)
|
||||
# the ranges stop short of the parent's end, so the collapsed file must be trimmed
|
||||
track = make_track(ranged_mpd(server, [(INIT_LEN, 5119), (5120, CLIP_END)]), server)
|
||||
ctx = make_ctx(tmp_path, "clipped.mp4")
|
||||
|
||||
DASH.download_track(track, ctx)
|
||||
@@ -203,6 +213,81 @@ def test_collapse_trims_parent_bytes_past_the_last_segment(server, tmp_path):
|
||||
assert ctx.save_path.read_bytes() == PARENT[: CLIP_END + 1]
|
||||
|
||||
|
||||
def test_collapse_keeps_the_sidx_between_init_and_first_segment(server, tmp_path):
|
||||
media = [bytes([0xC0]) * 3000, bytes([0xD1]) * 2000]
|
||||
head = PARENT[:INIT_LEN] + sidx_box([len(m) for m in media])
|
||||
parent = head + b"".join(media)
|
||||
server.routes["/media.mp4"] = parent
|
||||
ranges = [(len(head), len(head) + 2999), (len(head) + 3000, len(parent) - 1)]
|
||||
ctx = make_ctx(tmp_path, "sidx.mp4")
|
||||
|
||||
DASH.download_track(make_track(ranged_mpd(server, ranges), server), ctx)
|
||||
|
||||
assert ctx.save_path.read_bytes() == parent
|
||||
assert [path for path, rng in server.requests if rng is None] == ["/media.mp4"]
|
||||
|
||||
|
||||
def test_segment_base_collapse_ends_at_the_last_byte(server, tmp_path):
|
||||
server.routes["/media.mp4"] = PARENT
|
||||
ctx = make_ctx(tmp_path, "segment_base.mp4")
|
||||
|
||||
DASH.download_track(make_track(segment_base_mpd(server), server), ctx)
|
||||
|
||||
# the media range ends at total - 1, so the truncate after the collapse adds no byte
|
||||
assert ctx.save_path.read_bytes() == PARENT
|
||||
|
||||
|
||||
def test_segment_base_unknown_total_fetches_the_rest_open_ended(server, tmp_path):
|
||||
server.routes["/media.mp4"] = PARENT
|
||||
server.unknown_total = True
|
||||
ctx = make_ctx(tmp_path, "unknown_total.mp4")
|
||||
|
||||
DASH.download_track(make_track(segment_base_mpd(server), server), ctx)
|
||||
|
||||
assert ctx.save_path.read_bytes() == PARENT
|
||||
assert ("/media.mp4", f"bytes={INIT_LEN}-") in server.requests
|
||||
|
||||
|
||||
def test_leading_gap_that_is_not_a_sidx_takes_segmented_path(server, tmp_path):
|
||||
# a filtered period cut from the same file leaves a gap of media, not an index
|
||||
gap = struct.pack(">I", 1000) + b"moof" + bytes(992)
|
||||
media = bytes([0xC0]) * 3000
|
||||
server.routes["/media.mp4"] = PARENT[:INIT_LEN] + gap + media
|
||||
start = INIT_LEN + len(gap)
|
||||
ctx = make_ctx(tmp_path, "gap.mp4")
|
||||
|
||||
DASH.download_track(make_track(ranged_mpd(server, [(start, start + 2999)]), server), ctx)
|
||||
|
||||
assert ctx.save_path.read_bytes() == PARENT[:INIT_LEN] + media
|
||||
assert not [path for path, rng in server.requests if rng is None]
|
||||
|
||||
|
||||
def test_sidx_indexing_more_than_the_listed_segments_takes_segmented_path(server, tmp_path):
|
||||
# the file carries a post-roll after the listed segments, and the sidx indexes it too
|
||||
media, post_roll = bytes([0xC0]) * 3000, bytes([0xEE]) * 500
|
||||
head = PARENT[:INIT_LEN] + sidx_box([len(media), len(post_roll)])
|
||||
server.routes["/media.mp4"] = head + media + post_roll
|
||||
ctx = make_ctx(tmp_path, "post-roll.mp4")
|
||||
|
||||
DASH.download_track(make_track(ranged_mpd(server, [(len(head), len(head) + 2999)]), server), ctx)
|
||||
|
||||
assert ctx.save_path.read_bytes() == PARENT[:INIT_LEN] + media
|
||||
|
||||
|
||||
def test_init_from_another_file_takes_segmented_path(server, tmp_path):
|
||||
# the media ranges start where an init of the same length would end, but the init is elsewhere
|
||||
init = bytes([0x11]) * INIT_LEN
|
||||
server.routes["/init.bin"] = init
|
||||
server.routes["/media.mp4"] = PARENT
|
||||
ranges = [(INIT_LEN, 5119), (5120, len(PARENT) - 1)]
|
||||
ctx = make_ctx(tmp_path, "init-elsewhere.mp4")
|
||||
|
||||
DASH.download_track(make_track(ranged_mpd(server, ranges, init='sourceURL="init.bin"'), server), ctx)
|
||||
|
||||
assert ctx.save_path.read_bytes() == init + PARENT[INIT_LEN:]
|
||||
assert not [path for path, rng in server.requests if rng is None and path == "/media.mp4"]
|
||||
|
||||
|
||||
def test_non_collapse_takes_segmented_merge_path(server, tmp_path):
|
||||
server.routes["/init.bin"] = INIT2
|
||||
server.routes["/part0.bin"] = PART0
|
||||
|
||||
@@ -185,6 +185,6 @@ def test_segment_base_range_survives_a_skipped_probe(server, probes):
|
||||
probe_kid=False,
|
||||
)
|
||||
|
||||
assert segments == [(f"{base(server)}p1.mp4", f"{INIT_LEN}-{len(MEDIA)}")]
|
||||
assert segments == [(f"{base(server)}p1.mp4", f"{INIT_LEN}-{len(MEDIA) - 1}")]
|
||||
assert track_kid is None
|
||||
assert not probes
|
||||
|
||||
@@ -61,3 +61,31 @@ def test_timeline_numbers_follow_start_number(start: int, count: int) -> None:
|
||||
@pytest.mark.parametrize(("start", "seconds", "count"), [(0, "1M36.720", 17), (1, "1M36.720", 17), (2642, "30", 5)])
|
||||
def test_duration_numbers_follow_start_number(start: int, seconds: str, count: int) -> None:
|
||||
assert _numbers(DURATION_MPD.format(start=start, seconds=seconds)) == list(range(start, start + count))
|
||||
|
||||
|
||||
TIME_MPD = """
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" type="static" mediaPresentationDuration="PT10S">
|
||||
<Period id="0" start="PT0S" duration="PT10S">
|
||||
<AdaptationSet mimeType="audio/mp4">
|
||||
<SegmentTemplate timescale="10" media="a/$Time$.mp4">
|
||||
<SegmentTimeline>{timeline}</SegmentTimeline>
|
||||
</SegmentTemplate>
|
||||
<Representation id="a" bandwidth="1"/>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
"""
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("timeline", "starts"),
|
||||
[
|
||||
# a negative @r repeats to the end of the Period, or to the next S@t
|
||||
('<S t="0" d="20" r="-1"/>', [0, 20, 40, 60, 80]),
|
||||
('<S t="0" d="20" r="-1"/><S t="60" d="40"/>', [0, 20, 40, 60]),
|
||||
# an S with @p cycles the Pattern durations from index @pE
|
||||
('<Pattern id="1"><P d="10" r="1"/><P d="30"/></Pattern><S t="0" r="4" p="1" pE="1"/>', [0, 10, 40, 50, 60]),
|
||||
],
|
||||
)
|
||||
def test_timeline_repeat_and_pattern_forms(timeline: str, starts: list[int]) -> None:
|
||||
assert _numbers(TIME_MPD.format(timeline=timeline)) == starts
|
||||
|
||||
@@ -99,6 +99,33 @@ def test_strict_single_unknown_original_no_dubbed(strict_mode):
|
||||
assert c["multi"] == ""
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("language", "languages", "tags"),
|
||||
[
|
||||
("zh", ["cmn"], set()),
|
||||
("zh-TW", ["cmn-TW"], set()),
|
||||
("cmn", ["zh-CN"], set()),
|
||||
("zh", ["zh", "cmn"], set()),
|
||||
("zh", ["cmn", "yue"], {"dual"}),
|
||||
("cmn", ["yue"], {"dubbed"}),
|
||||
("yue", ["cmn"], {"dubbed"}),
|
||||
("ar", ["arb"], set()),
|
||||
("no", ["nb-NO"], set()),
|
||||
("nb", ["nn"], set()),
|
||||
("no", ["nb", "da"], {"dual"}),
|
||||
],
|
||||
)
|
||||
def test_strict_counts_an_individual_language_as_its_macrolanguage(strict_mode, language, languages, tags):
|
||||
c = ctx(language, languages)
|
||||
assert {name for name in ("dual", "multi", "dubbed") if c[name]} == tags
|
||||
|
||||
|
||||
def test_the_primary_audio_is_the_original_language_under_its_macrolanguage(strict_mode):
|
||||
media_info = make_media_info(["yue", "cmn"])
|
||||
media_info.audio_tracks[1].channel_s = 6
|
||||
assert make_movie("zh").build_base_template_context(media_info)["audio_channels"] == "6.0"
|
||||
|
||||
|
||||
def test_count_dual_ignores_original(count_mode):
|
||||
c = ctx(None, ["en", "es"])
|
||||
assert c["dual"] == "DUAL"
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
"""get_boxes must give each thread its own box when tracks read their init segments at the same time."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import struct
|
||||
import threading
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from unshackle.core.utilities import get_boxes
|
||||
|
||||
|
||||
def tenc_init(kid: UUID, version: int, crypt_skip: int) -> bytes:
|
||||
body = struct.pack(">B3s", version, b"\0\0\0") + bytes([0, crypt_skip if version else 0]) + b"\x01\x10" + kid.bytes
|
||||
return b"\x00" * 8 + struct.pack(">I", 8 + len(body)) + b"tenc" + body
|
||||
|
||||
|
||||
def test_get_boxes_finds_the_tenc() -> None:
|
||||
kid = uuid4()
|
||||
(box,) = get_boxes(tenc_init(kid, 1, 0x19), b"tenc")
|
||||
assert box.key_ID == kid
|
||||
|
||||
|
||||
def test_get_boxes_is_right_when_tracks_parse_at_the_same_time() -> None:
|
||||
cases = [(uuid4(), version, crypt_skip) for version, crypt_skip in ((0, 0), (1, 0x19), (1, 0x91), (1, 0x55))] * 2
|
||||
failures: list[str] = []
|
||||
|
||||
def parse(kid: UUID, version: int, crypt_skip: int) -> None:
|
||||
data = tenc_init(kid, version, crypt_skip)
|
||||
for _ in range(1500):
|
||||
try:
|
||||
boxes = list(get_boxes(data, b"tenc"))
|
||||
except Exception as e:
|
||||
failures.append(repr(e))
|
||||
continue
|
||||
if [box.key_ID for box in boxes] != [kid]:
|
||||
failures.append("wrong or missing tenc")
|
||||
|
||||
threads = [threading.Thread(target=parse, args=case) for case in cases]
|
||||
for thread in threads:
|
||||
thread.start()
|
||||
for thread in threads:
|
||||
thread.join(timeout=120)
|
||||
assert not failures, failures[:3]
|
||||
assert not any(thread.is_alive() for thread in threads)
|
||||
@@ -0,0 +1,53 @@
|
||||
"""Tests for the HDR tag in the filename context when MediaInfo misses HDR10+."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import types
|
||||
|
||||
import pytest
|
||||
|
||||
from unshackle.core.config import config
|
||||
from unshackle.core.titles.movie import Movie
|
||||
from unshackle.core.tracks import Tracks, Video
|
||||
|
||||
|
||||
class DummyService:
|
||||
pass
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def clean_config(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(config, "tag_rules", [])
|
||||
monkeypatch.setattr(config, "language_tags", {})
|
||||
monkeypatch.setattr(config, "codec_names", {})
|
||||
|
||||
|
||||
def hdr_tag(commercial: str, range_: Video.Range) -> str:
|
||||
movie = Movie(id_="movie-0001", service=DummyService, name="The Film", year=2024, language="en")
|
||||
movie.tracks = Tracks(Video(url="https://example.test/v.mpd", language="en", codec=Video.Codec.AV1, range_=range_))
|
||||
video = types.SimpleNamespace(
|
||||
width=1920,
|
||||
height=1080,
|
||||
format="AV1",
|
||||
scan_type="Progressive",
|
||||
other_display_aspect_ratio=["16:9"],
|
||||
hdr_format_commercial=commercial,
|
||||
hdr_format="SMPTE ST 2086",
|
||||
transfer_characteristics="PQ",
|
||||
transfer_characteristics_original=None,
|
||||
frame_rate="23.976",
|
||||
)
|
||||
media_info = types.SimpleNamespace(video_tracks=[video], audio_tracks=[])
|
||||
return str(movie.build_base_template_context(media_info)["hdr"])
|
||||
|
||||
|
||||
def test_an_hdr10p_track_upgrades_a_plain_hdr10_tag() -> None:
|
||||
assert hdr_tag("HDR10", Video.Range.HDR10P) == "HDR10P"
|
||||
|
||||
|
||||
def test_an_hdr10_track_keeps_the_hdr_tag() -> None:
|
||||
assert hdr_tag("HDR10", Video.Range.HDR10) == "HDR"
|
||||
|
||||
|
||||
def test_mediainfo_hdr10p_is_unchanged() -> None:
|
||||
assert hdr_tag("HDR10 / HDR10+", Video.Range.HDR10) == "HDR10P"
|
||||
@@ -215,3 +215,9 @@ def test_a_quoted_dl_workers_value_works_like_the_cli(monkeypatch: pytest.Monkey
|
||||
service = SimpleNamespace(get_tracks=lambda title: SimpleNamespace(videos=[hevc("v", 2160)]), session=None)
|
||||
monkeypatch.setitem(config.dl, "workers", "8")
|
||||
assert probe_calls(monkeypatch, service) == [8]
|
||||
|
||||
|
||||
def test_a_dv_track_with_an_hdr10_base_lists_as_dv_plus_hdr10() -> None:
|
||||
video = Video(url="https://x/v.mp4", language="en", codec=Video.Codec.HEVC, range_=Video.Range.DV, hdr10_base=True)
|
||||
assert "[H.265, DV+HDR10]" in str(video)
|
||||
assert Video.from_dict(video.to_dict()).hdr10_base
|
||||
|
||||
@@ -31,7 +31,7 @@ from unshackle.core.api.handlers import validate_download_parameters
|
||||
from unshackle.core.config import config
|
||||
from unshackle.core.service import Service, TrackRequest
|
||||
from unshackle.core.services import Services
|
||||
from unshackle.core.tracks import Tracks, Video
|
||||
from unshackle.core.tracks import Audio, Chapter, Subtitle, Tracks, Video
|
||||
from unshackle.core.tracks import hybrid as hybrid_mod
|
||||
from unshackle.core.tracks.hybrid import Hybrid, hdr10plus_mean_pq, hdr10plus_shots, nits_to_pq
|
||||
|
||||
@@ -652,19 +652,14 @@ def video(
|
||||
|
||||
def test_hybrid_fails_with_neither_a_base_nor_dv() -> None:
|
||||
assert hybrid_gate_failure([video("sdr", Video.Range.SDR)], True) == (
|
||||
"HYBRID mode requires both HDR10/HDR10+ and DV tracks, but neither is available",
|
||||
"Available ranges: SDR",
|
||||
)
|
||||
assert hybrid_gate_failure([], True) == (
|
||||
"HYBRID mode requires both HDR10/HDR10+ and DV tracks, but neither is available",
|
||||
"Available ranges: none",
|
||||
"HYBRID needs HDR10/HDR10+ and DV tracks, available ranges: SDR"
|
||||
)
|
||||
assert hybrid_gate_failure([], True) == "HYBRID needs HDR10/HDR10+ and DV tracks, available ranges: none"
|
||||
|
||||
|
||||
def test_hybrid_fails_with_dv_only() -> None:
|
||||
assert hybrid_gate_failure([video("dv", Video.Range.DV)], True) == (
|
||||
"HYBRID mode requires both HDR10/HDR10+ and DV tracks, but only DV is available",
|
||||
"Available ranges: DV",
|
||||
"HYBRID needs HDR10/HDR10+ and DV tracks, available ranges: DV"
|
||||
)
|
||||
|
||||
|
||||
@@ -681,27 +676,16 @@ def test_hybrid_goes_on_with_a_base_and_dv_whatever_the_flag() -> None:
|
||||
def test_hybrid_fails_up_front_when_no_base_is_hevc() -> None:
|
||||
"""dovi_tool injects into HEVC, so an all-AV1 title fails before it downloads anything."""
|
||||
videos = [video("av1", Video.Range.HDR10P, codec=Video.Codec.AV1), video("dv", Video.Range.DV)]
|
||||
assert hybrid_gate_failure(videos, False) == (
|
||||
"HYBRID mode requires an HEVC HDR10/HDR10+ base, but none is available",
|
||||
"Available HDR10/HDR10+ codecs: AV1",
|
||||
)
|
||||
assert hybrid_gate_failure(videos, False) == "HYBRID needs an HEVC HDR10/HDR10+ base, available codecs: AV1"
|
||||
assert hybrid_gate_failure(videos + [video("h", Video.Range.HDR10, codec=None)], False) is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"ranges, to_dv, detail",
|
||||
[
|
||||
(
|
||||
[Video.Range.HDR10P],
|
||||
False,
|
||||
"Available ranges: HDR10P. Add --generate-dv to generate Dolby Vision from HDR10+.",
|
||||
),
|
||||
([Video.Range.HDR10], False, "Available ranges: HDR10"),
|
||||
(
|
||||
[Video.Range.HDR10],
|
||||
True,
|
||||
"Available ranges: HDR10. --generate-dv needs an HEVC HDR10+ track, and the service returned none.",
|
||||
),
|
||||
([Video.Range.HDR10P], False, "HDR10P; add --generate-dv to make DV from HDR10+"),
|
||||
([Video.Range.HDR10], False, "HDR10"),
|
||||
([Video.Range.HDR10], True, "HDR10; --generate-dv found no HEVC HDR10+ track"),
|
||||
],
|
||||
)
|
||||
def test_hybrid_fails_without_dv_and_hints_at_the_flag_only_when_it_is_off(
|
||||
@@ -709,10 +693,7 @@ def test_hybrid_fails_without_dv_and_hints_at_the_flag_only_when_it_is_off(
|
||||
) -> None:
|
||||
"""A service that fetches HYBRID by hand may never return HDR10+; the hint must not blame the user then."""
|
||||
videos = [video(r.name, r) for r in ranges]
|
||||
assert hybrid_gate_failure(videos, to_dv) == (
|
||||
"HYBRID mode requires both HDR10/HDR10+ and DV tracks, but only HDR10 is available",
|
||||
detail,
|
||||
)
|
||||
assert hybrid_gate_failure(videos, to_dv) == f"HYBRID needs HDR10/HDR10+ and DV tracks, available ranges: {detail}"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("to_dv", [False, True])
|
||||
@@ -750,3 +731,50 @@ def test_a_native_hybrid_passes_the_gate_and_takes_no_base_at_its_resolution() -
|
||||
|
||||
assert [v.id for v in bases] == ["h1080"]
|
||||
assert dv is not None and dv.id == "dvp2160"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"ranges, codecs, surround_on",
|
||||
[
|
||||
([Video.Range.SDR, Video.Range.HDR10], [], Video.Range.HDR10),
|
||||
([Video.Range.HYBRID], [Video.Codec.AVC, Video.Codec.HEVC], Video.Range.DV),
|
||||
],
|
||||
)
|
||||
def test_variants_merge_every_manifest_but_skip_a_subtitle_copy_and_later_chapters(
|
||||
ranges: list[Video.Range], codecs: list[Video.Codec], surround_on: Video.Range
|
||||
) -> None:
|
||||
"""Audio and a subtitle language that only a later manifest offers are kept. A track whose ID
|
||||
differs per manifest (a signed URL) is not duplicated, and later chapters do not clash."""
|
||||
fetches = 0
|
||||
|
||||
def fetch(title: Any, codec: Any, range_: Video.Range) -> Tracks:
|
||||
nonlocal fetches
|
||||
fetches += 1
|
||||
tracks = Tracks()
|
||||
tracks.add(
|
||||
Video(
|
||||
url="https://example.invalid/v", language="en", id_=f"{range_.name}{codec}", codec=codec, range_=range_
|
||||
)
|
||||
)
|
||||
tracks.add(Audio(url="https://example.invalid/a2", language="en", id_=f"stereo{fetches}", channels=2))
|
||||
if range_ == surround_on:
|
||||
tracks.add(Audio(url="https://example.invalid/a6", language="en", id_="surround", channels=6))
|
||||
tracks.add(Subtitle(url=f"https://example.invalid/s?tok={fetches}", language="en", id_=f"sub{fetches}"))
|
||||
if range_ == surround_on:
|
||||
tracks.add(Subtitle(url=f"https://example.invalid/j?tok={fetches}", language="ja", id_=f"ja{fetches}"))
|
||||
tracks.add(Chapter(0))
|
||||
return tracks
|
||||
|
||||
service = SimpleNamespace(
|
||||
track_request=TrackRequest(codecs=codecs, ranges=ranges),
|
||||
log=logging.getLogger("variants-test"),
|
||||
)
|
||||
|
||||
tracks = Service.get_tracks_for_variants(service, None, fetch) # type: ignore[arg-type]
|
||||
|
||||
assert fetches > 1
|
||||
assert sorted(a.id for a in tracks.audio) == ["stereo1", "surround"]
|
||||
assert [str(s.language) for s in tracks.subtitles] == ["en", "ja"]
|
||||
assert tracks.subtitles[0].id == "sub1"
|
||||
assert len(tracks.chapters) == 1
|
||||
assert len(tracks.videos) == fetches
|
||||
|
||||
@@ -150,4 +150,4 @@ def test_a_download_stopped_by_a_click_exception_reports_only_its_message() -> N
|
||||
lines = dl.failure_lines(error)
|
||||
|
||||
assert lines == [":x: Download Failed...", f" {error.format_message()}"]
|
||||
assert "unexpected error" in dl.failure_lines(ValueError("boom"))[-1]
|
||||
assert dl.failure_lines(ValueError("boom")) == [":x: Download Failed...", " ValueError: boom"]
|
||||
|
||||
@@ -19,7 +19,7 @@ import click
|
||||
from pywidevine.pssh import PSSH
|
||||
|
||||
from unshackle.commands.dl import dl
|
||||
from unshackle.core.drm import Widevine
|
||||
from unshackle.core.drm import ClearKey, Widevine
|
||||
from unshackle.core.drm.key_args import ZERO_KID
|
||||
from unshackle.core.import_service import ImportService
|
||||
from unshackle.core.manifests import DASH, HLS
|
||||
@@ -260,3 +260,19 @@ def test_a_subtitle_that_lists_its_kid_keeps_its_key(tmp_path: Path) -> None:
|
||||
drm = hls_import(tmp_path, subtitle_drm=widevine(SUB_KID, SUB_KEY))
|
||||
|
||||
assert drm["es"] and drm["es"][0].content_keys == {SUB_KID: SUB_KEY}
|
||||
|
||||
|
||||
def test_a_track_whose_drm_holds_its_own_key_is_left_alone() -> None:
|
||||
"""HLS AES-128 has no content_keys to fill, so injecting the pool into it must not crash."""
|
||||
svc = ImportService.__new__(ImportService)
|
||||
track = Video(url="https://example.invalid/v.m3u8", language="en", drm=[ClearKey(key=VIDEO_KEY)])
|
||||
title = SimpleNamespace(id="movie-1", tracks=[track])
|
||||
with (
|
||||
patch.object(ImportService, "key_pool", return_value=POOL),
|
||||
patch.object(ImportService, "exported_drm_system", return_value="widevine"),
|
||||
patch.object(ImportService, "exported_kids", return_value=[VIDEO_KID.hex]),
|
||||
patch.object(ImportService, "exported_keys", return_value={VIDEO_KID: VIDEO_KEY}),
|
||||
):
|
||||
svc.resolve_server_keys(cast(Any, title))
|
||||
|
||||
assert isinstance(track.drm[0], ClearKey)
|
||||
|
||||
@@ -3,6 +3,8 @@ from pathlib import Path
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
|
||||
import pytest
|
||||
|
||||
from unshackle.core.drm.verify import PIFF_TENC, PIFF_TFXD, KidMap, kid_windows, pick_windows
|
||||
|
||||
A, B, C = UUID(int=0xA), UUID(int=0xB), UUID(int=0xC)
|
||||
@@ -44,15 +46,28 @@ def sbgp(*runs: tuple[int, int]) -> bytes:
|
||||
return full(b"sbgp", b"seig" + struct.pack(">I", len(runs)) + b"".join(struct.pack(">II", *run) for run in runs))
|
||||
|
||||
|
||||
def movie(*sample_entries: bytes, handler: bytes = b"vide", stbl: bytes = b"") -> bytes:
|
||||
def trak(*sample_entries: bytes, track: int = 1, handler: bytes = b"vide", stbl: bytes = b"") -> bytes:
|
||||
stsd = full(b"stsd", struct.pack(">I", len(sample_entries)) + b"".join(sample_entries))
|
||||
hdlr = full(b"hdlr", bytes(4) + handler + bytes(12))
|
||||
trak = box(
|
||||
return box(
|
||||
b"trak",
|
||||
full(b"tkhd", bytes(8) + struct.pack(">I", 1)),
|
||||
full(b"tkhd", bytes(8) + struct.pack(">I", track)),
|
||||
box(b"mdia", full(b"mdhd", bytes(8) + struct.pack(">I", 1000)), hdlr, box(b"minf", box(b"stbl", stsd, stbl))),
|
||||
)
|
||||
return box(b"ftyp", b"iso6") + box(b"moov", trak, box(b"mvex", full(b"trex", struct.pack(">III", 1, 1, 0))))
|
||||
|
||||
|
||||
def movie(*sample_entries: bytes, handler: bytes = b"vide", stbl: bytes = b"", others: bytes = b"") -> bytes:
|
||||
moov = box(
|
||||
b"moov",
|
||||
trak(*sample_entries, handler=handler, stbl=stbl),
|
||||
others,
|
||||
box(b"mvex", full(b"trex", struct.pack(">III", 1, 1, 0))),
|
||||
)
|
||||
return box(b"ftyp", b"iso6") + moov
|
||||
|
||||
|
||||
def clear_audio(others: bytes = b"") -> bytes:
|
||||
return movie(box(b"mp4a", bytes(28)), handler=b"soun", others=others)
|
||||
|
||||
|
||||
def moof(
|
||||
@@ -178,3 +193,45 @@ def test_not_a_fragmented_mp4(tmp_path: Path) -> None:
|
||||
path = tmp_path / "video.ts"
|
||||
path.write_bytes(b"\x47" * 188 * 4)
|
||||
assert kid_windows(path) is None
|
||||
|
||||
|
||||
def test_clear_mp4_maps_no_kid(tmp_path: Path) -> None:
|
||||
path = tmp_path / "clear.m4a"
|
||||
path.write_bytes(clear_audio() + moof(1, 0))
|
||||
assert kid_windows(path) == KidMap({}, False)
|
||||
|
||||
|
||||
def test_encrypted_entry_without_a_tenc_is_not_clear(tmp_path: Path) -> None:
|
||||
path = tmp_path / "enc.mp4"
|
||||
path.write_bytes(movie(box(b"encv", bytes(78), box(b"sinf", box(b"frma", b"avc1")))) + moof(1, 0))
|
||||
assert kid_windows(path) is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize("kind", [b"enct", b"encs", b"drmi"])
|
||||
def test_other_encrypted_entry_kinds_are_not_clear(tmp_path: Path, kind: bytes) -> None:
|
||||
path = tmp_path / "enc.mp4"
|
||||
path.write_bytes(movie(box(kind, bytes(16)), handler=b"text") + moof(1, 0))
|
||||
assert kid_windows(path) is None
|
||||
|
||||
|
||||
def test_a_clear_entry_with_a_protecting_senc_is_not_clear(tmp_path: Path) -> None:
|
||||
path = tmp_path / "enc.m4a"
|
||||
senc = full(b"senc", struct.pack(">I", 1) + bytes(8))
|
||||
path.write_bytes(clear_audio() + moof(1, 0, senc))
|
||||
assert kid_windows(path) is None
|
||||
path.write_bytes(clear_audio() + moof(1, 0, full(b"senc", bytes(4))))
|
||||
assert kid_windows(path) == KidMap({}, False)
|
||||
|
||||
|
||||
def test_only_the_tracks_with_fragments_decide_clear(tmp_path: Path) -> None:
|
||||
path = tmp_path / "clear.m4a"
|
||||
path.write_bytes(clear_audio(others=trak(encv(A), track=2)) + moof(1, 0))
|
||||
assert kid_windows(path) == KidMap({}, False)
|
||||
path.write_bytes(clear_audio(others=trak(encv(A), track=2)))
|
||||
assert kid_windows(path) is None
|
||||
|
||||
|
||||
def test_a_clear_lead_beside_an_encrypted_entry_is_not_clear(tmp_path: Path) -> None:
|
||||
path = tmp_path / "lead.mp4"
|
||||
path.write_bytes(movie(box(b"avc1", bytes(78)), encv(A)) + moof(1, 0))
|
||||
assert kid_windows(path) is None
|
||||
|
||||
@@ -31,6 +31,23 @@ def test_subs_contain_all_needs_every_entry() -> None:
|
||||
assert evaluate_language_tag(rules, JA, EN_ES) == ""
|
||||
|
||||
|
||||
def test_audio_contain_all_tags_a_release_with_every_listed_language() -> None:
|
||||
rules = [
|
||||
{"audio_contain_all": ["fr-FR", "fr-CA"], "tag": "VF2"},
|
||||
{"audio": "fr-CA", "tag": "VFQ"},
|
||||
{"audio": "fr-FR", "tag": "VFF"},
|
||||
]
|
||||
fr_fr, fr_ca, en = Language.get("fr-FR"), Language.get("fr-CA"), Language.get("en-US")
|
||||
assert evaluate_language_tag(rules, [en, fr_fr, fr_ca], []) == "VF2"
|
||||
assert evaluate_language_tag(rules, [en, fr_ca], []) == "VFQ"
|
||||
assert evaluate_language_tag(rules, [en, fr_fr], []) == "VFF"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("condition", ["audio_contain_all", "subs_contain_all"])
|
||||
def test_an_empty_contain_all_list_matches_nothing(condition) -> None:
|
||||
assert evaluate_language_tag([{condition: [], "tag": "ALL"}], JA, EN_ES) == ""
|
||||
|
||||
|
||||
@pytest.mark.parametrize("bad", ["japanese", 1, [["ja"]], {"ja": 1}])
|
||||
def test_an_invalid_rule_value_is_no_match_not_a_crash(bad, caplog) -> None:
|
||||
rules = [{"audio": bad, "tag": "BAD"}, {"audio": "ja", "tag": "OK"}]
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
"""Licences take turns across DRMs with different KIDs, so one licence that carries every key is sent once."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import threading
|
||||
import time
|
||||
from types import SimpleNamespace
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
import pytest
|
||||
from pywidevine.pssh import PSSH
|
||||
from rich.table import Table
|
||||
from rich.tree import Tree
|
||||
|
||||
from unshackle.commands.dl import dl
|
||||
from unshackle.core.cdm.detect import cdm_type_stub
|
||||
from unshackle.core.constants import DOWNLOAD_CANCELLED, DownloadCancelled
|
||||
from unshackle.core.drm import Widevine
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
KID_A, KID_B, KID_C = (UUID(c * 32) for c in "abc")
|
||||
KEYS = {KID_A: "aa" * 16, KID_B: "bb" * 16, KID_C: "cc" * 16}
|
||||
|
||||
|
||||
class NoVaults:
|
||||
sources: dict = {}
|
||||
|
||||
def __bool__(self) -> bool:
|
||||
return False
|
||||
|
||||
def get_key(self, kid: UUID) -> tuple[None, None]:
|
||||
return None, None
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def licences(monkeypatch: pytest.MonkeyPatch) -> list[str]:
|
||||
"""Each licence returns every content key of the title, after a delay that lets the tracks overlap."""
|
||||
calls: list[str] = []
|
||||
|
||||
def get_content_keys(self: Widevine, **_: Any) -> None:
|
||||
calls.append(threading.current_thread().name)
|
||||
time.sleep(0.2)
|
||||
self.content_keys = dict(KEYS)
|
||||
|
||||
monkeypatch.setattr(Widevine, "get_content_keys", get_content_keys)
|
||||
monkeypatch.setattr(dl, "LICENSE_KEY_CACHE", {})
|
||||
monkeypatch.setattr(dl, "DRM_LOCKS", {})
|
||||
DOWNLOAD_CANCELLED.clear()
|
||||
yield calls
|
||||
DOWNLOAD_CANCELLED.clear()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def cmd() -> dl:
|
||||
cmd = dl.__new__(dl)
|
||||
cmd.log = logging.getLogger(__name__)
|
||||
cmd.service = "TEST"
|
||||
cmd.vaults = NoVaults()
|
||||
cmd.vault_cache_tally = None
|
||||
cmd._remote_service = None
|
||||
cmd.debug_logger = None
|
||||
cmd.cdm = cdm_type_stub("widevine")
|
||||
return cmd
|
||||
|
||||
|
||||
def widevine(*kids: UUID) -> Widevine:
|
||||
return Widevine(pssh=PSSH.new(system_id=PSSH.SystemId.Widevine, key_ids=list(kids)))
|
||||
|
||||
|
||||
def prepare(cmd: dl, drm: Widevine, track_kid: UUID, table: Table, **kwargs: Any) -> None:
|
||||
cmd.prepare_drm(
|
||||
drm,
|
||||
track=SimpleNamespace(drm=[drm]),
|
||||
title=None,
|
||||
certificate=lambda **_: None,
|
||||
licence=lambda **_: None,
|
||||
table=table,
|
||||
track_kid=track_kid,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
||||
def new_table() -> Table:
|
||||
table = Table.grid()
|
||||
table.add_row("")
|
||||
return table
|
||||
|
||||
|
||||
def run_together(cmd: dl, *jobs: tuple[Widevine, UUID]) -> tuple[Table, list[BaseException]]:
|
||||
table = new_table()
|
||||
errors: list[BaseException] = []
|
||||
|
||||
def run(drm: Widevine, kid: UUID) -> None:
|
||||
try:
|
||||
prepare(cmd, drm, kid, table)
|
||||
except BaseException as e:
|
||||
errors.append(e)
|
||||
|
||||
threads = [threading.Thread(target=run, args=job, name=f"track-{i}") for i, job in enumerate(jobs)]
|
||||
for t in threads:
|
||||
t.start()
|
||||
for t in threads:
|
||||
t.join()
|
||||
return table, errors
|
||||
|
||||
|
||||
def tree_labels(table: Table, kid: UUID) -> list[str]:
|
||||
trees = [cell for cell in table.columns[0].cells if isinstance(cell, Tree)]
|
||||
return [str(child.label) for tree in trees for child in tree.children if kid.hex in str(child.label)]
|
||||
|
||||
|
||||
def test_one_licence_for_two_pssh_with_different_kids(cmd: dl, licences: list[str]) -> None:
|
||||
first, second = widevine(KID_A, KID_B), widevine(KID_C)
|
||||
|
||||
table, errors = run_together(cmd, (first, KID_A), (second, KID_C))
|
||||
|
||||
assert not errors
|
||||
assert len(licences) == 1
|
||||
assert first.content_keys[KID_A] == KEYS[KID_A] and second.content_keys[KID_C] == KEYS[KID_C]
|
||||
assert any(label.endswith(" from cache") for kid in (KID_A, KID_C) for label in tree_labels(table, kid))
|
||||
|
||||
|
||||
def test_a_track_waiting_for_its_turn_sends_no_licence_after_a_failure(cmd: dl, licences: list[str]) -> None:
|
||||
DOWNLOAD_CANCELLED.set()
|
||||
|
||||
with pytest.raises(DownloadCancelled):
|
||||
prepare(cmd, widevine(KID_C), KID_C, new_table())
|
||||
|
||||
assert licences == []
|
||||
|
||||
|
||||
def test_force_licenses_again_although_the_keys_are_cached(cmd: dl, licences: list[str]) -> None:
|
||||
dl.LICENSE_KEY_CACHE.update(KEYS)
|
||||
|
||||
prepare(cmd, widevine(KID_C), KID_C, new_table(), force=True)
|
||||
|
||||
assert len(licences) == 1
|
||||
|
||||
|
||||
def test_a_key_label_is_added_once_with_its_marker_and_source() -> None:
|
||||
tree = Tree("Widevine")
|
||||
|
||||
dl.add_key_label(tree, KID_A, KEYS[KID_A], KID_A, "from cache")
|
||||
dl.add_key_label(tree, KID_A, KEYS[KID_A])
|
||||
dl.add_key_label(tree, KID_B, KEYS[KID_B], KID_A)
|
||||
|
||||
assert [str(child.label) for child in tree.children] == [
|
||||
f"[text2]{KID_A.hex}:{KEYS[KID_A]}* from cache",
|
||||
f"[text2]{KID_B.hex}:{KEYS[KID_B]}",
|
||||
]
|
||||
@@ -0,0 +1,106 @@
|
||||
"""Parse every public test manifest in tests/fixtures/manifests (refresh: scripts/fetch_manifest_corpus.py)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from collections import Counter
|
||||
from pathlib import Path
|
||||
from typing import Any, Union
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
||||
from unshackle.core.manifests import DASH, HLS, ISM
|
||||
from unshackle.core.tracks import Audio, Tracks, Video
|
||||
from unshackle.core.utils.xml import load_xml
|
||||
|
||||
CORPUS = Path(__file__).resolve().parent.parent / "fixtures" / "manifests"
|
||||
INDEX: list[dict[str, Any]] = json.loads((CORPUS / "index.json").read_text(encoding="utf-8"))
|
||||
|
||||
# file -> reason; strict, so a fix that makes one parse fails here until its entry is removed
|
||||
KNOWN_FAILURES: dict[str, str] = {}
|
||||
|
||||
|
||||
def cases(entries: list[dict[str, Any]]) -> list[Any]:
|
||||
return [
|
||||
pytest.param(e, id=e["file"], marks=pytest.mark.xfail(reason=KNOWN_FAILURES[e["file"]], strict=True))
|
||||
if e["file"] in KNOWN_FAILURES
|
||||
else pytest.param(e, id=e["file"])
|
||||
for e in entries
|
||||
]
|
||||
|
||||
|
||||
def parse(entry: dict[str, Any]) -> Tracks:
|
||||
"""Parse a fixture the way from_url does: XML from bytes, M3U8 decoded as UTF-8."""
|
||||
data = (CORPUS / entry["file"]).read_bytes()
|
||||
parser: Union[DASH, HLS, ISM]
|
||||
if entry["kind"] == "hls":
|
||||
parser = HLS.from_text(data.decode("utf-8"), entry["url"])
|
||||
else:
|
||||
parser = (DASH if entry["kind"] == "dash" else ISM)(load_xml(data), entry["url"])
|
||||
return parser.to_tracks("en")
|
||||
|
||||
|
||||
def most_per_set(tracks: list[Any]) -> int:
|
||||
return max(Counter(id(t.data["dash"]["adaptation_set"]) for t in tracks).values(), default=0)
|
||||
|
||||
|
||||
class NeedsNetwork(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def test_index_lists_every_known_failure() -> None:
|
||||
assert INDEX
|
||||
assert set(KNOWN_FAILURES) <= {e["file"] for e in INDEX}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("entry", cases(INDEX))
|
||||
def test_manifest_parses_to_tracks(entry: dict[str, Any]) -> None:
|
||||
tracks = parse(entry)
|
||||
|
||||
assert tracks.videos or tracks.audio or tracks.subtitles
|
||||
for track in tracks:
|
||||
# HLS CODECS is only a SHOULD (RFC 8216 4.3.4.2), so an HLS track can honestly have none
|
||||
assert track.codec is not None or entry["kind"] == "hls", track
|
||||
assert track.language, track
|
||||
|
||||
expect = entry.get("expect")
|
||||
if expect:
|
||||
assert most_per_set(tracks.videos) == expect["max_num_video"]
|
||||
assert most_per_set(tracks.audio) == expect["max_num_audio"]
|
||||
for codec_type, codecs, found in (
|
||||
(Video.Codec, expect["video_codec"], tracks.videos),
|
||||
(Audio.Codec, expect["audio_codec"], tracks.audio),
|
||||
):
|
||||
if codecs:
|
||||
assert {codec_type.from_codecs(c) for c in codecs.split(",")} <= {t.codec for t in found}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entry",
|
||||
[
|
||||
e
|
||||
for e in INDEX
|
||||
if e["kind"] == "dash"
|
||||
and e["file"] not in KNOWN_FAILURES
|
||||
and b'type="dynamic"' not in (CORPUS / e["file"]).read_bytes()
|
||||
],
|
||||
ids=lambda e: e["file"],
|
||||
)
|
||||
def test_dash_segments_and_drm_resolve_offline(entry: dict[str, Any]) -> None:
|
||||
"""Build the DRM and the segment list of every track; a track whose segment index must be fetched is skipped."""
|
||||
session = MagicMock()
|
||||
session.get.side_effect = NeedsNetwork
|
||||
for track in parse(entry):
|
||||
dash = track.data["dash"]
|
||||
manifest, adaptation_set, representation = dash["manifest"], dash["adaptation_set"], dash["representation"]
|
||||
DASH.get_drm(representation.findall("ContentProtection") + adaptation_set.findall("ContentProtection"))
|
||||
period = dash["period"] if dash.get("period") is not None else manifest.find("Period")
|
||||
try:
|
||||
_, segments, _, _, _ = DASH.get_period_segments(
|
||||
period, adaptation_set, representation, manifest, track, track.url, session, probe_kid=False
|
||||
)
|
||||
except NeedsNetwork:
|
||||
continue
|
||||
assert segments, track
|
||||
assert all(url.startswith(("http://", "https://")) for url, _ in segments), track
|
||||
@@ -19,7 +19,7 @@ import pytest
|
||||
from unshackle.core import binaries
|
||||
from unshackle.core.tracks import Audio, Subtitle, Tracks, Video
|
||||
from unshackle.core.tracks.track import (
|
||||
has_dts_uhd_sample_entry,
|
||||
has_mp4_only_audio_entry,
|
||||
iter_top_level_boxes,
|
||||
strip_duplicate_init_boxes,
|
||||
)
|
||||
@@ -36,9 +36,9 @@ def write_mp4(path: Path, sample_entry: bytes) -> Path:
|
||||
return path
|
||||
|
||||
|
||||
@pytest.mark.parametrize("fourcc", [b"dtsx", b"dtsy"])
|
||||
def test_dts_uhd_sample_entries_are_detected(tmp_path: Path, fourcc: bytes) -> None:
|
||||
assert has_dts_uhd_sample_entry(write_mp4(tmp_path / "a.mp4", fourcc)) is True
|
||||
@pytest.mark.parametrize("fourcc", [b"dtsx", b"dtsy", b"mha1", b"mha2", b"mhm1", b"mhm2"])
|
||||
def test_dts_uhd_and_mpeg_h_sample_entries_are_detected(tmp_path: Path, fourcc: bytes) -> None:
|
||||
assert has_mp4_only_audio_entry(write_mp4(tmp_path / "a.mp4", fourcc)) is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize("fourcc", [b"dtsc", b"dtse", b"dtsh", b"dtsl", b"ec-3", b"mp4a"])
|
||||
@@ -47,13 +47,13 @@ def test_other_dts_profiles_stay_in_matroska(tmp_path: Path, fourcc: bytes) -> N
|
||||
DTS:X Profile 1 is DTS-HD Master Audio underneath and Matroska stores it as
|
||||
A_DTS, so it must not be pulled out of Matroska by the DTS:X container rule.
|
||||
"""
|
||||
assert has_dts_uhd_sample_entry(write_mp4(tmp_path / "a.mp4", fourcc)) is False
|
||||
assert has_mp4_only_audio_entry(write_mp4(tmp_path / "a.mp4", fourcc)) is False
|
||||
|
||||
|
||||
def test_a_file_with_no_moov_is_not_detected(tmp_path: Path) -> None:
|
||||
path = tmp_path / "a.mp4"
|
||||
path.write_bytes(box(b"ftyp", b"isom") + box(b"mdat", b"dtsx" * 8))
|
||||
assert has_dts_uhd_sample_entry(path) is False, "a 4CC in mdat is not a sample entry"
|
||||
assert has_mp4_only_audio_entry(path) is False, "a 4CC in mdat is not a sample entry"
|
||||
|
||||
|
||||
def build_tracks(tmp_path: Path, audio_entry: bytes) -> Tracks:
|
||||
@@ -115,10 +115,10 @@ def test_other_audio_still_muxes_with_mkvmerge(tmp_path: Path, monkeypatch: pyte
|
||||
tracks.mux("Title", delete=False, output_path=tmp_path / "out.muxed.mkv")
|
||||
|
||||
|
||||
def test_a_missing_mp4box_names_the_install(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
def test_a_missing_mp4box_names_the_binary(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(binaries, "MP4Box", None, raising=False)
|
||||
tracks = build_tracks(tmp_path, b"dtsx")
|
||||
with pytest.raises(RuntimeError, match="gpac"):
|
||||
with pytest.raises(RuntimeError, match="MP4Box"):
|
||||
tracks.mux("Title", delete=False, output_path=tmp_path / "out.muxed.mkv")
|
||||
|
||||
|
||||
@@ -150,6 +150,30 @@ def test_substation_alpha_subtitles_are_left_out(tmp_path: Path, monkeypatch: py
|
||||
assert "s.vtt:lang=es" in command
|
||||
|
||||
|
||||
def test_mp4_subtitles_get_the_script_their_region_implies(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
captured: list[FakePopen] = []
|
||||
|
||||
def fake_popen(args: list[str], **kwargs: object) -> FakePopen:
|
||||
p = FakePopen(args, **kwargs)
|
||||
captured.append(p)
|
||||
Path(args[-1]).write_bytes(b"muxed")
|
||||
return p
|
||||
|
||||
monkeypatch.setattr(binaries, "MP4Box", Path("MP4Box"), raising=False)
|
||||
monkeypatch.setattr(subprocess, "Popen", fake_popen)
|
||||
|
||||
tracks = build_tracks(tmp_path, b"dtsx")
|
||||
vtt = Subtitle(id_="s1", url="https://x/s", codec=Subtitle.Codec.WebVTT, language="zh-TW")
|
||||
vtt.path = tmp_path / "s.vtt"
|
||||
vtt.path.write_text("WEBVTT\n")
|
||||
tracks.add(vtt)
|
||||
|
||||
tracks.mux("Title", delete=False, output_path=tmp_path / "out.muxed.mkv")
|
||||
command = captured[0].args
|
||||
assert f"{tmp_path / 's.vtt'}:lang=zh-Hant-TW" in command
|
||||
assert any(arg.endswith("=Chinese (Traditional)") for arg in command)
|
||||
|
||||
|
||||
def test_mp4box_errors_come_back_to_the_caller(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""A failed mux does not raise; the caller inspects the return code and lines."""
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ def header_length(path: Path) -> float:
|
||||
(Audio.Codec.ALAC, "alac", ".m4a"),
|
||||
(Audio.Codec.FLAC, "flac", ".flac"),
|
||||
(Audio.Codec.OPUS, "libopus", ".opus"),
|
||||
(Audio.Codec.MP3, "libmp3lame", ".mp3"),
|
||||
],
|
||||
)
|
||||
def test_remux_states_the_full_length_in_the_codec_container(
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
"""A bare UTF-16LE WRMHEADER in place of a PSSH box or PlayReady Object loads as PlayReady DRM."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import base64
|
||||
import logging
|
||||
from uuid import UUID
|
||||
|
||||
import m3u8
|
||||
import pytest
|
||||
from lxml import etree
|
||||
from pyplayready.misc.exceptions import InvalidPssh
|
||||
from pyplayready.system.pssh import PSSH
|
||||
from pywidevine.pssh import PSSH as WV_PSSH
|
||||
|
||||
from unshackle.core.drm import PlayReady, Widevine, drm_from_dict
|
||||
from unshackle.core.manifests.dash import DASH
|
||||
from unshackle.core.manifests.hls import HLS
|
||||
from unshackle.core.manifests.ism import ISM
|
||||
|
||||
KID = UUID("00112233-4455-6677-8899-aabbccddeeff")
|
||||
KID_B64 = base64.b64encode(KID.bytes_le).decode()
|
||||
PR_URN = "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95"
|
||||
WV_URN = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"
|
||||
|
||||
|
||||
def bare_header(version: str) -> str:
|
||||
"""Base64 of a bare WRMHEADER, with the KID where the given header version puts it."""
|
||||
if version == "4.0.0.0":
|
||||
data = f"<PROTECTINFO><KEYLEN>16</KEYLEN><ALGID>AESCTR</ALGID></PROTECTINFO><KID>{KID_B64}</KID>"
|
||||
else:
|
||||
data = f'<PROTECTINFO><KIDS><KID ALGID="AESCTR" VALUE="{KID_B64}"></KID></KIDS></PROTECTINFO>'
|
||||
xml = (
|
||||
f'<WRMHEADER xmlns="http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version="{version}">'
|
||||
f"<DATA>{data}<LA_URL>https://example.invalid/pr</LA_URL></DATA></WRMHEADER>"
|
||||
)
|
||||
return base64.b64encode(xml.encode("utf-16-le")).decode()
|
||||
|
||||
|
||||
def pr_protection(child: str, value: str) -> etree._Element:
|
||||
return etree.fromstring(
|
||||
f'<ContentProtection xmlns:cenc="urn:mpeg:cenc:2013" xmlns:mspr="urn:microsoft:playready" '
|
||||
f'schemeIdUri="{PR_URN}"><{child}>{value}</{child}></ContentProtection>'
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("version", ["4.0.0.0", "4.1.0.0", "4.2.0.0", "4.3.0.0"])
|
||||
@pytest.mark.parametrize("child", ["mspr:pro", "cenc:pssh"])
|
||||
def test_dash_loads_a_bare_header(child: str, version: str) -> None:
|
||||
drm = DASH.get_drm([pr_protection(child, bare_header(version))])
|
||||
|
||||
assert len(drm) == 1
|
||||
assert isinstance(drm[0], PlayReady)
|
||||
assert KID in drm[0].kids
|
||||
assert drm[0].pssh_b64
|
||||
PSSH(drm[0].pssh_b64)
|
||||
assert KID in drm_from_dict(drm[0].to_dict()).kids
|
||||
|
||||
|
||||
def test_wrapped_header_bytes_are_unchanged() -> None:
|
||||
header = bare_header("4.0.0.0")
|
||||
drm = PlayReady.from_pssh_b64(header)
|
||||
|
||||
assert drm.pssh.wrm_headers[0].dumps().encode("utf-16-le") == base64.b64decode(header)
|
||||
|
||||
|
||||
def test_dash_skips_an_unparseable_playready_entry_and_keeps_widevine(caplog: pytest.LogCaptureFixture) -> None:
|
||||
widevine = etree.fromstring(
|
||||
f'<ContentProtection xmlns:cenc="urn:mpeg:cenc:2013" schemeIdUri="{WV_URN}">'
|
||||
f"<cenc:pssh>{WV_PSSH.new(system_id=WV_PSSH.SystemId.Widevine, key_ids=[KID]).dumps()}</cenc:pssh>"
|
||||
"</ContentProtection>"
|
||||
)
|
||||
garbage = pr_protection("mspr:pro", base64.b64encode(b"\x00\x00not a header").decode())
|
||||
|
||||
with caplog.at_level(logging.WARNING, logger="DASH"):
|
||||
drm = DASH.get_drm([widevine, garbage])
|
||||
|
||||
assert [type(d) for d in drm] == [Widevine]
|
||||
assert "Skipping unparseable PlayReady ContentProtection" in caplog.text
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"data",
|
||||
[b"\x00\x00not a header", "<WRMHEADER/>".encode("utf-8")],
|
||||
ids=["garbage", "utf-8-header"],
|
||||
)
|
||||
def test_other_bad_data_keeps_the_original_error(data: bytes) -> None:
|
||||
with pytest.raises(InvalidPssh):
|
||||
PlayReady.from_pssh_b64(base64.b64encode(data).decode())
|
||||
|
||||
|
||||
def test_hls_loads_a_bare_header() -> None:
|
||||
key = m3u8.loads(
|
||||
"#EXTM3U\n"
|
||||
f'#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,URI="data:text/plain;charset=UTF-16;base64,{bare_header("4.0.0.0")}",'
|
||||
'KEYFORMAT="com.microsoft.playready",KEYFORMATVERSIONS="1"\n'
|
||||
"#EXTINF:4.0,\nseg0.mp4\n"
|
||||
).keys[0]
|
||||
|
||||
drm = HLS.get_drm(key)
|
||||
|
||||
assert isinstance(drm, PlayReady)
|
||||
assert KID in drm.kids
|
||||
|
||||
|
||||
def test_ism_loads_a_bare_header() -> None:
|
||||
header = etree.fromstring(f'<ProtectionHeader SystemID="{PR_URN[9:]}">{bare_header("4.0.0.0")}</ProtectionHeader>')
|
||||
|
||||
drm = ISM.get_drm([header])
|
||||
|
||||
assert len(drm) == 1
|
||||
assert KID in drm[0].kids
|
||||
@@ -63,6 +63,17 @@ def test_raise_errors_raises_the_load_failure() -> None:
|
||||
load_proxy_providers(OTHERS, raise_errors=True)
|
||||
|
||||
|
||||
def test_bare_query_order_follows_config_key_order_with_controld_last(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
from unshackle.core.proxies import ControlD
|
||||
|
||||
order = {"controld": {"token": "t"}, "surfsharkvpn": CREDENTIALS, "nordvpn": CREDENTIALS, "basic": {"us": "x"}}
|
||||
monkeypatch.setattr(config, "proxy_providers", order)
|
||||
monkeypatch.setattr(ControlD, "get_locations", lambda self: [])
|
||||
loaded = load_proxy_providers(("expressvpn", "protonvpn", "hola"), quiet=True)
|
||||
names = [getattr(p, "name", p.__class__.__name__) for p in loaded]
|
||||
assert names == ["Basic", "SurfsharkVPN", "NordVPN", "ControlD"]
|
||||
|
||||
|
||||
def test_rest_path_loads_windscribe_but_not_gluetun(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
from unshackle.core.proxies import Gluetun, WindscribeVPN
|
||||
from unshackle.core.proxies.resolve import initialize_proxy_providers
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import weakref
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
@@ -26,12 +27,31 @@ class Svc:
|
||||
def fallback(self) -> requests.Session:
|
||||
return run_proxy.fallback_session()
|
||||
|
||||
def helper_lookup(self, host: str) -> None:
|
||||
Helper().lookup(host)
|
||||
|
||||
def helper_fallback(self) -> requests.Session:
|
||||
return Helper().fallback()
|
||||
|
||||
|
||||
class Helper:
|
||||
"""A helper class of the service with its own HTTP session, which has no proxy."""
|
||||
|
||||
def __init__(self):
|
||||
self.session = requests.Session()
|
||||
|
||||
def lookup(self, host: str) -> None:
|
||||
lookup(host)
|
||||
|
||||
def fallback(self) -> requests.Session:
|
||||
return run_proxy.fallback_session()
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def watching(monkeypatch):
|
||||
monkeypatch.setattr(run_proxy, "watched", {})
|
||||
monkeypatch.setattr(run_proxy, "proxy_hosts", set())
|
||||
monkeypatch.setattr(run_proxy, "warned", set())
|
||||
monkeypatch.setattr(run_proxy, "warned", weakref.WeakKeyDictionary())
|
||||
run_proxy.watch(Svc, PROXY)
|
||||
|
||||
|
||||
@@ -109,7 +129,9 @@ def test_raw_socket_connect_to_a_host_name_warns(caplog, address, warns):
|
||||
assert bool(leaks(caplog)) is warns
|
||||
|
||||
|
||||
def test_core_frame_ends_the_walk(caplog):
|
||||
def test_core_frame_ends_the_walk(caplog, monkeypatch):
|
||||
"""A core lookup returns before the CDM host set is built, which a server does for every request it sends."""
|
||||
monkeypatch.setattr(run_proxy, "cdm_hosts", lambda: pytest.fail("cdm_hosts() ran for a core lookup"))
|
||||
with caplog.at_level(logging.WARNING):
|
||||
source = "sys.audit('socket.getaddrinfo', 'vault.example', 443, 0, 0, 0)"
|
||||
run_as(os.path.join(run_proxy.CORE_DIR, "core", "vaults.py"), source)
|
||||
@@ -149,6 +171,39 @@ def test_service_instance_uses_the_proxy_of_its_own_run(caplog):
|
||||
assert {r.name for r in caplog.records if r.getMessage() in leaks(caplog)} == {"Svc"}
|
||||
|
||||
|
||||
def test_a_reloaded_service_class_uses_the_proxy_of_its_own_run(caplog):
|
||||
"""A service reload makes a new class from the same directory; the watch still holds the old one."""
|
||||
reloaded = type("Svc", (), {"__init__": Svc.__init__, "lookup": Svc.lookup})
|
||||
with caplog.at_level(logging.WARNING):
|
||||
reloaded().lookup("direct.example") # a run with no proxy
|
||||
reloaded(PROXY).lookup("leak.example")
|
||||
assert len(leaks(caplog)) == 1
|
||||
assert "leak.example" in leaks(caplog)[0]
|
||||
|
||||
|
||||
def test_a_subclass_of_the_service_uses_the_proxy_of_its_own_run(caplog):
|
||||
sub = type("Sub", (Svc,), {})
|
||||
with caplog.at_level(logging.WARNING):
|
||||
sub().lookup("direct.example")
|
||||
assert leaks(caplog) == []
|
||||
|
||||
|
||||
def test_a_helper_session_without_proxy_does_not_hide_a_leak(caplog):
|
||||
"""A helper class of the service is not the service instance, so the proxy of the run still decides."""
|
||||
with caplog.at_level(logging.WARNING):
|
||||
Svc(PROXY).helper_lookup("leak.example")
|
||||
assert len(leaks(caplog)) == 1
|
||||
assert Svc(PROXY).helper_fallback().proxies == {"all": PROXY}
|
||||
|
||||
|
||||
def test_each_run_warns_even_when_a_finished_run_had_the_same_id(caplog):
|
||||
"""CPython reuses the id of a freed instance, so the warned hosts belong to the instance itself."""
|
||||
with caplog.at_level(logging.WARNING):
|
||||
for _ in range(2):
|
||||
Svc(PROXY).lookup("leak.example")
|
||||
assert len(leaks(caplog)) == 2
|
||||
|
||||
|
||||
def test_fallback_session_takes_the_proxy_of_the_calling_run():
|
||||
session = Svc("http://own.example:1").fallback()
|
||||
assert session.proxies == {"all": "http://own.example:1"}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Unit tests for remote git service-repo resolution. No network, no real git."""
|
||||
"""Unit tests for remote git service-repo resolution. No network; only the bytecode tests run a real git."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -245,6 +245,66 @@ def test_changed_services_up_to_date(monkeypatch):
|
||||
assert service_repo.changed_services(Path("/x"), "same", "same") == []
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def bytecode_clone(tmp_path):
|
||||
"""A clone of a repo that commits a ``.pyc``, with that ``.pyc`` rewritten as an import does."""
|
||||
git = service_repo.binaries.Git
|
||||
if not git:
|
||||
pytest.skip("git not found")
|
||||
upstream, dest = tmp_path / "upstream", tmp_path / "clone"
|
||||
(upstream / "EXAMPLE" / "__pycache__").mkdir(parents=True)
|
||||
(upstream / "EXAMPLE" / "__init__.py").write_text("X = 1\n")
|
||||
(upstream / "EXAMPLE" / "__pycache__" / "__init__.cpython-312.pyc").write_bytes(b"old")
|
||||
|
||||
def run(*args: str, cwd: Path = upstream) -> None:
|
||||
subprocess.run(
|
||||
[git, "-c", "user.name=t", "-c", "user.email=t@t", "-c", "commit.gpgsign=false", *args],
|
||||
cwd=cwd,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
)
|
||||
|
||||
run("init", "-q", "-b", "main")
|
||||
run("add", "-A")
|
||||
run("commit", "-qm", "init")
|
||||
run("clone", "-q", str(upstream), str(dest), cwd=tmp_path)
|
||||
(dest / "EXAMPLE" / "__pycache__" / "__init__.cpython-312.pyc").write_bytes(b"rewritten")
|
||||
return upstream, dest, run
|
||||
|
||||
|
||||
def test_rewritten_bytecode_does_not_block_pull(bytecode_clone, tmp_path):
|
||||
upstream, dest, run = bytecode_clone
|
||||
assert service_repo.is_dirty(dest) is False
|
||||
assert service_repo.local_dirty_services(dest) == []
|
||||
(upstream / "EXAMPLE" / "__init__.py").write_text("X = 2\n")
|
||||
(upstream / "EXAMPLE" / "__pycache__" / "__init__.cpython-312.pyc").write_bytes(b"new")
|
||||
run("commit", "-qam", "update")
|
||||
service_repo.pull(dest, tmp_path / "stamp")
|
||||
assert (dest / "EXAMPLE" / "__init__.py").read_text() == "X = 2\n"
|
||||
|
||||
|
||||
def test_source_edit_still_dirty_beside_bytecode(bytecode_clone):
|
||||
_, dest, _ = bytecode_clone
|
||||
(dest / "EXAMPLE" / "__init__.py").write_text("X = 3\n")
|
||||
assert service_repo.is_dirty(dest) is True
|
||||
assert service_repo.local_dirty_services(dest) == ["EXAMPLE"]
|
||||
|
||||
|
||||
def test_untracked_bytecode_does_not_block_pull(bytecode_clone, tmp_path):
|
||||
upstream, dest, run = bytecode_clone
|
||||
(dest / "EXAMPLE" / "__pycache__" / "__init__.cpython-314.pyc").write_bytes(b"local")
|
||||
(dest / "OTHER").mkdir()
|
||||
(dest / "OTHER" / "__init__.py").write_text("")
|
||||
(dest / "OTHER" / "__init__.cpython-314-x86_64-linux-gnu.so").write_bytes(b"compiled")
|
||||
(upstream / "EXAMPLE" / "__init__.py").write_text("X = 2\n")
|
||||
(upstream / "EXAMPLE" / "__pycache__" / "__init__.cpython-314.pyc").write_bytes(b"upstream")
|
||||
run("add", "-A")
|
||||
run("commit", "-qm", "update")
|
||||
service_repo.pull(dest, tmp_path / "stamp")
|
||||
assert (dest / "EXAMPLE" / "__init__.py").read_text() == "X = 2\n"
|
||||
assert (dest / "OTHER" / "__init__.cpython-314-x86_64-linux-gnu.so").read_bytes() == b"compiled"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("order", [["a", "b"], ["b", "a"]])
|
||||
def test_collision_first_source_wins(tmp_path, order):
|
||||
"""Discovery dedupes by tag honoring list order: the FIRST source to define a tag wins,
|
||||
|
||||
@@ -121,3 +121,11 @@ def test_overdue_staged_service_applies_while_busy(service_dir: Path, monkeypatc
|
||||
assert services.apply_pending(busy={"FOO"}) == ["FOO"]
|
||||
assert services.MODULES["FOO"].VERSION == 2
|
||||
assert services.PENDING == set() and "FOO" not in services.PENDING_SINCE
|
||||
|
||||
|
||||
def test_service_that_exits_on_import_fails_its_reload_only(service_dir: Path):
|
||||
"""A service calling sys.exit at import time is a load error, not a stop of the process."""
|
||||
(service_dir / "FOO" / "__init__.py").write_text("import sys\nsys.exit(1)\n")
|
||||
os.utime(service_dir / "FOO" / "__init__.py", (time.time() + 9, time.time() + 9))
|
||||
services.reload_services(["FOO"])
|
||||
assert services.LOAD_ERRORS and services.LOAD_ERRORS[-1].startswith("FOO: failed to import - SystemExit")
|
||||
|
||||
@@ -27,3 +27,11 @@ def test_retry_log_counts_only_real_retries(rate_limited, caplog, max_retries):
|
||||
|
||||
retries = [r.getMessage() for r in caplog.records if "Retrying" in r.getMessage()]
|
||||
assert retries == [f"429 Too Many Requests(/x). Retrying... ({n}/{max_retries})" for n in range(1, max_retries + 1)]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("max_retries", "attempts"), [(0, ""), (2, " after 3 attempts")])
|
||||
def test_spent_budget_names_the_attempts_and_host_not_the_url(rate_limited, max_retries, attempts):
|
||||
with pytest.raises(MaxRetriesError) as raised:
|
||||
rate_limited.get("https://example.invalid/x?hmac=secret", max_retries=max_retries)
|
||||
|
||||
assert str(raised.value) == f"GET example.invalid failed{attempts}: 429 Too Many Requests"
|
||||
|
||||
@@ -287,6 +287,26 @@ def test_cdm_returning_the_flagged_key_clears_the_flag(tmp_path: Path, monkeypat
|
||||
assert not local.is_bad_key(KID, BAD)
|
||||
|
||||
|
||||
def test_a_licence_key_that_replaces_a_bad_local_pair_is_stored(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
"""The local vault held the bad pair when the licence key arrived, so it skipped the KID; store it now."""
|
||||
local = SQLite("local", tmp_path / "local.db")
|
||||
local.add_key("SVC", KID, BAD)
|
||||
vaults = Vaults("SVC")
|
||||
vaults.vaults = [local]
|
||||
cmd = make_cmd(monkeypatch, vaults)
|
||||
drm = FakeDRM({KID: vaults.get_key(KID)[0]})
|
||||
path = tmp_path / "video.mp4"
|
||||
path.write_bytes(b"cipher")
|
||||
assert local.add_keys("SVC", {KID: GOOD}) == 0
|
||||
|
||||
cmd.decrypt_verified(drm, path, lambda drm, track_kid: drm.content_keys.update({KID: GOOD}), KID)
|
||||
cmd.wait_vault_writes()
|
||||
assert local.is_bad_key(KID, BAD)
|
||||
assert local.get_key(KID, "SVC") == GOOD
|
||||
|
||||
|
||||
def test_stale_backup_from_a_killed_run_is_not_restored(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
poisoned = Remote("poisoned", tmp_path / "poisoned.db")
|
||||
poisoned.add_key("SVC", KID, BAD)
|
||||
@@ -426,7 +446,7 @@ def test_only_the_kid_whose_window_fails_is_flagged(tmp_path: Path, monkeypatch:
|
||||
|
||||
|
||||
def test_a_kid_absent_from_the_map_is_judged_by_the_fallback(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""A KID the map does not know (a zero-KID tenc, a licence KID the file does not carry)
|
||||
"""A map that holds an all-zero tenc KID is not complete, so a KID it does not know
|
||||
shares the whole-file verdict, and a wrong key there is flagged."""
|
||||
lead = UUID(int=7)
|
||||
local = SQLite("local", tmp_path / "local.db")
|
||||
@@ -446,7 +466,9 @@ def test_a_kid_absent_from_the_map_is_judged_by_the_fallback(tmp_path: Path, mon
|
||||
return drm.decrypted_with[-1][lead if start is not None else KID] == GOOD
|
||||
|
||||
monkeypatch.setattr(
|
||||
dl_module.verify, "kid_windows", lambda path: dl_module.verify.KidMap({lead: [(4.0, 6.0)]}, True)
|
||||
dl_module.verify,
|
||||
"kid_windows",
|
||||
lambda path: dl_module.verify.KidMap({lead: [(4.0, 6.0)], UUID(int=0): [(8.0, 10.0)]}, True),
|
||||
)
|
||||
monkeypatch.setattr(dl_module, "ffmpeg_decodes", decodes)
|
||||
path = tmp_path / "video.mp4"
|
||||
@@ -501,11 +523,93 @@ def test_a_wrong_mapped_key_does_not_flag_a_kid_the_file_does_not_carry(
|
||||
assert drm.content_keys == {audio: GOOD, KID: GOOD}
|
||||
assert local.is_bad_key(KID, BAD)
|
||||
assert not local.is_bad_key(audio, GOOD)
|
||||
assert local.get_key(audio, "SVC") == GOOD # judged on the retry and copied
|
||||
assert local.get_key(audio, "SVC") is None
|
||||
|
||||
|
||||
def test_a_kid_the_file_does_not_carry_is_not_judged_by_it(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""The CDM licensed the video KID and a vault served the audio KID. An FFmpeg that fails
|
||||
every decode of the video file must not flag the audio KID, nor copy it to another vault."""
|
||||
audio = UUID(int=7)
|
||||
local = SQLite("local", tmp_path / "local.db")
|
||||
remote = Remote("remote", tmp_path / "remote.db")
|
||||
remote.add_key("SVC", audio, GOOD)
|
||||
vaults = Vaults("SVC")
|
||||
vaults.vaults = [local, remote]
|
||||
cmd = make_cmd(monkeypatch, vaults)
|
||||
drm = FakeDRM({audio: vaults.get_key(audio)[0], KID: GOOD})
|
||||
monkeypatch.setattr(
|
||||
dl_module.verify, "kid_windows", lambda path: dl_module.verify.KidMap({KID: [(4.0, 6.0)]}, True)
|
||||
)
|
||||
monkeypatch.setattr(dl_module, "ffmpeg_decodes", lambda path, start=None, seconds=3, video=None: False)
|
||||
path = tmp_path / "video.mp4"
|
||||
path.write_bytes(b"cipher")
|
||||
licences: list[UUID] = []
|
||||
|
||||
cmd.decrypt_verified(drm, path, lambda drm, track_kid: licences.append(track_kid), KID)
|
||||
cmd.wait_vault_writes()
|
||||
assert drm.content_keys == {audio: GOOD, KID: GOOD}
|
||||
assert not licences
|
||||
assert not local.is_bad_key(audio, GOOD)
|
||||
assert local.get_key(audio, "SVC") is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("served", "decodes", "told"),
|
||||
[
|
||||
(GOOD, False, False), # broken FFmpeg, the CDM returns the same key
|
||||
(BAD, True, True), # the CDM returns another key
|
||||
],
|
||||
)
|
||||
def test_a_remote_vault_is_told_only_when_another_key_replaces_its_pair(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, served: str, decodes: bool, told: bool
|
||||
) -> None:
|
||||
remote = Remote("remote", tmp_path / "remote.db")
|
||||
remote.add_key("SVC", KID, served)
|
||||
vaults = Vaults("SVC")
|
||||
vaults.vaults = [SQLite("local", tmp_path / "local.db"), remote]
|
||||
cmd = make_cmd(monkeypatch, vaults)
|
||||
if not decodes:
|
||||
monkeypatch.setattr(dl_module, "ffmpeg_decodes", lambda path, start=None, seconds=3, video=None: False)
|
||||
drm = FakeDRM({KID: vaults.get_key(KID)[0]})
|
||||
path = tmp_path / "video.mp4"
|
||||
path.write_bytes(b"cipher")
|
||||
|
||||
def licence(drm: FakeDRM, track_kid: UUID) -> None:
|
||||
assert not remote.is_bad_key(KID, served)
|
||||
drm.content_keys[KID] = GOOD
|
||||
|
||||
cmd.decrypt_verified(drm, path, licence, KID)
|
||||
assert drm.content_keys == {KID: GOOD}
|
||||
assert remote.is_bad_key(KID, served) is told
|
||||
|
||||
|
||||
def test_the_server_vault_is_told_at_once(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Over --remote the report is what makes the server skip the pair on the next licence."""
|
||||
reports: list[tuple[UUID, str]] = []
|
||||
server = SimpleNamespace(
|
||||
name="server_cdm",
|
||||
local=False,
|
||||
report_now=True,
|
||||
flag_bad_key=lambda service, kid, key, source: reports.append((kid, key)),
|
||||
)
|
||||
vaults = Vaults("SVC")
|
||||
vaults.vaults = [SQLite("local", tmp_path / "local.db")]
|
||||
vaults.sources[KID] = (BAD, server)
|
||||
cmd = make_cmd(monkeypatch, vaults)
|
||||
drm = FakeDRM({KID: BAD})
|
||||
path = tmp_path / "video.mp4"
|
||||
path.write_bytes(b"cipher")
|
||||
|
||||
def licence(drm: FakeDRM, track_kid: UUID) -> None:
|
||||
assert reports == [(KID, BAD)]
|
||||
drm.content_keys[KID] = GOOD
|
||||
|
||||
cmd.decrypt_verified(drm, path, licence, KID)
|
||||
assert drm.content_keys == {KID: GOOD}
|
||||
|
||||
|
||||
def test_only_checked_kids_are_copied_to_other_vaults(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Both the mapped KID and the absent one are proven before they reach another vault."""
|
||||
"""Only the mapped KID is proven and copied; the KID this file does not carry waits for its own file."""
|
||||
lead = UUID(int=7)
|
||||
local = SQLite("local", tmp_path / "local.db")
|
||||
remote = Remote("remote", tmp_path / "remote.db")
|
||||
@@ -530,9 +634,35 @@ def test_only_checked_kids_are_copied_to_other_vaults(tmp_path: Path, monkeypatc
|
||||
|
||||
cmd.decrypt_verified(drm, path, None, KID)
|
||||
cmd.wait_vault_writes()
|
||||
assert starts.count(None) == 1 # the absent KID went through the fallback before its copy
|
||||
assert None not in starts
|
||||
assert local.get_key(lead, "SVC") == GOOD
|
||||
assert local.get_key(KID, "SVC") == GOOD
|
||||
assert local.get_key(KID, "SVC") is None
|
||||
|
||||
|
||||
def test_a_clear_file_judges_and_copies_no_vault_key(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
local = SQLite("local", tmp_path / "local.db")
|
||||
remote = Remote("remote", tmp_path / "remote.db")
|
||||
remote.add_key("SVC", KID, BAD)
|
||||
vaults = Vaults("SVC")
|
||||
vaults.vaults = [local, remote]
|
||||
cmd = make_cmd(monkeypatch, vaults)
|
||||
drm = FakeDRM({KID: vaults.get_key(KID)[0]})
|
||||
checks: list = []
|
||||
|
||||
def decodes(path: Path, start: object = None, seconds: float = 3, video: object = None) -> bool:
|
||||
checks.append(start)
|
||||
return True
|
||||
|
||||
monkeypatch.setattr(dl_module.verify, "kid_windows", lambda path: dl_module.verify.KidMap({}, False))
|
||||
monkeypatch.setattr(dl_module, "ffmpeg_decodes", decodes)
|
||||
path = tmp_path / "audio.mp4"
|
||||
path.write_bytes(b"clear")
|
||||
|
||||
cmd.decrypt_verified(drm, path, None, KID)
|
||||
cmd.wait_vault_writes()
|
||||
assert checks == []
|
||||
assert local.get_key(KID, "SVC") is None
|
||||
assert not local.is_bad_key(KID, BAD)
|
||||
|
||||
|
||||
def test_flagged_pair_warns_once_per_vault(tmp_path: Path, caplog: pytest.LogCaptureFixture) -> None:
|
||||
@@ -602,6 +732,8 @@ def test_api_vault_reports_the_pair_upstream(monkeypatch: pytest.MonkeyPatch, ca
|
||||
vaults.vaults = [api]
|
||||
vaults.sources[KID] = (BAD, api)
|
||||
vaults.flag_bad_key(KID, BAD)
|
||||
assert not calls
|
||||
vaults.report_replaced({KID: GOOD})
|
||||
vaults.unflag_bad_key(KID, BAD)
|
||||
|
||||
assert calls == [
|
||||
@@ -609,28 +741,31 @@ def test_api_vault_reports_the_pair_upstream(monkeypatch: pytest.MonkeyPatch, ca
|
||||
("DELETE", f"https://vault.example/bad-keys/{KID.hex}/{BAD}", None),
|
||||
]
|
||||
|
||||
def flag_and_replace(source: object) -> None:
|
||||
vaults.sources[KID] = (BAD, source)
|
||||
vaults.flag_bad_key(KID, BAD)
|
||||
vaults.report_replaced({KID: GOOD})
|
||||
|
||||
calls.clear()
|
||||
vaults.sources[KID] = (BAD, SimpleNamespace(name="other"))
|
||||
vaults.flag_bad_key(KID, BAD)
|
||||
flag_and_replace(SimpleNamespace(name="other", local=False, report_now=False))
|
||||
assert calls == []
|
||||
vaults.sources[KID] = (BAD, api)
|
||||
|
||||
monkeypatch.setattr(api.session, "post", lambda url, **kw: (_ for _ in ()).throw(ConnectionError("down")))
|
||||
caplog.clear()
|
||||
with caplog.at_level(logging.DEBUG, logger="unshackle.core.vaults"):
|
||||
vaults.flag_bad_key(KID, BAD)
|
||||
flag_and_replace(api)
|
||||
assert [r.levelname for r in caplog.records] == ["DEBUG"]
|
||||
|
||||
gone = SimpleNamespace(status_code=404, raise_for_status=lambda: (_ for _ in ()).throw(RuntimeError("404")))
|
||||
monkeypatch.setattr(api.session, "post", lambda url, **kw: gone)
|
||||
caplog.clear()
|
||||
vaults.flag_bad_key(KID, BAD)
|
||||
flag_and_replace(api)
|
||||
assert not caplog.records
|
||||
|
||||
denied = SimpleNamespace(status_code=200, raise_for_status=lambda: None, json=lambda: {"code": 1, "message": "no"})
|
||||
monkeypatch.setattr(api.session, "post", lambda url, **kw: denied)
|
||||
monkeypatch.setattr(api.session, "delete", lambda url, **kw: denied)
|
||||
vaults.flag_bad_key(KID, BAD)
|
||||
flag_and_replace(api)
|
||||
vaults.unflag_bad_key(KID, BAD)
|
||||
assert not caplog.records
|
||||
|
||||
|
||||
@@ -39,6 +39,9 @@ def fake_server_vaults(pushes: list, vault_list: list[FakeVault]) -> Any:
|
||||
def __len__(self) -> int:
|
||||
return len(vault_list)
|
||||
|
||||
def clear_licensed_flags(self, content_keys: dict) -> list:
|
||||
return []
|
||||
|
||||
def add_keys(self, key_map: dict) -> int:
|
||||
pushes.append(key_map)
|
||||
return sum(vault.ok for vault in vault_list)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
"""A segment that fails every attempt reports the attempts and the cause, without the signed URL."""
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from unshackle.commands.dl import dl
|
||||
from unshackle.core.downloaders.requests import download, retries_exhausted
|
||||
from unshackle.core.session import MaxRetriesError, RnetSession, failure_reason
|
||||
|
||||
downloader = sys.modules[download.__module__]
|
||||
|
||||
SIGNED_URL = "https://cdn.example.invalid/dvt2=exp=1~hmac=deadbeef/seg/40_000.mp4a"
|
||||
RNET_BROKEN_PIPE = (
|
||||
f'is_request error: wreq::Error {{ kind: Request, url: "{SIGNED_URL}", source: hyper::Error(Io, '
|
||||
'Custom { kind: BrokenPipe, error: "stream closed because of a broken pipe" }) }'
|
||||
)
|
||||
|
||||
|
||||
class RequestError(Exception):
|
||||
"""Stands in for rnet.RequestError, which carries the URL in its text."""
|
||||
|
||||
|
||||
def test_failure_reason_keeps_the_rnet_error_text_and_drops_the_url():
|
||||
reason = failure_reason(MaxRetriesError("m", cause=RequestError(RNET_BROKEN_PIPE)))
|
||||
|
||||
assert reason == "RequestError (stream closed because of a broken pipe)"
|
||||
|
||||
|
||||
def test_spent_retries_report_one_line_without_the_url(monkeypatch, tmp_path):
|
||||
session = RnetSession()
|
||||
calls = []
|
||||
|
||||
def get(url, **kwargs):
|
||||
calls.append(kwargs.get("max_retries"))
|
||||
raise MaxRetriesError("GET cdn.example.invalid failed: x", cause=RequestError(RNET_BROKEN_PIPE))
|
||||
|
||||
monkeypatch.setattr(session, "get", get)
|
||||
monkeypatch.setattr(downloader, "retry_sleep", lambda exc, attempts: 0)
|
||||
|
||||
with pytest.raises(MaxRetriesError) as raised:
|
||||
for _ in download(url=SIGNED_URL, save_path=tmp_path / "seg", session=session):
|
||||
pass
|
||||
|
||||
assert calls == [0] * downloader.MAX_ATTEMPTS
|
||||
assert retries_exhausted(raised.value)
|
||||
assert not retries_exhausted(ValueError("boom"))
|
||||
header, line = dl.failure_lines(raised.value)
|
||||
assert f"gave up after {downloader.MAX_ATTEMPTS} failed attempts" in line
|
||||
assert "hmac" not in line
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Generated Sat Jun 01 21:01:19 2013 by Dolby Media Generator, Version 2013May16.160953 -->
|
||||
<MPD
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dolby="http://www.dolby.com/ns/online/DASH"
|
||||
xmlns="urn:mpeg:dash:schema:mpd:2011"
|
||||
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011"
|
||||
type="static"
|
||||
mediaPresentationDuration="PT0H0M30.030S"
|
||||
minBufferTime="PT1.2S"
|
||||
profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://dashif.org/guidelines/dash264">
|
||||
|
||||
<BaseURL>./</BaseURL>
|
||||
|
||||
<Period>
|
||||
<!-- Video -->
|
||||
<AdaptationSet mimeType="video/mp4" codecs="avc1.42801e" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="1" bandwidth="519264" width="640" height="480">
|
||||
<BaseURL>ChID_voices_51_256_ddp_V.mp4</BaseURL>
|
||||
<SegmentBase indexRange="742-953">
|
||||
<Initialization range="0-741"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<!-- Audio -->
|
||||
<AdaptationSet mimeType="audio/mp4" codecs="ec-3" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="2" bandwidth="256000">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:dolby:dash:audio_channel_configuration:2011" value="F801"/>
|
||||
<BaseURL>ChID_voices_51_256_ddp_A.mp4</BaseURL>
|
||||
<SegmentBase indexRange="603-766">
|
||||
<Initialization range="0-602"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" ?>
|
||||
<MPD mediaPresentationDuration="PT11.5416666667S" minBufferTime="PT2S" profiles="http://dashif.org/guidelines/dash264,urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd">
|
||||
<BaseURL>./</BaseURL>
|
||||
<Period>
|
||||
<AdaptationSet codecs="avc1.42c01e" contentType="video" frameRate="24/1" height="480" mimeType="video/mp4" par="16:9" scanType="progressive" subsegmentAlignment="true" subsegmentStartsWithSAP="1" width="848">
|
||||
<Representation bandwidth="1501728" id="6chID_848x480_24fps-avc1.42c01e-11s-848x480-h264-1500000bps_seg" sar="1:1">
|
||||
<BaseURL>6chID_848x480_24fps-avc1.42c01e-11s-848x480-h264-1500000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="685-752">
|
||||
<Initialization range="0-684"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet codecs="mp4a.40.5" contentType="audio" lang="en" mimeType="audio/mp4" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:mpegB:cicp:ChannelConfiguration" value="6"/>
|
||||
<Representation audioSamplingRate="48000" bandwidth="163750" id="6ch_ident_48kHz-en-11s-6-heaac-160000bps_seg">
|
||||
<BaseURL>6ch_ident_48kHz-en-11s-6-heaac-160000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-676">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" ?>
|
||||
<MPD mediaPresentationDuration="PT11.5416666667S" minBufferTime="PT2S" profiles="http://dashif.org/guidelines/dash264,urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd">
|
||||
<BaseURL>./</BaseURL>
|
||||
<Period>
|
||||
<AdaptationSet codecs="avc1.42c01e" contentType="video" frameRate="24/1" height="480" mimeType="video/mp4" par="16:9" scanType="progressive" subsegmentAlignment="true" subsegmentStartsWithSAP="1" width="848">
|
||||
<Representation bandwidth="1501728" id="6chID_848x480_24fps-avc1.42c01e-11s-848x480-h264-1500000bps_seg" sar="1:1">
|
||||
<BaseURL>6chID_848x480_24fps-avc1.42c01e-11s-848x480-h264-1500000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="685-752">
|
||||
<Initialization range="0-684"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet codecs="mp4a.40.30" contentType="audio" lang="en" mimeType="audio/mp4" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:mpegB:cicp:ChannelConfiguration" value="6"/>
|
||||
<Representation audioSamplingRate="48000" bandwidth="99426" id="6ch_ident_48kHz-en-11s-6-mps-96000bps_seg">
|
||||
<BaseURL>6ch_ident_48kHz-en-11s-6-mps-96000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="622-689">
|
||||
<Initialization range="0-621"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" ?>
|
||||
<MPD mediaPresentationDuration="PT68.4583333333S" minBufferTime="PT2S" profiles="http://dashif.org/guidelines/dash264,urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd">
|
||||
<BaseURL>./</BaseURL>
|
||||
<Period>
|
||||
<AdaptationSet codecs="avc1.42c01e" contentType="video" frameRate="24/1" height="476" mimeType="video/mp4" par="16:9" scanType="progressive" subsegmentAlignment="true" subsegmentStartsWithSAP="1" width="848">
|
||||
<Representation bandwidth="1501687" id="German_Forest_SHORT_1v0-avc1.42c01e-68s-848x476-h264-1500000bps_seg" sar="1:1">
|
||||
<BaseURL>German_Forest_SHORT_1v0-avc1.42c01e-68s-848x476-h264-1500000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="686-885">
|
||||
<Initialization range="0-685"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet codecs="mp4a.40.2" contentType="audio" lang="en" mimeType="audio/mp4" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:mpegB:cicp:ChannelConfiguration" value="2"/>
|
||||
<Representation audioSamplingRate="48000" bandwidth="131152" id="German_Forest_Short_Poem_english-en-68s-2-lc-128000bps_seg">
|
||||
<BaseURL>German_Forest_Short_Poem_english-en-68s-2-lc-128000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="606-805">
|
||||
<Initialization range="0-605"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet codecs="mp4a.40.2" contentType="audio" lang="de" mimeType="audio/mp4" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:mpegB:cicp:ChannelConfiguration" value="2"/>
|
||||
<Representation audioSamplingRate="48000" bandwidth="131152" id="German_Forest_Short_Poem_german-de-68s-2-lc-128000bps_seg">
|
||||
<BaseURL>German_Forest_Short_Poem_german-de-68s-2-lc-128000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="606-805">
|
||||
<Initialization range="0-605"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev91-g0930dfa-master on 2015-03-12T15:12:29Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT0H12M14.17S" maxSegmentDuration="PT0H0M2.00S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://dashif.org/guidelines/dash264,http://dashif.org/guidelines/dash-if-simple">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/DASH_HEVC_TestVectors/TearsOfSteel/OnDemand/MultiRate/TOS_OnDemand_HEVC_MultiRate.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H12M14.17S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="24" par="16:9" lang="eng" subsegmentStartsWithSAP="1" contentType="video">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="470596">
|
||||
<BaseURL>tears_of_steel_720p_500k_H265_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1798-6245"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1246133">
|
||||
<BaseURL>tears_of_steel_720p_1000k_H265_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1850-6297"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="2496699">
|
||||
<BaseURL>tears_of_steel_720p_2000k_H265_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1850-6297"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" lang="eng" subsegmentStartsWithSAP="1" contentType="audio">
|
||||
<Representation id="4" mimeType="audio/mp4" codecs="mp4a.40.29" audioSamplingRate="48000" startWithSAP="1" bandwidth="65203">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<BaseURL>tears_of_steel_64k_audio_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="849-5380">
|
||||
<Initialization range="0-848"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev91-g0930dfa-master on 2015-03-24T15:39:33Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT0H9M56.29S" maxSegmentDuration="PT0H0M2.00S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://dashif.org/guidelines/dash-if-simple">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/DASH_HEVC_TestVectors/BigBuckBunny/1a/1/BBB_OnDemand_HEVC_MultiRate.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H9M56.29S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="24" par="16:9" lang="und" subsegmentStartsWithSAP="1">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="429713">
|
||||
<BaseURL>bbb_720p_500k_H265_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1848-5467"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1141159">
|
||||
<BaseURL>bbb_720p_1000k_H265_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1850-5469"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="2281166">
|
||||
<BaseURL>bbb_720p_2000k_H265_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1850-5469"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" lang="und" subsegmentStartsWithSAP="1">
|
||||
<Representation id="4" mimeType="audio/mp4" codecs="mp4a.40.29" audioSamplingRate="48000" startWithSAP="1" bandwidth="65606">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<BaseURL>bbb_64k_audio_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="849-4528">
|
||||
<Initialization range="0-848"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev710-g713274f-master at 2015-10-14T09:01:54.894Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H12M14.167S" maxSegmentDuration="PT0H0M2.005S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://dashif.org/guidelines/dash-if-simple">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/Dashcontent/1/tos_720_Multirate_HEVC_ondemand.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H12M14.167S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="24" par="1:1" lang="und" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hvc1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="515353">
|
||||
<BaseURL>tos_720p_500k_H265_hvc1_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="948-5395">
|
||||
<Initialization range="0-947"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hvc1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1030940">
|
||||
<BaseURL>tos_720p_1000k_H265_hvc1_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="948-5395">
|
||||
<Initialization range="0-947"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hvc1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="2068688">
|
||||
<BaseURL>tos_720p_2000k_H265_hvc1_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="948-5395">
|
||||
<Initialization range="0-947"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" par="1:1" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="4" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="65928">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<BaseURL>tos_64k_audio_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="847-5294">
|
||||
<Initialization range="0-846"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="urn:mpeg:dash:schema:mpd:2011"
|
||||
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
||||
type="static"
|
||||
mediaPresentationDuration="PT654S"
|
||||
minBufferTime="PT4S"
|
||||
profiles="http://dashif.org/guidelines/dash264,urn:mpeg:dash:profile:isoff-on-demand:2011">
|
||||
|
||||
<BaseURL>http://dash.edgesuite.net/dash264/TestCases/1a/netflix/</BaseURL>
|
||||
<Period>
|
||||
<!-- English Audio -->
|
||||
<AdaptationSet mimeType="audio/mp4" codecs="mp4a.40.5" lang="en" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="1" bandwidth="72000">
|
||||
<BaseURL>ElephantsDream_AAC48K_064.mp4.dash</BaseURL>
|
||||
<SegmentBase indexRange="871-11131">
|
||||
<Initialization range="0-870"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<!-- Video -->
|
||||
<AdaptationSet mimeType="video/mp4" codecs="avc1.42401E" subsegmentAlignment="true" subsegmentStartsWithSAP="1" contentType='video' maxWidth="480" maxHeight="360" maxFrameRate="24" par="4:3">
|
||||
<Representation id="2" bandwidth="150000" width="480" height="360" frameRate="24" sar="1:1">
|
||||
<BaseURL>ElephantsDream_H264BPL30_0100.264.dash</BaseURL>
|
||||
<SegmentBase indexRange="984-11244">
|
||||
<Initialization range="0-983"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="3" bandwidth="250000" width="480" height="360" frameRate="24" sar="1:1">
|
||||
<BaseURL>ElephantsDream_H264BPL30_0175.264.dash</BaseURL>
|
||||
<SegmentBase indexRange="984-11245">
|
||||
<Initialization range="0-983"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="4" bandwidth="350000" width="480" height="360" frameRate="24" sar="1:1">
|
||||
<BaseURL>ElephantsDream_H264BPL30_0250.264.dash</BaseURL>
|
||||
<SegmentBase indexRange="984-11245">
|
||||
<Initialization range="0-983"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="5" bandwidth="750000" width="480" height="360" frameRate="24" sar="1:1">
|
||||
<BaseURL>ElephantsDream_H264BPL30_0500.264.dash</BaseURL>
|
||||
<SegmentBase indexRange="985-11245">
|
||||
<Initialization range="0-984"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" maxSubsegmentDuration="PT5.0S" mediaPresentationDuration="PT9M57S" minBufferTime="PT5.0S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://xmlns.sony.net/metadata/mpeg/dash/profile/senvu/2012" type="static" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd">
|
||||
<Period duration="PT9M57S" id="P1">
|
||||
<!-- Adaptation Set for main audio -->
|
||||
<AdaptationSet audioSamplingRate="48000" codecs="mp4a.40.5" contentType="audio" group="2" id="2" lang="en" mimeType="audio/mp4" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
|
||||
<Representation bandwidth="64000" id="2_1">
|
||||
<BaseURL>DASH_vodaudio_Track5.m4a</BaseURL>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<!-- Adaptation Set for video -->
|
||||
<AdaptationSet codecs="avc1.4D401E" contentType="video" frameRate="24000/1001" group="1" id="1" maxBandwidth="1609728" maxHeight="480" maxWidth="854" maximumSAPPeriod="5.0" mimeType="video/mp4" minBandwidth="452608" minHeight="480" minWidth="854" par="16:9" sar="1:1" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
|
||||
<Representation bandwidth="1005568" height="480" id="1_1" mediaStreamStructureId="1" width="854">
|
||||
<BaseURL>DASH_vodvideo_Track2.m4v</BaseURL>
|
||||
</Representation>
|
||||
<Representation bandwidth="1609728" height="480" id="1_2" mediaStreamStructureId="1" width="854">
|
||||
<BaseURL>DASH_vodvideo_Track1.m4v</BaseURL>
|
||||
</Representation>
|
||||
<Representation bandwidth="704512" height="480" id="1_3" mediaStreamStructureId="1" width="854">
|
||||
<BaseURL>DASH_vodvideo_Track3.m4v</BaseURL>
|
||||
</Representation>
|
||||
<Representation bandwidth="452608" height="480" id="1_4" mediaStreamStructureId="1" width="854">
|
||||
<BaseURL>DASH_vodvideo_Track4.m4v</BaseURL>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev91-g0930dfa-master on 2015-03-12T15:13:26Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT0H12M14.17S" maxSegmentDuration="PT0H0M2.00S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash264,http://dashif.org/guidelines/dash-if-simple">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/DASH_HEVC_TestVectors/TearsOfSteel/Live/MultiRate/TOS_Live_HEVC_MultiRate.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H12M14.17S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="24" par="16:9" lang="eng" contentType="video">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="474392">
|
||||
<SegmentTemplate timescale="12288" media="tears_of_steel_720p_500k_H265_$Number$.mp4" startNumber="1" duration="24514" initialization="TOS_Live_HEVC_MultiRate_set1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1250137">
|
||||
<SegmentTemplate timescale="12288" media="tears_of_steel_720p_1000k_H265_$Number$.mp4" startNumber="1" duration="24514" initialization="TOS_Live_HEVC_MultiRate_set1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="2500703">
|
||||
<SegmentTemplate timescale="12288" media="tears_of_steel_720p_2000k_H265_$Number$.mp4" startNumber="1" duration="24514" initialization="TOS_Live_HEVC_MultiRate_set1_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" lang="eng" contentType="audio">
|
||||
<Representation id="4" mimeType="audio/mp4" codecs="mp4a.40.29" audioSamplingRate="48000" startWithSAP="1" bandwidth="65432">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<SegmentTemplate timescale="48000" media="tears_of_steel_64k_audio_$Number$.mp4" startNumber="1" duration="93948" initialization="tears_of_steel_64k_audio_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev710-g713274f-master at 2015-10-16T09:31:17.480Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H12M14.167S" maxSegmentDuration="PT0H0M2.005S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash-if-simple">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/Dashcontent/tos_live_single_res_multi_rep_hvc/tos_720_Multirate_HEVC_Live.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H12M14.167S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="24" par="1:1" lang="und">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hvc1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="3" bandwidth="515577">
|
||||
<SegmentTemplate timescale="24" media="tos_720p_500k_H265_hvc1_$Number$.mp4" startNumber="1" duration="47" initialization="tos_720p_500k_H265_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hvc1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="3" bandwidth="1031164">
|
||||
<SegmentTemplate timescale="24" media="tos_720p_1000k_H265_hvc1_$Number$.mp4" startNumber="1" duration="47" initialization="tos_720p_1000k_H265_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hvc1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="3" bandwidth="2068913">
|
||||
<SegmentTemplate timescale="24" media="tos_720p_2000k_H265_hvc1_$Number$.mp4" startNumber="1" duration="47" initialization="tos_720p_2000k_H265_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" par="1:1" lang="eng">
|
||||
<Representation id="4" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="66152">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<SegmentTemplate timescale="48000" media="tos_64k_audio_$Number$.mp4" startNumber="1" duration="95999" initialization="tos_64k_audio_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev91-g0930dfa-master on 2015-03-24T15:40:46Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT0H9M56.29S" maxSegmentDuration="PT0H0M2.00S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash-if-simple">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/DASH_HEVC_TestVectors/BigBuckBunny/1b/1/BBB_Live_HEVC_MultiRate.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H9M56.29S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1280" maxHeight="720" maxFrameRate="24" par="16:9" lang="und">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="433711">
|
||||
<SegmentTemplate timescale="12288" media="bbb_720p_500k_H265_$Number$.mp4" startNumber="1" duration="24505" initialization="BBB_Live_HEVC_MultiRate_set1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1145164">
|
||||
<SegmentTemplate timescale="12288" media="bbb_720p_1000k_H265_$Number$.mp4" startNumber="1" duration="24505" initialization="BBB_Live_HEVC_MultiRate_set1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="2285171">
|
||||
<SegmentTemplate timescale="12288" media="bbb_720p_2000k_H265_$Number$.mp4" startNumber="1" duration="24505" initialization="BBB_Live_HEVC_MultiRate_set1_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" lang="und">
|
||||
<Representation id="4" mimeType="audio/mp4" codecs="mp4a.40.29" audioSamplingRate="48000" startWithSAP="1" bandwidth="65834">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<SegmentTemplate timescale="48000" media="bbb_64k_audio_$Number$.mp4" startNumber="1" duration="94089" initialization="bbb_64k_audio_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Generated Sat Jun 01 21:01:28 2013 by Dolby Media Generator, Version 2013May16.160953 -->
|
||||
<MPD
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dolby="http://www.dolby.com/ns/online/DASH"
|
||||
xmlns="urn:mpeg:dash:schema:mpd:2011"
|
||||
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011"
|
||||
type="static"
|
||||
mediaPresentationDuration="PT0H0M30.030S"
|
||||
minBufferTime="PT1.2S"
|
||||
profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://dashif.org/guidelines/dash264">
|
||||
|
||||
<BaseURL>./</BaseURL>
|
||||
|
||||
<Period>
|
||||
<!-- Video -->
|
||||
<AdaptationSet mimeType="video/mp4" codecs="avc1.42801e" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="1" bandwidth="520360" width="640" height="480">
|
||||
<BaseURL>ChID_voices_71_768_ddp_V.mp4</BaseURL>
|
||||
<SegmentBase indexRange="742-953">
|
||||
<Initialization range="0-741"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<!-- Audio -->
|
||||
<AdaptationSet mimeType="audio/mp4" codecs="ec-3" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="2" bandwidth="768000">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:dolby:dash:audio_channel_configuration:2011" value="FA01"/>
|
||||
<BaseURL>ChID_voices_71_768_ddp_A.mp4</BaseURL>
|
||||
<SegmentBase indexRange="604-767">
|
||||
<Initialization range="0-603"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" ?>
|
||||
<MPD mediaPresentationDuration="PT14.3333333333S" minBufferTime="PT2S" profiles="http://dashif.org/guidelines/dash264,urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd">
|
||||
<BaseURL>./</BaseURL>
|
||||
<Period>
|
||||
<AdaptationSet codecs="avc1.42c01e" contentType="video" frameRate="24/1" height="480" mimeType="video/mp4" par="16:9" scanType="progressive" subsegmentAlignment="true" subsegmentStartsWithSAP="1" width="848">
|
||||
<Representation bandwidth="1501691" id="8chID_848x480_24fps-avc1.42c01e-14s-848x480-h264-1500000bps_seg" sar="1:1">
|
||||
<BaseURL>8chID_848x480_24fps-avc1.42c01e-14s-848x480-h264-1500000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="685-752">
|
||||
<Initialization range="0-684"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet codecs="mp4a.40.5" contentType="audio" lang="en" mimeType="audio/mp4" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:mpegB:cicp:ChannelConfiguration" value="12"/>
|
||||
<Representation audioSamplingRate="48000" bandwidth="259712" id="8chID-en-14s-8-heaac-256000bps_seg">
|
||||
<BaseURL>8chID-en-14s-8-heaac-256000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-676">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" ?>
|
||||
<MPD mediaPresentationDuration="PT653.625S" minBufferTime="PT2S" profiles="http://dashif.org/guidelines/dash264,urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd">
|
||||
<BaseURL>./</BaseURL>
|
||||
<Period>
|
||||
<AdaptationSet codecs="avc1.42c01e" contentType="video" frameRate="24/1" height="480" mimeType="video/mp4" par="16:9" scanType="progressive" subsegmentAlignment="true" subsegmentStartsWithSAP="1" width="854">
|
||||
<Representation bandwidth="1501684" id="ED_SD_480p_reenc-avc1.42c01e-0s-854x480-h264-1500000bps_seg" sar="1:1">
|
||||
<BaseURL>ED_SD_480p_reenc-avc1.42c01e-0s-854x480-h264-1500000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="686-2289">
|
||||
<Initialization range="0-685"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet codecs="mp4a.40.30" contentType="audio" lang="en" mimeType="audio/mp4" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:mpegB:cicp:ChannelConfiguration" value="6"/>
|
||||
<Representation audioSamplingRate="48000" bandwidth="51287" id="ED-CM-5.1-DVD_length_fixed-en-653s-6-mps-48000bps_seg">
|
||||
<BaseURL>ED-CM-5.1-DVD_length_fixed-en-653s-6-mps-48000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="617-2220">
|
||||
<Initialization range="0-616"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="67285" id="ED-CM-5.1-DVD_length_fixed-en-653s-6-mps-64000bps_seg">
|
||||
<BaseURL>ED-CM-5.1-DVD_length_fixed-en-653s-6-mps-64000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="617-2220">
|
||||
<Initialization range="0-616"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="99284" id="ED-CM-5.1-DVD_length_fixed-en-653s-6-mps-96000bps_seg">
|
||||
<BaseURL>ED-CM-5.1-DVD_length_fixed-en-653s-6-mps-96000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="622-2225">
|
||||
<Initialization range="0-621"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="163283" id="ED-CM-5.1-DVD_length_fixed-en-653s-6-mps-160000bps_seg">
|
||||
<BaseURL>ED-CM-5.1-DVD_length_fixed-en-653s-6-mps-160000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="622-2225">
|
||||
<Initialization range="0-621"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="131284" id="ED-CM-5.1-DVD_length_fixed-en-653s-6-mps-128000bps_seg">
|
||||
<BaseURL>ED-CM-5.1-DVD_length_fixed-en-653s-6-mps-128000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="622-2225">
|
||||
<Initialization range="0-621"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" ?>
|
||||
<MPD mediaPresentationDuration="PT887.833333333S" minBufferTime="PT2S" profiles="http://dashif.org/guidelines/dash264,urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd">
|
||||
<BaseURL>./</BaseURL>
|
||||
<Period>
|
||||
<AdaptationSet codecs="avc1.42c01e" contentType="video" frameRate="24/1" height="368" mimeType="video/mp4" par="21:9" scanType="progressive" subsegmentAlignment="true" subsegmentStartsWithSAP="1" width="848">
|
||||
<Representation bandwidth="1501684" id="Sintel.2010.480p_reenc-avc1.42c01e-0s-848x368-h264-1500000bps_seg" sar="1:1">
|
||||
<BaseURL>Sintel.2010.480p_reenc-avc1.42c01e-0s-848x368-h264-1500000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="685-2852">
|
||||
<Initialization range="0-684"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet codecs="mp4a.40.30" contentType="audio" lang="en" mimeType="audio/mp4" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:mpegB:cicp:ChannelConfiguration" value="6"/>
|
||||
<Representation audioSamplingRate="48000" bandwidth="99283" id="sintel-master-51_48000_fixed-en-888s-6-mps-96000bps_seg">
|
||||
<BaseURL>sintel-master-51_48000_fixed-en-888s-6-mps-96000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="622-2789">
|
||||
<Initialization range="0-621"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="51285" id="sintel-master-51_48000_fixed-en-888s-6-mps-48000bps_seg">
|
||||
<BaseURL>sintel-master-51_48000_fixed-en-888s-6-mps-48000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="617-2784">
|
||||
<Initialization range="0-616"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="131283" id="sintel-master-51_48000_fixed-en-888s-6-mps-128000bps_seg">
|
||||
<BaseURL>sintel-master-51_48000_fixed-en-888s-6-mps-128000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="622-2789">
|
||||
<Initialization range="0-621"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="67283" id="sintel-master-51_48000_fixed-en-888s-6-mps-64000bps_seg">
|
||||
<BaseURL>sintel-master-51_48000_fixed-en-888s-6-mps-64000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="617-2784">
|
||||
<Initialization range="0-616"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="163283" id="sintel-master-51_48000_fixed-en-888s-6-mps-160000bps_seg">
|
||||
<BaseURL>sintel-master-51_48000_fixed-en-888s-6-mps-160000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="622-2789">
|
||||
<Initialization range="0-621"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev91-g0930dfa-master on 2015-03-12T15:32:19Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT0H12M14.17S" maxSegmentDuration="PT0H0M2.00S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://dashif.org/guidelines/dash264,http://dashif.org/guidelines/dash-if-simple">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/DASH_HEVC_TestVectors/TearsOfSteel/OnDemand/MultiRes/TOS_OnDemand_HEVC_MultiRes.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H12M14.17S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="16:9" lang="eng" subsegmentStartsWithSAP="1" contentType="video">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hev1.1.6.L63.90" width="512" height="288" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="588626">
|
||||
<BaseURL>tears_of_steel_288p_500k_H265_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1849-6296"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hev1.1.6.L90.90" width="768" height="432" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1207641">
|
||||
<BaseURL>tears_of_steel_432p_1000k_H265_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1850-6297"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="2496699">
|
||||
<BaseURL>tears_of_steel_720p_2000k_H265_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1850-6297"/>
|
||||
</Representation>
|
||||
<Representation id="4" mimeType="video/mp4" codecs="hev1.1.6.L120.90" width="1920" height="1080" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="4996401">
|
||||
<BaseURL>tears_of_steel_1080p_4000k_H265_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1853-6300"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" lang="eng" subsegmentStartsWithSAP="1" contentType="audio">
|
||||
<Representation id="5" mimeType="audio/mp4" codecs="mp4a.40.29" audioSamplingRate="48000" startWithSAP="1" bandwidth="65203">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<BaseURL>tears_of_steel_64k_audio_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="849-5380">
|
||||
<Initialization range="0-848"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev710-g713274f-master at 2015-10-16T09:35:00.413Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H12M14.167S" maxSegmentDuration="PT0H0M2.005S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://dashif.org/guidelines/dash-if-simple">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/Dashcontent/tos_ondemand_multi_res_multi_rep_hvc/tos_720_Multirate_HEVC_ondemand.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H12M14.167S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="1:1" lang="und" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hvc1.1.6.L63.90" width="512" height="288" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="506712">
|
||||
<BaseURL>tos_288p_500k_H265_hvc1_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="949-5396">
|
||||
<Initialization range="0-948"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hvc1.1.6.L90.90" width="768" height="432" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1021513">
|
||||
<BaseURL>tos_432p_1000k_H265_hvc1_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="924-5371">
|
||||
<Initialization range="0-923"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hvc1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="2068688">
|
||||
<BaseURL>tos_720p_2000k_H265_hvc1_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="948-5395">
|
||||
<Initialization range="0-947"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="4" mimeType="video/mp4" codecs="hvc1.1.6.L120.90" width="1920" height="1080" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="4096493">
|
||||
<BaseURL>tos_1080p_4000k_H265_hvc1_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="925-5372">
|
||||
<Initialization range="0-924"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" par="1:1" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="5" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="65928">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<BaseURL>tos_64k_audio_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="847-5294">
|
||||
<Initialization range="0-846"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev710-g713274f-master at 2015-10-15T08:08:21.937Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H12M14.167S" maxSegmentDuration="PT0H0M2.005S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://dashif.org/guidelines/dash-if-main">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/Dashcontent/5b_hev/tos_720_Multirate_HEVC_ondemand.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H12M14.167S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="1:1" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hev1.2.4.L63.90" width="512" height="288" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="500646">
|
||||
<BaseURL>tos_288p_500k_H265_10bit_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1911-6358">
|
||||
<Initialization range="0-1910"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hev1.2.4.L90.90" width="768" height="432" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="999733">
|
||||
<BaseURL>tos_432p_1000k_H265_10bit_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1912-6359">
|
||||
<Initialization range="0-1911"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hev1.2.4.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1993305">
|
||||
<BaseURL>tos_720p_2000k_H265_10bit_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1915-6362">
|
||||
<Initialization range="0-1914"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="4" mimeType="video/mp4" codecs="hev1.2.4.L120.90" width="1920" height="1080" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="3960054">
|
||||
<BaseURL>tos_1080p_4000k_H265_10bit_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1916-6363">
|
||||
<Initialization range="0-1915"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" par="1:1" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="5" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="65928">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<BaseURL>tos_64k_audio_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="847-5294">
|
||||
<Initialization range="0-846"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev710-g713274f-master at 2015-10-15T08:15:45.295Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H12M14.167S" maxSegmentDuration="PT0H0M2.005S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://dashif.org/guidelines/dash-if-main">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/Dashcontent/5b_hvc/tos_720_Multirate_HEVC_ondemand.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H12M14.167S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="1:1" lang="und" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hvc1.2.4.L63.90" width="512" height="288" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="500758">
|
||||
<BaseURL>tos_288p_500k_H265_10bit_hvc1_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="948-5395">
|
||||
<Initialization range="0-947"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hvc1.2.4.L90.90" width="768" height="432" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="999844">
|
||||
<BaseURL>tos_432p_1000k_H265_10bit_hvc1_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="948-5395">
|
||||
<Initialization range="0-947"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hvc1.2.4.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1993413">
|
||||
<BaseURL>tos_720p_2000k_H265_10bit_hvc1_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="950-5397">
|
||||
<Initialization range="0-949"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="4" mimeType="video/mp4" codecs="hvc1.2.4.L120.90" width="1920" height="1080" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="3960053">
|
||||
<BaseURL>tos_1080p_4000k_H265_10bit_hvc1_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="925-5372">
|
||||
<Initialization range="0-924"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" par="1:1" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="5" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="65928">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<BaseURL>tos_64k_audio_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="847-5294">
|
||||
<Initialization range="0-846"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev91-g0930dfa-master on 2015-03-24T16:36:48Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT0H9M56.29S" maxSegmentDuration="PT0H0M2.00S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://dashif.org/guidelines/dash-if-simple">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/DASH_HEVC_TestVectors/BigBuckBunny/2a/1/BBB_OnDemand_HEVC_MultiRes.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H9M56.29S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="16:9" lang="und" subsegmentStartsWithSAP="1">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hev1.1.6.L63.90" width="512" height="288" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="368078">
|
||||
<BaseURL>bbb_288p_500k_H265_from1080p_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1798-5417"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hev1.1.6.L90.90" width="768" height="432" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1136564">
|
||||
<BaseURL>bbb_432p_1000k_H265_from1080p_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1850-5469"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="2188852">
|
||||
<BaseURL>bbb_720p_2000k_H265_from1080p_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1850-5469"/>
|
||||
</Representation>
|
||||
<Representation id="4" mimeType="video/mp4" codecs="hev1.1.6.L120.90" width="1920" height="1080" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="4286337">
|
||||
<BaseURL>bbb_1080p_4000k_H265_from1080p_.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="1853-5472"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" lang="und" subsegmentStartsWithSAP="1">
|
||||
<Representation id="5" mimeType="audio/mp4" codecs="mp4a.40.29" audioSamplingRate="48000" startWithSAP="1" bandwidth="65606">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<BaseURL>bbb_64k_audio_init.mp4</BaseURL>
|
||||
<SegmentBase indexRangeExact="true" indexRange="849-4528">
|
||||
<Initialization range="0-848"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev91-g0930dfa-master on 2015-03-12T19:18:56Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT0H12M14.17S" maxSegmentDuration="PT0H0M2.00S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash264,http://dashif.org/guidelines/dash-if-simple">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/DASH_HEVC_TestVectors/TearsOfSteel/Live/MultiRes/TOS_Live_HEVC_MultiRes.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H12M14.17S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="16:9" lang="eng" contentType="video">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hev1.1.6.L63.90" width="512" height="288" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="540936">
|
||||
<SegmentTemplate timescale="12288" media="tears_of_steel_288p_500k_H265_from1080p_$Number$.mp4" startNumber="1" duration="24514" initialization="TOS_Live_HEVC_MultiRes_set1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hev1.1.6.L90.90" width="768" height="432" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1225260">
|
||||
<SegmentTemplate timescale="12288" media="tears_of_steel_432p_1000k_H265_from1080p_$Number$.mp4" startNumber="1" duration="24514" initialization="TOS_Live_HEVC_MultiRes_set1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="2520022">
|
||||
<SegmentTemplate timescale="12288" media="tears_of_steel_720p_2000k_H265_from1080p_$Number$.mp4" startNumber="1" duration="24514" initialization="TOS_Live_HEVC_MultiRes_set1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="4" mimeType="video/mp4" codecs="hev1.1.6.L120.90" width="1920" height="1080" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="5000417">
|
||||
<SegmentTemplate timescale="12288" media="tears_of_steel_1080p_4000k_H265_$Number$.mp4" startNumber="1" duration="24514" initialization="TOS_Live_HEVC_MultiRes_set1_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" lang="eng" contentType="audio">
|
||||
<Representation id="5" mimeType="audio/mp4" codecs="mp4a.40.29" audioSamplingRate="48000" startWithSAP="1" bandwidth="65432">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<SegmentTemplate timescale="48000" media="tears_of_steel_64k_audio_$Number$.mp4" startNumber="1" duration="93948" initialization="tears_of_steel_64k_audio_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev710-g713274f-master at 2015-10-16T09:27:04.475Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H12M14.167S" maxSegmentDuration="PT0H0M2.005S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash-if-simple">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/Dashcontent/tos_live_multi_res_multi_rep_hvc/tos_720_Multirate_HEVC_Live.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H12M14.167S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="1:1" lang="und">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hvc1.1.6.L63.90" width="512" height="288" frameRate="24" sar="1:1" startWithSAP="3" bandwidth="506937">
|
||||
<SegmentTemplate timescale="24" media="tos_288p_500k_H265_hvc1_$Number$.mp4" startNumber="1" duration="47" initialization="tos_288p_500k_H265_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hvc1.1.6.L90.90" width="768" height="432" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1021737">
|
||||
<SegmentTemplate timescale="24" media="tos_432p_1000k_H265_hvc1_$Number$.mp4" startNumber="1" duration="48" initialization="tos_432p_1000k_H265_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hvc1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="3" bandwidth="2068913">
|
||||
<SegmentTemplate timescale="24" media="tos_720p_2000k_H265_hvc1_$Number$.mp4" startNumber="1" duration="47" initialization="tos_720p_2000k_H265_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="4" mimeType="video/mp4" codecs="hvc1.1.6.L120.90" width="1920" height="1080" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="4096717">
|
||||
<SegmentTemplate timescale="24" media="tos_1080p_4000k_H265_hvc1_$Number$.mp4" startNumber="1" duration="48" initialization="tos_1080p_4000k_H265_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" par="1:1" lang="eng">
|
||||
<Representation id="5" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="66152">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<SegmentTemplate timescale="48000" media="tos_64k_audio_$Number$.mp4" startNumber="1" duration="95999" initialization="tos_64k_audio_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev710-g713274f-master at 2015-10-15T14:58:29.691Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H12M14.167S" maxSegmentDuration="PT0H0M2.005S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash-if-main">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/Dashcontent/tos_live_multi_res_multi_rep_10bit-hev/tos_720_Multirate_HEVC_Live.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H12M14.167S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="1:1" lang="eng">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hev1.2.4.L63.90" width="512" height="288" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="500870">
|
||||
<SegmentTemplate timescale="12288" media="tos_288p_500k_H265_10bit_$Number$.mp4" startNumber="1" duration="24559" initialization="tos_288p_500k_H265_10bit_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hev1.2.4.L90.90" width="768" height="432" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="999957">
|
||||
<SegmentTemplate timescale="12288" media="tos_432p_1000k_H265_10bit_$Number$.mp4" startNumber="1" duration="24573" initialization="tos_432p_1000k_H265_10bit_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hev1.2.4.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1993529">
|
||||
<SegmentTemplate timescale="12288" media="tos_720p_2000k_H265_10bit_$Number$.mp4" startNumber="1" duration="24556" initialization="tos_720p_2000k_H265_10bit_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="4" mimeType="video/mp4" codecs="hev1.2.4.L120.90" width="1920" height="1080" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="3960278">
|
||||
<SegmentTemplate timescale="12288" media="tos_1080p_4000k_H265_10bit_$Number$.mp4" startNumber="1" duration="24576" initialization="tos_1080p_4000k_H265_10bit_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" par="1:1" lang="eng">
|
||||
<Representation id="5" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="66152">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<SegmentTemplate timescale="48000" media="tos_64k_audio_$Number$.mp4" startNumber="1" duration="95999" initialization="tos_64k_audio_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev710-g713274f-master at 2015-10-15T08:25:16.217Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H12M14.167S" maxSegmentDuration="PT0H0M2.005S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash-if-main">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/Dashcontent/7b_hvc/tos_720_Multirate_HEVC_Live.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H12M14.167S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="1:1" lang="und">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hvc1.2.4.L63.90" width="512" height="288" frameRate="24" sar="1:1" startWithSAP="3" bandwidth="500982">
|
||||
<SegmentTemplate timescale="24" media="tos_288p_500k_H265_10bit_hvc1_$Number$.mp4" startNumber="1" duration="47" initialization="tos_288p_500k_H265_10bit_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hvc1.2.4.L90.90" width="768" height="432" frameRate="24" sar="1:1" startWithSAP="3" bandwidth="1000068">
|
||||
<SegmentTemplate timescale="24" media="tos_432p_1000k_H265_10bit_hvc1_$Number$.mp4" startNumber="1" duration="47" initialization="tos_432p_1000k_H265_10bit_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hvc1.2.4.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="3" bandwidth="1993637">
|
||||
<SegmentTemplate timescale="24" media="tos_720p_2000k_H265_10bit_hvc1_$Number$.mp4" startNumber="1" duration="47" initialization="tos_720p_2000k_H265_10bit_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="4" mimeType="video/mp4" codecs="hvc1.2.4.L120.90" width="1920" height="1080" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="3960277">
|
||||
<SegmentTemplate timescale="24" media="tos_1080p_4000k_H265_10bit_hvc1_$Number$.mp4" startNumber="1" duration="48" initialization="tos_1080p_4000k_H265_10bit_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" par="1:1" lang="eng">
|
||||
<Representation id="5" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="66152">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<SegmentTemplate timescale="48000" media="tos_64k_audio_$Number$.mp4" startNumber="1" duration="95999" initialization="tos_64k_audio_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev710-g713274f-master at 2015-10-15T14:49:42.583Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H9M56.480S" maxSegmentDuration="PT0H0M2.005S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash-if-main">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/Dashcontent/0/BBB_720_Multirate_HEVC_Live.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H9M56.480S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="1:1" lang="eng">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hev1.2.4.L63.90" width="512" height="288" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="524393">
|
||||
<SegmentTemplate timescale="12288" media="bbb_288p_500k_H265_10bit_$Number$.mp4" startNumber="1" duration="24576" initialization="bbb_288p_500k_H265_10bit_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hev1.2.4.L90.90" width="768" height="432" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1043401">
|
||||
<SegmentTemplate timescale="12288" media="bbb_432p_1000k_H265_10bit_$Number$.mp4" startNumber="1" duration="24576" initialization="bbb_432p_1000k_H265_10bit_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hev1.2.4.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="2040171">
|
||||
<SegmentTemplate timescale="12288" media="bbb_720p_2000k_H265_10bit_$Number$.mp4" startNumber="1" duration="24576" initialization="bbb_720p_2000k_H265_10bit_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="4" mimeType="video/mp4" codecs="hev1.2.4.L120.90" width="1920" height="1080" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="4076350">
|
||||
<SegmentTemplate timescale="12288" media="bbb_1080p_4000k_H265_10bit_$Number$.mp4" startNumber="1" duration="24576" initialization="bbb_1080p_4000k_H265_10bit_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" par="1:1" lang="eng">
|
||||
<Representation id="5" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="66163">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<SegmentTemplate timescale="48000" media="bbb_64k_audio_$Number$.mp4" startNumber="1" duration="95998" initialization="bbb_64k_audio_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev710-g713274f-master at 2015-10-15T10:30:27.109Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H9M56.480S" maxSegmentDuration="PT0H0M2.005S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash-if-main">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/Dashcontent/8_hvc/BBB_720_Multirate_HEVC_Live.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H9M56.480S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="1:1" lang="und">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hvc1.2.4.L63.90" width="512" height="288" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="524392">
|
||||
<SegmentTemplate timescale="24" media="bbb_288p_500k_H265_10bit_hvc1_$Number$.mp4" startNumber="1" duration="48" initialization="bbb_288p_500k_H265_10bit_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hvc1.2.4.L90.90" width="768" height="432" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1043400">
|
||||
<SegmentTemplate timescale="24" media="bbb_432p_1000k_H265_10bit_hvc1_$Number$.mp4" startNumber="1" duration="48" initialization="bbb_432p_1000k_H265_10bit_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hvc1.2.4.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="2040171">
|
||||
<SegmentTemplate timescale="24" media="bbb_720p_2000k_H265_10bit_hvc1_$Number$.mp4" startNumber="1" duration="48" initialization="bbb_720p_2000k_H265_10bit_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="4" mimeType="video/mp4" codecs="hvc1.2.4.L120.90" width="1920" height="1080" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="4076349">
|
||||
<SegmentTemplate timescale="24" media="bbb_1080p_4000k_H265_10bit_hvc1_$Number$.mp4" startNumber="1" duration="48" initialization="bbb_1080p_4000k_H265_10bit_hvc1_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" par="1:1" lang="eng">
|
||||
<Representation id="5" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="66163">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<SegmentTemplate timescale="48000" media="bbb_64k_audio_$Number$.mp4" startNumber="1" duration="95998" initialization="bbb_64k_audio_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev91-g0930dfa-master on 2015-03-24T16:42:10Z-->
|
||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT0H9M56.29S" maxSegmentDuration="PT0H0M2.00S" profiles="urn:mpeg:dash:profile:isoff-live:2011,http://dashif.org/guidelines/dash-if-simple">
|
||||
<ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
|
||||
<Title>/var/www/DASH_HEVC_TestVectors/BigBuckBunny/2b/1/BBB_Live_HEVC_MultiRes.mpd generated by GPAC</Title>
|
||||
</ProgramInformation>
|
||||
|
||||
<Period duration="PT0H9M56.29S">
|
||||
<AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="16:9" lang="und">
|
||||
<Representation id="1" mimeType="video/mp4" codecs="hev1.1.6.L63.90" width="512" height="288" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="371875">
|
||||
<SegmentTemplate timescale="12288" media="bbb_288p_500k_H265_from1080p_$Number$.mp4" startNumber="1" duration="24505" initialization="BBB_Live_HEVC_MultiRes_set1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="2" mimeType="video/mp4" codecs="hev1.1.6.L90.90" width="768" height="432" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="1140569">
|
||||
<SegmentTemplate timescale="12288" media="bbb_432p_1000k_H265_from1080p_$Number$.mp4" startNumber="1" duration="24505" initialization="BBB_Live_HEVC_MultiRes_set1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="3" mimeType="video/mp4" codecs="hev1.1.6.L93.90" width="1280" height="720" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="2192857">
|
||||
<SegmentTemplate timescale="12288" media="bbb_720p_2000k_H265_from1080p_$Number$.mp4" startNumber="1" duration="24505" initialization="BBB_Live_HEVC_MultiRes_set1_init.mp4"/>
|
||||
</Representation>
|
||||
<Representation id="4" mimeType="video/mp4" codecs="hev1.1.6.L120.90" width="1920" height="1080" frameRate="24" sar="1:1" startWithSAP="1" bandwidth="4290354">
|
||||
<SegmentTemplate timescale="12288" media="bbb_1080p_4000k_H265_from1080p_$Number$.mp4" startNumber="1" duration="24505" initialization="BBB_Live_HEVC_MultiRes_set1_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet segmentAlignment="true" lang="und">
|
||||
<Representation id="5" mimeType="audio/mp4" codecs="mp4a.40.29" audioSamplingRate="48000" startWithSAP="1" bandwidth="65834">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<SegmentTemplate timescale="48000" media="bbb_64k_audio_$Number$.mp4" startNumber="1" duration="94089" initialization="bbb_64k_audio_init.mp4"/>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Generated Sat Jun 01 21:01:10 2013 by Dolby Media Generator, Version 2013May16.160953 -->
|
||||
<MPD
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dolby="http://www.dolby.com/ns/online/DASH"
|
||||
xmlns="urn:mpeg:dash:schema:mpd:2011"
|
||||
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011"
|
||||
type="static"
|
||||
mediaPresentationDuration="PT0H0M30.030S"
|
||||
minBufferTime="PT1.2S"
|
||||
profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://dashif.org/guidelines/dash264">
|
||||
|
||||
<BaseURL>./</BaseURL>
|
||||
|
||||
<Period>
|
||||
<!-- Video -->
|
||||
<AdaptationSet mimeType="video/mp4" codecs="avc1.42801e" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="1" bandwidth="517528" width="640" height="480">
|
||||
<BaseURL>ChID_voices_20_128_ddp_V.mp4</BaseURL>
|
||||
<SegmentBase indexRange="742-953">
|
||||
<Initialization range="0-741"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<!-- Audio -->
|
||||
<AdaptationSet mimeType="audio/mp4" codecs="ec-3" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="2" bandwidth="128000">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:dolby:dash:audio_channel_configuration:2011" value="A000"/>
|
||||
<BaseURL>ChID_voices_20_128_ddp_A.mp4</BaseURL>
|
||||
<SegmentBase indexRange="603-766">
|
||||
<Initialization range="0-602"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" ?>
|
||||
<MPD mediaPresentationDuration="PT653.696S" minBufferTime="PT2S" profiles="http://dashif.org/guidelines/dash264,urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd">
|
||||
<BaseURL>./</BaseURL>
|
||||
<Period>
|
||||
<AdaptationSet codecs="avc1.42c01e" contentType="video" frameRate="24/1" height="480" mimeType="video/mp4" par="16:9" scanType="progressive" subsegmentAlignment="true" subsegmentStartsWithSAP="1" width="854">
|
||||
<Representation bandwidth="1501684" id="ED_SD_480p_reenc-avc1.42c01e-0s-854x480-h264-1500000bps_seg" sar="1:1">
|
||||
<BaseURL>ED_SD_480p_reenc-avc1.42c01e-0s-854x480-h264-1500000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="686-2289">
|
||||
<Initialization range="0-685"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet codecs="mp4a.40.5" contentType="audio" lang="en" mimeType="audio/mp4" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:mpegB:cicp:ChannelConfiguration" value="6"/>
|
||||
<Representation audioSamplingRate="48000" bandwidth="323283" id="ED-CM-5.1-DVD_length_fixed-en-653s-6-heaac-320000bps_seg">
|
||||
<BaseURL>ED-CM-5.1-DVD_length_fixed-en-653s-6-heaac-320000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2212">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="195289" id="ED-CM-5.1-DVD_length_fixed-en-653s-6-heaac-192000bps_seg">
|
||||
<BaseURL>ED-CM-5.1-DVD_length_fixed-en-653s-6-heaac-192000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2212">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="131291" id="ED-CM-5.1-DVD_length_fixed-en-653s-6-heaac-128000bps_seg">
|
||||
<BaseURL>ED-CM-5.1-DVD_length_fixed-en-653s-6-heaac-128000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2212">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="70295" id="ED-CM-5.1-DVD_length_fixed-en-653s-6-heaac-67000bps_seg">
|
||||
<BaseURL>ED-CM-5.1-DVD_length_fixed-en-653s-6-heaac-67000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2212">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="163291" id="ED-CM-5.1-DVD_length_fixed-en-653s-6-heaac-160000bps_seg">
|
||||
<BaseURL>ED-CM-5.1-DVD_length_fixed-en-653s-6-heaac-160000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2212">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" ?>
|
||||
<MPD mediaPresentationDuration="PT887.850666667S" minBufferTime="PT2S" profiles="http://dashif.org/guidelines/dash264,urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd">
|
||||
<BaseURL>./</BaseURL>
|
||||
<Period>
|
||||
<AdaptationSet codecs="avc1.42c01e" contentType="video" frameRate="24/1" height="368" mimeType="video/mp4" par="21:9" scanType="progressive" subsegmentAlignment="true" subsegmentStartsWithSAP="1" width="848">
|
||||
<Representation bandwidth="1501684" id="Sintel.2010.480p_reenc-avc1.42c01e-0s-848x368-h264-1500000bps_seg" sar="1:1">
|
||||
<BaseURL>Sintel.2010.480p_reenc-avc1.42c01e-0s-848x368-h264-1500000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="685-2852">
|
||||
<Initialization range="0-684"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet codecs="mp4a.40.5" contentType="audio" lang="en" mimeType="audio/mp4" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:mpegB:cicp:ChannelConfiguration" value="6"/>
|
||||
<Representation audioSamplingRate="48000" bandwidth="163288" id="sintel-master-51_48000_fixed-en-888s-6-heaac-160000bps_seg">
|
||||
<BaseURL>sintel-master-51_48000_fixed-en-888s-6-heaac-160000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2776">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="131288" id="sintel-master-51_48000_fixed-en-888s-6-heaac-128000bps_seg">
|
||||
<BaseURL>sintel-master-51_48000_fixed-en-888s-6-heaac-128000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2776">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="195287" id="sintel-master-51_48000_fixed-en-888s-6-heaac-192000bps_seg">
|
||||
<BaseURL>sintel-master-51_48000_fixed-en-888s-6-heaac-192000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2776">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="70291" id="sintel-master-51_48000_fixed-en-888s-6-heaac-67000bps_seg">
|
||||
<BaseURL>sintel-master-51_48000_fixed-en-888s-6-heaac-67000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2776">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="323283" id="sintel-master-51_48000_fixed-en-888s-6-heaac-320000bps_seg">
|
||||
<BaseURL>sintel-master-51_48000_fixed-en-888s-6-heaac-320000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2776">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" ?>
|
||||
<MPD mediaPresentationDuration="PT887.850666667S" minBufferTime="PT2S" profiles="http://dashif.org/guidelines/dash264,urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd">
|
||||
<BaseURL>./</BaseURL>
|
||||
<Period>
|
||||
<AdaptationSet codecs="avc1.42c01e" contentType="video" frameRate="24/1" height="368" mimeType="video/mp4" par="21:9" scanType="progressive" subsegmentAlignment="true" subsegmentStartsWithSAP="1" width="848">
|
||||
<Representation bandwidth="1501684" id="Sintel.2010.480p_reenc-avc1.42c01e-0s-848x368-h264-1500000bps_seg" sar="1:1">
|
||||
<BaseURL>Sintel.2010.480p_reenc-avc1.42c01e-0s-848x368-h264-1500000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="685-2852">
|
||||
<Initialization range="0-684"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<AdaptationSet codecs="mp4a.40.5" contentType="audio" lang="en" mimeType="audio/mp4" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:mpegB:cicp:ChannelConfiguration" value="12"/>
|
||||
<Representation audioSamplingRate="48000" bandwidth="259290" id="sintel_71_48_fixed-en-888s-8-heaac-256000bps_seg">
|
||||
<BaseURL>sintel_71_48_fixed-en-888s-8-heaac-256000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2776">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="451283" id="sintel_71_48_fixed-en-888s-8-heaac-448000bps_seg">
|
||||
<BaseURL>sintel_71_48_fixed-en-888s-8-heaac-448000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2776">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="131294" id="sintel_71_48_fixed-en-888s-8-heaac-128000bps_seg">
|
||||
<BaseURL>sintel_71_48_fixed-en-888s-8-heaac-128000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2776">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="323288" id="sintel_71_48_fixed-en-888s-8-heaac-320000bps_seg">
|
||||
<BaseURL>sintel_71_48_fixed-en-888s-8-heaac-320000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2776">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation audioSamplingRate="48000" bandwidth="195290" id="sintel_71_48_fixed-en-888s-8-heaac-192000bps_seg">
|
||||
<BaseURL>sintel_71_48_fixed-en-888s-8-heaac-192000bps_seg.mp4</BaseURL>
|
||||
<SegmentBase indexRange="609-2776">
|
||||
<Initialization range="0-608"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" maxSubsegmentDuration="PT5.0S" mediaPresentationDuration="PT9M57S" minBufferTime="PT5.0S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://xmlns.sony.net/metadata/mpeg/dash/profile/senvu/2012" type="static" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd">
|
||||
<Period duration="PT9M57S" id="P1">
|
||||
<!-- Adaptation Set for main audio -->
|
||||
<AdaptationSet audioSamplingRate="48000" codecs="mp4a.40.5" contentType="audio" group="2" id="2" lang="en" mimeType="audio/mp4" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
|
||||
<Representation bandwidth="64000" id="2_1">
|
||||
<BaseURL>DASH_vodaudio_Track7.m4a</BaseURL>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<!-- Adaptation Set for main audio -->
|
||||
<AdaptationSet audioSamplingRate="48000" codecs="mp4a.40.5" contentType="audio" group="2" id="3" lang="en" mimeType="audio/mp4" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="6"/>
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
|
||||
<Representation bandwidth="128000" id="3_2">
|
||||
<BaseURL>DASH_vodaudio_Track8.m4a</BaseURL>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<!-- Adaptation Set for video -->
|
||||
<AdaptationSet contentType="video" frameRate="24000/1001" group="1" id="1" maxBandwidth="4276224" maxHeight="1080" maxWidth="1920" maximumSAPPeriod="5.0" mimeType="video/mp4" minBandwidth="704512" minHeight="180" minWidth="320" par="16:9" sar="1:1" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
|
||||
<Representation bandwidth="704512" codecs="avc1.4D401E" height="180" id="1_1" mediaStreamStructureId="1" width="320">
|
||||
<BaseURL>DASH_vodvideo_Track6.m4v</BaseURL>
|
||||
</Representation>
|
||||
<Representation bandwidth="2011136" codecs="avc1.4D4028" height="720" id="1_2" mediaStreamStructureId="1" width="1280">
|
||||
<BaseURL>DASH_vodvideo_Track3.m4v</BaseURL>
|
||||
</Representation>
|
||||
<Representation bandwidth="3018752" codecs="avc1.4D4028" height="900" id="1_3" mediaStreamStructureId="1" width="1600">
|
||||
<BaseURL>DASH_vodvideo_Track2.m4v</BaseURL>
|
||||
</Representation>
|
||||
<Representation bandwidth="1005568" codecs="avc1.4D401E" height="360" id="1_4" mediaStreamStructureId="1" width="640">
|
||||
<BaseURL>DASH_vodvideo_Track5.m4v</BaseURL>
|
||||
</Representation>
|
||||
<Representation bandwidth="4276224" codecs="avc1.4D4028" height="1080" id="1_5" mediaStreamStructureId="1" width="1920">
|
||||
<BaseURL>DASH_vodvideo_Track1.m4v</BaseURL>
|
||||
</Representation>
|
||||
<Representation bandwidth="1609728" codecs="avc1.4D401E" height="480" id="1_6" mediaStreamStructureId="1" width="854">
|
||||
<BaseURL>DASH_vodvideo_Track4.m4v</BaseURL>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Generated Sat Jun 01 21:43:09 2013 by Dolby Media Generator, Version 2013May16.160953 -->
|
||||
<MPD
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:dolby="http://www.dolby.com/ns/online/DASH"
|
||||
xmlns="urn:mpeg:dash:schema:mpd:2011"
|
||||
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011"
|
||||
type="static"
|
||||
mediaPresentationDuration="PT0H0M30.030S"
|
||||
minBufferTime="PT1.2S"
|
||||
profiles="urn:mpeg:dash:profile:isoff-on-demand:2011,http://dashif.org/guidelines/dash264">
|
||||
|
||||
<BaseURL>./</BaseURL>
|
||||
|
||||
<Period>
|
||||
<!-- Video -->
|
||||
<AdaptationSet mimeType="video/mp4" codecs="avc1.42801e" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="1" bandwidth="523520" width="640" height="480">
|
||||
<BaseURL>ChID_voices_71_384_448_768_ddp_V.mp4</BaseURL>
|
||||
<SegmentBase indexRange="742-953">
|
||||
<Initialization range="0-741"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
<!-- Audio -->
|
||||
<AdaptationSet mimeType="audio/mp4" codecs="ec-3" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="2" bandwidth="384000">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:dolby:dash:audio_channel_configuration:2011" value="FA01"/>
|
||||
<BaseURL>ChID_voices_71_384_448_768_ddp_A_2.mp4</BaseURL>
|
||||
<SegmentBase indexRange="604-767">
|
||||
<Initialization range="0-603"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="3" bandwidth="448000">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:dolby:dash:audio_channel_configuration:2011" value="FA01"/>
|
||||
<BaseURL>ChID_voices_71_384_448_768_ddp_A_3.mp4</BaseURL>
|
||||
<SegmentBase indexRange="604-767">
|
||||
<Initialization range="0-603"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
<Representation id="4" bandwidth="768000">
|
||||
<AudioChannelConfiguration schemeIdUri="urn:dolby:dash:audio_channel_configuration:2011" value="FA01"/>
|
||||
<BaseURL>ChID_voices_71_384_448_768_ddp_A_4.mp4</BaseURL>
|
||||
<SegmentBase indexRange="604-767">
|
||||
<Initialization range="0-603"/>
|
||||
</SegmentBase>
|
||||
</Representation>
|
||||
</AdaptationSet>
|
||||
</Period>
|
||||
</MPD>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user