Project

General

Profile

Htsp » History » Version 150

Jaroslav Kysela, 2015-06-09 15:22

1 117 Jaroslav Kysela
h1. Home Tv Streaming Protocol (HTSP) - Version 21
2 1 Andreas Smas
3
h2. General
4 58 sbi -
5
HTSP is a TCP based protocol primarily intended for streaming of live TV and related meta data such as channels, group of channels (called tags in HTSP) and electronic program guide (EPG) information.
6
7 61 Adam Sutton
The transmission and reception of a channel over HTSP is referred to as a subscription. A single HTSP session can handle as many concurrent subscriptions as the bandwidth and CPU permits.
8 1 Andreas Smas
9 61 Adam Sutton
The HTSP server in tvheadend has a payload-aware scheduler for prioritizing more important packets (such as I-frames) before less important ones (such as B-frames). This makes HTSP suitable for long-distance transmissions and/or paths with non-perfect delivery.
10 1 Andreas Smas
(It has been tested with a server in Stockholm and the client in Berlin).
11
12 17 Andreas Smas
For information about the HTSP wire format please read [[htsmsgbinary|HTSMSG binary format]]
13 1 Andreas Smas
14 61 Adam Sutton
If you're looking to develop a new client, there are several existing client implementations from which you might be able to gain knowledge:
15
16
* "XBMC":https://github.com/opdenkamp/xbmc/tree/master/xbmc/pvrclients/tvheadend
17
* "Showtime":https://github.com/andoma/showtime/tree/master/src/backend/htsp
18 65 John Törnblom
* "TVHGuide":https://github.com/john-tornblom/TVHGuide
19 69 Adam Sutton
* "PyHTSP":https://github.com/adamsutton/tvheadend/tree/master/lib/py/tvh/htsp.py (This is a demo client and is WIP, it has limited functionality).
20 1 Andreas Smas
21 22 Andreas Smas
----
22 18 Andreas Smas
23 84 Jaroslav Kysela
h2. Protocol Changes
24 83 Jaroslav Kysela
25 145 Jaroslav Kysela
h3. v20..v21
26
27
* dvrEntry structures
28
** added files msg (multiple files) to the files field
29
** added dataSize field to show actual (last) file size in dvrEntry updates
30
* epg events - added subtitle field
31
32 126 Jaroslav Kysela
33 131 Jaroslav Kysela
h3. v19..v20
34
35
* dvrEntry structures
36
** added subscriptionError, streamErrors, dataErrors fields
37
** added subtitle fields
38
* autorecEntry structures
39
** added dupDetect and fulltext fields
40 144 Jaroslav Kysela
* added errors fields to the stream status
41
* added satpos to the subscription start
42 131 Jaroslav Kysela
* added subscriptionError field to subscriptionStatus server-to-client method
43
44
h3. v18..v19
45
46 126 Jaroslav Kysela
* autorec/timerec structures
47
** added directory field (forced output directory)
48 127 Jaroslav Kysela
** added enabled field
49
50 126 Jaroslav Kysela
51 119 Jaroslav Kysela
h3. v17..v18
52
53
* added addTimerecEntry, deleteTimerecEntry methods
54
* added timerecEntryAdd, timerecEntryUpdate, timerecEntryDelete server-to-client methods
55
* extended addAutorecEntry method
56
** added start/startWindow/name fields
57
** added owner/creator fields
58
** obsoleted creator field
59
* extended dvrEntryAdd, dvrEntryUpdate
60
** added timerecId field
61
** added owner/creator fields
62
* extended addAutorecEntry, deleteAutorecEntry methods
63
** added start/startWindow fields
64
** obsoleted approxTime
65
** added name/owner/creator fields
66
* extended autorecEntryAdd, autorecEntryUpdate server-to-client methods
67
** fields like for addAutorecEntry
68
* extended getTag method
69
** added tagIndex field
70
71 110 Jaroslav Kysela
h3. v16..v17
72
73
* extended subscriptionStart server-to-client method
74
** added meta field
75
* changed H264 meta data handling (codec meta data are in the meta field only in start message)
76
* VORBIS and AAC codecs have codec specific meta data in the meta field in start message
77 115 Jaroslav Kysela
* changed subscribe method
78
** the normts is always active and the parameter is ignored
79
80 110 Jaroslav Kysela
81 107 Jaroslav Kysela
h3. v15..v16
82
83
* added getProfiles, getDvrConfigs methods
84
* removed getCodecs methods
85
* extended subscribe method
86
** add profile field
87
88 105 Jaroslav Kysela
h3. v14..v15
89
90
* extended channelAdd, channelUpdate server-to-client methods
91 106 Jaroslav Kysela
** the channelIcon URL can be relative 'imagecache/%d' or '/imagecache/%d'
92 1 Andreas Smas
* extended getChannel method
93 106 Jaroslav Kysela
** the channelIcon URL can be relative 'imagecache/%d' or '/imagecache/%d'
94
95 105 Jaroslav Kysela
96 100 Jaroslav Kysela
h3. v13..v14
97
98
* added getChannel method
99
100 85 Jaroslav Kysela
h3. v12..v13
101
102
* added addAutorecEntry method
103
* added deleteAutorecEntry method
104 92 Jaroslav Kysela
* added autorecEntryAdd, autorecEntryUpdate, autorecEntryDelete server-to-client methods
105 85 Jaroslav Kysela
* extended channelAdd server-to-client method
106 87 Jaroslav Kysela
** added channelNumberMinor (for {major}.{minor} channel numbers)
107
* extended dvrEntryAdd and dvrEntryUpdate server-to-client methods
108 88 Jaroslav Kysela
** added eventId, autorecId, startExtra, stopExtra, retention, priority, contentType fields
109 97 Jaroslav Kysela
* extended addDvrEntry method
110
** added retention
111
* extended updateDvrEntry method
112
** added retention, priority
113
* extended epgQuery method
114
** added minduration, maxduration
115 85 Jaroslav Kysela
* added subscriptionGrace server-to-client method
116 97 Jaroslav Kysela
117 85 Jaroslav Kysela
118 83 Jaroslav Kysela
h3. v11..v12
119
120
* added subscriptionFilterStream method
121
* added getDvrCutpoints method
122
123
124
h3. v10..v11
125
126 86 Jaroslav Kysela
* added audio_type in the subscriptionStart server-to-client method
127 83 Jaroslav Kysela
* added getCodecs method
128
129 58 sbi -
h2. Communication
130
131
132 69 Adam Sutton
This communication is currently implemented by using htsmsg's. All strings are encoded as UTF-8.
133 1 Andreas Smas
134
There are two distinct ways for communication within HTSP.
135
136 28 Andreas Smas
Apart from this there is a number of messages that needs to be exchanged during login, see the login section below.
137
138 1 Andreas Smas
139 58 sbi -
h3. RPC communication
140
141
142 1 Andreas Smas
There is a normal RPC way of doing things. I.e. the client sends a request and the server responds with a reply. All the RPC methods are listed below as the 'Client to Server' methods. Apart from all message fields listed within each message type the client can add an additional field:
143 18 Andreas Smas
144 17 Andreas Smas
RPC request extra fields:
145 58 sbi -
<pre>
146 28 Andreas Smas
seq              int  optional   Sequence number. This field will be echoed back by the server in the reply.
147 1 Andreas Smas
username         str  optional   Username, in combination with 'digest' this can be used to raise the privileges
148
                                 for the session in combination with invocation of a method. 
149 28 Andreas Smas
digest           bin  optional   Used to raise privileges.
150 58 sbi -
</pre>
151 18 Andreas Smas
152 1 Andreas Smas
The followings field should be used by the client to match the reply with the request.
153
All replies are guaranteed to arrive in the same order as the requests.
154
Even so, probably the best way to implement the request-reply client is by taking advantage of the 'seq' field.
155
156
RPC reply extra fields:
157 58 sbi -
<pre>
158 18 Andreas Smas
seq              int  optional   Sequence number. Same as in the request.
159 19 Andreas Smas
error            str  optional   If present an error has occurred and the text describes the error.
160
noaccess         int  optional   If present and set to '1' the user is prohibited from invoking the method due to 
161 1 Andreas Smas
                                 access restrictions. 
162 58 sbi -
</pre>
163 1 Andreas Smas
164 18 Andreas Smas
165 58 sbi -
h3. Streaming communication
166
167
168 19 Andreas Smas
For streaming of live TV and various related messages the server will continuously push data to the client.
169 1 Andreas Smas
These messages are referred to as asynchronous messages and always have the 'method' field set and never have the 'seq' field set.
170
Also, the client can enable an additional asyncMetadata mode and by doing so it will be notified by the server when meta data changes. (EPG updates, creation of channels and tags, etc). 
171
172 34 Andreas Smas
173 58 sbi -
h3. Authentication
174
175
176 29 Andreas Smas
In Tvheadend, each method has an associated access restriction. Currently there is only one restriction (Streaming). However, this may change in the future.
177 1 Andreas Smas
178
Privileges for these restrictions may be granted in two ways: Username + Password and/or Source IP address.
179
Therefore it is possible to gain permissions to the system without entering a username and password.
180
While this is really useful it also complicates the authentication schema a bit.
181
Upon connect the initial privileges will be raised based on the source address.
182
183
Before any username / password based authentication has taken place the client must have
184 34 Andreas Smas
obtained a challenge (which stays fixed for the session). This is done via the 'hello' method.
185 1 Andreas Smas
186
In principle it's possible to use two different authentication idioms with HTSP.
187
Depending on how your application works one or another may be more suitable.
188
While they do not really differ from a protocol point of view it's worth mentioning a bit about them here:
189
190
191 58 sbi -
h3. Initial login authentication
192
193
194 1 Andreas Smas
The client performs all of its authentication using the 'login' method.
195
196
It may choose to send:
197 58 sbi -
* Username and password: Privileges will be raised based on these credentials.
198
* Username only: Privileges will be based on just the source address. The username will be used for various logging purposes.
199
* Nothing: Privileges will be based on just the source address.
200 1 Andreas Smas
201
If no privileges are granted after the login message has been received by the server (i.e. both network and username + password based)
202
the server will reply with 'noaccess' set to 1. A client that only employs initial login should honor this flag and ask the
203
user for a username + password and retry by using the 'authenticate' method. I.e. it should not send the 'login' method again.
204
205
206 58 sbi -
h3. On-demand authentication
207
208
209 1 Andreas Smas
The client performs all of its authentication when it needs to.
210
211
When using this method, the client will check every RPC reply for the 'noaccess' field.
212
If it set to 1 it whould ask the user for username + password and retry the request but also
213 58 sbi -
add 'username' and 'digest' to the original message. (See _RPC request extra fields_ above)
214 1 Andreas Smas
215
Typically it would not send a username or digest during login.
216 29 Andreas Smas
217
----
218 34 Andreas Smas
219 66 Adam Sutton
h2. Client to Server (RPC) methods
220 34 Andreas Smas
221
h3. hello
222 58 sbi -
223
Used to identify the client toward the server and to get the session challenge used to
224 1 Andreas Smas
hash passwords into digests. The client can request a different version of the HTSP
225 66 Adam Sutton
protocol with this method. If no 'hello' message is sent the server assumes latest version
226 1 Andreas Smas
is to be used.
227 34 Andreas Smas
228 66 Adam Sutton
Client/Server should select lowest common version, if this is not possible connection should be terminated.
229 1 Andreas Smas
230
Request message fields:
231
<pre>
232 66 Adam Sutton
htspversion        u32   required   Client preferred HTSP version.
233
clientname         str   required   Client software name.
234
clientversion      str   required   Client software version.
235 58 sbi -
</pre>
236 1 Andreas Smas
237
Reply message fields:
238 34 Andreas Smas
<pre>
239 66 Adam Sutton
htspversion        u32   required   The server supports all versions of the protocol up to and including this number.
240
servername         str   required   Server software name.
241
serverversion      str   required   Server software version.
242
servercapability   str[] required   Server capabilities (Added in version 6)
243 1 Andreas Smas
challenge          bin   required   32 bytes randomized data used to generate authentication digests
244 73 Adam Sutton
webroot            str   optional   Server HTTP webroot (Added in version 8)
245
                                    Note: any access to TVH webserver should include this at start of URL path
246 1 Andreas Smas
</pre>
247
248 70 Adam Sutton
Note: possible values for servercapability[]:
249
<pre>
250
cwc                Descrambling available
251
v4l                Analogue TV available
252
linuxdvb           Linux DVB API available
253 1 Andreas Smas
imagecache         Image caching available
254 73 Adam Sutton
timeshift          Timeshifting available (Added in version 9).
255 70 Adam Sutton
</pre>
256
257 58 sbi -
h3. authenticate
258 1 Andreas Smas
259
This can be used to issue authentication without doing anything else.
260
If no privileges are gained it will return with 'noaccess' set to 1.
261
262 33 Andreas Smas
Request message fields:
263 1 Andreas Smas
<pre>
264 66 Adam Sutton
None   
265 33 Andreas Smas
</pre>
266 58 sbi -
267
Reply message fields:
268
<pre>
269 66 Adam Sutton
noaccess           u32   optional   If set to 1, no privileges were granted.
270 33 Andreas Smas
</pre>
271 1 Andreas Smas
272
----
273
274 66 Adam Sutton
h3. getDiskSpace (Added in version 3)
275 58 sbi -
276 66 Adam Sutton
Return diskspace status from Tvheadend's PVR storage
277 1 Andreas Smas
278 66 Adam Sutton
Request message fields:
279
<pre>
280
None
281
</pre>
282 1 Andreas Smas
283 66 Adam Sutton
Reply message fields:
284
<pre>
285
freediskspace      s64   required   Bytes available.
286
totaldiskspace     s64   required   Total capacity.
287
</pre>
288 1 Andreas Smas
289 66 Adam Sutton
h3. getSysTime (Added in version 3)
290 1 Andreas Smas
291 66 Adam Sutton
Return system time on the server.
292
293 1 Andreas Smas
Request message fields:
294
<pre>
295
None
296
</pre>
297
298
Reply message fields:
299 58 sbi -
<pre>
300 66 Adam Sutton
time               s64  required   UNIX time.
301
timezone           s32  required   Minutes west of GMT.
302 1 Andreas Smas
</pre>
303 23 Andreas Smas
304 1 Andreas Smas
----
305
306 66 Adam Sutton
h3. enableAsyncMetadata
307 1 Andreas Smas
308 66 Adam Sutton
When this is enabled the client will get continuous updates from the server about added, update or deleted channels, tags, dvr and epg entries.
309 1 Andreas Smas
310 66 Adam Sutton
An interactive application that presents the user with information about these things should probably enable this and the implement the various server to client methods.
311 1 Andreas Smas
312
Request message fields:
313
<pre>
314 66 Adam Sutton
epg                u32   optional   Set to 1, to include EPG data in async, implied by epgMaxTime (Added in version 6).
315
lastUpdate         s64   optional   Only provide metadata that has changed since this time (Added in version 6).
316
epgMaxTime         s64   optional   Maximum time to return EPG data up to (Added in version 6)
317
language           str   optional   RFC 2616 compatible language list (Added in version 6)
318 1 Andreas Smas
</pre>
319
320
Reply message fields:
321
<pre>
322 66 Adam Sutton
None
323 1 Andreas Smas
</pre>
324
325 66 Adam Sutton
Once the reply as been sent the initial data set will be provided, and then updates will arrive asynchronously after that. The initial data dump is sent using the following messages:
326 1 Andreas Smas
327 66 Adam Sutton
<pre>
328
tagAdd                   optional
329
channelAdd               optional
330
tagUpdate                optional
331
dvrEntryAdd              optional
332
eventAdd                 optional   (Added in version 6)
333
initialSyncComplete      required
334
</pre>
335 1 Andreas Smas
336 66 Adam Sutton
----
337 1 Andreas Smas
338 101 Jaroslav Kysela
h3. getChannel (Added in version 14)
339
340
Request information about the given channel.
341
342
Request message fields:
343
<pre>
344
channelId          u32   required   Channel ID.
345
</pre>
346
347
Reply message fields:
348
<pre>
349
see channelAdd
350
</pre>
351
352
----
353
354 66 Adam Sutton
h3. getEvent
355 1 Andreas Smas
356 66 Adam Sutton
Request information about the given event. An event typically corresponds to a program on a channel.
357 1 Andreas Smas
358 66 Adam Sutton
The language field in the request allows preference for languages to be requested for the various string fields.
359
360 1 Andreas Smas
Request message fields:
361 45 mdd -
<pre>
362 66 Adam Sutton
eventId            u32   required   Event ID.
363
language           str   optional   RFC 2616 compatible language list (Added in version 6)
364 1 Andreas Smas
</pre>
365
366
Reply message fields:
367
<pre>
368 66 Adam Sutton
see eventAdd
369 1 Andreas Smas
</pre>
370
371 66 Adam Sutton
h3. getEvents (Added in version 4)
372 1 Andreas Smas
373 66 Adam Sutton
Request information about a set of events. If no options are specified the entire EPG database will be returned.
374 57 sbi -
375 58 sbi -
Request message fields:
376 1 Andreas Smas
<pre>
377 66 Adam Sutton
eventId            u32   optional   Event ID to begin from (Optional since version 6)
378
channelId          u32   optional   Channel ID to get data for (Added in version 6)
379
numFollowing       u32   optional   Number of events to add (Optional since version 6)
380
maxTime            u64   optional   Maximum time to return data up to (Added in version 6)
381
language           str   optional   RFC 2616 compatible language list (Added in version 6)
382 1 Andreas Smas
</pre>
383
384
Reply message fields:
385
<pre>
386 66 Adam Sutton
events             msg[] required   List of events, using response message fields from eventAdd
387 1 Andreas Smas
</pre>
388 45 mdd -
389 66 Adam Sutton
h3. epgQuery (Added in version 4)
390 1 Andreas Smas
391 66 Adam Sutton
Query the EPG (event titles) and optionally restrict to channel/tag/content type.
392 1 Andreas Smas
393 66 Adam Sutton
Request message fields:
394
<pre>
395
query              str   required  Title regular expression to search for
396
channelId          u32   optional  [[ChannelId]] to restrict search to
397
tagId              u32   optional  [[TagId]] to restrict search to
398
contentType        u32   optional  DVB content type to restrict search to
399 98 Jaroslav Kysela
minduration        u32   optional  Minimal duration in seconds (Added in version 13)
400
maxduration        u32   optional  Maximal duration in seconds (Added in version 13)
401 66 Adam Sutton
language           str   optional  RFC 2616 compatible language list for title (Added in version 6)
402
full               u32   optional  Output full event list rather than just IDs
403
</pre>
404 1 Andreas Smas
405 66 Adam Sutton
Reply message fields:
406 1 Andreas Smas
407 66 Adam Sutton
if full == 1
408
<pre>
409
events             msg[] optional   List of events, using response message fields from eventAdd
410
</pre>
411
else
412
<pre>
413
eventIds           u32[] optional  List of eventIds that match the query
414
</pre>
415 1 Andreas Smas
416 66 Adam Sutton
h3. getEpgObject
417
418
Get detailed EPG Object info.
419
420 58 sbi -
Request message fields:
421 1 Andreas Smas
<pre>
422 66 Adam Sutton
id                 u32   required  Object ID
423
type               u32   optional  Object type
424 1 Andreas Smas
</pre>
425 58 sbi -
426 1 Andreas Smas
Reply message fields:
427 66 Adam Sutton
428 1 Andreas Smas
<pre>
429 66 Adam Sutton
TODO
430 1 Andreas Smas
</pre>
431
432 58 sbi -
----
433 1 Andreas Smas
434 109 Jaroslav Kysela
h3. getDvrConfigs (Added in version 16)
435
436
Return a list of DVR configurations.
437
438
Reply message fields:
439
<pre>
440
dvrconfigs         msg[]      optional   Supported DVR configurations.
441
</pre>
442
443
Message fields:
444
<pre>
445
uuid               str        required   DVR configuration ID
446
name               str        required   DVR configuration Name
447
comment            str        required   DVR configuration Comment
448
</pre>
449
450 66 Adam Sutton
h3. addDvrEntry (Added in version 4)
451
452 1 Andreas Smas
Create a new DVR entry. Either eventId or channelId, start and stop must be specified.
453
454
Request message fields:
455 66 Adam Sutton
<pre>
456
eventId            u32   optional   Event ID (Optional since version 5).
457
channelId          u32   optional   Channel ID (Added in version 5)
458
start              s64   optional   Time to start recording (Added in version 5)
459 96 Jaroslav Kysela
stop               s64   optional   Time to stop recording (Added in version 5)
460 66 Adam Sutton
retention          u32   optional   Retention time in days (Added in version 13)
461 117 Jaroslav Kysela
creator            str   optional   Name of the event creator (Added in version 5, obsoleted in version 18 - applications are not allowed to change credential)
462 66 Adam Sutton
priority           u32   optional   Recording priority (Added in version 5)
463
startExtra         s64   optional   Pre-recording buffer in minutes (Added in version 5)
464
stopExtra          s64   optional   Post-recording buffer in minutes (Added in version 5)
465
title              str   optional   Recording title, if no eventId (Added in version 6)
466 132 Jaroslav Kysela
subtitle           str   optional   Recording subtitle, if no eventId (Added in version 20)
467 1 Andreas Smas
description        str   optional   Recording description, if no eventId (Added in version 5)
468 109 Jaroslav Kysela
configName         str   optional   DVR configuration name or UUID
469 40 Andreas Smas
</pre>
470 1 Andreas Smas
471
Reply message fields:
472
<pre>
473 66 Adam Sutton
success            u32   required   1 if entry was added, 0 otherwise
474
id                 u32   optional   ID of created DVR entry
475 1 Andreas Smas
error              str   optional   English clear text of error message
476
</pre>
477 66 Adam Sutton
478 1 Andreas Smas
h3. updateDvrEntry (Added in version 5)
479 66 Adam Sutton
480 1 Andreas Smas
Update an existing DVR entry.
481
482
Request message fields:
483 66 Adam Sutton
<pre>
484
id                 u32   required   DVR Entry ID
485
start              s64   optional   New start time
486
stop               s64   optional   New stop time
487
title              str   optional   New entry title
488 138 Jaroslav Kysela
subtitle           str   optional   New entry subtitle (Added in version 21).
489 66 Adam Sutton
description        str   optional   New entry description (Added in version 6)
490 1 Andreas Smas
startExtra         s64   optional   New pre-record buffer (Added in version 6)
491 66 Adam Sutton
stopExtra          s64   optional   New post-record buffer (Added in version 6)
492 109 Jaroslav Kysela
configName         str   optional   New DVR configuration name or UUID
493 99 Jaroslav Kysela
retention          u32   optional   Retention in days (Added in version 13)
494
priority           u32   optional   Recording priority (Added in version 13)
495 1 Andreas Smas
</pre>
496
497
Reply message fields:
498
<pre>
499 66 Adam Sutton
success            u32   required   1 if update as successful, otherwise 0
500
error              str   optional   Error message if update failed
501 40 Andreas Smas
</pre>
502
503 66 Adam Sutton
h3. cancelDvrEntry (Added in version 5)
504 1 Andreas Smas
505 66 Adam Sutton
Cancel an existing recording, but don't remove the entry from the database.
506 1 Andreas Smas
507 66 Adam Sutton
Request message fields:
508
<pre>
509
id                 u32   required   dvrEnryId to delete
510
</pre>
511 1 Andreas Smas
512 66 Adam Sutton
Reply message fields:
513
<pre>
514
success            int   required   1 if entry was cancelled
515
error              str   optional   Error message if cancellation failed
516
</pre>
517 1 Andreas Smas
518 66 Adam Sutton
h3. deleteDvrEntry (Added in version 4)
519
520
Delete an existing DVR entry from the database.
521
522
Request message fields:
523 1 Andreas Smas
<pre>
524 66 Adam Sutton
id                 u32   required   DVR Entry ID
525 1 Andreas Smas
</pre>
526
527 11 Andreas Smas
Reply message fields:
528 1 Andreas Smas
<pre>
529 66 Adam Sutton
success            u32   required   1 if entry was removed
530
error              str   optional   Error message if the delete fails
531 1 Andreas Smas
</pre>
532
533 103 Jaroslav Kysela
h3. getDvrCutpoints (Added in version 12)
534
535
Get DVR cutpoints.
536
537
Request message fields:
538
<pre>
539
id                 u32   required   DVR Entry ID
540
</pre>
541
542
Reply message fields:
543
<pre>
544
cutpoints          msg[] optional   List of cutpoint entries, if a file is found and has some valid data.
545
</pre>
546
547
Cutpoint fields:
548
<pre>
549
start              u32   required   Cut start time in ms.
550
end                u32   required   Cut end time in ms.
551
type               u32   required   Action type: 
552
                                      0=Cut, 1=Mute, 2=Scene, 
553
                                      3=Commercial break.
554
</pre>
555
556 102 Jaroslav Kysela
---
557
558 91 Jaroslav Kysela
h3. addAutorecEntry (Added in version 13)
559
560
Create a new Autorec DVR entry. Title must be specified.
561
562
Request message fields:
563
<pre>
564 128 Jaroslav Kysela
enabled            u32   optional   Enabled flag (Added in version 19).
565 91 Jaroslav Kysela
title              str   required   Title for the recordings.
566 133 Jaroslav Kysela
fulltext           u32   optional   Full text flag (Added in version 20).
567 121 Jaroslav Kysela
directory          str   optional   Forced directory name - missing or empty = auto (Added in version 19).
568 120 Jaroslav Kysela
name               str   optional   Name of this autorec entry (Added in version 18).
569 91 Jaroslav Kysela
configName         str   optional   DVR Configuration Name / UUID.
570
channelId          u32   optional   Channel ID.
571
minDuration        u32   optional   Minimal duration in seconds (0 = Any).
572
maxDuration        u32   optional   Maximal duration in seconds (0 = Any).
573 1 Andreas Smas
daysOfWeek         u32   optional   Bitmask - Days of week (0x01 = Monday, 0x40 = Sunday, 0x7f = Whole Week, 0 = Not set).
574
priority           u32   optional   Priority (0 = Important, 1 = High, 2 = Normal, 3 = Low, 4 = Unimportant, 5 = Not set).
575 117 Jaroslav Kysela
approxTime         u32   optional   Minutes from midnight (up to 24*60) (window +- 15 mintes) (Obsoleted from version 18).
576
start              s32   optional   Minutes from midnight (up to 24*60) for the start of the time window (including) (Added in version 18).
577
startWindow        s32   optional   Minutes from modnight (up to 24*60) for the end of the time window (including, cross-noon allowed) (Added in version 18).
578 91 Jaroslav Kysela
startExtra         s64   optional   Extra start minutes (pre-time).
579
stopExtra          s64   optional   Extra stop minutes (post-time).
580 134 Jaroslav Kysela
dupDetect          u32   optional   Dup Detect (0 = all, 1 = diff episode, 2 = diff subtitle, 3 = diff description, 4 = once per week, 5 = once per day) (Added in version 20).
581 91 Jaroslav Kysela
comment            str   optional   User Comment.
582
</pre>
583 83 Jaroslav Kysela
584
Reply message fields:
585
<pre>
586
success            u32   required   1 if entry was added, 0 otherwise
587
id                 str   optional   ID (string!) of created autorec DVR entry
588
error              str   optional   English clear text of error message
589
</pre>
590
591
h3. deleteAutorecEntry (Added in version 13)
592
593
Delete an existing autorec DVR entry from the database.
594
595
Request message fields:
596
<pre>
597
id                 str   required   Autorec DVR Entry ID (string!)
598
</pre>
599
600
Reply message fields:
601
<pre>
602
success            u32   required   1 if entry was removed
603
error              str   optional   Error message if the delete fails
604 1 Andreas Smas
</pre>
605 83 Jaroslav Kysela
606 117 Jaroslav Kysela
---
607 1 Andreas Smas
608 117 Jaroslav Kysela
h3. addTimerecEntry (Added in version 18)
609
610
Create a new Timerec DVR entry. Title must be specified.
611
612
Request message fields:
613
<pre>
614 129 Jaroslav Kysela
enabled            u32   optional   Enabled flag (Added in version 19).
615 117 Jaroslav Kysela
title              str   required   Title for the recordings.
616 125 Jaroslav Kysela
directory          str   optional   Forced output directory name (Added in version 19).
617 117 Jaroslav Kysela
name               str   optional   Name for this timerec entry.
618
configName         str   optional   DVR Configuration Name / UUID.
619 150 Jaroslav Kysela
channelId          u32   optional   Channel ID.
620 117 Jaroslav Kysela
daysOfWeek         u32   optional   Bitmask - Days of week (0x01 = Monday, 0x40 = Sunday, 0x7f = Whole Week, 0 = Not set).
621
priority           u32   optional   Priority (0 = Important, 1 = High, 2 = Normal, 3 = Low, 4 = Unimportant, 5 = Not set).
622 150 Jaroslav Kysela
start              u32   optional   Minutes from midnight (up to 24*60) for the start of the time window (including)
623
stop               u32   optional   Minutes from modnight (up to 24*60) for the end of the time window (including, cross-noon allowed)
624 117 Jaroslav Kysela
retention          u32   optional   Retention in days. 
625
comment            str   optional   User Comment.
626
</pre>
627
628
Reply message fields:
629
<pre>
630
success            u32   required   1 if entry was added, 0 otherwise
631
id                 str   optional   ID (string!) of created timerec DVR entry
632
error              str   optional   English clear text of error message
633
</pre>
634
635
h3. deleteTimerecEntry (Added in version 18)
636
637
Delete an existing timerec DVR entry from the database.
638
639
Request message fields:
640
<pre>
641
id                 str   required   Timerec DVR Entry ID (string!)
642
</pre>
643
644
Reply message fields:
645
<pre>
646
success            u32   required   1 if entry was removed
647
error              str   optional   Error message if the delete fails
648
</pre>
649
650
----
651
652 66 Adam Sutton
h3. getTicket (Added in version 5)
653 1 Andreas Smas
654 66 Adam Sutton
Get a ticket to allow access to a channel or recording via HTTP
655 1 Andreas Smas
656 66 Adam Sutton
Request message fields:
657 1 Andreas Smas
<pre>
658 66 Adam Sutton
channelId          u32  optional   Channel to gain access for
659
dvrId              u32  optional   DVR file to gain access for
660 1 Andreas Smas
</pre>
661
662
Reply message fields:
663
<pre>
664 66 Adam Sutton
path               str  required   The full path for access URL (no scheme, host or port)
665
ticket             str  required   The ticket to pass in the URL query string
666 1 Andreas Smas
</pre>
667
668 66 Adam Sutton
h3. subscribe
669 1 Andreas Smas
670 66 Adam Sutton
Request subscription to the given channel. 
671 1 Andreas Smas
672 66 Adam Sutton
Request message fields:
673
<pre>
674
channelId          u32   required   ID for channel. 
675
subscriptionId     u32   required   Subscription ID. Selected by client. This value is not interpreted by the server in any form. 
676
                                    The value is used from now on in all messages related to the subscription.
677 1 Andreas Smas
weight             u32   optional   Weighting of this subscription (same as recording priority).
678 73 Adam Sutton
90khz              u32   optional   Request PTS/DTS in default 90kHz timebase, default is 1MHz (Added in version 7)
679
normts             u32   optional   Request PTS/DTS normalisation (Added in version 7)
680
                                    Note: this will mean missing timestamps are added, first packet should be ~0 and will always be an i-frame.
681
                                    Note: this is implied if timeshiftPeriod is enabled
682 114 Jaroslav Kysela
                                    Note: from version 17, this is always enabled and this parameter is ignored.
683 73 Adam Sutton
queueDepth         u32   optional   Change the default packet queue lengths, default 500000 bytes (Added in version 7)
684
                                    Note: I-frame depth is 3*queueDepth, P-frame is 2*queueDepth and B-frame is queueDepth
685
timeshiftPeriod    u32   optional   The number of seconds to keep in the timeshift buffer (Added in version 9)
686
                                    Note: this may be bounded by server configuration settings
687 108 Jaroslav Kysela
profile            str   optional   Select stream profile (Added in version 16).
688 11 Andreas Smas
</pre>
689 66 Adam Sutton
690 1 Andreas Smas
Reply message fields:
691
<pre>
692 73 Adam Sutton
90khz              u32   optional   Indicates 90khz timestamps will be used
693
normts             u32   optional   Indicates timestamps will be normalised (and fixed)
694
timeshiftPeriod    u32   optional   The actual timeshiftPeriod to be used
695 66 Adam Sutton
</pre>
696 1 Andreas Smas
697 66 Adam Sutton
h3. unsubscribe
698
699
Stop a subscription.
700
701
Request message fields:
702 1 Andreas Smas
<pre>
703 66 Adam Sutton
subscriptionId     u32   required   Subscription ID.
704 58 sbi -
</pre>
705
706 11 Andreas Smas
Reply message fields:
707 1 Andreas Smas
<pre>
708 66 Adam Sutton
None
709 58 sbi -
</pre>
710 11 Andreas Smas
711 66 Adam Sutton
h3. subscriptionChangeWeight (Added in version 5)
712 1 Andreas Smas
713 66 Adam Sutton
Change the weight of an existing subscription
714 1 Andreas Smas
715 66 Adam Sutton
Request message fields:
716
<pre>
717
subscriptionId     u32   required   Subscription ID.
718
weight             u32   optional   The new subscription weight.
719 1 Andreas Smas
</pre>
720
721
Reply message fields:
722
<pre>
723 69 Adam Sutton
None
724 1 Andreas Smas
</pre>
725
726 73 Adam Sutton
h3. subscriptionSkip (Added in version 9)
727
728
Skip a timeshift enabled subscription. The response will be asynchronous subscriptionSkip().
729
730
Request message fields:
731
<pre>
732
subscriptionId     u32   required   Subscription ID.
733
absolute           u32   optional   The skip request is absolute
734
time               u64   optional   Specify skip using time (units are as for PTS)
735
size               u64   optional   Specify skip using size (Not currently used)
736
</pre>
737
738
Reply message fields:
739
<pre>
740
None
741
</pre>
742
743
h3. subscriptionSeek (Added in version 9)
744
745
Synonym for subscriptionSkip
746
747
h3. subscriptionSpeed (Added in version 9)
748
749
Set the playback speed for the subscription. The response will be asynchronous subscriptionSpeed().
750
751
Request message fields:
752
<pre>
753
subscriptionId     u32   required   Subscription ID.
754
speed              u32   required   Specify speed (0=pause, 100=1x fwd, -100=1x backward)
755
</pre>
756
757
Reply message fields:
758
<pre>
759
None
760
</pre>
761
762
h3. subscriptionLive (Added in version 9)
763
764
Return a timeshifted session to live. Reply will be asynchronous subscriptionSkip().
765
766
Request message fields:
767
<pre>
768
subscriptionId     u32   required   Subscription ID.
769
</pre>
770
771
Reply message fields:
772
<pre>
773
None
774 82 Jaroslav Kysela
</pre>
775 1 Andreas Smas
776 83 Jaroslav Kysela
h3. subscriptionFilterStream (Added in version 12)
777 1 Andreas Smas
778 83 Jaroslav Kysela
Enable or disable specified streams by index.
779
780
Request message fields:
781
<pre>
782
subscriptionId     u32        required   Subscription ID.
783
enable             list[u32]  optional   Enable stream indexes
784
disable            list[u32]  optional   Disable (filter out) stream indexes
785
</pre>
786
787
Reply message fields:
788 1 Andreas Smas
<pre>
789
None
790 109 Jaroslav Kysela
</pre>
791
792
---
793
794
h3. getProfiles (Added in version 16)
795
796
Return a list of stream profiles (configurations).
797
798
Reply message fields:
799
<pre>
800
profiles           msg[]      optional   Supported profiles
801
</pre>
802
803
Message fields:
804
<pre>
805
uuid               str        required   Profile ID
806
name               str        required   Profile Name
807
comment            str        required   Profile Comment
808 83 Jaroslav Kysela
</pre>
809
810
h3. getCodecs (Added in version 11, Removed in version 16)
811
812 82 Jaroslav Kysela
Return a list of encoders (codecs).
813
814 1 Andreas Smas
Reply message fields:
815 82 Jaroslav Kysela
<pre>
816 83 Jaroslav Kysela
encoders           list[str]  optional   Supported encoders
817 82 Jaroslav Kysela
</pre>
818
819 70 Adam Sutton
h3. fileOpen (Added in version 8)
820 69 Adam Sutton
821
Open a file within the Tvheadend file system. This is now the preferred method (in place of HTTP) for accessing recordings.
822
823
Accessing recordings via HTSP will overcome the limitations of standard HTTP streaming which cannot handle both skipping and growing files (i.e. in-progress recordings) at the same time.
824
825 1 Andreas Smas
Request message fields:
826 69 Adam Sutton
<pre>
827 70 Adam Sutton
file               str   required   File path to open
828 1 Andreas Smas
</pre>
829
830 70 Adam Sutton
Valid file paths:
831
<pre>
832
/dvrfile/ID        will open the file associated with DVR entry ID
833 74 Adam Sutton
/imagecache/ID     will open the file associated with imagecache entry ID (Note: only works for HTSPv10+)
834 70 Adam Sutton
</pre>
835
836 69 Adam Sutton
Reply message fields:
837
<pre>
838
id                 u32   required   The file handle used for further file operations
839
size               u64   optional   The size of the file in bytes
840 1 Andreas Smas
mtime              u64   optional   The last time the file was modified
841 69 Adam Sutton
</pre>
842
843 70 Adam Sutton
h3. fileRead (Added in version 8)
844 69 Adam Sutton
845 1 Andreas Smas
Read data from a file.
846
847 69 Adam Sutton
Request message fields:
848
<pre>
849
id                 u32   required   The file handle used for further file operations
850 70 Adam Sutton
size               u64   required   The amount of data to read
851
offset             u64   optional   Offset into the file to read (default is current position)
852 69 Adam Sutton
</pre>
853 1 Andreas Smas
854 69 Adam Sutton
Reply message fields:
855
<pre>
856
data               bin   required   The data read from the file (size may be less than requested)
857
</pre>
858
859 70 Adam Sutton
h3. fileClose (Added in version 8)
860 69 Adam Sutton
861
Close an opened file.
862
863
Request message fields:
864
<pre>
865 1 Andreas Smas
id                 u32   required   The file handle to be closed
866 69 Adam Sutton
</pre>
867
868
Reply message fields:
869
<pre>
870
None
871
</pre>
872 70 Adam Sutton
873 69 Adam Sutton
h3. fileStat (Added in version 8)
874
875
Get status of a file.
876
877
Request message fields:
878
<pre>
879
id                 u32   required   The file handle to be stat'd
880 1 Andreas Smas
</pre>
881
882
Reply message fields:
883
<pre>
884
size               u64   optional   The size of the file in bytes
885
mtime              u64   optional   The last time the file was modified
886
</pre>
887 70 Adam Sutton
888
h3. fileSeek (Added in version 8)
889
890
Seek to position in a file.
891
892
Request message fields:
893
<pre>
894
id                 u32   required   The file handle to be stat'd
895
offset             u64   required   The position to seek in the file
896
whence             str   required   Where to seek relative to (default=SEEK_SET)
897
</pre>
898
899
Note: valid values for whence
900
<pre>
901
SEEK_SET           Seek relative to start of file
902
SEEK_CUR           Seek relative to current position in file
903 72 Adam Sutton
SEEK_END           Seek relative (backwards) to end of file
904 70 Adam Sutton
</pre>
905
906
Reply message fields:
907
<pre>
908
offset             u64   optional   The new absolute position within the file
909
</pre>
910 66 Adam Sutton
911 1 Andreas Smas
h1. Server to Client methods
912
913
----
914
915
h3. channelAdd
916
917
A new channel has been created on the server.
918
919
Message fields:
920
<pre>
921
channelId          u32   required   ID of channel.
922 66 Adam Sutton
channelNumber      u32   required   Channel number, 0 means unconfigured.
923 90 Jaroslav Kysela
channelNumberMinor u32   optional   Minor channel number (Added in version 13).
924 1 Andreas Smas
channelName        str   required   Name of channel.
925 70 Adam Sutton
channelIcon        str   optional   URL to an icon representative for the channel
926
                                    (For v8+ clients this could be a relative /imagecache/ID URL
927 73 Adam Sutton
                                     intended to be fed to fileOpen() or HTTP server)
928 104 Jaroslav Kysela
                                    (For v15+ clients this could be a relative imagecache/ID URL
929
                                     intended to be fed to fileOpen() or HTTP server)
930 66 Adam Sutton
eventId            u32   optional   ID of the current event on this channel.
931
nextEventId        u32   optional   ID of the next event on the channel.
932
tags               u32[] optional   Tags this channel is mapped to.
933
services           msg[] optional   List of available services (Added in version 5)
934 13 Andreas Smas
</pre>
935 1 Andreas Smas
936 66 Adam Sutton
Service fields:
937 1 Andreas Smas
<pre>
938 66 Adam Sutton
name               str   required   Service name
939
type               str   required   Service type
940
caid               u32   optional   Encryption CA ID
941
caname             str   optional   Encryption CA name
942 11 Andreas Smas
</pre>
943 1 Andreas Smas
944 66 Adam Sutton
h3. channelUpdate
945 11 Andreas Smas
946 66 Adam Sutton
Same as channelAdd, but all fields (except channelId) are optional.
947
948 58 sbi -
h3. channelDelete
949 1 Andreas Smas
950
A channel has been deleted on the server.
951 58 sbi -
952
Message fields:
953 1 Andreas Smas
<pre>
954
channelId          u32   required   ID of channel.
955
</pre>
956
957
----
958
959 11 Andreas Smas
h3. tagAdd
960 1 Andreas Smas
961
A new tag has been created on the server.
962
963
Message fields:
964
<pre>
965 66 Adam Sutton
tagId              u32   required   ID of tag.
966
tagName            str   required   Name of tag.
967 117 Jaroslav Kysela
tagIndex           u32   optional   Index value for sorting (default by from min to max) (Added in version 18).
968 66 Adam Sutton
tagIcon            str   optional   URL to an icon representative for the channel.
969
tagTitledIcon      u32   optional   Icon includes a title
970 1 Andreas Smas
members            u32[] optional   Channel IDs of those that belong to the tag
971 11 Andreas Smas
</pre>
972 39 elupus -
973 58 sbi -
h3. tagUpdate
974 66 Adam Sutton
975 11 Andreas Smas
Same as tagAdd, but all fields (except tagId) are optional.
976
977 1 Andreas Smas
h3. tagDelete
978 58 sbi -
979 1 Andreas Smas
A tag has been deleted from the server.
980
981
Message fields:
982 66 Adam Sutton
<pre>
983 58 sbi -
tagId              u32   required   ID of tag.
984
</pre>
985 12 Andreas Smas
986 1 Andreas Smas
----
987 66 Adam Sutton
988 58 sbi -
h3. dvrEntryAdd (Added in version 4)
989 1 Andreas Smas
990 58 sbi -
A new recording has been created on the server.
991 1 Andreas Smas
992 2 Andreas Smas
Message fields:
993 66 Adam Sutton
<pre>
994
id                 u32   required   ID of dvrEntry.
995
channel            u32   required   Channel of dvrEntry.
996
start              s64   required   Time of when this entry was scheduled to start recording.
997 89 Jaroslav Kysela
stop               s64   required   Time of when this entry was scheduled to stop recording.
998
startExtra         s64   required   Extra start time (pre-time) in minutes (Added in version 13).
999 1 Andreas Smas
stopExtra          s64   required   Extra stop time (post-time) in minutes (Added in version 13).
1000
retention          s64   required   DVR Entry retention time in days.
1001 89 Jaroslav Kysela
priority           u32   required   Priority (0 = Important, 1 = High, 2 = Normal, 3 = Low, 4 = Unimportant, 5 = Not set) (Added in version 13).
1002
eventId            u32   optional   Associated EPG Event ID (Added in version 13).
1003 117 Jaroslav Kysela
autorecId          str   optional   Associated Autorec UUID (Added in version 13).
1004
timerecId          str   optional   Associated Timerec UUID (Added in version 18).
1005 89 Jaroslav Kysela
contentType        u32   optional   Content Type (like in the DVB standard) (Added in version 13).
1006 66 Adam Sutton
title              str   optional   Title of recording
1007 137 Jaroslav Kysela
subtitle           str   optional   Subtitle of recording (Added in version 20).
1008 1 Andreas Smas
summary            str   optional   Short description of the recording (Added in version 6).
1009
description        str   optional   Long description of the recording.
1010 66 Adam Sutton
state              str   required   Recording state
1011
error              str   optional   Plain english error description (e.g. "Aborted by user").
1012 117 Jaroslav Kysela
owner              str   optional   Name of the entry owner (Added in version 18).
1013
creator            str   optional   Name of the entry creator (Added in version 18).
1014 135 Jaroslav Kysela
subscriptionError  str   optional   Subscription error string (Added in version 20).
1015
streamErrors       str   optional   Number of recording errors (Added in version 20).
1016
dataErrors         str   optional   Number of stream data errors (Added in version 20).
1017 146 Jaroslav Kysela
path               str   optional   Recording path for playback.
1018
files              msg   optional   All recorded files for playback (Added in version 21).
1019 147 Jaroslav Kysela
dataSize           s64   optional   Actual file size of the last recordings (Added in version 21).
1020 1 Andreas Smas
</pre>
1021 66 Adam Sutton
1022 48 mdd -
TODO: recording states
1023
1024
h3. dvrEntryUpdate
1025 66 Adam Sutton
1026
Message fields:
1027
<pre>
1028
Same as dvrEntryAdd, but all fields (except id) are optional.
1029 51 elupus -
</pre>
1030 66 Adam Sutton
1031 58 sbi -
h3. dvrEntryDelete (Added in version 4)
1032 66 Adam Sutton
1033 58 sbi -
A recording has been deleted from the server.
1034 48 mdd -
1035
Message fields:
1036 66 Adam Sutton
<pre>
1037 1 Andreas Smas
id                 u32   required   ID of recording to delete.
1038 48 mdd -
</pre>
1039 58 sbi -
1040 48 mdd -
----
1041 95 Jaroslav Kysela
1042
h3. autorecEntryAdd (Added in version 13)
1043
1044
A new autorec recording has been created on the server.
1045
1046 1 Andreas Smas
Message fields:
1047 95 Jaroslav Kysela
<pre>
1048
id                 str   required   ID (string!) of dvrAutorecEntry.
1049
enabled            u32   required   If autorec entry is enabled (activated).
1050 117 Jaroslav Kysela
name               str   required   Name of the autorec entry (Added in version 18).
1051 95 Jaroslav Kysela
minDuration        u32   required   Minimal duration in seconds (0 = Any).
1052
maxDuration        u32   required   Maximal duration in seconds (0 = Any).
1053
retention          u32   required   Retention time (in days).
1054
daysOfWeek         u32   required   Bitmask - Days of week (0x01 = Monday, 0x40 = Sunday, 0x7f = Whole Week, 0 = Not set).
1055
priority           u32   required   Priority (0 = Important, 1 = High, 2 = Normal, 3 = Low, 4 = Unimportant, 5 = Not set).
1056
approxTime         u32   required   Minutes from midnight (up to 24*60).
1057 149 Jaroslav Kysela
start              s32   required   Exact start time (minutes from midnight) (Added in version 18).
1058
startWindow        s32   required   Exact stop time (minutes from midnight) (Added in version 18).
1059 1 Andreas Smas
startExtra         s64   required   Extra start minutes (pre-time).
1060
stopExtra          s64   required   Extra stop minutes (post-time).
1061 95 Jaroslav Kysela
title              str   optional   Title.
1062 136 Jaroslav Kysela
fulltext           u32   optional   Fulltext flag (Added in version 20).
1063 122 Jaroslav Kysela
directory          str   optional   Forced directory name (Added in version 19).
1064 95 Jaroslav Kysela
channel            u32   optional   Channel ID.
1065 117 Jaroslav Kysela
owner              str   optional   Owner of this autorec entry (Added in version 18).
1066
creator            str   optional   Creator of this autorec entry (Added in version 18).
1067 136 Jaroslav Kysela
dupDetect          u32   optional   Duplicate detection (see addAutorecEntry) (Added in version 20).
1068 95 Jaroslav Kysela
</pre>
1069 1 Andreas Smas
1070 95 Jaroslav Kysela
h3. autorecEntryUpdate (Added in version 13)
1071
1072
Message fields:
1073
<pre>
1074 117 Jaroslav Kysela
Same as autorecEntryAdd but all fields (except id) are optional.
1075 95 Jaroslav Kysela
</pre>
1076
1077 1 Andreas Smas
h3. autorecEntryDelete (Added in version 13)
1078
1079
Message fields:
1080
<pre>
1081
id                 str   required   Autorec Entry ID (string!)
1082 117 Jaroslav Kysela
</pre>
1083
1084
----
1085
1086 118 Jaroslav Kysela
h3. timerecEntryAdd (Added in version 18)
1087 117 Jaroslav Kysela
1088
A new autorec recording has been created on the server.
1089
1090
Message fields:
1091
<pre>
1092
title              str   required   Title for the recordings.
1093 123 Jaroslav Kysela
directory          str   optional   Forced directory name (Added in version 19).
1094 117 Jaroslav Kysela
enabled            u32   required   Title for the recordings.
1095
name               str   required   Name for this timerec entry.
1096
configName         str   required   DVR Configuration Name / UUID.
1097 148 Jaroslav Kysela
channel            u32   required   Channel ID.
1098 117 Jaroslav Kysela
daysOfWeek         u32   optional   Bitmask - Days of week (0x01 = Monday, 0x40 = Sunday, 0x7f = Whole Week, 0 = Not set).
1099
priority           u32   optional   Priority (0 = Important, 1 = High, 2 = Normal, 3 = Low, 4 = Unimportant, 5 = Not set).
1100
start              u32   required   Minutes from midnight (up to 24*60) for the start of the time window (including)
1101
stop               u32   required   Minutes from modnight (up to 24*60) for the end of the time window (including, cross-noon allowed)
1102 148 Jaroslav Kysela
retention          u32   optional   Retention in days.
1103 117 Jaroslav Kysela
owner              str   optional   Owner of this timerec entry.
1104
creator            str   optional   Creator of this timerec entry.
1105
</pre>
1106
1107
h3. timerecEntryUpdate (Added in version 18)
1108
1109
Message fields:
1110
<pre>
1111
Same as timerecEntryAdd but all fields (except id) are optional.
1112
</pre>
1113
1114
h3. timerecEntryDelete (Added in version 18)
1115
1116
Message fields:
1117
<pre>
1118
id                 str   required   Timerec Entry ID (string!)
1119 95 Jaroslav Kysela
</pre>
1120
1121
----
1122
1123 66 Adam Sutton
h3. eventAdd (Added in version 6)
1124 48 mdd -
1125 66 Adam Sutton
Message fields:
1126
<pre>
1127
eventId            u32   required   Event ID
1128
channelId          u32   required   The channel this event is related to.
1129
start              u64   required   Start time of event, UNIX time.
1130
stop               u64   required   Ending time of event, UNIX time.
1131
title              str   optional   Title of event.
1132
summary            str   optional   Short description of the event (Added in version 6).
1133
description        str   optional   Long description of the event.
1134
serieslinkId       u32   optional   Series Link ID (Added in version 6).
1135
episodeId          u32   optional   Episode ID (Added in version 6).
1136
seasonId           u32   optional   Season ID (Added in version 6).
1137
brandId            u32   optional   Brand ID (Added in version 6).
1138
contentType        u32   optional   DVB content code (Added in version 4, Modified in version 6*).
1139
ageRating          u32   optional   Minimum age rating (Added in version 6).
1140
starRating         u32   optional   Star rating (1-5) (Added in version 6).
1141
firstAired         s64   optional   Original broadcast time, UNIX time (Added in version 6).
1142
seasonNumber       u32   optional   Season number (Added in version 6).
1143
seasonCount        u32   optional   Show season count (Added in version 6).
1144
episodeNumber      u32   optional   Episode number (Added in version 6).
1145
episodeCount       u32   optional   Season episode count (Added in version 6).
1146
partNumber         u32   optional   Multi-part episode part number (Added in version 6).
1147
partCount          u32   optional   Multi-part episode part count (Added in version 6).
1148
episodeOnscreen    str   optional   Textual representation of episode number (Added in version 6).
1149
image              str   optional   URL to a still capture from the episode (Added in version 6).
1150
dvrId              u32   optional   ID of a recording (Added in version 5).
1151
nextEventId        u32   optional   ID of next event on the same channel.
1152
</pre>
1153 48 mdd -
1154 66 Adam Sutton
* *contentType previously had the major DVB category in the bottom 4 bits, 
1155
  however in v6 this has been changed to properly match DVB, so top 4 bits
1156
  as major category and bottom 4 bits has sub-category. Clients requesting
1157
  v5 or lower will get the old output.
1158 48 mdd -
1159 66 Adam Sutton
h3. eventUpdate (Added in version 6)
1160 35 Andreas Smas
1161 58 sbi -
Message fields:
1162
<pre>
1163 66 Adam Sutton
Same as eventAdd but all fields (except eventId) are optional.
1164 35 Andreas Smas
</pre>
1165 58 sbi -
1166 77 John Törnblom
h3. eventDelete (Added in version 6)
1167 35 Andreas Smas
1168 66 Adam Sutton
Message fields:
1169
<pre>
1170
eventId            u32   required   Event ID
1171
</pre>
1172 14 Andreas Smas
1173 66 Adam Sutton
---
1174 14 Andreas Smas
1175 66 Adam Sutton
h3. initialSyncCompleted (Added in version 2)
1176 14 Andreas Smas
1177 66 Adam Sutton
Sent after all the initial metadata has been sent when session has been set to async mode.
1178 38 Andreas Smas
1179
Message fields:
1180 14 Andreas Smas
<pre>
1181
</pre>
1182
1183
----
1184
1185
h3. subscriptionStart
1186 53 Andreas Smas
1187 66 Adam Sutton
Asynchronous message output when a new subscription is successfully started.
1188 14 Andreas Smas
1189
Message fields:
1190 1 Andreas Smas
<pre>
1191 66 Adam Sutton
subscriptionId     u32   required   Subscription ID.
1192
streams            msg[] required   Array of messages with stream information
1193
sourceinfo         msg   optional   Source information.
1194
</pre>
1195 37 Andreas Smas
1196 66 Adam Sutton
Stream message fields:
1197
<pre>
1198
index              u32   required   Index for this stream
1199
type               str   required   Type of stream
1200 113 Jaroslav Kysela
meta               bin   optional   Codec metadata (private data, libav - extradata) (Added in version 17)
1201 66 Adam Sutton
language           str   optional   Language for stream
1202
Video components only:
1203
width              u32   optional   Width of video in pixels
1204
height             u32   optional   Height of video in pixels
1205 68 Andreas Smas
aspect_num         u32   optional   Aspect ratio numerator (Added in version 5) *Can be incorrect and should not be relied upon*
1206
aspect_den         u32   optional   Aspect ratio denonminator (Added in version 5) *Can be incorrect and should not be relied upon*
1207 66 Adam Sutton
Audio components only:
1208 76 Dave Chapman
audio_type         u32   optional   Audio type - 0=Normal; 1=Clean effects; 2=Hearing impaired; 3=Visually impaired commentary; 4-255=Reserved (Added in version 11)
1209 66 Adam Sutton
channels           u32   optional   Number of audio channels (Added in version 5)
1210
rate               u32   optional   Audio bitrate (Added in version 5)
1211
Subtitle components only:
1212
composition_id     u32   optional   ??? (Added in version 5)
1213
ancillary_id       u32   optional   ??? (Added in version 5)
1214
</pre>
1215 2 Andreas Smas
1216 66 Adam Sutton
Sourceinfo message fields:
1217
<pre>
1218
adapter            str   optional   Adapter name
1219
mux                str   optional   Transponder name
1220
network            str   optional   Network name
1221 142 Jaroslav Kysela
provider           str   optional   Provide name (like 'Sky UK')
1222 1 Andreas Smas
service            str   optional   Service name
1223 143 Jaroslav Kysela
satpos             str   optional   Satellite position name (Added in version 20).
1224 66 Adam Sutton
</pre>
1225 15 Andreas Smas
1226 66 Adam Sutton
Video Stream types:
1227 1 Andreas Smas
<pre>
1228 79 Jaroslav Kysela
MPEG2VIDEO                    MPEG2 video, meta field is present (configuration blocks)
1229
H264                          H264 video, meta field is present (configuration blocks)
1230
HEVC                          HEVC video, meta field is present (configuration blocks)
1231 66 Adam Sutton
</pre>
1232 15 Andreas Smas
1233 1 Andreas Smas
Audio Stream types:
1234
<pre>
1235 66 Adam Sutton
MPEG2AUDIO                    MPEG2 audio (MP2)
1236
AC3                           AC3 audio
1237 79 Jaroslav Kysela
AAC                           ADTS framed AAC (one AAC packet per ADTS frame), meta field is present (MPEG4 config)
1238 66 Adam Sutton
EAC3                          Enhanced AC3 audio
1239 79 Jaroslav Kysela
VORBIS                        Vorbis audio, meta field is present with the main vorbis header
1240 16 Andreas Smas
</pre>
1241
1242 66 Adam Sutton
Subtitle Stream types:
1243
<pre>
1244
TELETEXT                      ???
1245
DVBSUB                        ???
1246
</pre>
1247 55 Lars Op den Kamp -
1248 112 Jaroslav Kysela
h3. subscriptionGrace
1249
1250
Notifies client about the grace timeout (timeout for stream activation). It can be issues multiple times.
1251
For example a configuration with satellite rotors requires more than 120 seconds to tune, so users
1252
should be notified..
1253
1254
Message fields:
1255
<pre>
1256
subscriptionId     u32   required   Subscription ID.
1257
graceTimeout       u32   required   Grace timeout in seconds.
1258
</pre>
1259
1260 55 Lars Op den Kamp -
h3. subscriptionStop
1261
1262 66 Adam Sutton
A subscription has been stopped.
1263 55 Lars Op den Kamp -
1264
Message fields:
1265
<pre>
1266 66 Adam Sutton
subscriptionId     u32   required   Subscription ID.
1267 1 Andreas Smas
status             str   optional   Error message if subscription stopped unexpectedly.
1268 141 Jaroslav Kysela
subscriptionError  str   optional   Subscription error code (Added in version 20).
1269 1 Andreas Smas
</pre>
1270 141 Jaroslav Kysela
1271 1 Andreas Smas
1272 73 Adam Sutton
h3. subscriptionSkip (Added version 9)
1273
1274
A subscription has been skipped.
1275
1276
Message fields:
1277
<pre>
1278
subscriptionId     u32   required   Subscription ID.
1279
error              u32   optional   The last skip command caused an error.
1280
absolute           u32   optional   Indicates the output is absolute (Note: should always be 1 at the moment)
1281
time               u64   optional   The time the subscription has skipped to.
1282
size               u64   optional   The position in the file we've skipped to (Note: not currently used).
1283
</pre>
1284
1285
h3. subscriptionSpeed (Added version 9)
1286
1287
A subscription's playback speed has changed.
1288
1289
This can happen even without a speed request, should playback reach either end of the buffer.
1290
1291
Message fields:
1292
<pre>
1293
subscriptionId     u32   required   Subscription ID.
1294
speed              u32   required   The new speed of the subscription
1295
</pre>
1296
1297 55 Lars Op den Kamp -
h3. subscriptionStatus
1298
1299 66 Adam Sutton
Subscription status update.
1300 58 sbi -
1301
Message fields:
1302
<pre>
1303 66 Adam Sutton
subscriptionId     u32   required   Subscription ID.
1304
status             str   optional   English clear text of error status. Absence of this field means that the status is OK. 
1305 140 Jaroslav Kysela
subscriptionError  str   optional   Subscription error code (Added in version 20).
1306 139 Jaroslav Kysela
</pre>
1307 58 sbi -
1308 16 Andreas Smas
h3. queueStatus
1309
1310 1 Andreas Smas
The queueStatus message is sent every second during normal data delivery.
1311 60 John Törnblom
1312
The transmit scheduler have different drop thresholds for different frame types.
1313 66 Adam Sutton
1314 1 Andreas Smas
If congestion occurs it will favor dropping B-frames before P-frames before I-frames.
1315
All audio is recognized as I-frames. 
1316 58 sbi -
1317 1 Andreas Smas
Message fields:
1318
<pre>
1319 66 Adam Sutton
subscriptionId     u32   required   Subscription ID.
1320
packets            u32   required   Number of data packets in queue.
1321
bytes              u32   required   Number of bytes in queue.
1322
delay              u32   optional   Estimated delay of queue (in µs).
1323 1 Andreas Smas
Bdrops             u32   required   Number of B-frames dropped
1324 66 Adam Sutton
Pdrops             u32   required   Number of P-frames dropped
1325
Idrops             u32   required   Number of I-frames dropped
1326 73 Adam Sutton
delay              s64   required   Delta between first and last DTS (Added in version 9)
1327 1 Andreas Smas
</pre>
1328
1329
h3. signalStatus
1330
1331
The signalStatus message is sent every second during normal data delivery.
1332
1333
The optional fields may not have been implemented or may not be supported by the active adapter.
1334
1335
Message fields:
1336
<pre>
1337 66 Adam Sutton
subscriptionId     u32   required   Subscription ID.
1338
feStatus           str   required   Frontend status.
1339
feSNR              u32   optional   Signal to noise ratio.
1340 1 Andreas Smas
feSignal           u32   optional   Signal status percentage.
1341
feBER              u32   optional   Bit error rate.
1342
feUNC              u32   optional   Uncorrected blocks.
1343 73 Adam Sutton
</pre>
1344
1345
h3. timeshiftStatus
1346
1347
Provide status every second about the timeshift buffer.
1348
1349
Message fields:
1350
<pre>
1351
subscriptionId     u32   required   Subscription ID.
1352
full               u32   required   Indicates whether the buffer is full
1353
shift              s64   required   Current position relative to live
1354
start              s64   optional   PTS of the first frame in the buffer
1355
end                s64   optional   PTS of the last frame in the buffer
1356 1 Andreas Smas
</pre>
1357
1358
h3. muxpkt
1359
1360
Streaming data.
1361
1362
Message fields:
1363
<pre>
1364 66 Adam Sutton
subscriptionId     u32   required   Subscription ID.
1365
frametype          u32   required   Type of frame as ASCII value: 'I', 'P', 'B'
1366
stream             u32   required   Stream index. Corresponds to the streams reported in the subscriptionStart message.
1367
dts                s64   optional   Decode Time Stamp in µs.
1368
pts                s64   optional   Presentation Time Stamp in µs.
1369
duration           u32   required   Duration of frame in µs.
1370
payload            bin   required   Actual frame data.
1371 1 Andreas Smas
</pre>