-
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
-
329
-
330
-
331
-
332
-
333
-
334
-
335
-
336
-
337
-
338
-
339
-
340
-
341
-
342
-
343
-
344
-
345
-
346
-
347
-
348
-
349
-
350
-
351
-
352
-
353
-
354
-
355
-
356
-
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
-
365
-
366
-
367
-
368
-
369
-
370
-
371
-
372
-
373
-
374
-
375
-
376
-
377
-
378
-
379
-
380
-
381
-
382
-
383
-
384
-
385
-
386
-
387
-
388
-
389
-
390
-
391
-
392
-
393
-
394
-
395
-
396
-
397
-
398
-
399
-
400
-
401
-
402
-
403
-
404
-
405
-
406
-
407
-
408
-
409
-
410
-
411
-
412
-
413
-
414
-
415
-
416
-
417
-
418
-
419
-
420
-
421
-
422
-
423
-
424
-
425
-
426
-
427
-
428
-
429
-
430
-
431
-
432
-
433
-
434
-
435
-
436
-
437
-
438
-
439
-
440
-
441
-
442
-
443
-
444
-
445
-
446
-
447
-
448
-
449
-
450
-
451
-
452
-
453
-
454
-
455
-
456
-
457
-
458
-
459
-
460
-
461
-
462
-
463
-
464
-
465
-
466
-
467
-
468
-
469
-
470
-
471
-
472
-
473
-
474
-
475
-
476
-
477
-
478
-
479
-
480
-
481
-
482
-
483
-
484
-
485
-
486
-
487
-
488
-
489
-
490
-
491
-
492
-
493
-
494
-
495
-
496
-
497
-
498
-
499
-
500
-
501
-
502
-
503
-
504
-
505
-
506
-
507
-
508
-
509
-
510
-
511
-
512
-
513
-
514
-
515
-
516
-
517
-
518
-
519
-
520
-
521
-
522
-
523
-
524
-
525
-
526
-
527
-
528
-
529
-
530
-
531
-
532
-
533
-
534
-
535
-
536
-
537
-
538
-
539
-
540
-
541
-
542
-
543
-
544
-
545
-
546
-
547
-
548
-
549
-
550
-
551
-
552
-
553
-
554
-
555
-
556
-
557
-
558
-
559
-
560
-
561
-
562
-
563
-
564
-
565
-
566
-
567
-
568
-
569
-
570
-
571
-
572
-
573
-
574
-
575
-
576
-
577
-
578
-
579
-
580
-
581
-
582
-
583
-
584
-
585
-
586
-
587
-
588
-
589
-
590
-
591
-
592
-
593
-
594
-
595
-
596
-
597
-
598
-
599
-
600
-
601
-
602
-
603
-
604
-
605
-
606
-
607
-
608
-
609
-
610
-
611
-
612
-
613
-
614
-
615
-
616
-
617
-
618
-
619
-
620
-
621
-
622
-
623
-
624
-
625
-
626
// Copyright 2025 Shota FUJI
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0
[CCode (cheader_filename = "plac.h")]
namespace Plac {
namespace Discovery {
[CCode (
cname = "plac_discovery_server",
ref_function = "plac_discovery_server_retain",
unref_function = "plac_discovery_server_release"
)]
[Compact]
public class Server {
[CCode (cname = "plac_discovery_server_retain")]
public void @ref ();
[CCode (cname = "plac_discovery_server_release")]
public void unref ();
public Server(string id, string name, string version, string ip_addr, uint16 http_port);
public string id;
public string name;
public string version;
public string ip_addr;
public uint16 http_port;
}
[CCode (
cname = "plac_discovery_scan_result_code",
cprefix = "PLAC_DISCOVERY_SCAN_RESULT_",
has_type_id = false
)]
public enum ScanResultCode {
OK = 0,
UNKNOWN = 1,
NETWORK_UNAVAILABLE = 2,
SOCKET_PERMISSION_DENIED = 3,
SOCKET_ERROR = 4,
OUT_OF_MEMORY = 5,
}
[CCode (
cname = "plac_discovery_scan_result",
ref_function = "plac_discovery_scan_result_retain",
unref_function = "plac_discovery_scan_result_release"
)]
[Compact]
public class ScanResult {
[CCode (cname = "plac_discovery_scan_result_retain")]
public void @ref ();
[CCode (cname = "plac_discovery_scan_result_release")]
public void unref ();
[CCode (
cname = "servers_ptr",
array_length_cname = "servers_len",
array_length_type = "size_t"
)]
public Server[] servers;
public ScanResultCode code;
}
[CCode (cname = "plac_discovery_resolve")]
public ScanResult? resolve(string server_id, string ip_addr, uint16 http_port);
}
namespace Transport {
[CCode (
cname = "plac_transport_now_playing",
ref_function = "plac_transport_now_playing_retain",
unref_function = "plac_transport_now_playing_release"
)]
[Compact]
public class NowPlaying {
public string one_line_line1;
public string two_line_line1;
public string? two_line_line2;
public string three_line_line1;
public string? three_line_line2;
public string? three_line_line3;
public uint64 seek_position;
public uint64 length;
public bool has_seek_position;
public bool has_length;
public string? image_key;
}
[CCode (
cname = "plac_transport_seek_change",
ref_function = "plac_transport_seek_change_retain",
unref_function = "plac_transport_seek_change_release"
)]
[Compact]
public class SeekChange {
public string zone_id;
public uint64 seek_position;
public bool has_seek_position;
}
[CCode (
cname = "plac_transport_output_volume_unit",
cprefix = "PLAC_TRANSPORT_OUTPUT_VOLUME_",
has_type_id = false
)]
public enum OutputVolumeUnit {
UNKNOWN = 0,
NUMBER = 1,
DECIBEL = 2,
}
[CCode (cname = "plac_transport_output_volume", has_type_id = false)]
public struct OutputVolume {
public OutputVolumeUnit unit;
public double min;
public double max;
public double value;
public double step;
public bool muted;
}
[CCode (
cname = "plac_transport_output",
ref_function = "plac_transport_output_retain",
unref_function = "plac_transport_output_release"
)]
[Compact]
public class Output {
public string id;
public string display_name;
public bool is_incremental_volume;
public OutputVolume volume;
}
[CCode (
cname = "plac_transport_playback_state",
cprefix = "PLAC_TRANSPORT_PLAYBACK_",
has_type_id = false
)]
public enum PlaybackState {
LOADING = 0,
STOPPED = 1,
PAUSED = 2,
PLAYING = 3,
}
[CCode (
cname = "plac_transport_zone",
ref_function = "plac_transport_zone_retain",
unref_function = "plac_transport_zone_release"
)]
[Compact]
public class Zone {
public string id;
public string name;
[CCode (
cname = "outputs",
array_length_cname = "outputs_len",
array_length_type = "size_t"
)]
public Output[] outputs;
public PlaybackState playback;
public uint16 allowed_action;
public NowPlaying? now_playing;
[CCode (cname = "plac_transport_zone_retain")]
public void @ref ();
[CCode (cname = "plac_transport_zone_release")]
public void unref ();
}
[CCode (
cname = "plac_transport_zone_list_event",
ref_function = "plac_transport_zone_list_event_retain",
unref_function = "plac_transport_zone_list_event_release"
)]
[Compact]
public class ZoneListEvent {
[CCode (cname = "plac_transport_zone_list_event_retain")]
public void @ref ();
[CCode (cname = "plac_transport_zone_list_event_release")]
public void unref ();
[CCode (
cname = "added_zones_ptr",
array_length_cname = "added_zones_len",
array_length_type = "size_t"
)]
public Zone[] added;
[CCode (
cname = "changed_zones_ptr",
array_length_cname = "changed_zones_len",
array_length_type = "size_t"
)]
public Zone[] changed;
[CCode (
cname = "removed_zone_ids_ptr",
array_length_cname = "removed_zone_ids_len",
array_length_type = "size_t"
)]
public string[] removed;
[CCode (
cname = "seek_changes_ptr",
array_length_cname = "seek_changes_len",
array_length_type = "size_t"
)]
public SeekChange[] seek_changed;
}
[CCode (cname = "PLAC_TRANSPORT_ACTION_NEXT")]
public const uint16 ACTION_NEXT;
[CCode (cname = "PLAC_TRANSPORT_ACTION_PREV")]
public const uint16 ACTION_PREV;
[CCode (cname = "PLAC_TRANSPORT_ACTION_PAUSE")]
public const uint16 ACTION_PAUSE;
[CCode (cname = "PLAC_TRANSPORT_ACTION_PLAY")]
public const uint16 ACTION_PLAY;
[CCode (cname = "PLAC_TRANSPORT_ACTION_SEEK")]
public const uint16 ACTION_SEEK;
[CCode (
cname = "plac_transport_control_result_code",
cprefix = "PLAC_TRANSPORT_CONTROL_RESULT_",
has_type_id = false
)]
public enum ControlResultCode {
OK = 0,
UNKNOWN_ERROR = 1,
OUT_OF_MEMORY = 2,
FAILED_TO_SEND = 3,
CLOSED = 4,
NO_ACTION_BIT_SET = 5,
SERVER_ERROR = 6,
TIMEOUT = 7,
}
[CCode (
cname = "plac_transport_seek_result_code",
cprefix = "PLAC_TRANSPORT_SEEK_RESULT_",
has_type_id = false
)]
public enum SeekResultCode {
OK = 0,
UNKNOWN_ERROR = 1,
OUT_OF_MEMORY = 2,
FAILED_TO_SEND = 3,
CLOSED = 4,
SERVER_ERROR = 5,
TIMEOUT = 6,
}
[CCode (
cname = "plac_transport_volume_control_result_code",
cprefix = "PLAC_TRANSPORT_VOLUME_CONTROL_RESULT_",
has_type_id = false
)]
public enum VolumeControlResultCode {
OK = 0,
UNKNOWN_ERROR = 1,
OUT_OF_MEMORY = 2,
FAILED_TO_SEND = 3,
CLOSED = 4,
SERVER_ERROR = 5,
TIMEOUT = 6,
ILLEGAL_METHOD = 7,
}
}
namespace Browse {
[CCode (
cname = "plac_browse_hierarchy",
cprefix = "PLAC_BROWSE_HIERARCHY_",
has_type_id = false
)]
public enum Hierarchy {
BROWSE = 0,
PLAYLISTS = 1,
SETTINGS = 2,
INTERNET_RADIO = 3,
ALBUMS = 4,
ARTISTS = 5,
GENRES = 6,
COMPOSERS = 7,
SEARCH = 8,
}
[CCode (
cname = "plac_browse_item_hint",
cprefix = "PLAC_BROWSE_ITEM_HINT_",
has_type_id = false
)]
public enum ItemHint {
UNKNOWN = 0,
ACTION = 1,
ACTION_LIST = 2,
LIST = 3,
HEADER = 4,
}
[CCode (
cname = "plac_browse_input_prompt",
ref_function = "plac_browse_input_prompt_retain",
unref_function = "plac_browse_input_prompt_release"
)]
[Compact]
public class InputPrompt {
public string prompt;
public string action;
public string? default_value;
public bool is_password;
}
[CCode (
cname = "plac_browse_item",
ref_function = "plac_browse_item_retain",
unref_function = "plac_browse_item_release"
)]
[Compact]
public class Item {
public string title;
public string? subtitle;
public string? image_key;
public string? item_key;
public ItemHint hint;
public InputPrompt prompt;
}
[CCode (
cname = "plac_browse_result_code",
cprefix = "PLAC_BROWSE_RESULT_",
has_type_id = false
)]
public enum ResultCode {
OK = 0,
UNKNOWN_ERROR = 1,
MISSING_PROPERTY = 2,
OUT_OF_MEMORY = 3,
FAILED_TO_SEND = 4,
CLOSED = 5,
TIMEOUT = 6,
}
[CCode (
cname = "plac_browse_result_action",
cprefix = "PLAC_BROWSE_RESULT_ACTION_",
has_type_id = false
)]
public enum ResultAction {
NONE = 0,
REPLACE_ITEM = 1,
REMOVE_ITEM = 2,
LIST = 3,
ERROR_MESSAGE = 4,
MESSAGE = 5,
}
[CCode (
cname = "plac_browse_replace_item_action",
ref_function = "plac_browse_replace_item_action_retain",
unref_function = "plac_browse_replace_item_action_release"
)]
[Compact]
public class ReplaceItemAction {
public Item item;
}
[CCode (
cname = "plac_browse_list_action",
ref_function = "plac_browse_list_action_retain",
unref_function = "plac_browse_list_action_release"
)]
[Compact]
public class ListAction {
public string title;
public string? subtitle;
public string? image_key;
public uint64 level;
[CCode (
cname = "items_ptr",
array_length_cname = "items_len",
array_length_type = "size_t"
)]
public Item[] items;
}
[CCode (
cname = "plac_browse_error_message_action",
ref_function = "plac_browse_error_message_action_retain",
unref_function = "plac_browse_error_message_action_release"
)]
[Compact]
public class ErrorMessageAction {
public string message;
}
[CCode (
cname = "plac_browse_message_action",
ref_function = "plac_browse_message_action_retain",
unref_function = "plac_browse_message_action_release"
)]
[Compact]
public class MessageAction {
public string message;
}
[CCode (
cname = "plac_browse_result",
ref_function = "plac_browse_result_retain",
unref_function = "plac_browse_result_release"
)]
[Compact]
public class Result {
public ResultCode code;
public ResultAction action;
public ReplaceItemAction get_replace_item_action();
public ListAction get_list_action();
public ErrorMessageAction get_error_message_action();
public MessageAction get_message_action();
}
[CCode (
cname = "plac_browse_label",
ref_function = "plac_browse_label_retain",
unref_function = "plac_browse_label_release"
)]
[Compact]
public class Label {
public string plain_text;
[CCode (cname = "plac_browse_label_from_string")]
public Label(string src);
}
}
namespace Image {
[CCode (
cname = "plac_image_scaling_method",
cprefix = "PLAC_IMAGE_SCALING_METHOD_",
has_type_id = false
)]
public enum ScalingMethod {
FIT = 0,
FILL = 1,
STRETCH = 2,
}
[CCode (
cname = "plac_image_content_type",
cprefix = "PLAC_IMAGE_CONTENT_TYPE_",
has_type_id = false
)]
public enum ContentType {
JPEG = 0,
PNG = 1,
}
[CCode (
cname = "plac_image_get_options",
ref_function = "plac_image_get_options_retain",
unref_function = "plac_image_get_options_release"
)]
[Compact]
public class GetOptions {
[CCode (cname = "plac_image_get_options_make")]
public GetOptions();
public void set_size(ScalingMethod scaling, size_t width, size_t height);
public void set_content_type(ContentType content_type);
}
}
[CCode (
cname = "plac_connection_connection_error",
cprefix = "PLAC_CONNECTION_ERROR_",
has_type_id = false
)]
public enum ConnectionError {
UNKNOWN = 0,
CLOSED_BY_SERVER = 1,
OUT_OF_MEMORY = 2,
UNEXPECTED_RESPONSE = 3,
NETWORK_UNAVAILABLE = 4,
NETWORK_ERROR = 5,
}
[CCode (
cname = "plac_connection_connection_error_event",
ref_function = "plac_connection_connection_error_event_retain",
unref_function = "plac_connection_connection_error_event_release"
)]
[Compact]
public class ConnectionErrorEvent {
[CCode (cname = "plac_connection_connection_error_event_retain")]
public void @ref ();
[CCode (cname = "plac_connection_connection_error_event_release")]
public void unref ();
public ConnectionError code;
}
[CCode (
cname = "plac_connection_connected_event",
ref_function = "plac_connection_connected_event_retain",
unref_function = "plac_connection_connected_event_release"
)]
[Compact]
public class ConnectedEvent {
[CCode (cname = "plac_connection_connected_event_retain")]
public void @ref ();
[CCode (cname = "plac_connection_connected_event_release")]
public void unref ();
public string token;
}
[CCode (
cname = "plac_connection_event",
ref_function = "plac_connection_event_retain",
unref_function = "plac_connection_event_release"
)]
[Compact]
public class ConnectionEvent {
[CCode (cname = "plac_connection_event_retain")]
public void @ref ();
[CCode (cname = "plac_connection_event_release")]
public void unref ();
[CCode (
cname = "plac_connection_event_kind",
cprefix = "PLAC_CONNECTION_EVENT_",
has_type_id = false
)]
public enum Kind {
ERROR = 0,
CONNECTED = 1,
ZONE_LIST = 10,
}
public Kind kind;
[CCode (cname = "plac_connection_event_get_connection_error_event")]
public ConnectionErrorEvent get_connection_error_event();
[CCode (cname = "plac_connection_event_get_connected_event")]
public ConnectedEvent get_connected_event();
[CCode (cname = "plac_connection_event_get_zone_list_event")]
public Transport.ZoneListEvent get_zone_list_event();
}
[CCode (
cname = "plac_connection",
ref_function = "plac_connection_retain",
unref_function = "plac_connection_release"
)]
[Compact]
private class Connection {
[CCode (cname = "plac_connection_make")]
public Connection(Discovery.Server server, string? token);
[CCode (cname = "plac_connection_retain")]
public void @ref ();
[CCode (cname = "plac_connection_release")]
public void unref ();
[CCode (cname = "plac_connection_get_event")]
public ConnectionEvent get_event();
[CCode (cname = "plac_connection_disconnect")]
public void disconnect();
[CCode (cname = "plac_connection_subscribe_zones")]
public void subscribe_zones();
[CCode (cname = "plac_connection_control")]
public void control(Transport.Zone zone, uint16 action);
[CCode (cname = "plac_connection_change_volume")]
public Transport.VolumeControlResultCode change_volume(Transport.Output output, double abs_value);
[CCode (cname = "plac_connection_increase_volume")]
public Transport.VolumeControlResultCode increase_volume(Transport.Output output);
[CCode (cname = "plac_connection_decrease_volume")]
public Transport.VolumeControlResultCode decrease_volume(Transport.Output output);
[CCode (cname = "plac_connection_seek")]
public Transport.SeekResultCode seek(Transport.Zone zone, int64 seconds);
[CCode (cname = "plac_connection_browse")]
public Browse.Result? browse(Browse.Hierarchy hierarchy, Transport.Zone? zone, Browse.Item? item, bool pop);
[CCode (cname = "plac_connection_get_image_url")]
public string? get_image_url(string image_key, Image.GetOptions options);
}
}