summaryrefslogtreecommitdiff
path: root/TODO
blob: 222d6bab11490eb74d5eeab6a39263a7295e1309 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
== Colors
#f0e6dc #412f2d #934a5b #5a6811

== Names
 * camu
  - liana
 * libalabaster
 * libnaunet
  - nnwt
 * stela

== Webite/Manual
=== Website
 * Landing Page
  - Video Demo
 * Products Page
 * Downloads
 * Contact
 * Source Code
 * Design Documents

=== Manual
 * Installation and Usage

== TODO
=== TODAY
 - [x] Commit libalabaster build update.
 - [x] Commit stela changes.
 - [x] Commit ffmpeg build update.
 - [x] Small list refactor.
 - [x] Commit libnaunet changes.
 - [x] Consolidate spng, stb_img, and wuffs into one file with server/client ifdefs.
 - [x] Commit subproject changes.
 - [-] Sink errored buffer improvement.
  - [-] More checks for VIDEO_EMPTY() || VIDEO_ENDED() for better experience.
   - This was an actual correctness issue.
  - [x] Checking buffer states needs a lock, check asserts.
  - [x] Commit fixes.
  - [x] Commit changes.
 - [x] cache selection in meson_options
 - [x] al_atomic_* -> atomic_*
 - [x] Test pause -> cmv-clear -> add audio only
 - [x] libnaunet zlib wrap
 - [ ] Remove entry->ended from sink.
 - [ ] Pass over logging.
 - [ ] list_remove().
 - [ ] Do ntp like latency evaluation.
 - [ ] packet_cache_v2.
 - [ ] Implement queued.
 - [ ] Command line argument test in libnaunet.
 - [ ] Header cleanup.
 - [ ] https://github.com/JuliaStrings/utf8proc/blob/master/utf8proc.h
  - [ ] ustr for ui elements.
  - [ ] remove wstr.
 - [ ] Packet benchmark.
  - Create packet, write bunch of ints, send to another thread, thread adds everything.
 - [ ] Startup timing information.
  - From main() to window_system_main() then everything in desktop_open().
     - Might as well work on the cleanup part too.
 - [ ] RPC header packing.
  - [ ] Look for more obvious packet_stream/rpc optimizations.

== Emscripten Sink
 - [ ] WebSocket packet_stream.
 - [ ] Server-side WebSocket and TCP.
  - nn_multiplex handles WebSocket upgrade.
 - [ ] Analyze thread-safety requirements of nn_signal usage.
  - [ ] Sink
  - [ ] VCR
 - [ ] Should still be able to rely on miniaudio.
 - [ ] MOMO should be comptabible with WebGL.

=== DMMN
 - [ ] List lock.
 - [ ] Reconnect/Reseek.
 - [ ] Verbose connection logging.
 - [ ] List clear.
 - [ ] Visual status.
 - [ ] Window win32 testing.
 - [ ] Complete release build config.

=== List
 - [x] list.c:294 assert.
  - Very common in testing with remote client (SINK_LOCAL-only theory still possible).
 - [ ] Better name for set_current() type functions.
 - [ ] Fix ref counting and unloading.
 - [ ] List unset.
  - [ ] Cleanup pizzabot.
 - [ ] Gapless/Queued.
  - Consider case where an entry gets queued on the sink at a point when the list already
    expects it to be playing.
 - [ ] list_close(): Free resources if no sinks or wait for all sinks to be removed then free resources.
 - [ ] End on a paused entry should advance with the next entry starting paused.
 - [ ] Allow ended entry to be unpaused (skip to next).
 - [ ] Factor in estimated ping.
  - Per-sink?
 - [ ] Use ended state sink-side?
  - Never set ended entry?
 - [ ] Docs.

=== Sink
 - [x] CTRL+C twice forces SIGINT.
 - [ ] Synced pausing is broken when video processing falls massively behind.
   - Will cause 'Requested PTS is lower than oldest frame in video_buffer'.
 - [ ] Mark entries for removal rather than remove in-place.
 - [ ] More optimal command queue.

=== Cache
 - See cache/entry.h.
 - [ ] Don't use file_mapped for large files.
 - [ ] EOF when seeking forward in slow http source.
 - [ ] HTTP timeout.

=== Liana
 - [ ] Invalid connection handling.
  - [ ] Clearest way to "cut off connection immediately".
  - [ ] Max packet size (invalid header).
 - [ ] Node connection pool.
  - [ ] One "connection" object should suffice for retrieving duration, handling stream, and loading visual data for client.

=== VCR
 - Proper "Whole File" implementation.
  - [ ] Track loop count, reset on flush?
  - [ ] Reject images.
 - [ ] Internalize "packet cache" logic.

=== Codecs
 - [ ] Negotiate codec with sinks.
 - [ ] Better wuffs support.
 - [ ] https://snisurset.net/code/abydos

=== Desktop/CMV
 - [ ] Consistent cleanup on errors.
  - Start from desktop.c:camu_desktop_open().
 - [ ] More visual sink-only status.
  - [ ] mpv/libplacebo shaders.
  - [ ] Diagonal swipe for pause.
  - [ ] Motion blur for next/prev.
   - Nintendo switch photo viewer-like.
  - [ ] Overlay text for volume.
 - [ ] Idle animation.
   - https://www.shadertoy.com/view/wtsXRX

=== Renderer
 - [ ] queue_libplacebo rgb24 upload fails on ANV and Wine(wined3d), at least.
 - [ ] vaapi fallback if Vulkan decoding not available.
 - [ ] Command queue.
  - [ ] Queue creation/deletion.
  - [ ] Texture upload.
 - [ ] MOMO frame queue.
 - [ ] Log when scaling flips from required to not and vice versa.

=== CMC
 - [ ] Browse pane.
  - [ ] Tile implementation.
 - [ ] Flesh out "user" concept enough to be usable.

=== Portal
 - [ ] Post cache thread-safety.
 - [ ] https://github.com/lwthiker/curl-impersonate

=== Node
 - [ ] Implement node paradigm.
 - [ ] Allow cmv to act as a node.

=== libalabaster
 - [x] Thread-safe rand().
  - [x] AL_THREAD_LOCAL_SRAND
 - [ ] Scrap trying to use stdlib rand() and copy a prng algorithm from somewhere.
  - Worrying about predicting the state in libc is actually dumb.
  - https://prng.di.unimi.it/xoroshiro64starstar.c
  - https://prng.di.unimi.it/

=== libnaunet
 - [ ] Native Windows file backend.
  - https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-win32_find_dataa

=== Stela
 - [x] X11/common nix Vulkan.
 - [x] GLFW Vulkan destroy surface.
 - [-] X11 and GLFW cursor.
  - [x] Xcursor
 - [-] Fix vaapi on x11.
  - It's actually Xwayland lacking dma import extension.
 - [ ] Wayland xkb.
  - https://wayland-book.com/seat/keyboard.html
  - https://xkbcommon.org/doc/current/xkbcommon_8h.html#a638bf7a52db06f383ce5a4ef99dfe539
  - https://github.com/glfw/glfw/blob/8e15281d34a8b9ee9271ccce38177a3d812456f8/src/wl_window.c#L1880
 - [ ] Configurable depth and stencil buffer.
 - [ ] Consider server-side transcode in terms of the build.
  - If video decode specific GPU device wiring is needed, should it be in stela?
 - [ ] Latency tweaking.
  - Wayland presentation timing.
  - https://github.com/ishitatsuyuki/LatencyFleX

=== Other Optimizations
 - [ ] Walk up cmv and document program design.
 - [ ] Memory pool for al_alloc_object.
 - [ ] alloca str_to_c_str.

=== Style
 - [ ] Pass on log levels.
 - [ ] Rename mutex variables to lock.

=== Tests
 - [x] Sporadic buffer errors.
 - [ ] Emulate slow packet stream connection.
  - ev_set_io_collect_interval() in loop.c.
 - [ ] Fast open -> shuffle spam -> disconnect deadlock.
 - [ ] Simulate ping, connection speed, connection instablitiy.
 - [ ] Seek again before slow client can respond to the first seek.
 - [ ] al_array_contains
 - [ ] al_array_unsorted_search_by_key

==== Test cases
// BUFFER_QUEUED -> BUFFER_INIT in CLIENT_REMOVE_BUFFERS.
//  - Ended audio or video only-entry processes a seek right after being skipped from.
//  - In switch_to(), because it's ended, remove_entry_buffers() is not called on this entry.
//  - During the seek within CLIENT_REMOVE_BUFFERS (this point before this change),
//    we don't touch an empty buffer's state. An empty buffer that was QUEUED stays QUEUED.
//  - CLIENT_RECONNECTED has no effect because the entry is not current.
//  - Now, if this entry is ever switch_to()'d, add_or_queue_entry() will assert
//    because a buffer's state being QUEUED at that point is invalid.

=== Build
 - [x] Allow forcing ffmpeg-compat.
  - 3 levels? latest, 4, 3.
 - [x] allow --force-fallback-for=libavcodec.
 - [x] Allow selecting window from camu.
  - [x] 'guess' option
 - [x] Don't require shaderc if libplacebo found.
 - [x] Audio optional based on if libpulse/libasound are found.
 - [x] libalabaster option for release build with asserts (al_assert only).
 - [ ] Update simple build and test in README.
 - [ ] Fix mingw64 initial build (shaderc compile).
 - [ ] Change git clone depth of subproject wraps based on build configuration.
 - [ ] Web build.

=== External
 - [ ] miniaudio dsound flush.
 - [ ] notcurses ffmpeg flush/reset.

=== camu_db
==== Transfer
 - [ ] Compare all raw_responses that are identical except not relevant timestamps.
 - [ ] json.dumps(d).decode('unicode-escape').encode('utf8')
 - [ ] Index all posts.
 - [ ] Impement remake_post() using raw responses.
 - [ ] Estimate size requirement.
 - [ ] Re-write database using moves for resources.

==== Status
 - [ ] Generate following list for pixiv and twitter, do twitter one-shots in twitter7/8.
 - [ ] List all pixiv ids in database, compare against current following list.
 - [ ] Merge run/* in some way that respects the file dates.
 - [ ] Move original pixiv into proper DB.
  - [ ] Verify whether pixiv_app returns updated date or created date.
  - [ ] Flag with unchecked updated date.
 - [ ] Move in twitterN/pixivN temporary directories.
  - Clear up significant space.
  - Rewrite everything with moves.
 - [ ] Setup system for downloading a list of tweet IDs.
  - [ ] Download likes.
  - [ ] Download missing? Twitter posts.
 - [ ] Proper format for TikTok.
 - [ ] Proper format for Youtube.
 - [ ] Sort out and attempt to source various loose files.

== References
=== egl_resize
 * https://gitlab.freedesktop.org/mesa/mesa/-/issues/6547
 * https://github.com/KhronosGroup/EGL-Registry/pull/160/files
 * https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18984
 * https://gitlab.freedesktop.org/mesa/mesa/-/issues/7217

=== hwdec
 * https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg/-/blob/meson-4.4/meson.build
 * https://ffmpeg.org/doxygen/trunk/qsv_decode_8c-example.html
 * https://github.com/Themaister/Granite/blob/master/video/ffmpeg_hw_device.cpp
 * https://trac.ffmpeg.org/wiki/HWAccelIntro
 * https://github.com/mpv-player/mpv/blob/master/video/decode/vd_lavc.c#L699
 * https://trac.ffmpeg.org/wiki/Hardware/VAAPI

=== subs
* Get subtitles.
ffmpeg -i <path>.mkv -map 0:s:2 -vn -an -codec:s ass <output>.ass
* Detect type.
uchardet subs.srt
* Re-encode subs.
ffmpeg -sub_charenc ISO-8859-1 -i <path>.srt <output>.ass
* Single audio and video streams.
ffmpeg -i <path>.mkv -map 0:v -map 0:a -c:v copy -c:a copy <output>.mkv
* Add subtitles.
ffmpeg -i <path>.mkv -i <path>.ass -map 0:v -map 0:a -map 1:s -c:v copy -c:a copy -c:s copy <output>.mkv

=== No stdlib
https://github.com/mjansson/rpmalloc

=== Android
https://blog.differentpla.net/blog/2022/05/10/nvidia-shield-adb/
https://github.com/brackeen/glfm/blob/main/examples/touch.c
https://developer.android.com/ndk/reference/group/audio#aaudiostream_gettimestamp
https://github.com/googlearchive/android-audio-high-performance/blob/master/aaudio/hello-aaudio/src/main/cpp/PlayAudioEngine.cpp
https://github.com/google/ExoPlayer/blob/release-v1/library/src/main/java/com/google/android/exoplayer/audio/AudioTrack.java
https://www.youtube.com/watch?v=FJW8nGV4jxY

=== Audio
https://github.com/lipnitsk/mocp/blob/master/equalizer.c#L10

=== cmsb
https://github.com/NixOS/nixpkgs/pull/37730/files
Could help with iteration.

== Ideas/Plans
 - [ ] Stela KMS backend.
 - [ ] XMB (XrossMediaBar) spiritual succesor.
 - [ ] Minecraft mod.
 - [ ] Non-TCP (UDP, QUIC?) protocol support.
 - [ ] NDS client.

=== JSON parsing lib
 - Reference serde_json?
 - https://old.reddit.com/r/C_Programming/comments/wjoghd/implementing_an_optional_type_in_c/
 - https://github.com/serde-rs/json
 - https://old.reddit.com/r/embedded/comments/1byxt04/attribute_packed_in_embedded_systems_pros_and_cons/
 - https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Attributes.html

// vim: set ft=asciidoc: