guideparser.c File Reference

#include <string.h>
#include <memory.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "rtv.h"
#include "rtvlib.h"
#include "guideparser.h"

Go to the source code of this file.

Data Structures

struct  str_xref_t

Defines

#define V1_CHAN_REC_SIZE   (624)
#define DAYSOFWEEK_STR_SZ   (32)
#define SHOW_RATING_STR_SZ   (40)
#define GENRE_STR_SZ   (70)

Enumerations

enum  rtv_guide_ver_t { RTV_GV_UNKNOWN = 0, RTV_GV_1 = 1, RTV_GV_2 = 2 }

Functions

static char * xref_string (int key, str_xref_t *data_st)
static char * xref_as_mask_string (int key, str_xref_t *data_st)
char * rtv_xref_quality (int key)
char * rtv_xref_input_source (int key)
static void mapDaysOfWeek (int dayofweek, char **daysStr)
static void mapExtendedTVRating (int tvrating, char **ratingStr)
static void mapExtendedMPAARating (int mpaarating, char **ratingStr)
static void convertThemeInfoEndian (theme_info_t *strThemeInfo)
static void convertChannelInfoEndian (channel_info_t *strChannelInfo)
static void convertProgramInfoEndian (program_info_t *strProgramInfo)
static void convertMovieInfoEndian (movie_info_t *strMovieInfo)
static void convertPartsInfoEndian (parts_info_t *strPartsInfo)
static void convertReplayShowEndian (replay_show_t *strReplayShow)
static void convertV2ReplayChannelEndian (replay_channel_v2_t *strReplayChannel)
static void convertV1ReplayChannelEndian (replay_channel_v1_t *strReplayChannel)
static void convertReplayGuideEndian (guide_header_t *strGuideHeader)
static char * convertCodepage (char *szString)
static int parse_show (replay_show_t *show_rec, rtv_show_export_t *sh)
static void print_v2_guide_snapshot_header (v2_guide_snapshot_header_t *rtv2hdr)
static void print_groupdata_header (group_data_t *gdatahdr)
static void print_category_array (category_array_t ca[], unsigned int entries)
static int rtv_struct_chk (void)
static int convert_v1_to_v2_snapshot_header (guide_header_t *v2hdr, v1_guide_header_t *v1hdr)
int parse_guide_snapshot (const char *guideDump, int size, rtv_guide_export_t *guideExport)
int build_v2_bogus_snapshot (char **snapshot)
int build_v1_bogus_snapshot (char **snapshot)

Variables

str_xref_t rtv_quality []
str_xref_t input_source []
str_xref_t show_genre []
str_xref_t input_device []
str_xref_t service_tier []
str_xref_t ivs_status []
str_xref_t tv_rating []
str_xref_t mpaa_rating []
str_xref_t recording_type []


Define Documentation

#define DAYSOFWEEK_STR_SZ   (32)
 

Definition at line 37 of file guideparser.c.

Referenced by mapDaysOfWeek().

#define GENRE_STR_SZ   (70)
 

Definition at line 39 of file guideparser.c.

Referenced by parse_show().

#define SHOW_RATING_STR_SZ   (40)
 

Definition at line 38 of file guideparser.c.

Referenced by mapExtendedMPAARating(), and mapExtendedTVRating().

#define V1_CHAN_REC_SIZE   (624)
 

Definition at line 36 of file guideparser.c.

Referenced by convert_v1_to_v2_snapshot_header().


Enumeration Type Documentation

enum rtv_guide_ver_t
 

Enumerator:
RTV_GV_UNKNOWN 
RTV_GV_1 
RTV_GV_2 

Definition at line 41 of file guideparser.c.


Function Documentation

int build_v1_bogus_snapshot char **  snapshot  ) 
 

Definition at line 1083 of file guideparser.c.

References v1_guide_snapshot_header_t::channelcount, v1_guide_snapshot_header_t::channelcountcheck, v1_guide_snapshot_header_t::channeloffset, v1_guide_header_t::groupData, v1_guide_snapshot_header_t::groupdataoffset, v1_guide_header_t::guideSnapshotHeader, v1_guide_snapshot_header_t::osversion, v1_guide_snapshot_header_t::showoffset, v1_guide_snapshot_header_t::snapshotversion, v1_guide_snapshot_header_t::structuresize, and group_data_t::structuresize.

Referenced by make_get_guide_resp().

int build_v2_bogus_snapshot char **  snapshot  ) 
 

Definition at line 1047 of file guideparser.c.

References v2_guide_snapshot_header_t::channelcount, v2_guide_snapshot_header_t::channelcountcheck, v2_guide_snapshot_header_t::channeloffset, replay_channel_v2_t::channeltype, replay_channel_v2_t::created, guide_header_t::groupData, v2_guide_snapshot_header_t::groupdataoffset, guide_header_t::guideSnapshotHeader, v2_guide_snapshot_header_t::osversion, v2_guide_snapshot_header_t::showoffset, v2_guide_snapshot_header_t::snapshotsize, v2_guide_snapshot_header_t::snapshotversion, v2_guide_snapshot_header_t::structuresize, group_data_t::structuresize, replay_channel_v2_t::szShowLabel, v2_guide_snapshot_header_t::unknown1, and v2_guide_snapshot_header_t::unknown2.

Referenced by make_get_guide_resp().

static int convert_v1_to_v2_snapshot_header guide_header_t v2hdr,
v1_guide_header_t v1hdr
[static]
 

Definition at line 870 of file guideparser.c.

References v1_guide_snapshot_header_t::channelcount, v2_guide_snapshot_header_t::channelcount, v1_guide_snapshot_header_t::channelcountcheck, v2_guide_snapshot_header_t::channelcountcheck, v2_guide_snapshot_header_t::channeloffset, v1_guide_snapshot_header_t::flags, v2_guide_snapshot_header_t::flags, v1_guide_header_t::groupData, guide_header_t::groupData, v2_guide_snapshot_header_t::groupdataoffset, v1_guide_header_t::guideSnapshotHeader, guide_header_t::guideSnapshotHeader, v2_guide_snapshot_header_t::osversion, v2_guide_snapshot_header_t::showoffset, v2_guide_snapshot_header_t::snapshotversion, v2_guide_snapshot_header_t::structuresize, and V1_CHAN_REC_SIZE.

Referenced by parse_guide_snapshot().

static void convertChannelInfoEndian channel_info_t strChannelInfo  )  [static]
 

Definition at line 425 of file guideparser.c.

References channel_info_t::channel, channel_info_t::channelindex, channel_info_t::isvalid, channel_info_t::structuresize, channel_info_t::tmsID, and channel_info_t::usetuner.

Referenced by parse_show().

static char* convertCodepage char *  szString  )  [static]
 

Definition at line 562 of file guideparser.c.

Referenced by parse_show().

static void convertMovieInfoEndian movie_info_t strMovieInfo  )  [static]
 

Definition at line 452 of file guideparser.c.

References movie_info_t::mpaa, movie_info_t::runtime, movie_info_t::stars, and movie_info_t::year.

Referenced by parse_show().

static void convertPartsInfoEndian parts_info_t strPartsInfo  )  [static]
 

Definition at line 462 of file guideparser.c.

References parts_info_t::maxparts, and parts_info_t::partnumber.

Referenced by parse_show().

static void convertProgramInfoEndian program_info_t strProgramInfo  )  [static]
 

Definition at line 437 of file guideparser.c.

References program_info_t::autorecord, program_info_t::eventtime, program_info_t::flags, program_info_t::isvalid, program_info_t::minutes, program_info_t::recLen, program_info_t::structuresize, program_info_t::tmsID, and program_info_t::tuning.

Referenced by parse_show().

static void convertReplayGuideEndian guide_header_t strGuideHeader  )  [static]
 

Definition at line 524 of file guideparser.c.

References v2_guide_snapshot_header_t::bytesfree, group_data_t::categories, group_data_t::category, group_data_t::categoryoffset, v2_guide_snapshot_header_t::channelcount, v2_guide_snapshot_header_t::channelcountcheck, v2_guide_snapshot_header_t::channeloffset, v2_guide_snapshot_header_t::flags, guide_header_t::groupData, v2_guide_snapshot_header_t::groupdataoffset, guide_header_t::guideSnapshotHeader, v2_guide_snapshot_header_t::osversion, v2_guide_snapshot_header_t::showoffset, v2_guide_snapshot_header_t::snapshotsize, v2_guide_snapshot_header_t::snapshotversion, v2_guide_snapshot_header_t::structuresize, group_data_t::structuresize, v2_guide_snapshot_header_t::unknown1, v2_guide_snapshot_header_t::unknown2, v2_guide_snapshot_header_t::unknown3, v2_guide_snapshot_header_t::unknown6, and v2_guide_snapshot_header_t::unknown7.

Referenced by parse_guide_snapshot().

static void convertReplayShowEndian replay_show_t strReplayShow  )  [static]
 

Definition at line 469 of file guideparser.c.

References replay_show_t::channel_id, replay_show_t::checkpointed, replay_show_t::downloadid, replay_show_t::GOP_count, replay_show_t::GOP_highest, replay_show_t::GOP_last, replay_show_t::guaranteed, replay_show_t::guideid, replay_show_t::indexsize, replay_show_t::inputsource, replay_show_t::instance, replay_show_t::intact, replay_show_t::ivsstatus, replay_show_t::mpegsize, replay_show_t::playbackflags, replay_show_t::quality, replay_show_t::seconds, replay_show_t::show_id, replay_show_t::timessent, replay_show_t::unused, and replay_show_t::upgradeflag.

Referenced by parse_show().

static void convertThemeInfoEndian theme_info_t strThemeInfo  )  [static]
 

Definition at line 416 of file guideparser.c.

References theme_info_t::flags, theme_info_t::suzuki_id, and theme_info_t::thememinutes.

static void convertV1ReplayChannelEndian replay_channel_v1_t strReplayChannel  )  [static]
 

Definition at line 510 of file guideparser.c.

References replay_channel_v1_t::allocatedspace, replay_channel_v1_t::category, replay_channel_v1_t::channeltype, replay_channel_v1_t::created, replay_channel_v1_t::keep, replay_channel_v1_t::quality, replay_channel_v1_t::stored, and replay_channel_v1_t::timereserved.

static void convertV2ReplayChannelEndian replay_channel_v2_t strReplayChannel  )  [static]
 

Definition at line 496 of file guideparser.c.

References replay_channel_v2_t::allocatedspace, replay_channel_v2_t::category, replay_channel_v2_t::channeltype, replay_channel_v2_t::created, replay_channel_v2_t::keep, replay_channel_v2_t::quality, replay_channel_v2_t::stored, and replay_channel_v2_t::timereserved.

static void mapDaysOfWeek int  dayofweek,
char **  daysStr
[static]
 

Definition at line 313 of file guideparser.c.

References CE_FRI, CE_MON, CE_SAT, CE_SUN, CE_THU, CE_TUE, CE_WED, and DAYSOFWEEK_STR_SZ.

static void mapExtendedMPAARating int  mpaarating,
char **  ratingStr
[static]
 

Definition at line 372 of file guideparser.c.

References SHOW_RATING_STR_SZ.

Referenced by parse_show().

static void mapExtendedTVRating int  tvrating,
char **  ratingStr
[static]
 

Definition at line 348 of file guideparser.c.

References SHOW_RATING_STR_SZ.

Referenced by parse_show().

int parse_guide_snapshot const char *  guideDump,
int  size,
rtv_guide_export_t guideExport
 

Definition at line 893 of file guideparser.c.

References group_data_t::catbuffer, group_data_t::categories, group_data_t::category, group_data_t::categoryoffset, rtv_guide_export_t::channel_list, v2_guide_snapshot_header_t::channelcount, v2_guide_snapshot_header_t::channelcountcheck, convert_v1_to_v2_snapshot_header(), convertReplayGuideEndian(), guide_header_t::groupData, GRP_DATA_NUM_CATEGORIES, guide_header_t::guideSnapshotHeader, v2_guide_snapshot_header_t::osversion, print_v2_guide_snapshot_header(), rc, rtv_guide_export_t::rec_show_list, REPLAYSHOW_V2_PADDING, RTV_DBGLOG, RTV_ERRLOG, RTV_GV_1, RTV_GV_2, rtv_struct_chk(), RTVLOG_GUIDE, v2_guide_snapshot_header_t::showoffset, v2_guide_snapshot_header_t::snapshotsize, v2_guide_snapshot_header_t::snapshotversion, and x.

Referenced by get_guide_ss().

static int parse_show replay_show_t show_rec,
rtv_show_export_t sh
[static]
 

Definition at line 586 of file guideparser.c.

References program_info_t::actorLen, rtv_show_export_t::actors, replay_show_t::beforepadding, rtv_show_flags_t::cc, replay_show_t::channel_id, rtv_show_export_t::channel_id, replay_show_t::channelInfo, convertChannelInfoEndian(), convertCodepage(), convertMovieInfoEndian(), convertPartsInfoEndian(), convertProgramInfoEndian(), convertReplayShowEndian(), rtv_show_export_t::description, program_info_t::descriptionLen, rtv_show_export_t::director, program_info_t::directorLen, rtv_show_export_t::duration_sec, rtv_show_export_t::duration_str, rtv_show_export_t::episode, program_info_t::episodeLen, program_info_t::eventtime, rtv_show_export_t::file_name, program_info_t::flags, rtv_show_export_t::flags, rtv_show_export_t::genre, program_info_t::genre1, program_info_t::genre2, program_info_t::genre3, program_info_t::genre4, GENRE_STR_SZ, replay_show_t::GOP_count, rtv_show_export_t::gop_count, rtv_show_flags_t::guaranteed, replay_show_t::guaranteed, rtv_show_export_t::guest, program_info_t::guestLen, rtv_show_flags_t::guide_id, replay_show_t::guideid, rtv_show_export_t::input_source, replay_show_t::inputsource, channel_info_t::isvalid, rtv_show_flags_t::letterbox, mapExtendedMPAARating(), mapExtendedTVRating(), parts_info_t::maxparts, program_info_t::minutes, rtv_show_flags_t::movie, rtv_show_export_t::movie_runtime, rtv_show_export_t::movie_stars, rtv_show_export_t::movie_year, movie_info_t::mpaa, mpaa_rating, rtv_show_flags_t::multipart, rtv_show_export_t::padding_before, parts_info_t::partnumber, rtv_show_export_t::producer, program_info_t::producerLen, replay_show_t::programInfo, replay_show_t::quality, rtv_show_export_t::quality, rtv_show_export_t::rating, rtv_show_export_t::rating_extended, rtv_show_flags_t::repeat, RTV_DBGLOG, rtv_format_datetime_sec32(), rtv_format_datetime_sec32_2(), rtv_hex_dump(), rtv_sec_to_hr_mn_str(), RTV_WARNLOG, RTVLOG_GUIDE, movie_info_t::runtime, rtv_show_flags_t::sap, rtv_show_export_t::sch_show_length, rtv_show_export_t::sch_st_tm_str, rtv_show_export_t::sch_st_tm_str2, rtv_show_export_t::sch_start_time, replay_show_t::seconds, show_genre, replay_show_t::show_id, rtv_show_export_t::show_id, movie_info_t::stars, rtv_show_flags_t::stereo, rtv_show_export_t::suzuki, program_info_t::suzukiLen, channel_info_t::szChannelLabel, channel_info_t::szChannelName, program_info_t::szDescription, rtv_show_export_t::title, program_info_t::titleLen, TRUE, rtv_show_export_t::tune_chan_desc, rtv_show_export_t::tune_chan_name, program_info_t::tuning, rtv_show_export_t::tuning, tv_rating, rtv_show_export_t::unavailable, channel_info_t::usetuner, xref_as_mask_string(), xref_string(), and movie_info_t::year.

static void print_category_array category_array_t  ca[],
unsigned int  entries
[static]
 

Definition at line 821 of file guideparser.c.

References RTV_PRT, and x.

static void print_groupdata_header group_data_t gdatahdr  )  [static]
 

Definition at line 802 of file guideparser.c.

References group_data_t::categories, group_data_t::category, group_data_t::categoryoffset, RTV_PRT, group_data_t::structuresize, and x.

static void print_v2_guide_snapshot_header v2_guide_snapshot_header_t rtv2hdr  )  [static]
 

Definition at line 781 of file guideparser.c.

References v2_guide_snapshot_header_t::channelcount, v2_guide_snapshot_header_t::channelcountcheck, v2_guide_snapshot_header_t::channeloffset, v2_guide_snapshot_header_t::flags, v2_guide_snapshot_header_t::groupdataoffset, v2_guide_snapshot_header_t::osversion, RTV_PRT, v2_guide_snapshot_header_t::showoffset, v2_guide_snapshot_header_t::snapshotsize, v2_guide_snapshot_header_t::snapshotversion, and v2_guide_snapshot_header_t::structuresize.

Referenced by parse_guide_snapshot().

static int rtv_struct_chk void   )  [static]
 

Definition at line 837 of file guideparser.c.

References CHANNELINFO_SZ, GUIDEHEADER_SZ, GUIDEHEADER_V1_SZ, PROGRAMINFO_SZ, rc, REPLAYCHANNEL_SZ, REPLAYSHOW_SZ, and RTV_ERRLOG.

Referenced by parse_guide_snapshot().

char* rtv_xref_input_source int  key  ) 
 

Definition at line 108 of file guideparser.c.

References input_source, and xref_string().

Referenced by rtv_print_show().

char* rtv_xref_quality int  key  ) 
 

Definition at line 92 of file guideparser.c.

References rtv_quality, and xref_string().

Referenced by rtv_print_show().

static char* xref_as_mask_string int  key,
str_xref_t data_st
[static]
 

Definition at line 70 of file guideparser.c.

Referenced by parse_show().

static char* xref_string int  key,
str_xref_t data_st
[static]
 

Definition at line 58 of file guideparser.c.

Referenced by parse_show(), rtv_xref_input_source(), and rtv_xref_quality().


Variable Documentation

str_xref_t input_device[]
 

Initial value:

{
   { 64, "Standard" },
   { 65, "A Lineup" },
   { 66, "B Lineup" },
   { 68, "Rebuild Lineup" },
   { 71, "Non-Addressable Converter" },
   { 72, "Hamlin" },
   { 73, "Jerrold Impulse" },
   { 74, "Jerrold" },
   { 76, "Digital Rebuild" },
   { 77, "Multiple Converters" },
   { 78, "Pioneer" },
   { 79, "Oak" },
   { 80, "Premium" },
   { 82, "Cable-ready-TV" },
   { 83, "Converter Switch" },
   { 84, "Tocom" },
   { 85, "A Lineup Cable-ready-TV" },
   { 86, "B Lineup Cable-ready-TV" },
   { 87, "Scientific-Atlanta" },
   { 88, "Digital" },
   { 90, "Zenith" },
   { -1, "" }
}

Definition at line 220 of file guideparser.c.

str_xref_t input_source[]
 

Initial value:

{
   { 0, "Direct RF" }, 
   { 1, "Direct Line 1"} , 
   { 2, "Direct Line 2" }, 
   { 3, "Tuner"} , 
   { 16, "Pre-loaded" }, 
   { -1, "" }
}

Definition at line 99 of file guideparser.c.

Referenced by rtv_xref_input_source().

str_xref_t ivs_status[]
 

Initial value:

{
   { 0, "Local" }, 
   { 1, "LAN" } , 
   { 2, "Internet Downloadable" }, 
   { 3, "Internet Download Failed" }, 
   { 4, "Internet Index Download Restart" } , 
   { 5, "Internet Index Downloading" }, 
   { 6, "Internet Index Download Complete" }, 
   { 7, "Internet MPEG Download Restart" } , 
   { 8, "Internet MPEG Downloading" }, 
   { 9, "Internet MPEG Download Complete" } , 
   { 10, "Internet File Not Found" }, 
   { -1, "" }
}

Definition at line 261 of file guideparser.c.

str_xref_t mpaa_rating[]
 

Initial value:

{
   { 0x00000002, "G"} , 
   { 0x00000004, "NC-17" }, 
   { 0x00000008, "NR" }, 
   { 0x00000010, "PG"} , 
   { 0x00000020, "PG-13" }, 
   { 0x00000040, "R" }, 
   { -1, "" }
}

Definition at line 293 of file guideparser.c.

Referenced by parse_show().

str_xref_t recording_type[]
 

Initial value:

{
   { 1, "Recurring" }, 
   { 2, "Theme"} , 
   { 3, "Single" }, 
   { 4, "Zone" }, 
   { -1, "" }
}

Definition at line 304 of file guideparser.c.

str_xref_t rtv_quality[]
 

Initial value:

{
   { RTV_QUALITY_HIGH, "High" }, 
   { RTV_QUALITY_MEDIUM, "Medium"} , 
   { RTV_QUALITY_STANDARD, "Standard" }, 
   { -1, "" }
}

Definition at line 84 of file guideparser.c.

Referenced by rtv_xref_quality().

str_xref_t service_tier[]
 

Initial value:

{
   { 1, "Basic" }, 
   { 2, "Expanded Basi" } , 
   { 3, "Premium" }, 
   { 4, "PPV" } , 
   { 5, "DMX/Music" }, 
   { -1, "" }
}

Definition at line 249 of file guideparser.c.

str_xref_t show_genre[]
 

Definition at line 116 of file guideparser.c.

Referenced by parse_show().

str_xref_t tv_rating[]
 

Initial value:

{
   { 0x00000800, "TV-14" }, 
   { 0x00001000, "TV-G" }, 
   { 0x00002000, "TV-MA"} , 
   { 0x00004000, "TV-PG" }, 
   { 0x00008000, "TV-Y" }, 
   { 0x00010000, "TV-Y7"} , 
   { -1, "" }
}

Definition at line 279 of file guideparser.c.

Referenced by parse_show().


Generated on Fri Sep 10 03:13:24 2010 for mvpmc by  doxygen 1.4.6