ascii-chat
Binary v0.16.50-198-g78f51665f
Library lib/v0.3.2-2240-g78f51665f
Video chat in your terminal
Loading...
Searching...
No Matches
media.c File Reference

Media file and stream options. More...

Go to the source code of this file.

Macros

#define RENDER_FILE_MODES   (OPTION_MODE_CLIENT | OPTION_MODE_MIRROR | OPTION_MODE_DISCOVERY)

Variables

const registry_entry_t g_media_entries []

Detailed Description

Media file and stream options.

Options for streaming from media files, URLs, seeking, looping, and cookie handling for streaming services.

Author
Zachary Fogg me@zf.nosp@m.o.gg
Date
January 2026

Definition in file media.c.

Macro Definition Documentation

◆ RENDER_FILE_MODES

#define RENDER_FILE_MODES   (OPTION_MODE_CLIENT | OPTION_MODE_MIRROR | OPTION_MODE_DISCOVERY)

Variable Documentation

◆ g_media_entries

const registry_entry_t g_media_entries[]

Definition at line 95 of file media.c.

95 {{"file",
96 'f',
98 offsetof(options_t, media_file),
99 "",
100 0,
101 "Append a media file to the playback playlist (repeat --file/--url in order). Stream from media file or stdin "
102 "(use '-' for stdin). Supported formats: see man ffmpeg-formats; codecs: see man "
103 "ffmpeg-codecs.",
104 "MEDIA",
105 NULL,
106 false,
107 "ASCII_CHAT_FILE",
108 NULL,
109 parse_media_file,
110 false,
111 false,
113 {.input_type = OPTION_INPUT_FILEPATH},
114 NULL},
115 {"url",
116 'u',
118 offsetof(options_t, media_url),
119 "",
120 0,
121 "Append a network URL to the playback playlist (repeat --file/--url in order). Direct HTTP/HTTPS/RTSP streams use "
122 "FFmpeg; complex sites (YouTube, TikTok, etc.) use "
123 "yt-dlp. Supported formats: see man ffmpeg-formats; codecs: see man ffmpeg-codecs; sites: yt-dlp "
124 "https://github.com/yt-dlp/yt-dlp/blob/master/README.md#supported-sites.",
125 "MEDIA",
126 NULL,
127 false,
128 "ASCII_CHAT_URL",
129 NULL,
130 parse_media_url,
131 false,
132 false,
134 {0},
135 NULL},
136 {"loop",
137 'l',
139 offsetof(options_t, media_loop),
140 &default_media_loop_value,
141 sizeof(bool),
142 "Loop single media or repeat the complete playlist.",
143 "MEDIA",
144 NULL,
145 false,
146 "ASCII_CHAT_LOOP",
147 NULL,
148 NULL,
149 false,
150 false,
152 {0},
153 NULL},
154 {"pause",
155 '\0',
157 offsetof(options_t, pause),
158 &default_pause_value,
159 sizeof(bool),
160 "Start playback paused (toggle with spacebar, requires --file or --url).",
161 "MEDIA",
162 NULL,
163 false,
164 "ASCII_CHAT_PAUSE",
165 NULL,
166 NULL,
167 false,
168 false,
170 {0},
171 NULL},
172 {"seek",
173 's',
175 offsetof(options_t, media_seek_timestamp),
176 &default_media_seek_value,
177 sizeof(double),
178 "Seek to timestamp before playback (format: seconds, MM:SS, or HH:MM:SS.ms).",
179 "MEDIA",
180 NULL,
181 false,
182 "ASCII_CHAT_SEEK",
183 NULL,
185 false,
186 false,
188 {.examples = g_seek_examples, .input_type = OPTION_INPUT_STRING},
189 NULL},
190 {"yt-dlp-options",
191 '\0',
193 offsetof(options_t, yt_dlp_options),
194 NULL,
195 sizeof(((options_t *)0)->yt_dlp_options),
196 "Arbitrary yt-dlp options passed to the extraction subprocess for URL resolution. "
197 "Examples: --no-warnings or --proxy socks5://127.0.0.1:1080 or --cookies-from-browser=firefox.",
198 "MEDIA",
199 NULL,
200 false,
201 "ASCII_CHAT_YT_DLP_OPTIONS",
202 NULL,
203 NULL,
204 false,
205 false,
207 {0},
208 NULL},
209 {"video-codec",
210 '\0',
212 offsetof(options_t, video_codec),
213 "auto",
214 sizeof(((options_t *)0)->video_codec),
215 "Video codec: auto (default) tries HEVC, H.264, then raw RGB. Explicit hevc, h264, or raw never falls back.",
216 "MEDIA",
217 "CODEC",
218 false,
219 "ASCII_CHAT_VIDEO_CODEC",
220 validate_video_codec,
221 NULL,
222 false,
223 false,
225 {0},
226 NULL},
227
228#define RENDER_FILE_MODES (OPTION_MODE_CLIENT | OPTION_MODE_MIRROR | OPTION_MODE_DISCOVERY)
229
230#ifndef __EMSCRIPTEN__
231 {"render-kitty",
232 '\0',
234 offsetof(options_t, render_kitty),
235 &default_render_kitty_value,
236 sizeof(bool),
237 "Display a snapshot using Kitty graphics (requires --snapshot). Combine with --render-file to save it.",
238 "MEDIA",
239 NULL,
240 false,
241 "ASCII_CHAT_RENDER_KITTY",
242 validate_kitty_output,
243 NULL,
244 false,
245 false,
247 {0},
248 NULL},
249#endif
250
251 {"render-file",
252 '\0',
254 offsetof(options_t, render_file),
255 "",
256 sizeof(((options_t *)0)->render_file),
257 "Render ASCII frames to stdout or video/image file. Use '-' for stdout; extension determines format: "
258 ".mp4, .mov, .webm, .avi, .gif, .png, .jpg. Named files retain ASCII on stdout and show terminal "
259 "progress while finishing; redirect stdout to hide it.",
260 "MEDIA",
261 "PATH",
262 false,
263 "ASCII_CHAT_RENDER_FILE",
264 validate_kitty_output,
265 NULL,
266 false,
267 false,
269 {.input_type = OPTION_INPUT_FILEPATH},
270 NULL},
271
272 {"render-theme",
273 '\0',
275 offsetof(options_t, render_theme),
276 &default_render_theme_value,
277 sizeof(int),
278 "Terminal color scheme for rendered output: dark, light, auto.",
279 "MEDIA",
280 "THEME",
281 false,
282 "ASCII_CHAT_RENDER_THEME",
283 NULL,
285 false,
286 false,
288 {.enum_values = g_render_theme_values, .enum_descriptions = g_render_theme_descs, .input_type = OPTION_INPUT_ENUM},
289 NULL},
290
291 {"render-font",
292 '\0',
294 offsetof(options_t, render_font),
295 "",
296 sizeof(((options_t *)0)->render_font),
297 "Font for render-file output: bundled names (matrix or default), system font names, or absolute .ttf/.otf path. "
298 "Default: default (bundled DejaVu Sans Mono). "
299 "Examples: matrix, default, JetBrains Mono, Nerd Font Mono, /path/to/font.ttf.",
300 "MEDIA",
301 "FONT",
302 false,
303 "ASCII_CHAT_RENDER_FONT",
304 NULL,
305 NULL,
306 false,
307 false,
309 {.input_type = OPTION_INPUT_FILEPATH},
310 NULL},
311
312 {"render-font-size",
313 '\0',
315 offsetof(options_t, render_font_size),
316 &default_render_font_size_value,
317 sizeof(double),
318 "Font size in points for render-file output (default: 0, auto-scales video; positive fractional sizes supported).",
319 "MEDIA",
320 "SIZE",
321 false,
322 "ASCII_CHAT_RENDER_FONT_SIZE",
323 validate_render_font_size,
324 NULL,
325 false,
326 false,
328 {.input_type = OPTION_INPUT_NUMERIC},
329 NULL},
330
@ OPTION_INPUT_STRING
Free-form text input.
Definition builder.h:189
@ OPTION_INPUT_NUMERIC
Numeric value with optional min/max/step.
Definition builder.h:188
@ OPTION_INPUT_FILEPATH
File path completion.
Definition builder.h:190
@ OPTION_INPUT_ENUM
Choose from fixed set of enum values.
Definition builder.h:187
@ OPTION_TYPE_DOUBLE
Floating point (–ratio 1.5).
Definition builder.h:174
@ OPTION_TYPE_STRING
String value (–name foo).
Definition builder.h:173
@ OPTION_TYPE_CALLBACK
Custom parser function.
Definition builder.h:175
@ OPTION_TYPE_BOOL
Boolean flag (–flag, no value).
Definition builder.h:171
struct options_state options_t
Immutable, RCU-published snapshot of the application's runtime configuration.
@ OPTION_MODE_CLIENT
Client mode (bit 1).
Definition options.h:936
@ OPTION_MODE_DISCOVERY
Discovery mode (bit 4).
Definition options.h:939
@ OPTION_MODE_MIRROR
Mirror mode (bit 2).
Definition options.h:937
#define REGISTRY_TERMINATOR()
Initialize a terminator entry (sentinel value for array end) Uses designated initializers to properly...
#define RENDER_FILE_MODES
const char * g_render_theme_values[]
Definition metadata.c:111
const char * g_seek_examples[]
Definition metadata.c:151
const char * g_render_theme_descs[]
Definition metadata.c:113
bool parse_timestamp(const char *arg, void *dest, char **error_msg)
Custom parser for –seek flag.
Definition parsers.c:938
bool parse_render_theme(const char *arg, void *dest, char **error_msg)
Parse render theme option for pixel rendering.
Definition parsers.c:282