CPPMyth
Library to interoperate with MythTV server
Loading...
Searching...
No Matches
mythtypes.h
1/*
2 * Copyright (C) 2014 Jean-Luc Barriere
3 *
4 * This Program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
7 * any later version.
8 *
9 * This Program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; see the file COPYING. If not, write to
16 * the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 */
21
22#ifndef MYTHTYPES_H
23#define MYTHTYPES_H
24
25#include "mythsharedptr.h"
26#define MYTH_SHARED_PTR Myth::shared_ptr
27
28#include <string>
29#include <stdint.h>
30#include <vector>
31#include <map>
32#include <ctime>
33
38namespace Myth
39{
40 uint32_t StringToId(const std::string& str);
41 std::string IdToString(uint32_t id);
42 time_t StringToTime(const std::string& isotime);
43 std::string TimeToString(time_t time, bool utc = false);
44 int StringToInt(const std::string& str);
45 std::string IntToString(int i);
46
47 typedef enum
48 {
49 RT_NotRecording = 0, // (0x00)
50 RT_SingleRecord = 1, // (0x01)
51 RT_DailyRecord, // (0x02)
52 RT_ChannelRecord, // (0x03) obsolete since 76
53 RT_AllRecord, // (0x04)
54 RT_WeeklyRecord, // (0x05)
55 RT_OneRecord, // (0x06)
56 RT_OverrideRecord, // (0x07)
57 RT_DontRecord, // (0x08)
58 RT_FindDailyRecord, // (0x09) obsolete since 76
59 RT_FindWeeklyRecord, // (0x0a) obsolete since 76
60 RT_TemplateRecord, // (0x0b)
61 RT_UNKNOWN // Keep at last
62 } RT_t;
63
64 RT_t RuleTypeFromString(unsigned proto, const std::string& type);
65 RT_t RuleTypeFromNum(unsigned proto, int type);
66 const char *RuleTypeToString(unsigned proto, RT_t type);
67 int RuleTypeToNum(unsigned proto, RT_t type);
68
69 typedef enum
70 {
71 DI_InRecorded = 0, // (0x01)
72 DI_InOldRecorded = 1, // (0x02)
73 DI_InAll, // (0x0F)
74 DI_NewEpi, // (0x10)
75 DI_UNKNOWN // Keep at last
76 } DI_t;
77
78 DI_t DupInFromString(unsigned proto, const std::string& type);
79 DI_t DupInFromNum(unsigned proto, int type);
80 const char *DupInToString(unsigned proto, DI_t type);
81 int DupInToNum(unsigned proto, DI_t type);
82
83 typedef enum
84 {
85 DM_CheckNone = 0, // (0x01)
86 DM_CheckSubtitle = 1, // (0x02)
87 DM_CheckDescription, // (0x04)
88 DM_CheckSubtitleAndDescription, // (0x06)
89 DM_CheckSubtitleThenDescription, // (0x08)
90 DM_UNKNOWN // Keep at last
91 } DM_t;
92
93 DM_t DupMethodFromString(unsigned proto, const std::string& type);
94 DM_t DupMethodFromNum(unsigned proto, int type);
95 const char *DupMethodToString(unsigned proto, DM_t type);
96 int DupMethodToNum(unsigned proto, DM_t type);
97
98 typedef enum
99 {
100 ST_NoSearch = 0, // (0x00)
101 ST_PowerSearch = 1, // (0x01)
102 ST_TitleSearch, // (0x02)
103 ST_KeywordSearch, // (0x03)
104 ST_PeopleSearch, // (0x04)
105 ST_ManualSearch, // (0x05)
106 ST_UNKNOWN // Keep at last
107 } ST_t;
108
109 ST_t SearchTypeFromString(unsigned proto, const std::string& type);
110 ST_t SearchTypeFromNum(unsigned proto, int type);
111 const char *SearchTypeToString(unsigned proto, ST_t type);
112 int SearchTypeToNum(unsigned proto, ST_t type);
113
114 typedef enum
115 {
116 CATT_CategoryNone = 0,
117 CATT_CategoryMovie,
118 CATT_CategorySeries,
119 CATT_CategorySports,
120 CATT_CategoryTVShow,
121 CATT_UNKNOWN // Keep at last
122 } CATT_t;
123
124 CATT_t CategoryTypeFromString(unsigned proto, const std::string& type);
125 CATT_t CategoryTypeFromNum(unsigned proto, int type);
126 const char *CategoryTypeToString(unsigned proto, CATT_t type);
127 int CategoryTypeToNum(unsigned proto, CATT_t type);
128
129 typedef enum
130 {
131 FM_NewEpisode = 0x001,
132 FM_IdentifiableEpisode = 0x002,
133 FM_FirstShowing = 0x004,
134 FM_PrimeTime = 0x008,
135 FM_CommercialFree = 0x010,
136 FM_HighDefinition = 0x020,
137 FM_ThisEpisode = 0x040,
138 FM_ThisSeries = 0x080,
139 FM_ThisTime = 0x100,
140 FM_ThisDayAndTime = 0x200,
141 FM_ThisChannel = 0x400
142 } FM_t;
143
144 typedef enum
145 {
146 EVENT_HANDLER_STATUS = 0, // Internal event: Backend status change
147 EVENT_HANDLER_TIMER, // Internal event: Every cycle without event
148 EVENT_UNKNOWN,
149 EVENT_UPDATE_FILE_SIZE,
150 EVENT_LIVETV_WATCH,
151 EVENT_LIVETV_CHAIN,
152 EVENT_DONE_RECORDING,
153 EVENT_QUIT_LIVETV,
154 EVENT_RECORDING_LIST_CHANGE,
155 EVENT_SCHEDULE_CHANGE,
156 EVENT_SIGNAL,
157 EVENT_ASK_RECORDING,
158 EVENT_CLEAR_SETTINGS_CACHE,
159 EVENT_GENERATED_PIXMAP,
160 EVENT_SYSTEM_EVENT,
161 } EVENT_t;
162
163 typedef enum
164 {
165 WHENCE_SET = 0,
166 WHENCE_CUR = 1,
167 WHENCE_END = 2,
168 } WHENCE_t;
169
170 typedef enum
171 {
172 RS_TUNING = -10,
173 RS_FAILED = -9,
174 RS_TUNER_BUSY = -8,
175 RS_LOW_DISKSPACE = -7,
176 RS_CANCELLED = -6,
177 RS_MISSED = -5,
178 RS_ABORTED = -4,
179 RS_RECORDED = -3,
180 RS_RECORDING = -2,
181 RS_WILL_RECORD = -1,
182 RS_UNKNOWN = 0,
183 RS_DONT_RECORD = 1,
184 RS_PREVIOUS_RECORDING = 2,
185 RS_CURRENT_RECORDING = 3,
186 RS_EARLIER_RECORDING = 4,
187 RS_TOO_MANY_RECORDINGS = 5,
188 RS_NOT_LISTED = 6,
189 RS_CONFLICT = 7,
190 RS_LATER_SHOWING = 8,
191 RS_REPEAT = 9,
192 RS_INACTIVE = 10,
193 RS_NEVER_RECORD = 11,
194 RS_OFFLINE = 12,
195 RS_OTHER_SHOWING = 13,
196 } RS_t;
197
198 RS_t RecStatusFromString(unsigned proto, const std::string& type);
199 RS_t RecStatusFromNum(unsigned proto, int type);
200 const char *RecStatusToString(unsigned proto, RS_t type);
201 int RecStatusToNum(unsigned proto, RS_t type);
202
203 struct ItemList
204 {
205 uint32_t count;
206 uint32_t protoVer;
207
208 ItemList()
209 : count(0)
210 , protoVer(0)
211 {}
212 };
213
214 typedef std::vector<std::string> StringList;
215 typedef MYTH_SHARED_PTR<StringList> StringListPtr;
216
217 struct Version
218 {
219 std::string version;
220 uint32_t protocol;
221 uint32_t schema;
222
223 Version()
224 : protocol(0)
225 , schema(0)
226 {}
227 };
228
229 typedef MYTH_SHARED_PTR<Version> VersionPtr;
230
231 struct Setting
232 {
233 std::string key;
234 std::string value;
235 };
236
237 typedef MYTH_SHARED_PTR<Setting> SettingPtr;
238 typedef std::map<std::string, SettingPtr> SettingMap;
239 typedef MYTH_SHARED_PTR<SettingMap> SettingMapPtr;
240
241 struct Artwork
242 {
243 std::string url;
244 std::string fileName;
245 std::string storageGroup;
246 std::string type;
247 };
248
249 typedef MYTH_SHARED_PTR<Artwork> ArtworkPtr;
250 typedef std::vector<ArtworkPtr> ArtworkList;
251 typedef MYTH_SHARED_PTR<ArtworkList> ArtworkListPtr;
252
253 struct Channel
254 {
255 uint32_t chanId;
256 std::string chanNum;
257 std::string callSign;
258 std::string iconURL;
259 std::string channelName;
260 uint32_t mplexId;
261 bool commFree;
262 std::string chanFilters;
263 uint32_t sourceId;
264 uint32_t inputId;
265 bool visible;
266
267 Channel()
268 : chanId(0)
269 , mplexId(0)
270 , commFree(false)
271 , sourceId(0)
272 , inputId(0)
273 , visible(true)
274 {}
275 };
276
277 typedef MYTH_SHARED_PTR<Channel> ChannelPtr;
278 typedef std::vector<ChannelPtr> ChannelList;
279 typedef MYTH_SHARED_PTR<ChannelList> ChannelListPtr;
280
281 struct Recording
282 {
283 uint32_t recordId;
284 int32_t priority;
285 int8_t status;
286 uint32_t encoderId;
287 uint8_t recType;
288 uint8_t dupInType;
289 uint8_t dupMethod;
290 time_t startTs;
291 time_t endTs;
292 std::string profile;
293 std::string recGroup;
294 std::string storageGroup;
295 std::string playGroup;
296 uint32_t recordedId; // Since proto 82
297
298 Recording()
299 : recordId(0)
300 , priority(0)
301 , status(0)
302 , encoderId(0)
303 , recType(0)
304 , dupInType(DI_InRecorded)
305 , dupMethod(DM_CheckNone)
306 , startTs(0)
307 , endTs(0)
308 , recordedId(0)
309 {}
310 };
311
312 typedef MYTH_SHARED_PTR<Recording> RecordingPtr;
313 typedef std::vector<RecordingPtr> RecordingList;
314 typedef MYTH_SHARED_PTR<RecordingList> RecordingListPtr;
315
316 /* Program flags from MythTV 32 */
317 typedef enum {
318 FL_NONE = 0x00000000,
319 FL_COMMFLAG = 0x00000001,
320 FL_CUTLIST = 0x00000002,
321 FL_AUTOEXP = 0x00000004,
322 FL_EDITING = 0x00000008,
323 FL_BOOKMARK = 0x00000010,
324 FL_REALLYEDITING = 0x00000020,
325 FL_COMMPROCESSING = 0x00000040,
326 FL_DELETEPENDING = 0x00000080,
327 FL_TRANSCODED = 0x00000100,
328 FL_WATCHED = 0x00000200,
329 FL_PRESERVED = 0x00000400,
330 FL_CHANCOMMFREE = 0x00000800,
331 FL_REPEAT = 0x00001000,
332 FL_DUPLICATE = 0x00002000,
333 FL_REACTIVATE = 0x00004000,
334 FL_IGNOREBOOKMARK = 0x00008000,
335 FL_IGNOREPROGSTART = 0x00010000,
336 FL_ALLOWLASTPLAYPOS = 0x00020000,
337 FL_TYPEMASK = 0x00F00000,
338 FL_INUSERECORDING = 0x01000000,
339 FL_INUSEPLAYING = 0x02000000,
340 FL_INUSEOTHER = 0x04000000,
341 } FL_t;
342
343 /* Video properties from MythTV 32 */
344 typedef enum {
345 VID_UNKNOWN = 0x00,
346 VID_HDTV = 0x01,
347 VID_WIDESCREEN = 0x02,
348 VID_AVC = 0x04,
349 VID_720 = 0x08,
350 VID_1080 = 0x10,
351 VID_DAMAGED = 0x20,
352 VID_3DTV = 0x40,
353 } VID_t;
354
355 /* Audio properties from MythTV 32 */
356 typedef enum {
357 AUD_UNKNOWN = 0x00,
358 AUD_STEREO = 0x01,
359 AUD_MONO = 0x02,
360 AUD_SURROUND = 0x04,
361 AUD_DOLBY = 0x08,
362 AUD_HARDHEAR = 0x10,
363 AUD_VISUALIMPAIR = 0x20,
364 } AUD_t;
365
366 /* Subtitle properties from MythTV 32 */
367 typedef enum {
368 SUB_UNKNOWN = 0x00,
369 SUB_HARDHEAR = 0x01,
370 SUB_NORMAL = 0x02,
371 SUB_ONSCREEN = 0x04,
372 SUB_SIGNED = 0x08
373 } SUB_t;
374
375 struct Program
376 {
377 time_t startTime;
378 time_t endTime;
379 std::string title;
380 std::string subTitle;
381 std::string description;
382 uint16_t season;
383 uint16_t episode;
384 std::string category;
385 std::string catType;
386 std::string hostName;
387 std::string fileName;
388 int64_t fileSize;
389 bool repeat;
390 uint32_t programFlags;
391 std::string seriesId;
392 std::string programId;
393 std::string inetref;
394 time_t lastModified;
395 double stars;
396 std::string airdate;
397 uint16_t audioProps;
398 uint16_t videoProps;
399 uint16_t subProps;
400 Channel channel;
401 Recording recording;
402 std::vector<Artwork> artwork;
403
404 Program()
405 : startTime(0)
406 , endTime(0)
407 , season(0)
408 , episode(0)
409 , fileSize(0)
410 , repeat(false)
411 , programFlags(0)
412 , lastModified(0)
413 , stars(0.0)
414 , audioProps(0)
415 , videoProps(0)
416 , subProps(0)
417 {}
418 };
419
420 typedef MYTH_SHARED_PTR<Program> ProgramPtr;
421 typedef std::vector<ProgramPtr> ProgramList;
422 typedef MYTH_SHARED_PTR<ProgramList> ProgramListPtr;
423 typedef std::map<time_t, ProgramPtr> ProgramMap;
424 typedef MYTH_SHARED_PTR<ProgramMap> ProgramMapPtr;
425
426 struct CaptureCard
427 {
428 uint32_t cardId;
429 std::string cardType;
430 std::string hostName;
431
432 CaptureCard()
433 : cardId(0)
434 {}
435 };
436
437 typedef MYTH_SHARED_PTR<CaptureCard> CaptureCardPtr;
438 typedef std::vector<CaptureCardPtr> CaptureCardList;
439 typedef MYTH_SHARED_PTR<CaptureCardList> CaptureCardListPtr;
440
441 struct CardInput
442 {
443 uint32_t inputId;
444 uint32_t cardId;
445 uint32_t sourceId;
446 uint32_t mplexId;
447 std::string inputName;
448 uint8_t liveTVOrder;
449
450 CardInput()
451 : inputId(0)
452 , cardId(0)
453 , sourceId(0)
454 , mplexId(0)
455 , liveTVOrder(0)
456 {}
457 };
458
459 typedef MYTH_SHARED_PTR<CardInput> CardInputPtr;
460 typedef std::vector<CardInputPtr> CardInputList;
461 typedef MYTH_SHARED_PTR<CardInputList> CardInputListPtr;
462
463 struct VideoSource
464 {
465 uint32_t sourceId;
466 std::string sourceName;
467
468 VideoSource()
469 : sourceId(0)
470 {}
471 };
472
473 typedef MYTH_SHARED_PTR<VideoSource> VideoSourcePtr;
474 typedef std::vector<VideoSourcePtr> VideoSourceList;
475 typedef MYTH_SHARED_PTR<VideoSourceList> VideoSourceListPtr;
476
477 struct RecordSchedule
478 {
479 uint32_t recordId;
480 std::string title;
481 std::string subtitle;
482 std::string description;
483 std::string category;
484 time_t startTime;
485 time_t endTime;
486 std::string seriesId;
487 std::string programId;
488 uint32_t chanId;
489 std::string callSign;
490 int8_t findDay;
491 std::string findTime;
492 uint32_t parentId;
493 bool inactive;
494 uint16_t season;
495 uint16_t episode;
496 std::string inetref;
497 std::string type;
498 RT_t type_t;
499 std::string searchType;
500 ST_t searchType_t;
501 int8_t recPriority;
502 uint32_t preferredInput;
503 uint8_t startOffset;
504 uint8_t endOffset;
505 std::string dupMethod;
506 DM_t dupMethod_t;
507 std::string dupIn;
508 DI_t dupIn_t;
509 uint32_t filter;
510 std::string recProfile;
511 std::string recGroup;
512 std::string storageGroup;
513 std::string playGroup;
514 bool autoExpire;
515 uint32_t maxEpisodes;
516 bool maxNewest;
517 bool autoCommflag;
518 bool autoTranscode;
519 bool autoMetaLookup;
520 bool autoUserJob1;
521 bool autoUserJob2;
522 bool autoUserJob3;
523 bool autoUserJob4;
524 uint32_t transcoder;
525 time_t nextRecording;
526 time_t lastRecorded;
527 time_t lastDeleted;
528 uint32_t averageDelay;
529
530 RecordSchedule()
531 : recordId(0)
532 , startTime(0)
533 , endTime(0)
534 , chanId(0)
535 , findDay(0)
536 , parentId(0)
537 , inactive(false)
538 , season(0)
539 , episode(0)
540 , type_t(RT_NotRecording)
541 , searchType_t(ST_NoSearch)
542 , recPriority(0)
543 , preferredInput(0)
544 , startOffset(0)
545 , endOffset(0)
546 , dupMethod_t(DM_CheckNone)
547 , dupIn_t(DI_InRecorded)
548 , filter(0)
549 , autoExpire(false)
550 , maxEpisodes(0)
551 , maxNewest(false)
552 , autoCommflag(false)
553 , autoTranscode(false)
554 , autoMetaLookup(false)
555 , autoUserJob1(false)
556 , autoUserJob2(false)
557 , autoUserJob3(false)
558 , autoUserJob4(false)
559 , transcoder(0)
560 , nextRecording(0)
561 , lastRecorded(0)
562 , lastDeleted(0)
563 , averageDelay(0)
564 {}
565 };
566
567 typedef MYTH_SHARED_PTR<RecordSchedule> RecordSchedulePtr;
568 typedef std::vector<RecordSchedulePtr> RecordScheduleList;
569 typedef MYTH_SHARED_PTR<RecordScheduleList> RecordScheduleListPtr;
570
571 struct SignalStatus
572 {
573 bool lock;
574 int signal;
575 int snr;
576 long ber;
577 long ucb;
578
579 SignalStatus()
580 : lock(false)
581 , signal(0)
582 , snr(0)
583 , ber(0)
584 , ucb(0)
585 {}
586 };
587
588 typedef MYTH_SHARED_PTR<SignalStatus> SignalStatusPtr;
589
590 struct EventMessage
591 {
592 EVENT_t event;
593 std::vector<std::string> subject;
594 ProgramPtr program;
595 SignalStatusPtr signal;
596
597 EventMessage()
598 : event(EVENT_UNKNOWN)
599 {}
600 };
601
602 typedef MYTH_SHARED_PTR<const EventMessage> EventMessagePtr;
603
604 struct StorageGroupFile
605 {
606 std::string fileName;
607 std::string storageGroup;
608 std::string hostName;
609 time_t lastModified;
610 int64_t size;
611
612 StorageGroupFile()
613 : lastModified(0)
614 , size(0)
615 {}
616 };
617
618 typedef MYTH_SHARED_PTR<StorageGroupFile> StorageGroupFilePtr;
619
620 typedef enum
621 {
622 MARK_CUT_END = 0,
623 MARK_CUT_START = 1,
624 MARK_BOOKMARK = 2,
625 MARK_BLANK_FRAME = 3,
626 MARK_COMM_START = 4,
627 MARK_COMM_END = 5,
628 MARK_GOP_START = 6,
629 MARK_KEYFRAME = 7,
630 MARK_SCENE_CHANGE = 8,
631 MARK_GOP_BYFRAME = 9,
632 MARK_ASPECT_1_1 = 10,
633 MARK_ASPECT_4_3 = 11,
634 MARK_ASPECT_16_9 = 12,
635 MARK_ASPECT_2_21_1 = 13,
636 MARK_ASPECT_CUSTOM = 14,
637 MARK_VIDEO_WIDTH = 30,
638 MARK_VIDEO_HEIGHT = 31,
639 MARK_VIDEO_RATE = 32,
640 MARK_DURATION_MS = 33,
641 MARK_TOTAL_FRAMES = 34,
642 } MARK_t;
643
644 struct Mark
645 {
646 MARK_t markType;
647 int64_t markValue;
648
649 Mark()
650 : markType(MARK_CUT_END)
651 , markValue(0)
652 {}
653 };
654
655 typedef MYTH_SHARED_PTR<Mark> MarkPtr;
656 typedef std::vector<MarkPtr> MarkList;
657 typedef MYTH_SHARED_PTR<MarkList> MarkListPtr;
658}
659
660#endif /* MYTHTYPES_H */
This is the main namespace that encloses all public classes.
Definition mythcontrol.h:30