hmt/hmt.h
prpr b341756468 Tag string fields to allow UTF-8 or ISO-6937.
Modify iPlate guidance also.
Add/correct/use manifest constants.
Update filename location to offset 0x180.
2022-04-07 02:54:35 +01:00

176 lines
3.9 KiB
C

#ifdef _WIN32
#include <windows.h>
#define MAXPATHLEN MAX_PATH
#else
#include <strings.h>
#include <sys/param.h>
#endif
enum hmt_attribute {
HMTA_ENCRYPTED = 0,
HMTA_LOCKED,
HMTA_NEW,
HMTA_ENCFLAGGED,
HMTA_SHRUNK,
HMTA_DEDUPED,
HMTA_DETECTADS,
HMTA_UNLIMITEDCOPY,
HMTA_RADIO,
HMTA_GHOST,
HMTA_THUMBNAIL,
};
struct hmt {
char fname[MAXPATHLEN + 1];
int fd;
uint8_t *bin;
uint32_t binsize;
int mmapped;
int modified;
int readonly;
/* Recording information */
char *directory;
char *filename;
uint8_t type;
uint32_t start;
uint32_t end;
uint16_t duration;
uint8_t recstatus;
uint8_t flags1;
uint8_t flags2;
uint8_t failreason;
uint32_t resume;
uint16_t num_bookmarks;
char *mediatitle;
uint32_t *bookmarks;
uint8_t flags3;
uint8_t guidance_type;
uint8_t guidance_mode;
char *guidance;
uint8_t copycount;
uint16_t tzoffset;
uint32_t lcn;
char *channel;
uint16_t service_id;
uint16_t tsid;
uint16_t onid;
uint16_t pmt_pid;
uint16_t video_pid;
enum { DEF_SD = 1, DEF_HD } definition;
uint16_t audio_pid;
uint32_t schedstart;
uint32_t scheddur;
uint8_t genre;
char *title;
char *synopsis;
uint16_t event_id;
uint8_t xflags1;
uint8_t xflags2;
uint8_t xflags3;
int series;
int episode;
int episodetot;
};
void parse_hmt(struct hmt *);
uint8_t *strip_string(uint8_t *);
int guidance(struct hmt *);
const char *genredescr(unsigned char b);
unsigned char genrecode(char *);
const char *genre(unsigned char);
const char *recordingstatus(struct hmt *);
const char *failurereason(struct hmt *);
char *hmt_flags(struct hmt *);
int hmt_is(struct hmt *, enum hmt_attribute);
#define HMT_FOLDER 0x80
#define HMT_FOLDER_LEN 254
#define HMT_FILENAME 0x17f
#define HMT_FILENAME_LEN 256
#define HMT_TITLE 0x29a
#define HMT_TITLE_LEN 48
#define HMT_ITITLE 0x516
#define HMT_ITITLE_LEN 48
#define HMT_CHANNEL_NUM 0x458 /* 4 bytes */
#define HMT_CHANNEL_NAME 0x45c
#define HMT_CHANNEL_NAME_LEN 42
#define HMT_SYNOPSIS 0x616
#define HMT_SYNOPSIS_LEN 252
#define HMT_RECSTATUS 0x28c
#define HMT_FAILREASON 0x290
#define HMT_RECTYPE 0x4b8
#define HMT_RECTYPE_RADIO 0x2
#define HMT_FLAGS1 0x28d
#define HMT_FLAGS1_LOCKED 0x4
#define HMT_FLAGS1_NEW 0x8
#define HMT_FLAGS2 0x28e
#define HMT_FLAGS2_ENCRYPTED 0x1
#define HMT_FLAGS2_THUMBNAIL 0x2
#define HMT_FLAGS2_GHOST 0x8
#define HMT_BOOKMARKS_CNT 0x298
#define HMT_BOOKMARKS 0x31c
#define HMT_FLAGS3 0x3dc
#define HMT_FLAGS3_PROTECTED_COPY_UNLIMITED 0
#define HMT_FLAGS3_PROTECTED_COPY_LIMITED 0x2
#define HMT_FLAGS3_UNPROTECTED 0x4
#define HMT_RECORDING_START 0x280 /* 4 bytes */
#define HMT_RECORDING_END 0x284 /* 4 bytes */
#define HMT_STORED_DURATION 0x288 /* 2 bytes */
#define HMT_SCHEDULED_START 0x4f8 /* 4 bytes */
#define HMT_SCHEDULED_DURATION 0x4fc /* 4 bytes */
#define HMT_PLAYED_TIME 0x294 /* 4 bytes */
#define HMT_GENRE 0x514
#define HMT_EVENTID 0x716
#define HMT_GUIDETYPE 0x3e0
#define HMT_GUIDETYPE_ON 0x01
#define HMT_GUIDETYPE_OFF 0xff
#define HMT_GUIDEMODE 0x3e1
#define HMT_GUIDEMODE_ON 0x01
#define HMT_GUIDEMODE_OFF 0
#define HMT_GUIDANCE 0x3e2
#define HMT_GUIDANCE_LEN 74
#define HMT_GUIDETYPE2 0x73b
#define HMT_GUIDEMODE2 0x73c
#define HMT_GUIDANCE2 0x741
#define HMT_SID 0x488 /* 2 bytes */
#define HMT_TSID 0x48a /* 2 bytes */
#define HMT_ONID 0x48c /* 2 bytes */
#define HMT_PMTPID 0x48e /* 2 bytes */
#define HMT_VIDEOPID 0x490 /* 2 bytes */
#define HMT_AUDIOPID 0x49c /* 2 bytes */
#define HMT_HDFLAG 0x498 /* 1 == SD, 2 == HD */
#define HMT_HDFLAG2 0x4bc /* 1 == SD, 0 == HD */
#define HMT_COPYCOUNT 0x431
#define HMT_TZOFFSET 0x434
/* Section of HMT used for 'eng' string from guidance text. */
#define HMT_SHRUNK 0x73d /* Set to E for shrunk.. */
#define HMT_DEDUPED 0x73e /* Set to N for deduped.. */
#define HMT_DETECTADS 0x73f /* Set to G for detectads.. */
#define HMT_SERIES 0x10
#define HMT_EPISODE 0x11
#define HMT_EPISODETOT 0x12
#define HMT_EPG_TITLE 0x3e
#define HMT_EPG_SYNOPSIS 0x13e
#define HMT_EPG_GUIDANCE 0x269