Skip to content

Commit 8ee6bc8

Browse files
committed
hls2
1 parent 50d7981 commit 8ee6bc8

12 files changed

Lines changed: 2107 additions & 23 deletions

File tree

AGENTS.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
## Overview
44

55
Please err on the side of high quality, not lazy, implementation decisions, because the code
6-
will have to be maintained for a long time. And everybody, LLM or person, is able to work
6+
will have to be maintained for a long time. Everybody, LLM or person, is able to work
77
better if we keep the code clean and to a high standard to start with.
88

99
Even if your instructions don't include specific admonishment about quality, it is always
10-
necessary.
10+
necessary. Lws started in 2010 the main goal when working on a feature is to
11+
improve the library with the feature. That means shortcuts and desperate
12+
incomplete hacks to deliver the feature are always wrong.
1113

1214
Our work should follow the existing usage of apis in the project as much as possible.
1315

@@ -54,14 +56,17 @@ We are very concerned about security, architecturally and in the code. We avoid
5456

5557
- `FILE *` and use apis like open(), read().
5658

57-
- casual linked-lists and use `lws_dll2_t`.
59+
- hand-rolled ad-hoc code when there are library helpers, eg no casual
60+
linked-lists; use `lws_dll2_t` instead.
5861

5962
We consider using:
6063

6164
- lwsac instead of discrete allocations, if the pattern of allocations will benefit from it.
6265

6366
- lws_struct to convert between sqlite storage <-> structs <-> JSON
6467

68+
- lws_tokenize instead of strtok() and variants
69+
6570
We are very concerned about portability and all builds occur with -Werror -Wall -Wextra.
6671

6772
## Appropriate locality
@@ -109,7 +114,7 @@ commands for the platform.
109114

110115
minimal-examples-lowlevel/http-client/minimal-http-client-post/CMakeLists.txt shows how to use the fixtures
111116
stuff to magic peers into being while being sensitive to parallel CI using a CMake unique socket allocator
112-
function to make unique ports.
117+
function to select unique ports.
113118

114119
In the case you can build and run ctest meaningfully, please do confirm the build passes before completing
115120
work on your goal. Use parallel builds and eg, ctest -j8 to reduce the cost in realtime.

lib/core-net/client/connect3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ lws_client_connect_3_connect(struct lws *wsi, const char *ads,
515515

516516
if (wsi->a.context->event_loop_ops->promote_parallel)
517517
wsi->a.context->event_loop_ops->promote_parallel(wsi, pidx);
518-
else
518+
else if (lws_socket_is_valid(wsi->desc.sockfd))
519519
compatible_close(wsi->desc.sockfd);
520520

521521
promote_parallel_fd(wsi, pidx);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
1
2+
00:00:00,500 --> 00:00:02,800
3+
[Big Buck Bunny] Subtitulo de prueba uno.
4+
5+
2
6+
00:00:03,000 --> 00:00:05,500
7+
Este es el subtitulo dos,
8+
cruzando un limite de segmento.
9+
10+
3
11+
00:00:06,200 --> 00:00:09,000
12+
Subtitulo tres en el mismo segmento
13+
que el dos.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
1
2+
00:00:00,500 --> 00:00:02,800
3+
[Big Buck Bunny] Test subtitle cue one.
4+
5+
2
6+
00:00:03,000 --> 00:00:05,500
7+
This is cue two, spanning a
8+
segment boundary at ~5s.
9+
10+
3
11+
00:00:06,200 --> 00:00:09,000
12+
Cue three lands in the same segment
13+
as cue two, to test multi-cue output.

minimal-examples-lowlevel/http-server/minimal-http-server-hls/mount-origin/player.css

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,28 @@ video {
2323
height: auto;
2424
display: block;
2525
}
26+
27+
/* Subtitle cue rendering. Cues arrive via the native <track> element that
28+
* hls.js creates (renderTextTracksNatively). Font-size is expressed in vh
29+
* units so it scales with the viewport (and thus the actual rendered video
30+
* size) rather than the tiny default; in fullscreen it grows further via the
31+
* :fullscreen rule below. The cue vertical position (VTTCue.line) is set in
32+
* player.js, which also lifts cues higher when fullscreen so they clear
33+
* tablet camera cutouts at the bottom edge. */
34+
video::cue {
35+
font-size: 2.2vh;
36+
line-height: 1.25;
37+
background: rgba(0, 0, 0, 0.72);
38+
color: #ffffff;
39+
white-space: pre-wrap;
40+
}
41+
/* In fullscreen the video fills the viewport; bump the cue font to match the
42+
larger frame (proportional to the size increase, not the same fixed size). */
43+
video:fullscreen::cue,
44+
video:-webkit-full-screen::cue {
45+
font-size: 3.4vh;
46+
line-height: 1.3;
47+
}
2648
.header {
2749
width: 100%;
2850
max-width: 800px;
@@ -63,8 +85,22 @@ video {
6385
width: 100%;
6486
max-width: 800px;
6587
display: flex;
66-
justify-content: flex-end;
88+
justify-content: space-between;
89+
align-items: center;
6790
margin-top: 10px;
91+
gap: 12px;
92+
}
93+
94+
.button-group {
95+
display: flex;
96+
align-items: center;
97+
gap: 8px;
98+
}
99+
100+
/* put a little air between adjacent controls inside a group */
101+
.button-group .toggle-btn,
102+
.button-group select.toggle-btn {
103+
margin-right: 0;
68104
}
69105

70106
.toggle-btn {
@@ -85,6 +121,18 @@ video {
85121
color: #ffffff;
86122
}
87123

124+
/* "on" state, used for the CC toggle */
125+
.toggle-btn.active {
126+
background-color: #2a7a2a;
127+
color: #ffffff;
128+
border-color: #3a9a3a;
129+
}
130+
131+
#sub-lang {
132+
padding: 5px 8px;
133+
cursor: pointer;
134+
}
135+
88136
.video-title {
89137
color: #888888;
90138
font-size: 14px;

minimal-examples-lowlevel/http-server/minimal-http-server-hls/mount-origin/player.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ <h2>LWS Media Player</h2>
2323
</div>
2424

2525
<div class="button-container">
26-
<button id="toggle-logs-btn" class="toggle-btn">logs</button>
26+
<div class="button-group">
27+
<button id="toggle-logs-btn" class="toggle-btn">logs</button>
28+
<select id="sub-lang" class="toggle-btn hidden" title="Subtitle language"></select>
29+
<button id="cc-btn" class="toggle-btn hidden" title="Toggle subtitles">CC</button>
30+
</div>
2731
<button id="delete-btn" class="toggle-btn hidden" style="background: #cc0000;">&#x1F5D1; delete</button>
2832
</div>
2933

0 commit comments

Comments
 (0)