49 #include "stbhwcrypt.h" 61 #ifdef COMMON_INTERFACE 69 #define STB_PVR_PRINT(x) STB_SPDebugWrite x 71 #define STB_PVR_PRINT(x) 75 #define DBG_CIP(x, ...) {U32DHMS gmt = STB_GCNowDHMSGmt(); \ 76 STB_SPDebugWrite("%02u:%02u:%02u: %s" x, DHMS_HOUR(gmt), DHMS_MINS(gmt), DHMS_SECS(gmt), __FUNCTION__, ##__VA_ARGS__); } 78 #define DBG_CIP(x, ...) 85 #define FUNCTION_START(X) STB_SPDebugWrite(">>> %s\n", # X) 86 #ifdef FUNCTION_FINISH 87 #undef FUNCTION_FINISH 89 #define FUNCTION_FINISH(X) STB_SPDebugWrite("<<< %s\n", # X) 92 #define HANDLE_BASE 0x00000001 94 #define DB_FILENAME_LEN 32 95 #define BASENAME_LEN 16 97 #define DB_FILE_EXTENSION ".odb" 98 #define DB_FILE_EXTENTION_LEN 4 100 #define ODB_MAGIC_1 'O' 101 #define ODB_MAGIC_2 'd' 102 #define ODB_MAGIC_3 'B' 104 #define ODB_VERSION_1 1 105 #define ODB_VERSION_2 2 106 #define ODB_CUR_VERSION ODB_VERSION_2 108 #define BOOKMARK_FILENAME_SIZE 10 109 #define BOOKMARK_TOLERANCE 30 111 #define REC_AD_RECEIVER_MIX 0 112 #define REC_AD_BROADCAST_MIX 1 114 #define REC_INFO_BUFFER_SIZE ((sizeof(S_REC_INFO) + (AES128_KEY_SIZE - 1)) & ~(AES128_KEY_SIZE - 1)) 117 #define REC_LOCKED 0x0001 118 #define REC_ENCRYPTED 0x0002 119 #define REC_HAS_GUIDANCE 0x0004 120 #define REC_SERIES 0x0008 121 #define REC_RECOMMENDATION 0x0010 122 #define REC_HAS_VIDEO 0x0020 123 #define REC_PARENTAL_LOCK 0x0040 127 #ifdef COMMON_INTERFACE 133 } S_REC_CIPLUS_LICENCE;
138 U8BIT private_data[CIP_PIN_PRIVATE_DATA_SIZE];
141 typedef struct s_rec_ciplus_item
147 U8BIT uri[CIP_URI_LEN];
148 S_REC_CIPLUS_LICENCE licence;
149 S_REC_CIPLUS_PIN pin;
151 struct s_rec_ciplus_item *prev;
152 struct s_rec_ciplus_item *next;
159 #ifdef COMMON_INTERFACE 162 S_REC_CIPLUS_ITEM *item_list;
163 S_REC_CIPLUS_ITEM *uri_item;
164 S_REC_CIPLUS_ITEM *licence_item;
165 S_REC_CIPLUS_ITEM *pin_item;
169 #ifdef COMMON_INTERFACE 191 E_STB_PVR_START_MODE smode;
192 U32BIT timeshift_seconds;
193 #ifdef COMMON_INTERFACE 194 E_STB_DMX_DESC_TYPE desc_type;
220 U8BIT name[STB_PVR_NAME_LEN];
221 U8BIT prog_crid[STB_PVR_MAX_CRID_LEN];
222 U8BIT other_crid[STB_PVR_MAX_CRID_LEN];
223 U8BIT additional_info[STB_PVR_ADDITIONAL_INFO_LEN];
228 U32BIT parental_rating;
229 S32BIT start_padding;
236 EXT_INFO_SERVICE_NAME,
239 EXT_INFO_EXTENDED_DESC,
240 EXT_INFO_CIPLUS_LICENCE,
242 EXT_INFO_CIPLUS_CICAM_ID,
253 U8BIT basename[BASENAME_LEN];
261 BOOKMARK_PLAYBACK_POSITION
276 static BOOLEAN initialised_flag = FALSE;
277 static BOOLEAN formatting_flag = FALSE;
278 static BOOLEAN repairing_flag = FALSE;
280 static U8BIT num_paths;
285 static void *disk_mutex;
287 static U16BIT num_disks_in_db;
289 static U16BIT default_pvr_disk_id = INVALID_DISK_ID;
291 static void *list_mutex;
294 static U8BIT *enc_dec_key;
295 static U8BIT *enc_dec_iv;
296 static U32BIT enc_dec_key_len;
297 static U8BIT *rec_info_buffer;
302 static void ReadRecordings(U16BIT disk_id);
303 static void RemoveRecordings(U16BIT disk_id);
305 static U32BIT GetCurrentRecordTime(U32BIT handle);
307 static BOOLEAN WriteODBFile(U16BIT disk_id, U8BIT *basename, BOOLEAN write_header,
309 static BOOLEAN WriteExtendedInfo(U16BIT disk_id, U8BIT *basename, U16BIT ext_id,
310 U32BIT data_len, U8BIT *data);
311 static BOOLEAN ReadExtendedInfo(U16BIT disk_id, U8BIT *basename, U16BIT ext_id, U8BIT *data,
313 static U32BIT GetExtendedInfoSize(U16BIT disk_id, U8BIT *basename, U16BIT ext_id);
314 static void InsertRecordingInList(
S_RECORDING *rec_ptr);
315 static void RemoveRecordingFromList(
S_RECORDING *rec_ptr);
316 static U32BIT GetNextFreeHandle(
void);
318 static void GetDBRecordBasename(U32BIT file_number, U8BIT *filename);
319 static void GetDBRecordFilename(U32BIT file_number, U8BIT *filename);
320 static BOOLEAN IncludesVideoPid(
S_PVR_PID_INFO *pid_array, U16BIT num_pids);
322 #ifdef COMMON_INTERFACE 323 static void FreeCIPlusItemList(U8BIT path);
324 static void FreeCIPlusItem(S_REC_CIPLUS_ITEM *item);
325 static void ReadCIPlusItems(U8BIT path,
S_RECORDING *rec_ptr);
326 static void ApplyCIPlusItems(U8BIT path,
S_RECORDING *rec_ptr, U32BIT position_in_seconds,
328 static void FindNextCIPlusItem(U8BIT path, S16BIT speed);
329 static BOOLEAN WriteCIPlusInfo(U16BIT disk_id, U8BIT *basename, U16BIT ext_id, U32BIT timestamp,
330 U32BIT data_len, U8BIT *data);
331 static BOOLEAN UpdateCIPlusInfo(U16BIT disk_id, U8BIT *basename, U16BIT ext_id, U32BIT timestamp,
332 U32BIT data_len, U8BIT *data);
335 static void GetBookmarkFolderName(U8BIT *basename, U8BIT *bookmark_folder_name);
336 static void GetBookmarkFileName(U32BIT time, E_BOOKMARK_TYPE type, U8BIT *name);
337 static E_BOOKMARK_TYPE GetBookmarkType(U8BIT *file_name);
338 static U32BIT GetBookmarkTime(U8BIT *file_name);
339 static BOOLEAN AddBookmark(U16BIT disk_id, U8BIT *basename, U32BIT time, U8BIT *name,
340 E_BOOKMARK_TYPE type);
341 static void RemoveBookmark(U16BIT disk_id, U8BIT *basename, U32BIT time, U8BIT *name,
342 E_BOOKMARK_TYPE type);
343 static void RemoveAllBookmarks(U16BIT disk_id, U8BIT *basename);
344 static U32BIT GetBookmarks(U16BIT disk_id, U8BIT *basename,
LINK_LIST_HEADER *bookmarks,
345 E_BOOKMARK_TYPE type, BOOLEAN names);
366 U8BIT num_recorders, num_players;
367 U8BIT num_audio_decoders, num_video_decoders;
376 STB_PVR_PRINT((
"STB_PVRInitialise: tuners = %d, audio/video decoders = %d/%d", num_recorders,
377 num_audio_decoders, num_video_decoders));
382 STB_PVR_PRINT((
"STB_PVRInitialise: num players = %d, num recorders = %d", num_players, num_recorders));
384 if ((num_players > 0) && (num_recorders > 0))
387 if (play_status != NULL)
389 for (i = 0; i < num_paths; i++)
391 play_status[i].handle = 0;
392 #ifdef COMMON_INTERFACE 394 play_status[i].item_list = NULL;
395 play_status[i].uri_item = NULL;
396 play_status[i].licence_item = NULL;
397 play_status[i].pin_item = NULL;
403 if (record_status != NULL)
405 for (i = 0; i < num_paths; i++)
407 record_status[i].handle = 0;
408 record_status[i].start_time = 0;
409 record_status[i].duration = 0;
410 record_status[i].paused = FALSE;
411 record_status[i].encrypted = FALSE;
412 record_status[i].rec_index = INVALID_RES_ID;
413 record_status[i].num_pids = 0;
414 record_status[i].rec_pids_array = NULL;
415 #ifdef COMMON_INTERFACE 416 record_status[i].keys[KEY_PARITY_EVEN].valid = FALSE;
417 record_status[i].keys[KEY_PARITY_ODD].valid = FALSE;
426 initialised_flag = TRUE;
433 default_pvr_disk_id = INVALID_DISK_ID;
443 return(initialised_flag);
461 if (initialised_flag == TRUE)
486 ret_val = initialised_flag;
502 default_pvr_disk_id = disk_id;
520 disk_id = default_pvr_disk_id;
521 if (disk_id == INVALID_DISK_ID)
525 for (index = 0; (index < num_disks) && (disk_id == INVALID_DISK_ID); index++)
530 disk_id = INVALID_DISK_ID;
553 BOOLEAN result = FALSE;
580 BOOLEAN
STB_PVRFormat(U16BIT disk_id, E_STB_PVR_FORMATMODE mode, U8BIT *prog)
582 BOOLEAN ret_val = FALSE;
586 STB_PVR_PRINT((
"STB_PVRFormat (mode = %d)", mode));
591 if (formatting_flag == FALSE)
595 formatting_flag = TRUE;
598 RemoveRecordings(disk_id);
602 case FORMAT_PROGRESS:
603 if (formatting_flag == TRUE)
612 if (formatting_flag == TRUE)
618 formatting_flag = FALSE;
647 BOOLEAN
STB_PVRRepair(U16BIT disk_id, E_STB_PVR_REPAIRMODE mode, U8BIT *prog)
649 BOOLEAN ret_val = FALSE;
653 STB_PVR_PRINT((
"STB_PVRRepair (mode = %d)", mode));
655 if (initialised_flag == TRUE)
660 if (repairing_flag == FALSE)
669 if (repairing_flag == FALSE)
673 repairing_flag = TRUE;
679 case REPAIR_PROGRESS:
680 if (repairing_flag == TRUE)
689 if (repairing_flag == TRUE)
693 repairing_flag = FALSE;
724 if (initialised_flag)
729 for (index = 0; index < num_disks_in_db; index++)
731 disks_in_db[index].valid = FALSE;
737 for (index = 0; index < num_disks; index++)
745 for (i = 0; (i < num_disks_in_db) && !disk_found; i++)
747 if (disks_in_db[i].disk_id == disk_id)
749 disks_in_db[i].valid = TRUE;
758 if (disks_in_db != NULL)
760 ReadRecordings(disk_id);
762 disks_in_db[num_disks_in_db].disk_id = disk_id;
763 disks_in_db[num_disks_in_db].valid = TRUE;
770 ReadRecordings(disk_id);
776 for (index = 0; index < num_disks_in_db; index++)
778 if (!disks_in_db[index].valid)
781 RemoveRecordings(disks_in_db[index].disk_id);
783 for (i = index + 1; i < num_disks_in_db; i++)
785 disks_in_db[i - 1].disk_id = disks_in_db[i].disk_id;
786 disks_in_db[i - 1].valid = disks_in_db[i].valid;
791 if (num_disks_in_db == 0)
822 if (initialised_flag)
826 if (GetRecording(handle) != NULL)
849 U8BIT db_filename[DB_FILENAME_LEN];
850 U8BIT basename[BASENAME_LEN];
851 U8BIT tmp_str[STB_PVR_NAME_LEN];
855 U8BIT hour, min, sec;
862 if (initialised_flag)
867 *handle = GetNextFreeHandle();
869 STB_PVR_PRINT((
"STB_PVRCreateRecording(disk=0x%04x, name=\"%s\"): handle=0x%08lx", disk_id, name, *handle));
877 GetDBRecordBasename(file_number, basename);
878 GetDBRecordFilename(file_number, db_filename);
888 rec_ptr->handle = *handle;
889 rec_ptr->disk_id = disk_id;
891 strncpy((
char *)rec_ptr->basename, (
char *)basename, BASENAME_LEN);
895 &rec_ptr->rec_info.rec_date,
896 &rec_ptr->rec_info.rec_hour,
897 &rec_ptr->rec_info.rec_min,
898 &rec_ptr->rec_info.rec_sec,
903 snprintf((
char *)tmp_str, STB_PVR_NAME_LEN,
"Recording %lu", (
unsigned long)*handle);
904 strncpy((
char *)rec_ptr->rec_info.name, (
char *)tmp_str, STB_PVR_NAME_LEN);
909 if (num_bytes >
sizeof(rec_ptr->rec_info.name))
914 snprintf((
char *)tmp_str, STB_PVR_NAME_LEN,
"Recording %lu", (
unsigned long)*handle);
915 strncpy((
char *)rec_ptr->rec_info.name, (
char *)tmp_str, STB_PVR_NAME_LEN);
919 memcpy(rec_ptr->rec_info.name, name, num_bytes);
923 if (WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, TRUE, &rec_ptr->rec_info))
925 InsertRecordingInList(rec_ptr);
951 U8BIT db_filename[DB_FILENAME_LEN];
956 STB_PVR_PRINT((
"STB_PVRDestroyRecording(0x%lx)", handle));
960 if (initialised_flag)
964 rec_ptr = GetRecording(handle);
967 if (strlen((
char *)rec_ptr->basename) > 0)
969 strncpy((
char *)db_filename, (
char *)rec_ptr->basename, DB_FILENAME_LEN);
970 strncat((
char *)db_filename, DB_FILE_EXTENSION, DB_FILENAME_LEN - strlen((
char *)rec_ptr->basename));
974 RemoveAllBookmarks(rec_ptr->disk_id, rec_ptr->basename);
980 RemoveRecordingFromList(rec_ptr);
1005 STB_PVR_PRINT((
"STB_PVRSaveRecording(handle=0x%lx)", handle));
1007 if (initialised_flag)
1012 rec_ptr = GetRecording(handle);
1013 if (rec_ptr != NULL)
1015 if (strlen((
char *)rec_ptr->basename) > 0)
1017 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, TRUE, &rec_ptr->rec_info);
1023 STB_PVR_PRINT((
"STB_PVRSaveRecording(0x%08lx): Failed to find recording", handle));
1042 U16BIT num_recordings;
1049 if (initialised_flag)
1054 for (num_recordings = 0, rec_ptr = rec_list; rec_ptr != NULL;
1055 num_recordings++, rec_ptr = rec_ptr->next)
1058 if (num_recordings > 0)
1061 *handle_array = (U32BIT *)
STB_GetMemory(num_recordings *
sizeof(U32BIT));
1062 if (*handle_array != NULL)
1064 for (index = 0, rec_ptr = rec_list; rec_ptr != NULL; index++, rec_ptr = rec_ptr->next)
1066 (*handle_array)[index] = rec_ptr->handle;
1080 return(num_recordings);
1091 if (handle_array != NULL)
1114 if (initialised_flag)
1118 for (rec_ptr = rec_list; !found && (rec_ptr != NULL); rec_ptr = rec_ptr->next)
1122 *handle = rec_ptr->handle;
1147 U8BIT end_hour, end_min, end_secs;
1148 U16BIT earliest_date;
1149 U8BIT earliest_hour, earliest_min;
1156 if (initialised_flag)
1160 curr_rec = GetRecording(curr_handle);
1165 curr_rec->rec_info.rec_min, curr_rec->rec_info.rec_sec, curr_rec->rec_info.len_hour,
1166 curr_rec->rec_info.len_min, curr_rec->rec_info.len_sec, &end_date, &end_hour, &end_min,
1167 &end_secs, CALC_ADD);
1170 for (rec_ptr = rec_list; !found && (rec_ptr != NULL); rec_ptr = rec_ptr->next)
1172 if (rec_ptr->handle != curr_handle)
1177 rec_ptr->rec_info.rec_hour, rec_ptr->rec_info.rec_min, 0, COMP_2GE1))
1185 rec_ptr->rec_info.rec_date, rec_ptr->rec_info.rec_hour,
1186 rec_ptr->rec_info.rec_min, 0, COMP_2LT1))
1189 earliest_date = rec_ptr->rec_info.rec_date;
1190 earliest_hour = rec_ptr->rec_info.rec_hour;
1191 earliest_min = rec_ptr->rec_info.rec_min;
1192 *next_handle = rec_ptr->handle;
1198 earliest_date = rec_ptr->rec_info.rec_date;
1199 earliest_hour = rec_ptr->rec_info.rec_hour;
1200 earliest_min = rec_ptr->rec_info.rec_min;
1201 *next_handle = rec_ptr->handle;
1231 BOOLEAN STB_PVRImportRecording(
void)
1233 BOOLEAN ret_val = FALSE;
1234 E_STB_DMX_DEMUX_SOURCE dmx_source;
1237 BOOLEAN ts, video, audio;
1239 FUNCTION_START(STB_PVRImportRecording);
1241 STB_PVR_PRINT((
"STB_PVRImportRecording"));
1243 if (initialised_flag == TRUE)
1247 handle = STB_PVRGrabHandle(
"import");
1248 ts = STB_PVRTestDataImporter(0, handle, STREAM_TRANS);
1249 video = STB_PVRTestDataImporter(0, handle, STREAM_VIDEO);
1250 audio = STB_PVRTestDataImporter(0, handle, STREAM_AUDIO);
1252 if ((ts == TRUE) || (video == TRUE) || (audio == TRUE))
1256 STB_PVR_PRINT((
"PVR - Start TS Import"));
1268 STB_PVR_PRINT((
"PVR - Start PES Import"));
1278 while ((video == TRUE) || (audio == TRUE));
1287 STB_PVR_PRINT((
"PVR - Finished Import"));
1294 STB_PVRReleaseHandle(handle);
1295 STB_PVR_PRINT((
"PVR - No Import"));
1299 FUNCTION_FINISH(STB_PVRImportRecording);
1318 BOOLEAN STB_PVRExportRecording(U32BIT handle)
1320 BOOLEAN ret_val = FALSE;
1321 USE_UNWANTED_PARAM(handle);
1322 BOOLEAN video, audio;
1324 FUNCTION_START(STB_PVRExportRecording);
1326 STB_PVR_PRINT((
"STB_PVRExportRecording(%lx)", handle));
1328 if (initialised_flag == TRUE)
1332 STB_PVR_PRINT((
"PVR - Start Export"));
1341 while ((video == TRUE) || (audio == TRUE));
1343 STB_PVR_PRINT((
"PVR - Finished Export"));
1350 FUNCTION_FINISH(STB_PVRExportRecording);
1371 for (i = 0; (i < num_paths) && (handle == 0); i++)
1373 if (record_status[i].rec_index == rec_index)
1375 handle = record_status[i].handle;
1396 path = INVALID_RES_ID;
1398 for (i = 0; (i < num_paths) && (path == INVALID_RES_ID); i++)
1400 if (record_status[i].rec_index == rec_index)
1423 if (initialised_flag)
1428 rec_ptr = GetRecording(handle);
1429 if (rec_ptr != NULL)
1431 if (strlen((
char *)rec_ptr->basename) > 0)
1436 if (num_bytes <=
sizeof(rec_ptr->rec_info.name))
1438 memcpy(rec_ptr->rec_info.name, name, num_bytes);
1442 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
1466 if (initialised_flag)
1471 rec_ptr = GetRecording(handle);
1472 if (rec_ptr != NULL)
1474 name_ptr = &rec_ptr->rec_info.name[0];
1503 if (initialised_flag)
1508 rec_ptr = GetRecording(handle);
1509 if (rec_ptr != NULL)
1511 *date = rec_ptr->rec_info.rec_date;
1512 *hours = rec_ptr->rec_info.rec_hour;
1513 *mins = rec_ptr->rec_info.rec_min;
1514 *secs = rec_ptr->rec_info.rec_sec;
1536 U8BIT *length_secs, U32BIT *rec_size_kb)
1546 if (initialised_flag)
1550 rec_ptr = GetRecording(handle);
1551 if (rec_ptr != NULL)
1553 if (rec_ptr->recording)
1556 rec_time = GetCurrentRecordTime(handle);
1557 *length_hours = rec_time / 3600;
1558 *length_mins = (rec_time % 3600) / 60;
1559 *length_secs = (rec_time % 3600) % 60;
1564 *length_hours = rec_ptr->rec_info.len_hour;
1565 *length_mins = rec_ptr->rec_info.len_min;
1566 *length_secs = rec_ptr->rec_info.len_sec;
1600 disk_id = INVALID_DISK_ID;
1602 if (initialised_flag)
1607 rec_ptr = GetRecording(handle);
1608 if (rec_ptr != NULL)
1610 disk_id = rec_ptr->disk_id;
1633 if (initialised_flag)
1638 rec_ptr = GetRecording(handle);
1639 if (rec_ptr != NULL)
1645 if (name_len <=
sizeof(rec_ptr->rec_info.other_crid))
1647 memcpy(rec_ptr->rec_info.other_crid, crid, name_len);
1651 rec_ptr->rec_info.other_crid[0] =
'\0';
1656 rec_ptr->rec_info.other_crid[0] =
'\0';
1659 if (strlen((
char *)rec_ptr->basename) > 0)
1661 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
1687 if (initialised_flag)
1692 rec_ptr = GetRecording(handle);
1693 if (rec_ptr != NULL)
1697 if ((len > 0) && (len < name_len))
1699 memcpy(crid, rec_ptr->rec_info.other_crid, len);
1728 if (initialised_flag)
1733 rec_ptr = GetRecording(handle);
1734 if (rec_ptr != NULL)
1736 if (strlen((
char *)rec_ptr->basename) > 0)
1740 if (num_bytes <= STB_PVR_ADDITIONAL_INFO_LEN)
1742 memcpy(rec_ptr->rec_info.additional_info, additional_info, num_bytes);
1746 memcpy(rec_ptr->rec_info.additional_info, additional_info, STB_PVR_ADDITIONAL_INFO_LEN);
1750 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
1774 if (initialised_flag)
1779 rec_ptr = GetRecording(handle);
1780 if (rec_ptr != NULL)
1782 name_ptr = &rec_ptr->rec_info.additional_info[0];
1802 FUNCTION_START(STB_PVRRecordingSetParentalRating);
1804 if (initialised_flag)
1809 rec_ptr = GetRecording(handle);
1810 if (rec_ptr != NULL)
1812 rec_ptr->rec_info.parental_rating = parental_rating;
1815 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
1821 FUNCTION_FINISH(STB_PVRRecordingSetParentalRating);
1833 U32BIT parental_rating = 0;
1837 if (initialised_flag)
1842 rec_ptr = GetRecording(handle);
1843 if (rec_ptr != NULL)
1845 parental_rating = rec_ptr->rec_info.parental_rating;
1853 return parental_rating;
1867 if (initialised_flag)
1872 rec_ptr = GetRecording(handle);
1873 if (rec_ptr != NULL)
1875 rec_ptr->rec_info.start_padding = start_padding;
1878 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
1896 S32BIT start_padding = 0;
1900 if (initialised_flag)
1905 rec_ptr = GetRecording(handle);
1906 if (rec_ptr != NULL)
1908 start_padding = rec_ptr->rec_info.start_padding;
1916 return start_padding;
1930 if (initialised_flag)
1935 rec_ptr = GetRecording(handle);
1936 if (rec_ptr != NULL)
1938 rec_ptr->rec_info.end_padding = end_padding;
1941 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
1959 S32BIT end_padding = 0;
1963 if (initialised_flag)
1968 rec_ptr = GetRecording(handle);
1969 if (rec_ptr != NULL)
1971 end_padding = rec_ptr->rec_info.end_padding;
1994 if (initialised_flag)
1999 rec_ptr = GetRecording(handle);
2000 if ((rec_ptr != NULL) && (service_name != NULL))
2002 if (strlen((
char *)rec_ptr->basename) > 0)
2007 WriteExtendedInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_SERVICE_NAME,
2008 name_len, service_name);
2034 if (initialised_flag)
2039 rec_ptr = GetRecording(handle);
2040 if (rec_ptr != NULL)
2042 result = ReadExtendedInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_SERVICE_NAME,
2043 service_name, name_len);
2066 if (initialised_flag)
2071 rec_ptr = GetRecording(handle);
2072 if ((rec_ptr != NULL) && (description != NULL))
2074 if (strlen((
char *)rec_ptr->basename) > 0)
2079 WriteExtendedInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_SHORT_DESC,
2080 desc_len, description);
2106 if (initialised_flag)
2111 rec_ptr = GetRecording(handle);
2112 if (rec_ptr != NULL)
2114 result = ReadExtendedInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_SHORT_DESC,
2115 description, desc_len);
2140 if (initialised_flag)
2145 rec_ptr = GetRecording(handle);
2146 if (rec_ptr != NULL)
2148 length = GetExtendedInfoSize(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_SHORT_DESC);
2156 return((U16BIT)length);
2171 if (initialised_flag)
2176 rec_ptr = GetRecording(handle);
2177 if ((rec_ptr != NULL) && (description != NULL))
2179 if (strlen((
char *)rec_ptr->basename) > 0)
2184 WriteExtendedInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_EXTENDED_DESC,
2185 desc_len, description);
2211 if (initialised_flag)
2216 rec_ptr = GetRecording(handle);
2217 if (rec_ptr != NULL)
2219 result = ReadExtendedInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_EXTENDED_DESC,
2220 description, desc_len);
2245 if (initialised_flag)
2250 rec_ptr = GetRecording(handle);
2251 if (rec_ptr != NULL)
2253 length = GetExtendedInfoSize(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_EXTENDED_DESC);
2261 return((U16BIT)length);
2276 if (initialised_flag)
2281 rec_ptr = GetRecording(handle);
2282 if (rec_ptr != NULL)
2288 if (name_len <=
sizeof(rec_ptr->rec_info.prog_crid))
2290 memcpy(rec_ptr->rec_info.prog_crid, crid, name_len);
2294 rec_ptr->rec_info.prog_crid[0] =
'\0';
2299 rec_ptr->rec_info.prog_crid[0] =
'\0';
2302 if (strlen((
char *)rec_ptr->basename) > 0)
2304 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
2330 if (initialised_flag)
2335 rec_ptr = GetRecording(handle);
2336 if (rec_ptr != NULL)
2340 if ((len > 0) && (len < name_len))
2342 memcpy(crid, rec_ptr->rec_info.prog_crid, len);
2367 BOOLEAN is_recording;
2371 is_recording = FALSE;
2373 if (initialised_flag)
2377 rec_ptr = GetRecording(handle);
2378 if (rec_ptr != NULL)
2380 is_recording = rec_ptr->recording;
2388 return(is_recording);
2402 if (initialised_flag)
2406 rec_ptr = GetRecording(handle);
2407 if (rec_ptr != NULL)
2409 rec_ptr->rec_info.flags |= REC_SERIES;
2411 if (strlen((
char *)rec_ptr->basename) > 0)
2413 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
2434 if (initialised_flag)
2438 rec_ptr = GetRecording(handle);
2439 if (rec_ptr != NULL)
2441 rec_ptr->rec_info.flags |= REC_RECOMMENDATION;
2443 if (strlen((
char *)rec_ptr->basename) > 0)
2445 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
2469 if (initialised_flag)
2473 rec_ptr = GetRecording(handle);
2474 if (rec_ptr != NULL)
2476 if ((rec_ptr->rec_info.flags & REC_SERIES) != 0)
2498 BOOLEAN recommendation;
2502 recommendation = FALSE;
2504 if (initialised_flag)
2508 rec_ptr = GetRecording(handle);
2509 if (rec_ptr != NULL)
2511 if ((rec_ptr->rec_info.flags & REC_RECOMMENDATION) != 0)
2513 recommendation = TRUE;
2522 return(recommendation);
2540 if (initialised_flag)
2544 rec_ptr = GetRecording(handle);
2545 if (rec_ptr != NULL)
2549 rec_ptr->rec_info.flags |= REC_LOCKED;
2553 rec_ptr->rec_info.flags &= ~REC_LOCKED;
2556 if (strlen((
char *)rec_ptr->basename) > 0)
2558 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
2586 if (initialised_flag)
2590 rec_ptr = GetRecording(handle);
2591 if (rec_ptr != NULL)
2593 if ((rec_ptr->rec_info.flags & REC_LOCKED) != 0)
2622 if (initialised_flag)
2626 rec_ptr = GetRecording(handle);
2627 if (rec_ptr != NULL)
2629 rec_ptr->selected = state;
2655 if (initialised_flag)
2659 rec_ptr = GetRecording(handle);
2660 if (rec_ptr != NULL)
2662 selected = rec_ptr->selected;
2687 if (initialised_flag)
2691 rec_ptr = GetRecording(handle);
2692 if (rec_ptr != NULL)
2694 if ((rec_ptr->rec_info.flags & REC_ENCRYPTED) != 0)
2723 if (initialised_flag)
2727 rec_ptr = GetRecording(handle);
2728 if (rec_ptr != NULL)
2732 rec_ptr->rec_info.flags |= REC_PARENTAL_LOCK;
2736 rec_ptr->rec_info.flags &= ~REC_PARENTAL_LOCK;
2739 if (strlen((
char *)rec_ptr->basename) > 0)
2741 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
2769 if (initialised_flag)
2773 rec_ptr = GetRecording(handle);
2774 if (rec_ptr != NULL)
2776 if ((rec_ptr->rec_info.flags & REC_PARENTAL_LOCK) != 0)
2806 if (initialised_flag)
2810 rec_ptr = GetRecording(handle);
2811 if ((rec_ptr != NULL) && (text != NULL))
2813 if (strlen((
char *)rec_ptr->basename) > 0)
2818 if (WriteExtendedInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_GUIDANCE,
2821 rec_ptr->rec_info.flags |= REC_HAS_GUIDANCE;
2822 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
2844 BOOLEAN has_guidance;
2848 has_guidance = FALSE;
2850 if (initialised_flag)
2854 rec_ptr = GetRecording(handle);
2855 if (rec_ptr != NULL)
2857 if ((rec_ptr->rec_info.flags & REC_HAS_GUIDANCE) != 0)
2859 has_guidance = TRUE;
2868 return(has_guidance);
2887 if (initialised_flag)
2891 rec_ptr = GetRecording(handle);
2892 if (rec_ptr != NULL)
2895 if ((rec_ptr->rec_info.flags & REC_HAS_GUIDANCE) != 0)
2897 result = ReadExtendedInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_GUIDANCE,
2924 if (initialised_flag)
2929 rec_ptr = GetRecording(handle);
2930 if (rec_ptr != NULL)
2933 if ((rec_ptr->rec_info.flags & REC_HAS_GUIDANCE) != 0)
2935 length = GetExtendedInfoSize(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_GUIDANCE);
2944 return((U16BIT)length);
2962 if (initialised_flag)
2966 rec_ptr = GetRecording(handle);
2967 if (rec_ptr != NULL)
2969 rec_ptr->rec_info.status = (U8BIT)status;
2971 retval = WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
2997 if (initialised_flag && (status != NULL))
3002 rec_ptr = GetRecording(handle);
3003 if (rec_ptr != NULL)
3005 *status = (E_PVR_RECORDING_STATUS)rec_ptr->rec_info.status;
3017 #ifdef COMMON_INTERFACE 3025 BOOLEAN STB_PVRRecordingSetCicamId(U32BIT handle, U8BIT *cicam_id, U8BIT id_len)
3030 FUNCTION_START(STB_PVRRecordingSetCicamId);
3034 if (initialised_flag)
3039 rec_ptr = GetRecording(handle);
3040 if (rec_ptr != NULL)
3042 if (strlen((
char *)rec_ptr->basename) > 0)
3044 retval = WriteExtendedInfo(rec_ptr->disk_id, rec_ptr->basename,
3045 EXT_INFO_CIPLUS_CICAM_ID, id_len, cicam_id);
3052 FUNCTION_FINISH(STB_PVRRecordingSetCicamId);
3064 BOOLEAN STB_PVRRecordingGetCicamId(U32BIT handle, U8BIT *cicam_id, U8BIT id_len)
3069 FUNCTION_START(STB_PVRRecordingGetCicamId);
3073 if (initialised_flag)
3078 rec_ptr = GetRecording(handle);
3079 if (rec_ptr != NULL)
3081 retval = ReadExtendedInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_CIPLUS_CICAM_ID,
3088 FUNCTION_FINISH(STB_PVRRecordingGetCicamId);
3099 BOOLEAN STB_PVRRecordingAddURI(U32BIT handle, U8BIT *uri)
3105 S_REC_CIPLUS_ITEM *item;
3106 S_REC_CIPLUS_ITEM *list_item;
3107 U8BIT audio_decoder;
3108 U8BIT video_decoder;
3111 FUNCTION_START(STB_PVRRecordingAddURI);
3115 if (initialised_flag)
3120 rec_ptr = GetRecording(handle);
3121 if (rec_ptr != NULL)
3123 if (strlen((
char *)rec_ptr->basename) > 0)
3125 timestamp = GetCurrentRecordTime(handle);
3126 retval = WriteCIPlusInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_CIPLUS_URI,
3127 timestamp, CIP_URI_LEN, uri);
3129 DBG_CIP(
"(0x%08lx): Added URI @ %lu secs", handle, timestamp)
3134 for (play_path = 0; play_path < num_paths; play_path++)
3136 if (play_status[play_path].handle == handle)
3141 if ((item = (S_REC_CIPLUS_ITEM *)
STB_GetMemory(
sizeof(S_REC_CIPLUS_ITEM))) != NULL)
3143 memset(item, 0,
sizeof(S_REC_CIPLUS_ITEM));
3145 item->item_type = EXT_INFO_CIPLUS_URI;
3146 item->timestamp = timestamp;
3147 memcpy(item->u.uri, uri, CIP_URI_LEN);
3149 if (play_status[play_path].item_list == NULL)
3152 play_status[play_path].item_list = item;
3157 for (list_item = play_status[play_path].item_list; list_item->next != NULL;
3158 list_item = list_item->next)
3161 list_item->next = item;
3162 item->prev = list_item;
3171 FindNextCIPlusItem(play_path, speed);
3184 FUNCTION_FINISH(STB_PVRRecordingAddURI);
3195 BOOLEAN STB_PVRRecordingUpdateURI(U32BIT handle, U8BIT *uri)
3201 FUNCTION_START(STB_PVRRecordingUpdateURI);
3205 if (initialised_flag)
3210 rec_ptr = GetRecording(handle);
3211 if (rec_ptr != NULL)
3213 if (strlen((
char *)rec_ptr->basename) > 0)
3216 for (path = 0; (path < num_paths) && (play_status[path].handle != handle); path++)
3219 if (path < num_paths)
3222 if (play_status[path].uri_item != NULL)
3225 memcpy(play_status[path].uri_item->u.uri, uri, CIP_URI_LEN);
3227 retval = UpdateCIPlusInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_CIPLUS_URI,
3228 play_status[path].uri_item->timestamp, CIP_URI_LEN, uri);
3230 DBG_CIP(
"(0x%08lx): Updated URI @ %lu secs", handle,
3231 play_status[path].uri_item->timestamp)
3245 FUNCTION_FINISH(STB_PVRRecordingUpdateURI);
3257 BOOLEAN STB_PVRRecordingAddLicence(U32BIT handle, U8BIT *licence, U16BIT licence_len)
3263 S_REC_CIPLUS_ITEM *item;
3264 S_REC_CIPLUS_ITEM *list_item;
3265 U8BIT audio_decoder;
3266 U8BIT video_decoder;
3269 FUNCTION_START(STB_PVRRecordingAddLicence);
3273 if (initialised_flag)
3277 rec_ptr = GetRecording(handle);
3278 if ((rec_ptr != NULL) && (licence != NULL) && (licence_len > 0))
3280 if (strlen((
char *)rec_ptr->basename) > 0)
3282 timestamp = GetCurrentRecordTime(handle);
3284 retval = WriteCIPlusInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_CIPLUS_LICENCE,
3285 timestamp, licence_len, licence);
3287 DBG_CIP(
"(0x%08lx): Added licence, len %u, @ %lu secs", handle,
3288 licence_len, timestamp)
3293 for (play_path = 0; play_path < num_paths; play_path++)
3295 if (play_status[play_path].handle == handle)
3300 if ((item = (S_REC_CIPLUS_ITEM *)
STB_GetMemory(
sizeof(S_REC_CIPLUS_ITEM))) != NULL)
3302 memset(item, 0,
sizeof(S_REC_CIPLUS_ITEM));
3304 item->item_type = EXT_INFO_CIPLUS_LICENCE;
3305 item->timestamp = timestamp;
3306 item->u.licence.used = FALSE;
3308 if ((item->u.licence.data =
STB_GetMemory(licence_len)) != NULL)
3310 memcpy(item->u.licence.data, licence, licence_len);
3311 item->u.licence.length = licence_len;
3314 if (play_status[play_path].item_list == NULL)
3317 play_status[play_path].item_list = item;
3322 for (list_item = play_status[play_path].item_list; list_item->next != NULL;
3323 list_item = list_item->next)
3326 list_item->next = item;
3327 item->prev = list_item;
3336 FindNextCIPlusItem(play_path, speed);
3349 FUNCTION_FINISH(STB_PVRRecordingAddLicence);
3361 BOOLEAN STB_PVRRecordingUpdateLicence(U32BIT handle, U8BIT *licence, U16BIT licence_len)
3367 FUNCTION_START(STB_PVRRecordingUpdateLicence);
3371 if (initialised_flag)
3376 rec_ptr = GetRecording(handle);
3377 if (rec_ptr != NULL)
3379 if (strlen((
char *)rec_ptr->basename) > 0)
3382 for (path = 0; (path < num_paths) && (play_status[path].handle != handle); path++)
3385 if (path < num_paths)
3388 if (play_status[path].licence_item != NULL)
3392 memcpy(play_status[path].licence_item->u.licence.data, licence, licence_len);
3394 retval = UpdateCIPlusInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_CIPLUS_LICENCE,
3395 play_status[path].licence_item->timestamp, licence_len, licence);
3397 DBG_CIP(
"(0x%08lx): Updated licence @ %lu secs", handle,
3398 play_status[path].licence_item->timestamp)
3407 FUNCTION_FINISH(STB_PVRRecordingUpdateLicence);
3423 BOOLEAN STB_PVRRecordingAddPin(U32BIT handle, U8BIT age_rating, U8BIT *private_data,
3424 U16BIT date_code, U8BIT hour, U8BIT min, U8BIT secs)
3428 S_REC_CIPLUS_PIN pin_item;
3431 U8BIT gmt_hour, gmt_min, gmt_secs;
3434 S_REC_CIPLUS_ITEM *item;
3435 S_REC_CIPLUS_ITEM *list_item;
3436 U8BIT audio_decoder;
3437 U8BIT video_decoder;
3440 FUNCTION_START(STB_PVRRecordingAddPin);
3444 if (initialised_flag)
3448 rec_ptr = GetRecording(handle);
3449 if (rec_ptr != NULL)
3451 if (strlen((
char *)rec_ptr->basename) > 0)
3453 pin_item.age_rating = age_rating;
3454 memcpy(pin_item.private_data, private_data, CIP_PIN_PRIVATE_DATA_SIZE);
3458 timestamp = GetCurrentRecordTime(handle);
3464 gmt_date, gmt_hour, gmt_min, gmt_secs)) < 0)
3466 if ((U32BIT)-time_diff > timestamp)
3470 time_diff = -(S32BIT)timestamp;
3474 timestamp = (S32BIT)timestamp + time_diff;
3477 retval = WriteCIPlusInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_CIPLUS_PIN,
3478 timestamp,
sizeof(pin_item), (U8BIT *)&pin_item);
3480 DBG_CIP(
"(0x%08lx): Added pin rating %u, @ %lu secs", handle,
3481 age_rating, timestamp)
3486 for (play_path = 0; play_path < num_paths; play_path++)
3488 if (play_status[play_path].handle == handle)
3493 if ((item = (S_REC_CIPLUS_ITEM *)
STB_GetMemory(
sizeof(S_REC_CIPLUS_ITEM))) != NULL)
3495 memset(item, 0,
sizeof(S_REC_CIPLUS_ITEM));
3497 item->item_type = EXT_INFO_CIPLUS_PIN;
3498 item->timestamp = timestamp;
3499 item->u.pin.age_rating = age_rating;
3500 memcpy(item->u.pin.private_data, private_data, CIP_PIN_PRIVATE_DATA_SIZE);
3502 if (play_status[play_path].item_list == NULL)
3505 play_status[play_path].item_list = item;
3510 for (list_item = play_status[play_path].item_list; list_item->next != NULL;
3511 list_item = list_item->next)
3514 list_item->next = item;
3515 item->prev = list_item;
3524 FindNextCIPlusItem(play_path, speed);
3537 FUNCTION_FINISH(STB_PVRRecordingAddPin);
3558 if (initialised_flag)
3562 for (rec_ptr = rec_list; rec_ptr != NULL; rec_ptr = rec_ptr->next)
3565 if (rec_ptr->disk_id == disk_id)
3567 if (rec_ptr->recording)
3570 retval += ((GetCurrentRecordTime(rec_ptr->handle) + 29) / 60);
3574 retval += (rec_ptr->rec_info.len_hour * 60) + rec_ptr->rec_info.len_min;
3602 if (initialised_flag)
3606 for (rec_ptr = rec_list; rec_ptr != NULL; rec_ptr = rec_ptr->next)
3609 if (rec_ptr->disk_id == disk_id)
3613 total_size += rec_size;
3641 U8BIT audio_decoder, video_decoder;
3643 CREATE_LINK_LIST_HEADER(bookmarks);
3644 U32BIT position_in_seconds;
3645 BOOLEAN start_playback;
3646 #ifdef COMMON_INTERFACE 3655 STB_PVR_PRINT((
"PVR - StartPlaying(%d): handle=0x%lx", path, handle));
3657 if (initialised_flag)
3661 rec_ptr = GetRecording(handle);
3662 if (rec_ptr != NULL)
3667 if (strlen((
char *)rec_ptr->basename) > 0)
3669 start_playback = TRUE;
3671 #ifdef COMMON_INTERFACE 3672 if (ReadExtendedInfo(rec_ptr->disk_id, rec_ptr->basename, EXT_INFO_CIPLUS_CICAM_ID,
3673 cicam_id,
sizeof(cicam_id)))
3681 ReadCIPlusItems(path, rec_ptr);
3687 start_playback = FALSE;
3694 play_status[path].handle = handle;
3695 position_in_seconds = 0;
3700 if (GetBookmarks(rec_ptr->disk_id, rec_ptr->basename, &bookmarks,
3701 BOOKMARK_PLAYBACK_POSITION, FALSE) > 0)
3706 position_in_seconds = b->time;
3708 EmptyBookmarks(&bookmarks, TRUE);
3710 STB_PVR_PRINT((
"PVR - StartPlaying(%d): resuming from %d seconds", path, position_in_seconds));
3713 if ((rec_ptr->rec_info.flags & REC_ENCRYPTED) != 0)
3716 if ((enc_dec_key != NULL) && (enc_dec_iv != NULL))
3719 enc_dec_iv, enc_dec_key_len);
3724 STB_PVR_PRINT((
"STB_PVRStartPlaying(%u 0x%08lx): Playback failed, encryption key not available",
3734 #ifdef COMMON_INTERFACE 3735 if ((play_status[path].slot_id != INVALID_RES_ID) && (play_status[path].item_list != NULL))
3740 ApplyCIPlusItems(path, rec_ptr, position_in_seconds, 100);
3743 FindNextCIPlusItem(path, 100);
3749 if ((rec_ptr->rec_info.flags & REC_HAS_VIDEO) != 0)
3798 *handle = play_status[path].handle;
3815 U8BIT audio_decoder;
3816 U8BIT video_decoder;
3818 CREATE_LINK_LIST_HEADER(bookmarks);
3819 U8BIT hours, mins, secs;
3820 U32BIT position_in_seconds;
3825 if ((path < num_paths) && (play_status[path].handle != 0))
3829 rec_ptr = GetRecording(play_status[path].handle);
3830 if ((rec_ptr != NULL) && (strlen((
char *)rec_ptr->basename) > 0))
3833 if (GetBookmarks(rec_ptr->disk_id, rec_ptr->basename, &bookmarks,
3834 BOOKMARK_PLAYBACK_POSITION, FALSE) > 0)
3839 position_in_seconds = b->time;
3842 STB_PVR_PRINT((
"PVR - STB_PVRSavePlayPosition(%d): removing bookmark at %d seconds",
3843 path, position_in_seconds));
3845 RemoveBookmark(rec_ptr->disk_id, rec_ptr->basename, position_in_seconds, NULL,
3846 BOOKMARK_PLAYBACK_POSITION);
3848 EmptyBookmarks(&bookmarks, TRUE);
3858 position_in_seconds = (hours * 3600) + (mins * 60) + secs;
3862 STB_PVR_PRINT((
"PVR - STB_PVRSavePlayPosition(%d): failed retrieving elapsed time", path));
3863 position_in_seconds = 0;
3866 STB_PVR_PRINT((
"PVR - STB_PVRSavePlayPosition(%d): adding bookmark at %d seconds", path,
3867 position_in_seconds));
3869 AddBookmark(rec_ptr->disk_id, rec_ptr->basename, position_in_seconds, NULL,
3870 BOOKMARK_PLAYBACK_POSITION);
3887 CREATE_LINK_LIST_HEADER(bookmarks);
3897 rec_ptr = GetRecording(handle);
3898 if ((rec_ptr != NULL) && (strlen((
char *)rec_ptr->basename) > 0))
3901 if (GetBookmarks(rec_ptr->disk_id, rec_ptr->basename, &bookmarks,
3902 BOOKMARK_PLAYBACK_POSITION, FALSE) > 0)
3909 EmptyBookmarks(&bookmarks, TRUE);
3933 U8BIT audio_decoder;
3934 U8BIT video_decoder;
3939 STB_PVR_PRINT((
"PVR - StopPlaying (%d)", path));
3941 if ((path < num_paths) && (play_status[path].handle != 0))
3948 rec_ptr = GetRecording(play_status[path].handle);
3949 if ((rec_ptr != NULL) && (strlen((
char *)rec_ptr->basename) > 0))
3951 #ifdef COMMON_INTERFACE 3953 FreeCIPlusItemList(path);
3961 play_status[path].handle = 0;
3980 FUNCTION_START(STB_PVRGetTriplet);
3984 rec_ptr = GetRecording(handle);
3985 if (rec_ptr != NULL)
3987 *serv_id = rec_ptr->rec_info.serv_id;
3988 *ts_id = rec_ptr->rec_info.ts_id;
3989 *orig_net_id = rec_ptr->rec_info.orig_net_id;
3992 FUNCTION_FINISH(STB_PVRGetTriplet);
4012 STB_PVR_PRINT((
"STB_PVRStartPlayRunning(%d)", path));
4034 STB_PVR_PRINT((
"STB_PVRStartPlayPaused(%d)", path));
4056 STB_PVR_PRINT((
"STB_PVRStartPlaySync(%d)", path));
4083 if (initialised_flag)
4087 rec_ptr = GetRecording(handle);
4088 if (rec_ptr != NULL)
4090 if ((rec_ptr->rec_info.flags & REC_HAS_VIDEO) != 0)
4117 BOOLEAN video, audio;
4148 if (path < num_paths)
4150 if (record_status[path].rec_pids_array != NULL)
4153 record_status[path].rec_pids_array = NULL;
4154 record_status[path].num_pids = 0;
4157 if ((num_pids > 0) && (pid_array != NULL))
4160 if (record_status[path].rec_pids_array != NULL)
4162 memcpy(record_status[path].rec_pids_array, pid_array, num_pids *
sizeof(
S_PVR_PID_INFO));
4163 record_status[path].num_pids = num_pids;
4191 if (initialised_flag)
4195 rec_ptr = GetRecording(record_status[path].handle);
4196 if (rec_ptr != NULL)
4202 record_status[path].rec_pids_array);
4230 if (path < num_paths)
4232 record_status[path].serv_id = serv_id;
4233 record_status[path].ts_id = ts_id;
4234 record_status[path].orig_net_id = orig_net_id;
4253 CREATE_LINK_LIST_HEADER(bookmarks);
4254 U8BIT audio_decoder;
4255 U8BIT video_decoder;
4256 U8BIT hours, mins, secs;
4257 U32BIT position_in_seconds;
4265 if ((path < num_paths) && (play_status[path].handle != 0))
4272 rec_ptr = GetRecording(play_status[path].handle);
4273 if ((rec_ptr != NULL) && (strlen((
char *)rec_ptr->basename) > 0))
4276 GetBookmarks(rec_ptr->disk_id, rec_ptr->basename, &bookmarks,
4277 BOOKMARK_USER, FALSE);
4282 position_in_seconds = (hours * 3600) + (mins * 60) + secs;
4289 if ((position_in_seconds <= BOOKMARK_TOLERANCE) &&
4290 (b->time <= BOOKMARK_TOLERANCE))
4294 else if ((position_in_seconds >= b->time - BOOKMARK_TOLERANCE) &&
4295 (position_in_seconds <= b->time + BOOKMARK_TOLERANCE))
4306 RemoveBookmark(rec_ptr->disk_id, rec_ptr->basename, b->time, NULL,
4312 AddBookmark(rec_ptr->disk_id, rec_ptr->basename, position_in_seconds, NULL,
4317 EmptyBookmarks(&bookmarks, TRUE);
4336 CREATE_LINK_LIST_HEADER(bookmarks);
4337 U32BIT num_bookmarks;
4338 U8BIT audio_decoder;
4339 U8BIT video_decoder;
4340 U8BIT hours, mins, secs;
4341 U32BIT position_in_seconds;
4349 if ((path < num_paths) && (play_status[path].handle != 0))
4356 rec_ptr = GetRecording(play_status[path].handle);
4357 if ((rec_ptr != NULL) && (strlen((
char *)rec_ptr->basename) > 0))
4360 num_bookmarks = GetBookmarks(rec_ptr->disk_id, rec_ptr->basename, &bookmarks,
4361 BOOKMARK_USER, FALSE);
4363 if (num_bookmarks > 0)
4370 position_in_seconds = (hours * 3600) + (mins * 60) + secs;
4375 if (b->time > position_in_seconds)
4389 EmptyBookmarks(&bookmarks, TRUE);
4409 U16BIT num_bookmarks;
4415 if (path < num_paths)
4422 return(num_bookmarks);
4434 CREATE_LINK_LIST_HEADER(bookmark_list);
4435 U32BIT num_bookmarks;
4444 if (bookmarks != NULL)
4449 if (initialised_flag && (handle != 0))
4453 rec_ptr = GetRecording(handle);
4454 if ((rec_ptr != NULL) && (strlen((
char *)rec_ptr->basename) > 0))
4457 num_bookmarks = GetBookmarks(rec_ptr->disk_id, rec_ptr->basename, &bookmark_list,
4458 BOOKMARK_USER, TRUE);
4459 if ((num_bookmarks > 0) && (bookmarks != NULL))
4462 if (*bookmarks != NULL)
4468 (*bookmarks)[i] = b;
4479 EmptyBookmarks(&bookmark_list, FALSE);
4487 return(num_bookmarks);
4502 if (bookmarks != NULL)
4504 for (i = 0; i < num; i++)
4507 if (b->name != NULL)
4531 time = ((
S_BOOKMARK *)bookmark_handle)->time;
4553 len = strlen((
char *)n);
4554 if (len >= STB_PVR_NAME_LEN)
4556 len = STB_PVR_NAME_LEN - 1;
4562 memcpy(name, n, len);
4584 #ifdef COMMON_INTERFACE 4586 U8BIT audio_decoder;
4587 U8BIT video_decoder;
4588 U8BIT hours, mins, secs;
4589 U32BIT position_in_seconds;
4595 #ifdef COMMON_INTERFACE 4596 if ((path < num_paths) && (play_status[path].handle != 0))
4598 if ((play_status[path].slot_id != INVALID_RES_ID) && (play_status[path].item_list != NULL))
4602 if ((rec_ptr = GetRecording(play_status[path].handle)) != NULL)
4609 position_in_seconds = (hours * 3600) + (mins * 60) + secs;
4613 ApplyCIPlusItems(path, rec_ptr, position_in_seconds, speed);
4616 FindNextCIPlusItem(path, speed);
4624 USE_UNWANTED_PARAM(path);
4645 BOOLEAN start_recording;
4652 ASSERT(path < num_paths);
4654 if (initialised_flag)
4658 rec_ptr = GetRecording(handle);
4659 if ((rec_ptr != NULL) && (strlen((
char *)rec_ptr->basename) > 0))
4662 rec_ptr->rec_info.serv_id = record_status[path].serv_id;
4663 rec_ptr->rec_info.ts_id = record_status[path].ts_id;
4664 rec_ptr->rec_info.orig_net_id = record_status[path].orig_net_id;
4666 if (record_status[path].encrypted && (enc_dec_key != NULL) && (enc_dec_iv != NULL))
4668 rec_ptr->rec_info.flags |= REC_ENCRYPTED;
4672 rec_ptr->rec_info.flags &= ~REC_ENCRYPTED;
4676 if (IncludesVideoPid(record_status[path].rec_pids_array, record_status[path].num_pids))
4678 rec_ptr->rec_info.flags |= REC_HAS_VIDEO;
4682 rec_ptr->rec_info.flags &= ~REC_HAS_VIDEO;
4685 rec_ptr->rec_info.status = RECORDING_STATUS_STARTED;
4688 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, FALSE, &rec_ptr->rec_info);
4692 start_recording = FALSE;
4694 if (record_status[path].encrypted)
4697 if ((enc_dec_key != NULL) && (enc_dec_iv != NULL))
4700 start_recording = TRUE;
4705 record_status[path].rec_index = INVALID_RES_ID;
4706 STB_PVR_PRINT((
"STB_PVRStartRecording(%u 0x%08lx): Recording failed, encryption key not available",
4713 start_recording = TRUE;
4716 if (start_recording)
4719 record_status[path].timeshift_seconds);
4721 record_status[path].handle = handle;
4723 #ifdef COMMON_INTERFACE 4725 if (record_status[path].keys[KEY_PARITY_EVEN].valid)
4728 KEY_PARITY_EVEN, record_status[path].keys[KEY_PARITY_EVEN].key,
4729 record_status[path].keys[KEY_PARITY_EVEN].iv);
4731 if (record_status[path].keys[KEY_PARITY_ODD].valid)
4734 KEY_PARITY_ODD, record_status[path].keys[KEY_PARITY_ODD].key,
4735 record_status[path].keys[KEY_PARITY_ODD].iv);
4739 if (
STB_PVRRecordStart(rec_ptr->disk_id, record_status[path].rec_index, rec_ptr->basename,
4740 record_status[path].num_pids, record_status[path].rec_pids_array))
4743 record_status[path].paused = FALSE;
4744 record_status[path].duration = 0;
4746 rec_ptr->recording = TRUE;
4751 record_status[path].handle = 0;
4753 record_status[path].rec_index = INVALID_RES_ID;
4754 STB_PVR_PRINT((
"STB_PVRStartRecording(%u, 0x%08lx): Failed to start recording", path, handle));
4760 record_status[path].rec_index = INVALID_RES_ID;
4766 if (rec_ptr == NULL)
4768 STB_PVR_PRINT((
"STB_PVRStartRecording(%u, 0x%08lx): Couldn't find recording to be started", path, handle));
4772 STB_PVR_PRINT((
"STB_PVRStartRecording(%u, 0x%08lx): Basename not set for recording", path, handle));
4796 if (!record_status[path].paused)
4803 record_status[path].paused = TRUE;
4827 if (record_status[path].paused)
4834 record_status[path].paused = FALSE;
4861 U32BIT recording_time;
4862 U8BIT hours, mins, secs;
4866 ASSERT(path < num_paths);
4870 if (initialised_flag)
4874 rec_ptr = GetRecording(record_status[path].handle);
4875 if ((rec_ptr != NULL) && (strlen((
char *)rec_ptr->basename) > 0))
4878 if (record_status[path].paused)
4880 recording_time = record_status[path].duration;
4884 recording_time = record_status[path].duration +
STB_OSGetClockDiff(record_status[path].start_time);
4887 recording_time = (recording_time + 499) / 1000;
4889 hours = recording_time / 3600;
4890 mins = (recording_time / 60) - (hours * 60);
4891 secs = recording_time % 60;
4893 rec_ptr->rec_info.len_hour = hours;
4894 rec_ptr->rec_info.len_min = mins;
4895 rec_ptr->rec_info.len_sec = secs;
4896 rec_ptr->rec_info.status = RECORDING_STATUS_COMPLETED;
4898 rec_ptr->recording = FALSE;
4899 WriteODBFile(rec_ptr->disk_id, rec_ptr->basename, TRUE, &rec_ptr->rec_info);
4902 if (record_status[path].rec_pids_array != NULL)
4905 record_status[path].rec_pids_array = NULL;
4906 record_status[path].num_pids = 0;
4909 record_status[path].handle = 0;
4911 #ifdef COMMON_INTERFACE 4913 record_status[path].keys[KEY_PARITY_EVEN].valid = FALSE;
4914 record_status[path].keys[KEY_PARITY_ODD].valid = FALSE;
4918 record_status[path].rec_index = INVALID_RES_ID;
4945 ASSERT(path < num_paths);
4949 if (initialised_flag)
4953 *handle = record_status[path].handle;
4954 rec_ptr = GetRecording(*handle);
4955 if (rec_ptr != NULL)
4982 ASSERT(path < num_paths);
4984 STB_PVR_PRINT((
"STB_PVRStartRecordRunning(%d)", path));
4986 record_status[path].smode = START_RUNNING;
4987 record_status[path].timeshift_seconds = 0;
5008 ASSERT(path < num_paths);
5010 STB_PVR_PRINT((
"STB_PVRStartRecordPaused(%d)", path));
5012 record_status[path].smode = START_PAUSED;
5013 record_status[path].timeshift_seconds = timeshift_seconds;
5031 BOOLEAN audio, video;
5035 ASSERT(path < num_paths);
5062 BOOLEAN video, audio;
5066 ASSERT(path < num_paths);
5090 record_status[path].encrypted = state;
5095 #ifdef COMMON_INTERFACE 5105 BOOLEAN STB_PVRSetDescramblerKey(U8BIT path, E_STB_DMX_DESC_TYPE desc_type,
5106 E_STB_DMX_DESC_KEY_PARITY parity, U8BIT *key, U8BIT *iv)
5110 FUNCTION_START(STB_PVRSetDescramblerKey);
5114 if (path < num_paths)
5116 if (record_status[path].rec_index != INVALID_RES_ID)
5130 record_status[path].desc_type = desc_type;
5131 memcpy(record_status[path].keys[parity].key, key, 8);
5132 record_status[path].keys[parity].valid = TRUE;
5136 record_status[path].desc_type = desc_type;
5137 memcpy(record_status[path].keys[parity].key, key, 16);
5138 memcpy(record_status[path].keys[parity].iv, iv, 16);
5139 record_status[path].keys[parity].valid = TRUE;
5143 record_status[path].keys[parity].valid = FALSE;
5150 FUNCTION_FINISH(STB_PVRSetDescramblerKey);
5169 void STB_PVRExportFrame(U8BIT path)
5171 FUNCTION_START(STB_PVRExportFrame);
5173 ASSERT(path < num_paths);
5175 STB_PVR_PRINT((
"STB_PVRExportFrame(%d)", path));
5182 FUNCTION_FINISH(STB_PVRExportFrame);
5200 U8BIT audio_decoder, video_decoder;
5205 ASSERT(path < num_paths);
5207 STB_PVR_PRINT((
"STB_PVRPlayNormal(%u)", path));
5215 if (play_speed != 100)
5220 #ifdef COMMON_INTERFACE 5224 FindNextCIPlusItem(path, play_speed);
5246 U8BIT audio_decoder, video_decoder;
5247 BOOLEAN ret_val = FALSE;
5251 ASSERT(path < num_paths);
5282 U8BIT audio_decoder, video_decoder;
5286 ASSERT(path < num_paths);
5288 STB_PVR_PRINT((
"STB_PVRPlayPause(%d)", path));
5314 U8BIT audio_decoder, video_decoder;
5315 BOOLEAN ret_val = FALSE;
5319 ASSERT(path < num_paths);
5350 U8BIT audio_decoder, video_decoder;
5355 ASSERT(path < num_paths);
5357 STB_PVR_PRINT((
"STB_PVRPlayForward(%d)", path));
5366 if (play_speed <= 0)
5368 play_speed = -play_speed;
5370 STB_PVR_PRINT((
"STB_PVRPlayForward(%d): requesting FF play speed %d", path, play_speed));
5374 #ifdef COMMON_INTERFACE 5376 FindNextCIPlusItem(path, play_speed);
5397 U8BIT audio_decoder, video_decoder;
5398 BOOLEAN ret_val = FALSE;
5402 ASSERT(path < num_paths);
5433 U8BIT audio_decoder, video_decoder;
5438 ASSERT(path < num_paths);
5440 STB_PVR_PRINT((
"STB_PVRPlayReverse(%d)", path));
5451 play_speed = -play_speed;
5453 STB_PVR_PRINT((
"STB_PVRPlayReverse(%d): requesting FR play speed %d", path, play_speed));
5457 #ifdef COMMON_INTERFACE 5459 FindNextCIPlusItem(path, play_speed);
5480 U8BIT audio_decoder, video_decoder;
5481 BOOLEAN ret_val = FALSE;
5485 ASSERT(path < num_paths);
5518 ASSERT(path < num_paths);
5520 STB_PVR_PRINT((
"STB_PVRPlayFrameInc(%d)", path));
5546 ASSERT(path < num_paths);
5548 STB_PVR_PRINT((
"STB_PVRPlayFrameDec(%d)", path));
5574 ASSERT(path < num_paths);
5598 ASSERT(path < num_paths);
5615 U8BIT audio_decoder, video_decoder;
5619 ASSERT(path < num_paths);
5621 STB_PVR_PRINT((
"STB_PVRPlaySlower(%d)", path));
5649 BOOLEAN ret_val = FALSE;
5650 U8BIT audio_decoder, video_decoder;
5654 ASSERT(path < num_paths);
5680 U8BIT audio_decoder, video_decoder;
5684 ASSERT(path < num_paths);
5686 STB_PVR_PRINT((
"STB_PVRPlayFaster(%d)", path));
5715 BOOLEAN ret_val = FALSE;
5716 U8BIT audio_decoder, video_decoder;
5720 ASSERT(path < num_paths);
5755 ASSERT(path < num_paths);
5781 ASSERT(path < num_paths);
5809 *hours = (U8BIT)(temp_val / 60);
5810 *mins = (U8BIT)(temp_val % 60);
5830 U32BIT recording_time;
5833 U32BIT space_in_mins;
5841 if ((disk_used == 0) || (recording_time == 0))
5844 kb_per_min = 85 * 1024;
5849 kb_per_min = disk_used / recording_time;
5853 space_in_mins = disk_free / kb_per_min;
5855 *hours = (U8BIT)(space_in_mins / 60);
5856 *mins = (U8BIT)(space_in_mins % 60);
5901 STB_PVR_PRINT((
"STB_PVRCreateBookmark(handle = 0x%x, time = %d, name = %p", handle, time, name));
5902 rec_ptr = GetRecording(handle);
5903 if ((rec_ptr != NULL) && (strlen((
char *)rec_ptr->basename) > 0))
5905 retval = AddBookmark(rec_ptr->disk_id, rec_ptr->basename, time, name, BOOKMARK_USER);
5909 STB_PVR_PRINT((
"STB_PVRCreateBookmark: failed finding the recording"));
5934 STB_PVR_PRINT((
"STB_PVRDeleteBookmark(handle = 0x%x, time = %d, name = %p", handle, time, name));
5935 rec_ptr = GetRecording(handle);
5936 if ((rec_ptr != NULL) && (strlen((
char *)rec_ptr->basename) > 0))
5938 RemoveBookmark(rec_ptr->disk_id, rec_ptr->basename, time, name, BOOKMARK_USER);
5943 STB_PVR_PRINT((
"STB_PVRDeleteBookmark: failed finding the recording"));
5960 static void ReadRecordings(U16BIT disk_id)
5963 U8BIT filename[DB_FILENAME_LEN];
5964 E_STB_DIR_ENTRY_TYPE entry_type;
5971 FUNCTION_START(ReadRecordings);
5973 STB_PVR_PRINT((
"ReadRecordings(0x%04x)", disk_id));
5981 if (entry_type == DIR_ENTRY_FILE)
5984 if ((strlen((
char *)filename) > strlen(DB_FILE_EXTENSION)) &&
5985 (strlen((
char *)filename) <= (STB_PVR_BASENAME_LEN + strlen(DB_FILE_EXTENSION))) &&
5986 (strcmp((
char *)&filename[strlen((
char *)filename) - strlen(DB_FILE_EXTENSION)], DB_FILE_EXTENSION) == 0))
5998 if ((header.magic[0] == ODB_MAGIC_1) && (header.magic[1] == ODB_MAGIC_2) &&
5999 (header.magic[2] == ODB_MAGIC_3))
6004 if ((header.version == ODB_VERSION_1) || (header.version == ODB_VERSION_2))
6007 if (
STB_DSKReadFile(dbfile, rec_info_buffer, REC_INFO_BUFFER_SIZE) == REC_INFO_BUFFER_SIZE)
6009 if ((enc_dec_key != NULL) && (enc_dec_iv != NULL))
6011 STB_CRYPTAesCbcDecrypt(rec_info_buffer, rec_info_buffer, REC_INFO_BUFFER_SIZE,
6012 enc_dec_key, enc_dec_iv);
6016 memcpy(&rec_info, rec_info_buffer,
sizeof(
S_REC_INFO));
6018 if (header.version == ODB_VERSION_1)
6023 if ((rec_info.len_hour == 0) && (rec_info.len_min == 0) &&
6024 (rec_info.len_sec == 0))
6026 rec_info.status = RECORDING_STATUS_FAILED;
6030 rec_info.status = RECORDING_STATUS_COMPLETED;
6033 else if (header.version == ODB_VERSION_2)
6035 if (rec_info.status == RECORDING_STATUS_STARTED)
6038 rec_info.status = RECORDING_STATUS_FAILED;
6050 filename[strlen((
char *)filename) - strlen(DB_FILE_EXTENSION)] =
'\0';
6057 if (rec_ptr != NULL)
6062 memcpy(&rec_ptr->rec_info, &rec_info,
sizeof(
S_REC_INFO));
6065 rec_ptr->disk_id = disk_id;
6068 strncpy((
char *)rec_ptr->basename, (
char *)filename, BASENAME_LEN);
6074 rec_ptr->handle = GetNextFreeHandle();
6078 InsertRecordingInList(rec_ptr);
6096 FUNCTION_FINISH(ReadRecordings);
6104 static void RemoveRecordings(U16BIT disk_id)
6109 FUNCTION_START(RemoveRecordings);
6115 while (rec_ptr != NULL)
6117 next_rec = rec_ptr->next;
6119 if (rec_ptr->disk_id == disk_id)
6121 RemoveRecordingFromList(rec_ptr);
6129 FUNCTION_FINISH(RemoveRecordings);
6137 static U32BIT GetCurrentRecordTime(U32BIT handle)
6142 FUNCTION_START(GetCurrentRecordTime);
6147 for (path = 0; path < num_paths; path++)
6149 if (record_status[path].handle == handle)
6151 if (record_status[path].paused)
6153 record_time = record_status[path].duration;
6157 record_time = record_status[path].duration +
STB_OSGetClockDiff(record_status[path].start_time);
6160 record_time /= 1000;
6165 FUNCTION_FINISH(GetCurrentRecordTime);
6167 return(record_time);
6174 static U32BIT GetNextFreeHandle(
void)
6176 U32BIT handle = HANDLE_BASE;
6178 FUNCTION_START(GetNextFreeHandle);
6180 while (GetRecording(handle) != NULL)
6185 FUNCTION_FINISH(GetNextFreeHandle);
6199 FUNCTION_START(GetRecording);
6203 if (initialised_flag)
6207 for (rec_ptr = rec_list; (rec_ptr != NULL) && (rec_ptr->handle != handle); )
6209 rec_ptr = rec_ptr->next;
6215 FUNCTION_FINISH(GetRecording);
6225 static void GetDBRecordBasename(U32BIT file_number, U8BIT *filename)
6227 FUNCTION_START(GetDBRecordBasename);
6229 snprintf((
char *)filename, BASENAME_LEN,
"%08lx", (
long)file_number);
6231 FUNCTION_FINISH(GetDBRecordBasename);
6239 static void GetDBRecordFilename(U32BIT file_number, U8BIT *filename)
6241 FUNCTION_START(GetDBRecordFilename);
6243 GetDBRecordBasename(file_number, filename);
6244 strncat((
char *)filename, DB_FILE_EXTENSION, DB_FILE_EXTENTION_LEN);
6246 FUNCTION_FINISH(GetDBRecordFilename);
6257 static BOOLEAN WriteODBFile(U16BIT disk_id, U8BIT *basename, BOOLEAN write_header,
S_REC_INFO *rec_info)
6259 U8BIT db_filename[DB_FILENAME_LEN];
6264 FUNCTION_START(WriteODBFile);
6268 strncpy((
char *)db_filename, (
char *)basename, DB_FILENAME_LEN);
6269 strncat((
char *)db_filename, DB_FILE_EXTENSION, DB_FILENAME_LEN - (strlen((
char *)basename)));
6285 header.magic[0] = ODB_MAGIC_1;
6286 header.magic[1] = ODB_MAGIC_2;
6287 header.magic[2] = ODB_MAGIC_3;
6288 header.version = ODB_CUR_VERSION;
6304 memcpy(rec_info_buffer, (U8BIT *)rec_info,
sizeof(
S_REC_INFO));
6307 if ((enc_dec_key != NULL) && (enc_dec_iv != NULL))
6309 STB_CRYPTAesCbcEncrypt(rec_info_buffer, rec_info_buffer, REC_INFO_BUFFER_SIZE, enc_dec_key, enc_dec_iv);
6312 if (
STB_DSKWriteFile(dbfile, rec_info_buffer, REC_INFO_BUFFER_SIZE) != REC_INFO_BUFFER_SIZE)
6323 STB_PVR_PRINT((
"WriteODBFile: Failed to open file \"%s\" on disk 0x%04x", db_filename, disk_id));
6327 FUNCTION_FINISH(WriteODBFile);
6341 static BOOLEAN WriteExtendedInfo(U16BIT disk_id, U8BIT *basename, U16BIT ext_id,
6342 U32BIT data_len, U8BIT *data)
6344 U8BIT db_filename[DB_FILENAME_LEN];
6352 FUNCTION_START(WriteExtendedInfo);
6356 strncpy((
char *)db_filename, (
char *)basename, DB_FILENAME_LEN);
6357 strncat((
char *)db_filename, DB_FILE_EXTENSION, DB_FILENAME_LEN - (strlen((
char *)basename)));
6370 while (
STB_DSKReadFile(dbfile, (U8BIT *)&
id,
sizeof(
id)) ==
sizeof(id))
6372 if (
STB_DSKReadFile(dbfile, (U8BIT *)&size,
sizeof(size)) ==
sizeof(size))
6379 if (size == data_len)
6402 if (
STB_DSKWriteFile(dbfile, (U8BIT *)&ext_id,
sizeof(ext_id)) ==
sizeof(ext_id))
6405 if (
STB_DSKWriteFile(dbfile, (U8BIT *)&data_len,
sizeof(data_len)) ==
sizeof(data_len))
6420 FUNCTION_FINISH(WriteExtendedInfo);
6434 static BOOLEAN ReadExtendedInfo(U16BIT disk_id, U8BIT *basename, U16BIT ext_id, U8BIT *data,
6437 U8BIT db_filename[DB_FILENAME_LEN];
6444 FUNCTION_START(ReadExtendedInfo);
6448 strncpy((
char *)db_filename, (
char *)basename, DB_FILENAME_LEN);
6449 strncat((
char *)db_filename, DB_FILE_EXTENSION, DB_FILENAME_LEN - strlen((
char *)basename));
6460 while (
STB_DSKReadFile(dbfile, (U8BIT *)&
id,
sizeof(
id)) ==
sizeof(id))
6462 if (
STB_DSKReadFile(dbfile, (U8BIT *)&size,
sizeof(size)) ==
sizeof(size))
6466 if (data_len >= size)
6488 FUNCTION_FINISH(ReadExtendedInfo);
6500 static U32BIT GetExtendedInfoSize(U16BIT disk_id, U8BIT *basename, U16BIT ext_id)
6502 U8BIT db_filename[DB_FILENAME_LEN];
6509 FUNCTION_START(GetExtendedInfoSize);
6513 strncpy((
char *)db_filename, (
char *)basename, DB_FILENAME_LEN);
6514 strncat((
char *)db_filename, DB_FILE_EXTENSION, DB_FILENAME_LEN - strlen((
char *)basename));
6525 while (
STB_DSKReadFile(dbfile, (U8BIT *)&
id,
sizeof(
id)) ==
sizeof(id))
6527 if (
STB_DSKReadFile(dbfile, (U8BIT *)&size,
sizeof(size)) ==
sizeof(size))
6546 FUNCTION_FINISH(GetExtendedInfoSize);
6555 static void InsertRecordingInList(
S_RECORDING *rec_ptr)
6561 FUNCTION_START(InsertRecordingInList);
6566 for (list_ptr = rec_list; (list_ptr != NULL) && !found; )
6569 list_ptr->rec_info.rec_min, list_ptr->rec_info.rec_sec,
6570 rec_ptr->rec_info.rec_date, rec_ptr->rec_info.rec_hour,
6571 rec_ptr->rec_info.rec_min, rec_ptr->rec_info.rec_sec, COMP_1GT2))
6574 list_ptr = list_ptr->next;
6584 if (rec_list != NULL)
6586 rec_list->prev = rec_ptr;
6589 rec_ptr->prev = NULL;
6590 rec_ptr->next = rec_list;
6595 rec_ptr->prev = prev;
6596 rec_ptr->next = list_ptr;
6597 prev->next = rec_ptr;
6599 if (list_ptr != NULL)
6601 list_ptr->prev = rec_ptr;
6605 FUNCTION_FINISH(InsertRecordingInList);
6612 static void RemoveRecordingFromList(
S_RECORDING *rec_ptr)
6614 FUNCTION_START(RemoveRecordingFromList);
6616 if (rec_list == rec_ptr)
6618 rec_list = rec_ptr->next;
6621 if (rec_ptr->prev != NULL)
6623 rec_ptr->prev->next = rec_ptr->next;
6626 if (rec_ptr->next != NULL)
6628 rec_ptr->next->prev = rec_ptr->prev;
6633 FUNCTION_FINISH(RemoveRecordingFromList);
6642 static BOOLEAN IncludesVideoPid(
S_PVR_PID_INFO *pid_array, U16BIT num_pids)
6647 FUNCTION_START(IncludesVideoPid);
6651 for (i = 0; (i < num_pids) && !found; i++)
6653 if (pid_array[i].type == PVR_PID_TYPE_VIDEO)
6659 FUNCTION_FINISH(IncludesVideoPid);
6664 #ifdef COMMON_INTERFACE 6669 static void FreeCIPlusItemList(U8BIT path)
6671 S_REC_CIPLUS_ITEM *item;
6672 S_REC_CIPLUS_ITEM *next_item;
6674 FUNCTION_START(FreeCIPlusItemList);
6676 for (item = play_status[path].item_list; item != NULL; item = next_item)
6678 next_item = item->next;
6680 FreeCIPlusItem(item);
6683 play_status[path].item_list = NULL;
6684 play_status[path].uri_item = NULL;
6685 play_status[path].licence_item = NULL;
6686 play_status[path].pin_item = NULL;
6688 FUNCTION_FINISH(FreeCIPlusItemList);
6695 static void FreeCIPlusItem(S_REC_CIPLUS_ITEM *item)
6697 FUNCTION_START(FreeCIPlusItem);
6699 if (item->item_type == EXT_INFO_CIPLUS_LICENCE)
6701 if (item->u.licence.data != NULL)
6709 FUNCTION_FINISH(FreeCIPlusItem);
6718 static void ReadCIPlusItems(U8BIT path,
S_RECORDING *rec_ptr)
6720 U8BIT db_filename[DB_FILENAME_LEN];
6725 S_REC_CIPLUS_ITEM *item;
6726 S_REC_CIPLUS_ITEM *prev_item;
6728 FUNCTION_START(ReadCIPlusItems);
6731 FreeCIPlusItemList(path);
6733 strcpy((
char *)db_filename, (
char *)rec_ptr->basename);
6734 strcat((
char *)db_filename, DB_FILE_EXTENSION);
6736 dbfile =
STB_DSKOpenFile(rec_ptr->disk_id, db_filename, FILE_MODE_READ);
6747 while (
STB_DSKReadFile(dbfile, (U8BIT *)&
id,
sizeof(
id)) ==
sizeof(id))
6751 if (
STB_DSKReadFile(dbfile, (U8BIT *)&size,
sizeof(size)) ==
sizeof(size))
6753 if (
id == EXT_INFO_CIPLUS_URI)
6756 if ((item = (S_REC_CIPLUS_ITEM *)
STB_GetMemory(
sizeof(S_REC_CIPLUS_ITEM))) != NULL)
6758 memset(item, 0,
sizeof(S_REC_CIPLUS_ITEM));
6760 item->item_type = id;
6766 else if (
id == EXT_INFO_CIPLUS_LICENCE)
6769 if ((item = (S_REC_CIPLUS_ITEM *)
STB_GetMemory(
sizeof(S_REC_CIPLUS_ITEM))) != NULL)
6771 memset(item, 0,
sizeof(S_REC_CIPLUS_ITEM));
6773 item->item_type = id;
6774 item->u.licence.used = FALSE;
6779 item->u.licence.length = size -
sizeof(U32BIT);
6781 if ((item->u.licence.data =
STB_GetMemory(item->u.licence.length)) != NULL)
6783 STB_DSKReadFile(dbfile, item->u.licence.data, item->u.licence.length);
6787 else if (
id == EXT_INFO_CIPLUS_PIN)
6790 if ((item = (S_REC_CIPLUS_ITEM *)
STB_GetMemory(
sizeof(S_REC_CIPLUS_ITEM))) != NULL)
6792 memset(item, 0,
sizeof(S_REC_CIPLUS_ITEM));
6794 item->item_type = id;
6809 item->prev = prev_item;
6811 if (prev_item == NULL)
6813 play_status[path].item_list = item;
6817 prev_item->next = item;
6829 FUNCTION_FINISH(ReadCIPlusItems);
6841 static void ApplyCIPlusItems(U8BIT path,
S_RECORDING *rec_ptr, U32BIT position_in_seconds,
6844 S_REC_CIPLUS_ITEM *item;
6845 S_REC_CIPLUS_ITEM *found_item;
6846 U32BIT retention_limit;
6847 U8BIT uri[CIP_URI_LEN];
6849 FUNCTION_START(ApplyCIPlusItems);
6854 if (((item = play_status[path].uri_item) == NULL) || (speed >= 0))
6861 item = play_status[path].item_list;
6864 for (; item != NULL; item = item->next)
6866 if (item->timestamp <= position_in_seconds)
6868 if (item->item_type == EXT_INFO_CIPLUS_URI)
6870 if ((found_item == NULL) || (item->timestamp > found_item->timestamp))
6886 for (item = item->prev; item != NULL; item = item->prev)
6888 if (item->item_type == EXT_INFO_CIPLUS_URI)
6898 if (found_item == NULL)
6900 DBG_CIP(
": No URI found, so applying default URI for playback")
6909 retention_limit, rec_ptr->rec_info.rec_date, rec_ptr->rec_info.rec_hour,
6910 rec_ptr->rec_info.rec_min);
6915 else if ((found_item != NULL) && (found_item != play_status[path].uri_item))
6917 DBG_CIP(
": Applying URI at %lu seconds for playback", found_item->timestamp)
6920 play_status[path].uri_item = found_item;
6925 retention_limit, rec_ptr->rec_info.rec_date, rec_ptr->rec_info.rec_hour,
6926 rec_ptr->rec_info.rec_min);
6935 if (((item = play_status[path].licence_item) == NULL) || (speed >= 0))
6942 item = play_status[path].item_list;
6945 for (; item != NULL; item = item->next)
6947 if (item->timestamp <= position_in_seconds)
6949 if (item->item_type == EXT_INFO_CIPLUS_LICENCE)
6951 if (!item->u.licence.used)
6953 if ((found_item == NULL) || (item->timestamp > found_item->timestamp))
6959 else if ((found_item != NULL) && (item->item_type == EXT_INFO_CIPLUS_URI))
6962 if (item->timestamp > found_item->timestamp)
6979 for (item = item->prev; item != NULL; item = item->prev)
6981 if ((item->item_type == EXT_INFO_CIPLUS_LICENCE) && !item->u.licence.used)
6991 if ((found_item != NULL) && (found_item != play_status[path].licence_item))
6993 DBG_CIP(
": Sending licence at %lu seconds to CAM in slot %u",
6994 found_item->timestamp, play_status[path].slot_id)
6997 play_status[path].licence_item = found_item;
7001 found_item->u.licence.data, found_item->u.licence.length))
7004 found_item->u.licence.used = TRUE;
7008 play_status[path].licence_item = NULL;
7009 DBG_CIP(
": Failed to send CI+ licence for recording 0x%08lx to slot %u", rec_ptr->handle, play_status[path].slot_id)
7016 if (((item = play_status[path].pin_item) == NULL) || (speed >= 0))
7023 item = play_status[path].item_list;
7026 for (; item != NULL; item = item->next)
7028 if (item->timestamp <= position_in_seconds)
7030 if (item->item_type == EXT_INFO_CIPLUS_PIN)
7032 if ((found_item == NULL) || (item->timestamp > found_item->timestamp))
7048 for (item = item->prev; item != NULL; item = item->prev)
7050 if (item->item_type == EXT_INFO_CIPLUS_PIN)
7060 if ((found_item != NULL) && (found_item != play_status[path].pin_item))
7062 DBG_CIP(
": Applying PIN at %lu seconds for playback", found_item->timestamp)
7065 play_status[path].pin_item = found_item;
7069 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_CI, EV_TYPE_CI_PLAYBACK_BLANK_VIDEO, NULL, 0);
7071 found_item->u.pin.private_data);
7074 FUNCTION_FINISH(ApplyCIPlusItems);
7084 static void FindNextCIPlusItem(U8BIT path, S16BIT speed)
7086 S_REC_CIPLUS_ITEM *item;
7087 S_REC_CIPLUS_ITEM *next_item;
7088 U8BIT audio_decoder, video_decoder;
7090 FUNCTION_START(FindNextCIPlusItem);
7095 for (item = play_status[path].item_list; item != NULL; item = item->next)
7097 if (item->item_type == EXT_INFO_CIPLUS_URI)
7103 if (((play_status[path].uri_item == NULL) || (item->timestamp > play_status[path].uri_item->timestamp)) &&
7104 ((next_item == NULL) || (item->timestamp < next_item->timestamp)))
7112 if (((play_status[path].uri_item == NULL) || (item->timestamp < play_status[path].uri_item->timestamp)) &&
7113 ((next_item == NULL) || (item->timestamp > next_item->timestamp)))
7120 if ((item->item_type == EXT_INFO_CIPLUS_LICENCE) && !item->u.licence.used)
7126 if (((play_status[path].licence_item == NULL) || (item->timestamp > play_status[path].licence_item->timestamp)) &&
7127 ((next_item == NULL) || (item->timestamp < next_item->timestamp)))
7135 if (((play_status[path].licence_item == NULL) || (item->timestamp < play_status[path].licence_item->timestamp)) &&
7136 ((next_item == NULL) || (item->timestamp > next_item->timestamp)))
7143 if (item->item_type == EXT_INFO_CIPLUS_PIN)
7149 if (((play_status[path].pin_item == NULL) || (item->timestamp > play_status[path].pin_item->timestamp)) &&
7150 ((next_item == NULL) || (item->timestamp < next_item->timestamp)))
7158 if (((play_status[path].pin_item == NULL) || (item->timestamp < play_status[path].pin_item->timestamp)) &&
7159 ((next_item == NULL) || (item->timestamp > next_item->timestamp)))
7167 if (next_item != NULL)
7169 DBG_CIP(
": Next item is a change of %s @ %lu seconds",
7170 ((next_item->item_type == EXT_INFO_CIPLUS_URI) ?
"URI" :
7171 (next_item->item_type == EXT_INFO_CIPLUS_LICENCE) ?
"LICENCE" :
"PIN"), next_item->timestamp)
7179 FUNCTION_FINISH(FindNextCIPlusItem);
7192 static BOOLEAN WriteCIPlusInfo(U16BIT disk_id, U8BIT *basename, U16BIT ext_id, U32BIT timestamp,
7193 U32BIT data_len, U8BIT *data)
7195 U8BIT db_filename[DB_FILENAME_LEN];
7202 FUNCTION_START(WriteCIPlusInfo);
7206 strcpy((
char *)db_filename, (
char *)basename);
7207 strcat((
char *)db_filename, DB_FILE_EXTENSION);
7218 while (
STB_DSKReadFile(dbfile, (U8BIT *)&
id,
sizeof(
id)) ==
sizeof(id))
7220 if (
STB_DSKReadFile(dbfile, (U8BIT *)&size,
sizeof(size)) ==
sizeof(size))
7228 if (
STB_DSKWriteFile(dbfile, (U8BIT *)&ext_id,
sizeof(ext_id)) ==
sizeof(ext_id))
7231 size = data_len +
sizeof(timestamp);
7233 if (
STB_DSKWriteFile(dbfile, (U8BIT *)&size,
sizeof(size)) ==
sizeof(size))
7236 if (
STB_DSKWriteFile(dbfile, (U8BIT *)×tamp,
sizeof(timestamp)) ==
sizeof(timestamp))
7251 FUNCTION_FINISH(WriteCIPlusInfo);
7266 static BOOLEAN UpdateCIPlusInfo(U16BIT disk_id, U8BIT *basename, U16BIT ext_id, U32BIT timestamp,
7267 U32BIT data_len, U8BIT *data)
7269 U8BIT db_filename[DB_FILENAME_LEN];
7277 FUNCTION_START(UpdateCIPlusInfo);
7281 strcpy((
char *)db_filename, (
char *)basename);
7282 strcat((
char *)db_filename, DB_FILE_EXTENSION);
7293 while (
STB_DSKReadFile(dbfile, (U8BIT *)&
id,
sizeof(
id)) ==
sizeof(id))
7295 if (
STB_DSKReadFile(dbfile, (U8BIT *)&size,
sizeof(size)) ==
sizeof(size))
7299 if (
STB_DSKReadFile(dbfile, (U8BIT *)&file_time,
sizeof(file_time)) ==
sizeof(file_time))
7301 if (file_time == timestamp)
7304 if (size == (data_len +
sizeof(timestamp)))
7317 STB_DSKSeekFile(dbfile, FILE_POSITION_CURRENT, size -
sizeof(timestamp));
7333 FUNCTION_FINISH(UpdateCIPlusInfo);
7347 static void GetBookmarkFolderName(U8BIT *basename, U8BIT *bookmark_folder_name)
7349 FUNCTION_START(GetBookmarkFolderName);
7351 sprintf((
char *)bookmark_folder_name,
"bm%s", (
char *)basename);
7353 FUNCTION_FINISH(GetBookmarkFolderName);
7366 static void GetBookmarkFileName(U32BIT time, E_BOOKMARK_TYPE type, U8BIT *name)
7370 FUNCTION_START(GetBookmarkFileName);
7374 case BOOKMARK_PLAYBACK_POSITION:
7388 sprintf((
char *)name,
"%08x%c", (
unsigned int)time, tail);
7390 FUNCTION_FINISH(GetBookmarkFileName);
7398 static E_BOOKMARK_TYPE GetBookmarkType(U8BIT *file_name)
7400 E_BOOKMARK_TYPE type;
7402 FUNCTION_START(GetBookmarkType);
7404 switch (file_name[BOOKMARK_FILENAME_SIZE - 2])
7408 type = BOOKMARK_PLAYBACK_POSITION;
7415 type = BOOKMARK_USER;
7420 FUNCTION_FINISH(GetBookmarkType);
7430 static U32BIT GetBookmarkTime(U8BIT *file_name)
7434 FUNCTION_START(GetBookmarkTime);
7436 sscanf((
char *)file_name,
"%08x%*c", (
unsigned int *)&time);
7438 FUNCTION_FINISH(GetBookmarkTime);
7456 static BOOLEAN AddBookmark(U16BIT disk_id, U8BIT *basename, U32BIT time, U8BIT *name, E_BOOKMARK_TYPE type)
7458 BOOLEAN success = TRUE, check_folder = TRUE;
7460 U8BIT folder_name[STB_PVR_BASENAME_LEN + 2];
7461 U8BIT file_name[BOOKMARK_FILENAME_SIZE];
7462 U8BIT file_str[STB_PVR_BASENAME_LEN + 2 + BOOKMARK_FILENAME_SIZE];
7463 U8BIT default_name[9];
7467 FUNCTION_START(AddBookmark);
7469 GetBookmarkFolderName(basename, folder_name);
7470 GetBookmarkFileName(time, type, file_name);
7471 sprintf((
char *)file_str,
"%s/%.*s", (
char *)folder_name, BOOKMARK_FILENAME_SIZE - 1,
7476 check_folder = FALSE;
7477 if (type == BOOKMARK_USER)
7480 STB_PVR_PRINT((
"AddBookmark: bookmark %s already exists", file_str));
7491 STB_PVR_PRINT((
"AddBookmark: creating folder %s", folder_name));
7494 STB_PVR_PRINT((
"AddBookmark: failed creating folder %s", folder_name));
7506 STB_PVR_PRINT((
"AddBookmark: creating bookmark %s", file_str));
7519 sprintf((
char *)default_name,
"%02d:%02d:%02d", h, m, s);
7520 name = default_name;
7525 size = strlen((
char *)name);
7526 if (size > STB_PVR_NAME_LEN - 1)
7528 STB_PVR_PRINT((
"AddBookmark: name is too long, limiting it to %d characters", STB_PVR_NAME_LEN));
7529 size = STB_PVR_NAME_LEN - 1;
7542 STB_PVR_PRINT((
"AddBookmark: failed writing bookmark %s", file_str));
7549 STB_PVR_PRINT((
"AddBookmark: could not create file %s", file_str));
7554 FUNCTION_FINISH(AddBookmark);
7569 static void RemoveBookmark(U16BIT disk_id, U8BIT *basename, U32BIT time, U8BIT *name, E_BOOKMARK_TYPE type)
7571 U8BIT folder_name[STB_PVR_BASENAME_LEN + 2];
7572 U8BIT file_name[BOOKMARK_FILENAME_SIZE];
7573 U8BIT file_str[STB_PVR_BASENAME_LEN + 2 + BOOKMARK_FILENAME_SIZE];
7575 FUNCTION_START(RemoveBookmark);
7576 USE_UNWANTED_PARAM(name);
7578 GetBookmarkFolderName(basename, folder_name);
7579 GetBookmarkFileName(time, type, file_name);
7580 sprintf((
char *)file_str,
"%s/%.*s", (
char *)folder_name, BOOKMARK_FILENAME_SIZE - 1,
7583 STB_PVR_PRINT((
"Deleting bookmark %s", file_str));
7586 FUNCTION_FINISH(RemoveBookmark);
7595 static void RemoveAllBookmarks(U16BIT disk_id, U8BIT *basename)
7597 CREATE_LINK_LIST_HEADER(bookmarks);
7599 U8BIT folder_name[STB_PVR_BASENAME_LEN + 2];
7601 FUNCTION_START(RemoveAllBookmarks);
7603 if (GetBookmarks(disk_id, basename, &bookmarks, BOOKMARK_USER, FALSE) != 0)
7606 while (b_ptr != NULL)
7608 RemoveBookmark(disk_id, basename, b_ptr->time, NULL, BOOKMARK_USER);
7612 EmptyBookmarks(&bookmarks, TRUE);
7615 if (GetBookmarks(disk_id, basename, &bookmarks, BOOKMARK_PLAYBACK_POSITION, FALSE) != 0)
7618 while (b_ptr != NULL)
7620 RemoveBookmark(disk_id, basename, b_ptr->time, NULL, BOOKMARK_PLAYBACK_POSITION);
7624 EmptyBookmarks(&bookmarks, TRUE);
7627 GetBookmarkFolderName(basename, folder_name);
7630 FUNCTION_FINISH(RemoveAllBookmarks);
7645 static U32BIT GetBookmarks(U16BIT disk_id, U8BIT *basename,
LINK_LIST_HEADER *bookmarks,
7646 E_BOOKMARK_TYPE type, BOOLEAN names)
7650 U8BIT folder_name[STB_PVR_BASENAME_LEN + 2];
7651 U8BIT file_name[BOOKMARK_FILENAME_SIZE];
7652 U8BIT file_str[STB_PVR_BASENAME_LEN + 2 + BOOKMARK_FILENAME_SIZE];
7654 U32BIT read_bytes, offset;
7656 E_STB_DIR_ENTRY_TYPE entry_type;
7658 FUNCTION_START(GetBookmarks);
7661 GetBookmarkFolderName(basename, folder_name);
7668 if ((entry_type == DIR_ENTRY_FILE) && (GetBookmarkType(file_name) == type))
7674 b->time = GetBookmarkTime(file_name);
7678 sprintf((
char *)file_str,
"%s/%.*s", (
char *)folder_name,
7679 BOOKMARK_FILENAME_SIZE - 1, (
char *)file_name);
7686 if (offset < STB_PVR_NAME_LEN)
7688 read_bytes = offset;
7692 read_bytes = STB_PVR_NAME_LEN - 1;
7699 b->name[read_bytes] =
'\0';
7716 STB_PVR_PRINT((
"GetBookmarks: could not open folder %s", folder_name));
7720 FUNCTION_FINISH(GetBookmarks);
7734 FUNCTION_START(EmptyBookmarks);
7744 if (b->name != NULL)
7753 FUNCTION_FINISH(EmptyBookmarks);
7768 FUNCTION_START(CompareBookmarks);
7773 if ((b1 != NULL) && (b2 != NULL))
7775 if (b1->time < b2->time)
7779 else if (b1->time > b2->time)
7788 else if (b1 != NULL)
7792 else if (b2 != NULL)
7801 FUNCTION_FINISH(CompareBookmarks);
BOOLEAN STB_PVRCreateBookmark(U32BIT handle, U32BIT time, U8BIT *name)
Creates a bookmark associated with the a recording.
U32BIT STB_PVRGetPlayPosition(U32BIT handle)
Returns the bookmarked play position for the given recording.
BOOLEAN STB_DSKGetIntegrity(U16BIT disk_id)
Returns a summary of the disk integrity.
BOOLEAN STB_PVRIsValidRecording(U16BIT disk_id, U8BIT *basename)
Checks whether any of the files already exist that would be created by a recording with the given bas...
BOOLEAN STB_PVRFindRecordingFromCrid(U8BIT *prog_crid, U32BIT *handle)
Returns the handle of the recording with the given programme CRID.
BOOLEAN STB_PVRDeleteRecording(U16BIT disk_id, U8BIT *basename)
Deletes any files associated with the given base filename that were created as a result of the record...
void STB_LLAddBlockToEnd(LINK_LIST_HEADER *hdr, LINK_LIST_PTR_BLK *new_blk)
Adds the block identified by the new_blk pointer to the end of the linked list identified by the list...
U8BIT STB_PVRInitRecording(U8BIT num_tuners)
Initialisation for recording.
U32BIT STB_DSKGetUsed(U16BIT disk_id)
Returns the amount of space used on the disk.
void STB_PVRSetPlaybackNotifyTime(U8BIT audio_decoder, U8BIT video_decoder, U32BIT notify_time)
Sets the time the next notification event should be sent during playback. This is required for CI+...
void * STB_GetMemory(U32BIT bytes)
Attempts to allocate memory from the heap.
void STB_PVRRecordingSetName(U32BIT handle, U8BIT *name)
Sets the name for a recording.
S16BIT STB_PVRGetMaxPlaySpeed(U8BIT path)
Reads the PVR max play speed.
BOOLEAN STB_PVRRecordingGetServiceName(U32BIT handle, U8BIT *service_name, U16BIT name_len)
Gets the service name for a given recording.
void STB_PVRPlayFaster(U8BIT path, BOOLEAN include_slow_speeds)
Increase play speed - has no effect when decoding from demux.
U32BIT STB_PVRRecordingGetParentalRating(U32BIT handle)
Returns the parental rating age for the specified recording as set by STB_PVRRecordingSetParentalRati...
void STB_PVRPlaySetRetentionLimit(U8BIT audio_decoder, U8BIT video_decoder, U32BIT retention_limit, U16BIT rec_date, U8BIT rec_hour, U8BIT rec_min)
Set the retention limit for the playback. This function is used for CI+.
U16BIT STB_PVRRecordingGetDiskId(U32BIT handle)
Gets the disk id for a recording.
S16BIT STB_AVGetMaxPlaySpeed(U8BIT video_decoder)
Returns maximum video play speed as a percentage.
U8BIT STB_DSKGetFormatProgress(U16BIT disk_id)
Gets the progress of the format operation.
void STB_PVRSetPlaybackDecryptionKey(U8BIT audio_decoder, U8BIT video_decoder, BOOLEAN state, U8BIT *key, U8BIT *iv, U32BIT key_len)
Enables and sets the key that will be used to decrypt an encrypted recording during playback...
void STB_PVRSetRecordEncryptionKey(U8BIT rec_index, BOOLEAN state, U8BIT *key, U8BIT *iv, U32BIT key_len)
Enables or disables encryption and sets the encryption key to be used.
void STB_PVRReleaseRecorderIndex(U8BIT rec_index)
Releases a recording index when no longer needed.
void * STB_DSKOpenFile(U16BIT disk_id, U8BIT *name, E_STB_DSK_FILE_MODE mode)
Opens an existing file or creates a new one.
U16BIT STB_PVRRecordingGetGuidanceLen(U32BIT handle)
Gets the length of the guidance text for a given recording.
BOOLEAN STB_PVRGetRecordingSize(U16BIT disk_id, U8BIT *basename, U32BIT *rec_size_kb)
Returns the size in kilobytes of the recording defined by the given base filename.
BOOLEAN STB_PVRResumeRecording(U8BIT path)
Resumes a recording after it's been paused.
void STB_PVRSaveFrame(U8BIT audio_decoder, U8BIT video_decoder)
Save current frame of playback.
BOOLEAN STB_PVRRecordingSetStatus(U32BIT handle, E_PVR_RECORDING_STATUS status)
Set the status to be saved with the recording.
BOOLEAN STB_PVRRecordingHasGuidance(U32BIT handle)
Returns whether the given recording has guidance.
void STB_PVRRecordingSetStartPadding(U32BIT handle, S32BIT start_padding)
Sets the start padding value for the specified recording.
BOOLEAN STB_DSKSeekFile(void *file, E_STB_DSK_FILE_POSITION position, S32BIT offset)
Sets the read/write position of an open file.
S16BIT STB_AVGetMinPlaySpeed(U8BIT video_decoder)
Returns minimum video play speed as a percentage.
void * STB_DSKOpenDirectory(U16BIT disk_id, U8BIT *dir_name)
Opens a directory in order to read the entries.
U32BIT STB_OSGetClockDiff(U32BIT timestamp)
Get Difference between Given Time and Current Time.
Header file - macros and function prototypes for public use.
void * STB_OSCreateSemaphore(void)
Create a Semaphore.
BOOLEAN STB_PVRRecordingSetParentalLock(U32BIT handle, BOOLEAN state)
Sets the parental lock state of a recording.
BOOLEAN STB_PVRRecordingGetOtherCrid(U32BIT handle, U8BIT *crid, U16BIT name_len)
Gets the series/recommendation CRID for a given recording.
BOOLEAN STB_PVRRepair(U16BIT disk_id, E_STB_PVR_REPAIRMODE mode, U8BIT *prog)
Repairs disk for PVR. Call this for each mode.
S16BIT STB_PVRGetPlaySpeed(U8BIT audio_decoder, U8BIT video_decoder)
Returns the current playback speed.
void STB_PVRPlayNormal(U8BIT path)
Restarts playback (no trick mode) - has no effect when decoding from demux.
BOOLEAN STB_PVRDeleteBookmark(U32BIT handle, U32BIT time, U8BIT *name)
Deletes a bookmark associated with the a recording.
BOOLEAN STB_PVRRecordingGetStatus(U32BIT handle, E_PVR_RECORDING_STATUS *status)
Returns the status saved with the given recording.
BOOLEAN STB_PVRIsPlayNormal(U8BIT path)
Returns TRUE if play is not in trick mode.
BOOLEAN STB_PVRIsPlayMedium(U8BIT path)
Returns TRUE if play speed is medium (1x).
BOOLEAN STB_CiCcSendPinPlayback(U8BIT slot_id, U8BIT age_rating, U8BIT *private_data)
Sends a pin event to the CAM during playback.
void STB_PVRSetRecordStartMode(U8BIT rec_index, E_STB_PVR_START_MODE mode, U32BIT param)
Sets the startup mode for a recording. This function should be called before the recording is started...
BOOLEAN STB_PVRIsRecordAudio(U8BIT path)
Returns TRUE if record contains audio data.
void STB_AVStopAudioDecoding(U8BIT decoder)
Stops audio decoding on the given audio path.
void STB_DMXChangeDecodePIDs(U8BIT path, U16BIT pcr_pid, U16BIT video_pid, U16BIT audio_pid, U16BIT text_pid, U16BIT data_pid, U16BIT ad_pid)
Changes the packet IDs for the PCR Video, Audio, Text and Data.
void STB_CiCcGetDefaultUsageRulesInfo(U8BIT raw_uri[CIP_URI_LEN])
Sets the default URI values into the given array. The URI requires HDCP.
void STB_DMXGetDemuxSource(U8BIT path, E_STB_DMX_DEMUX_SOURCE *source, U8BIT *param)
Gets the current source of a given demux.
S32BIT STB_PVRRecordingGetStartPadding(U32BIT handle)
Gets the start padding value for the specified recording as set by STB_PVRRecordingSetStartPadding.
void STB_GCCalculateDateTime(U16BIT code, U8BIT hour, U8BIT min, U8BIT secs, U8BIT ohour, U8BIT omin, U8BIT osecs, U16BIT *rcode, U8BIT *rhour, U8BIT *rmin, U8BIT *rsecs, E_STB_GC_CALCTYPE calc)
Adds or subtracts offset from a date/time.
BOOLEAN STB_PVRRecordingGetTriplet(U32BIT handle, U16BIT *serv_id, U16BIT *ts_id, U16BIT *orig_net_id)
Read the DVB triplet (service id, transport id, orig net id) for a recording.
U16BIT STB_DSKGetDiskIdByIndex(U16BIT index)
Returns the id of the disk at the given index.
U8BIT STB_DPGetPathVideoDecoder(U8BIT path)
Returns the video decoder ID acquired by the given decode path.
BOOLEAN STB_DSKTellFile(void *file, U32BIT *offset)
Gets the current position in an open file.
void STB_DSKCloseFile(void *file)
Flushes and closes an open file.
BOOLEAN STB_PVRIsPlayForward(U8BIT path)
Returns TRUE if play is forwards trick mode.
U8BIT STB_PVRGetPathForRecordingIndex(U8BIT rec_index)
Returns the path for the given recording index.
PVR messages database access functions header file.
BOOLEAN STB_PVRPlayStart(U16BIT disk_id, U8BIT audio_decoder, U8BIT video_decoder, U8BIT demux, U8BIT *basename)
Starts playback.
void STB_CiCcApplyUsageRulesInfoForPlayback(U8BIT *uri)
Apply the given Usage Rules Information for playback.
Header file - Function prototypes for A/V control.
BOOLEAN STB_PVRIsPlayPause(U8BIT path)
Returns TRUE if play is paused trick mode.
void STB_DMXSetDemuxSource(U8BIT path, E_STB_DMX_DEMUX_SOURCE source, U8BIT param)
Configures the source of the demux.
void STB_OSSemaphoreSignal(void *semaphore)
Signal a Semaphore to Release it by decrementing its counter.
S32BIT STB_PVRRecordingGetEndPadding(U32BIT handle)
Gets the end padding value for the specified recording as set by STB_PVRRecordingSetEndPadding.
BOOLEAN STB_PVRIsInitialised(void)
Returns Initialised status.
void STB_GCConvertDateTime(U16BIT code, U8BIT hour, U8BIT min, U8BIT secs, U16BIT *rcode, U8BIT *rhour, U8BIT *rmin, U8BIT *rsecs, E_STB_GC_CONVTYPE conv)
Converts specified date / time to another.
BOOLEAN STB_PVRIsValidHandle(U32BIT handle)
Determines whether the given handle is in the recording database.
void STB_PVRRecordingSetParentalRatingAge(U32BIT handle, U32BIT parental_rating)
Sets the parental rating age for the specified recording.
BOOLEAN STB_PVRRecordingGetLocked(U32BIT handle)
Returns whether the given recording is locked.
void STB_PVRSavePlayPosition(U8BIT path)
Saves the bookmark holding the playback position. This bookmark is used to resume a playback when STB...
void STB_PVRRecordingSetAdditionalInfo(U32BIT handle, U8BIT *additional_info)
Sets the additional info string for a recording.
void * STB_ResizeMemory(void *ptr, U32BIT new_num_bytes)
Re-allocates a given memory area to the new size, ensuring data contained within the original memory ...
BOOLEAN STB_PVRRecordingSetGuidance(U32BIT handle, U8BIT *text)
Sets the guidance text of a recording.
BOOLEAN STB_PVRIsRecording(U8BIT path, U32BIT *handle)
Reads the PVR record status.
BOOLEAN STB_PVRRecordingSetLocked(U32BIT handle, BOOLEAN state)
Sets the locked state of a recording.
void STB_OSMutexUnlock(void *mutex)
Unlock a mutex (a.k.a. 'leave', 'signal' or 'release')
void STB_PVRRecordStop(U8BIT rec_index)
Stops a recording.
BOOLEAN STB_PVRSetRecoringTriplet(U8BIT path, U16BIT serv_id, U16BIT ts_id, U16BIT orig_net_id)
Saves the DVB triplet of the service to be recorded.
BOOLEAN STB_PVRInitialise(void)
Initialises PVR path control.
void STB_PVRRecordingSetCrid(U32BIT handle, U8BIT *crid)
Sets the programme CRID for a recording and saves the database file.
void STB_PVRStopPlaying(U8BIT path)
Stop the PVR play back.
void STB_OSSemaphoreWait(void *semaphore)
Wait on Semaphore Indefinity or Until Released.
Header file - macros and function prototypes for public use.
U32BIT STB_PVRDiskSize(U16BIT disk_id)
Returns disk size in MBytes.
BOOLEAN STB_DSKDeleteDirectory(U16BIT disk_id, U8BIT *dir_name)
Deletes a directory and all it contents, so use with care!
BOOLEAN STB_PVRFindNextSplitRecording(U32BIT curr_handle, U32BIT *next_handle)
Returns the handle of a split event recording that follows on from curr_handle.
U16BIT STB_DSKGetNumDisks(void)
Returns the number of disks currently detected.
void STB_ERSendEvent(BOOLEAN latched, BOOLEAN repeat, U16BIT path_class, U16BIT type, void *data, U32BIT data_size)
Sends an event to event reporting control module.
BOOLEAN STB_PVRIsPlayAudio(U8BIT path)
Returns TRUE if play contains audio data.
BOOLEAN STB_PVRCanBeUsedForRecording(U16BIT disk_id, U8BIT *basename)
Checks whether any of the files already exist that would be created by a recording with the given bas...
void STB_PVRPlayTrickMode(U8BIT audio_decoder, U8BIT video_decoder, E_STB_PVR_PLAY_MODE mode, S16BIT speed)
Sets trick mode during playback.
U8BIT * STB_PVRRecordingGetAdditionalInfo(U32BIT handle)
Gets the additional info string pointer for a recording.
S16BIT STB_AVGetNextPlaySpeed(U8BIT video_decoder, S16BIT speed, S16BIT inc, BOOLEAN include_slow_speeds)
Returns the next valid speed that is +/- inc above or below the given speed. Slow motion speeds (>-10...
U8BIT STB_DPGetNumPaths(void)
Returns the maximum number of decode paths.
BOOLEAN STB_PVRUpdateRecordingPids(U8BIT path, U16BIT num_pids, S_PVR_PID_INFO *pid_array)
Saves (takes a copy of) the array of pids to be recorded and pass them to the platform.
BOOLEAN STB_PVRRecordStart(U16BIT disk_id, U8BIT rec_index, U8BIT *basename, U16BIT num_pids, S_PVR_PID_INFO *pid_array)
Starts recording.
BOOLEAN STB_PVRRecordingGetRecommendation(U32BIT handle)
Returns whether the given recording is a recommendation.
void STB_PVRPlayFrameDec(U8BIT path)
Decrements play by one frame - has no effect when decoding from demux.
BOOLEAN STB_PVRCreateRecording(U16BIT disk_id, U8BIT *name, U32BIT *handle)
Create a new recording and return the handle.
BOOLEAN STB_PVRIsPlaying(U8BIT path, U32BIT *handle)
Reads the PVR play status.
void STB_PVREncryptRecording(U8BIT path, BOOLEAN state)
Sets whether a recording should be encrypted. Must be set before the recording is started...
void STB_PVRStartRecordRunning(U8BIT path)
Set to start recording in running mode.
void STB_DSKCloseDirectory(void *dir)
Closes the directory for reading.
void STB_PVRPlayForward(U8BIT path)
Set play forwards - has no effect when decoding from demux.
U32BIT STB_DSKWriteFile(void *file, U8BIT *data, U32BIT size)
Writes data to an open file.
BOOLEAN STB_PVRRecordResume(U8BIT rec_index)
Resumes a paused recording.
void STB_FreeMemory(void *addr)
Releases previously allocated heap memory.
BOOLEAN STB_PVRIsPlayVideo(U32BIT handle)
Returns TRUE if play contains video data.
U8BIT STB_HWGetVideoDecodePaths(void)
Returns the number of video decoding paths on the platform.
BOOLEAN STB_PVRPauseRecording(U8BIT path)
Pauses recording after it's been started.
BOOLEAN STB_PVRIsPlayReverse(U8BIT path)
Returns TRUE if play is backwards trick mode.
U8BIT STB_PVRAcquireRecorderIndex(U8BIT tuner, U8BIT demux)
Acquires an index to be used to reference a recording.
void STB_PVRPlaybackNotifyTime(U8BIT path)
Handles the notification received from the platform code when playback reaches a set position...
BOOLEAN STB_PVRFormat(U16BIT disk_id, E_STB_PVR_FORMATMODE mode, U8BIT *prog)
Formats disk for PVR. Call this for each mode.
BOOLEAN STB_PVRIsRecordVideo(U8BIT path)
Returns TRUE if record contains video data.
Debug functions header file.
void STB_PVRDiskUsed(U16BIT disk_id, U8BIT *hours, U8BIT *mins)
Returns disk space used in hours and minutes.
void STB_LLRemoveBlock(LINK_LIST_PTR_BLK *blk)
Removes the block identified by the blk pointer from its linked list.
Header file - Function prototypes for linked lists.
BOOLEAN STB_PVRRecordingGetSelected(U32BIT handle)
Returns whether the given recording is selected.
Header file - macros and function prototypes for public use.
void STB_OSMutexLock(void *mutex)
Lock a mutex (a.k.a. 'enter', 'wait' or 'get').
U16BIT STB_PVRGetDefaultDisk(void)
Returns the set default disk, or finds the first mounted (usable) disk if a default hasn't been set...
Header file - macros and function prototypes for public use.
void STB_AVStartVideoDecoding(U8BIT path)
Starts video decoding on the given video path.
void STB_AVStopVideoDecoding(U8BIT decoder)
Stops video decoding on the given video path. The video is not expected to be blanked.
LINK_LIST_PTR_BLK * STB_LLGetNextBlock(LINK_LIST_PTR_BLK *blk)
Returns a pointer to the next block in the linked list, or NULL if at the end of the list...
void STB_PVRStartPlaySync(U8BIT path)
Set to start playback synced to AV decoder.
BOOLEAN STB_PVRDestroyRecording(U32BIT handle)
Completely destroys a recording by deleting all files and removing it from the list of recordings...
BOOLEAN STB_CiCcSendPlaybackLicence(U8BIT slot_id, U16BIT program_number, U8BIT *licence, U16BIT licence_len)
Sends a CICAM licence to a module during playback, which will result in a modified licence being noti...
void STB_GCGetGMTDateTime(U16BIT *code, U8BIT *hour, U8BIT *min, U8BIT *secs)
Reads the current GMT date code and time.
BOOLEAN STB_PVRIsBeingRecorded(U32BIT handle)
Returns whether the recording with the given handle is currently being recorded.
void STB_PVRPlaySlower(U8BIT path, BOOLEAN include_slow_speeds)
Decrease play speed - has no effect when decoding from demux.
BOOLEAN STB_PVRRecordPause(U8BIT rec_index)
Pauses a recording currently taking place.
BOOLEAN STB_DSKReadDirectory(void *dir, U8BIT *filename, U16BIT filename_len, E_STB_DIR_ENTRY_TYPE *entry_type)
Reads the next entry from the directory, returning the name of the entry and the type of the entry...
void STB_PVRSaveRecording(U32BIT handle)
Save all info on the given recording. The filename and disk should already have been setup...
void STB_PVRSetStandbyState(BOOLEAN state)
Sets the standby state of the PVR path control.
U8BIT STB_DPGetPathTuner(U8BIT path)
Returns the tuner ID acquired by the given decode path.
BOOLEAN STB_PVRRecordingSetSelected(U32BIT handle, BOOLEAN state)
Sets the selected state of a recording.
U32BIT STB_PVRGetTimeOfAllRecordings(U16BIT disk_id)
Calculates the total disk space used in minutes.
Header file - Function prototypes for Event Reporting.
Header for STB unicode string handling routines.
BOOLEAN STB_DSKFileExists(U16BIT disk_id, U8BIT *filename)
Checks whether a file/directory will the given name exists.
BOOLEAN STB_PVRIsRecordStarted(U8BIT rec_index)
Returns whether recording has been started.
void STB_PVRPlayHasVideo(U8BIT audio_decoder, U8BIT video_decoder, BOOLEAN has_video)
Informs the platform whether there's video in the file to be played. Should be called before playback...
U8BIT STB_DPGetPathAudioDecoder(U8BIT path)
Returns the audio decoder ID acquired by the given decode path.
void STB_PVRRecordingSetExtendedDescription(U32BIT handle, U8BIT *description)
Sets the extended description for a recorded programme.
U8BIT STB_HWGetAudioDecodePaths(void)
Returns the number of audio decoding paths on the platform.
U32BIT STB_PVRGetSizeOfAllRecordings(U16BIT disk_id)
Calculates the total disk space used in KB for all recordings.
void STB_PVRReleaseRecordingHandles(U32BIT *handle_array)
Frees the given array of handles allocated by the preceding function.
BOOLEAN STB_PVRRecordingGetDescription(U32BIT handle, U8BIT *description, U16BIT desc_len)
Gets the short description for a given recording.
BOOLEAN STB_PVRCanDiskBeUsed(U16BIT disk_id)
Checks whether the given disk can be used for PVR functions.
LINK_LIST_PTR_BLK * STB_LLGetFirstBlock(LINK_LIST_HEADER *hdr)
Returns a pointer to the first block in the linked list, identified by hdr.
U32BIT STB_DSKGetSize(U16BIT disk_id)
Returns the size (capacity) of the disk.
void STB_PVRRecordingSetOtherCrid(U32BIT handle, U8BIT *crid)
Sets the series/recommendation CRID for a recording and saves the database file.
U8BIT * STB_PVRGetBookmarkName(void *bookmark_handle)
Allocates and returns the name associated with a bookmark.
U32BIT STB_GetNumBytesInString(U8BIT *string_ptr)
Determines the no of bytes of the given string.
BOOLEAN STB_PVRPlaySetPosition(U8BIT audio_decoder, U8BIT video_decoder, U32BIT position_in_seconds)
Sets the playback position after playback has started (i.e. jump to bookmark)
U8BIT STB_PVRInitPlayback(U8BIT num_audio_decoders, U8BIT num_video_decoders)
Initialisation for playback.
BOOLEAN STB_PVRRecordChangePids(U8BIT rec_index, U16BIT num_pids, S_PVR_PID_INFO *pids_array)
Changes the PIDs while recording.
Header file - Function prototypes for NVM and Heap.
U32BIT STB_PVRGetHandleForRecordingIndex(U8BIT rec_index)
Returns the handle for the given recording index.
const void * STB_MEMReadSecureConstant(U8BIT key, U32BIT *len)
Read constant defined by the given key from secure NVM. The data must not be released (it is managed ...
Header file - Function prototypes for operating system.
System Wide Global Technical Data Type Definitions.
void STB_PVRRecordingSetSeries(U32BIT handle)
Sets a recording to a series recording.
void STB_PVRSetDefaultDisk(U16BIT disk_id)
Sets the disk ID to be used as the default disk for PVR recordings. If this is set to INVALID_DISK_ID...
BOOLEAN STB_PVRApplyDescramblerKey(U8BIT rec_index, E_STB_DMX_DESC_TYPE desc_type, E_STB_DMX_DESC_KEY_PARITY parity, U8BIT *key, U8BIT *iv)
Called to apply the given descrambler key to the PID data being recorded. This function may be called...
BOOLEAN STB_PVRRecordingIsEncrypted(U32BIT handle)
Returns whether the given recording is encrypted.
U32BIT STB_DSKReadFile(void *file, U8BIT *data, U32BIT size)
Reads data from an open file.
Header file - macros and function prototypes for public use.
BOOLEAN STB_PVRRecordingGetGuidance(U32BIT handle, U8BIT *text, U16BIT text_len)
Returns the whether a recording has guidance and the guidance text if available.
void STB_PVRRecordEnabled(U8BIT rec_index, BOOLEAN *video, BOOLEAN *audio)
Returns status of audio/video recording.
void STB_PVRPlayMedium(U8BIT path)
Sets play speed to medium (1x) - has no effect when decoding from demux.
BOOLEAN STB_PVRStartRecording(U8BIT path, U32BIT handle)
Start the PVR record tasks.
U16BIT STB_PVRRecordingGetDescriptionLen(U32BIT handle)
Gets the length of the short description for a given recording.
void STB_PVRRecordingSetRecommendation(U32BIT handle)
Sets a recording to a recommendation recording.
BOOLEAN STB_PVRInitialiseMessages(void)
Initialises file that provides messages for recording er.
BOOLEAN STB_DPIsRecordingPath(U8BIT path)
Is the given decode path being used for recording.
void STB_PVRDiskFree(U16BIT disk_id, U8BIT *hours, U8BIT *mins)
Returns disk space free in hours and minutes.
void STB_AVStartAudioDecoding(U8BIT decoder)
Starts audio decoding on the given audio path.
BOOLEAN STB_PVRIsPlayStarted(U8BIT audio_decoder, U8BIT video_decoder)
Returns status of playback with the given decoders.
BOOLEAN STB_DSKDeleteFile(U16BIT disk_id, U8BIT *filename)
Deletes the file from the given disk.
void STB_PVRPlayFrameInc(U8BIT path)
Increments play by one frame - has no effect when decoding from demux.
S8BIT STB_CompareStringsIgnoreCase(U8BIT *string1_ptr, U8BIT *string2_ptr)
Compares the contents of the two given ASCII strings and returns the status (as per strcmp) but ignor...
U32BIT STB_PVRGetBookmarkTime(void *bookmark_handle)
Returns the time associated with a bookmark.
void STB_PVRUpdateRecordings(BOOLEAN force_load)
Called when a disk is added or removed and updates the disk database and the recordings that are now ...
BOOLEAN STB_PVRRecordingGetParentalLock(U32BIT handle)
Returns the parental lock state of the given recording.
U32BIT STB_CiCcGetRetentionLimit(U8BIT uri[CIP_URI_LEN])
Return the retention limit given a packed URI.
U8BIT STB_DSKGetRepairProgress(U16BIT disk_id)
Gets the progress of the repair operation.
Header file - Function prototypes for heap memory.
U16BIT STB_PVRGetRecordingHandles(U32BIT **handle_array)
Allocates and returns an array of all the recording handles.
void * STB_OSCreateMutex(void)
Create a mutex.
U8BIT STB_CiCcFindSlotForCicamId(U8BIT cicam_id[CIP_CICAM_ID_LEN])
Checks CAMs in all slots to find the one with the given CAM id.
void STB_PVRRecordingSetServiceName(U32BIT handle, U8BIT *service_name)
Sets the service name for a recording and saves the database file.
BOOLEAN STB_PVRRecordingGetLength(U32BIT handle, U8BIT *length_hours, U8BIT *length_mins, U8BIT *length_secs, U32BIT *rec_size_kb)
Returns the length in time and size in KB of the recording with the given handle. ...
BOOLEAN STB_DSKCreateDirectory(U16BIT disk_id, U8BIT *dir_path)
Creates a directory with the given name.
void STB_PVRStopRecording(U8BIT path)
Stop the PVR recording.
U8BIT * STB_PVRRecordingGetName(U32BIT handle)
Gets the name for a recording.
void STB_PVRRecordingSetDescription(U32BIT handle, U8BIT *description)
Sets the short description for a recorded programme.
void STB_DSKSetStandby(BOOLEAN state)
Put all disks into or out of standby mode.
U8BIT STB_HWGetNumRecorders(void)
Returns the number of recordings that can take place at the same time.
Function prototypes for disk functions.
void STB_PVRSetPlayStartMode(U8BIT audio_decoder, U8BIT video_decoder, E_STB_PVR_START_MODE mode)
Set startup mode for playback.
BOOLEAN STB_PVRRecordingGetDateTime(U32BIT handle, U16BIT *date, U8BIT *hours, U8BIT *mins, U8BIT *secs)
Gets the date and time for a recording.
void STB_PVRStartRecordPaused(U8BIT path, U32BIT timeshift_seconds)
Set to start recording in paused mode for timeshift recording.
void STB_PVRPlayReverse(U8BIT path)
Set play backwards - has no effect when decoding from demux.
U16BIT STB_PVRGetBookmarksForRecording(U32BIT handle, void ***bookmarks)
Allocates and returns an array containing the handles of the bookmarks for the recording specified by...
void STB_OSTaskDelay(U16BIT timeout)
Delay Task for Specifed Time Period.
BOOLEAN STB_PVRIsPlayFastest(U8BIT path)
Returns TRUE if play speed is fastest possible.
Header file - Function prototypes for Demux control.
BOOLEAN STB_GCCompareDateTime(U16BIT code1, U8BIT hour1, U8BIT min1, U8BIT secs1, U16BIT code2, U8BIT hour2, U8BIT min2, U8BIT secs2, E_STB_GC_COMPTYPE comp)
Compares one date/time to another.
void STB_PVRRecordingSetEndPadding(U32BIT handle, S32BIT end_padding)
Sets the end padding value for the specified recording.
void STB_DSKRepair(U16BIT disk_id)
Initiates a data repair of the hard disk. This may cause the disk to become unreadable.
U32BIT STB_OSGetClockMilliseconds(void)
Get Current Computer Clock Time.
void STB_PVRPlayStop(U8BIT audio_decoder, U8BIT video_decoder)
Stops playback.
void STB_PVRPlayEnabled(U8BIT audio_decoder, U8BIT video_decoder, BOOLEAN *video, BOOLEAN *audio)
Returns whether audio and video playback has been started.
BOOLEAN STB_PVRSetRecordingPids(U8BIT path, U16BIT num_pids, S_PVR_PID_INFO *pid_array)
Saves (takes a copy of) the array of pids to be recorded.
void STB_AVBlankVideo(U8BIT path, BOOLEAN blank)
Blanks or unblanks the video display.
U16BIT STB_PVRRecordingGetExtendedDescriptionLen(U32BIT handle)
Gets the length of the extended description for a given recording.
void STB_PVRStartPlayRunning(U8BIT path)
Set to start playback in running mode.
void STB_PVRReleaseBookmarks(void **bookmarks, U16BIT num)
Frees a previously allocated array of bookmark handles.
U8BIT STB_DPGetPathDemux(U8BIT path)
Returns the demux path ID acquired by the given decode path.
void STB_PVRStartPlayPaused(U8BIT path)
Set to start playback in paused mode.
BOOLEAN STB_PVRSetPlaySpeed(U8BIT audio_decoder, U8BIT video_decoder, S16BIT speed)
Set the play speed for the specified decoder.
BOOLEAN STB_PVRRecordingGetCrid(U32BIT handle, U8BIT *crid, U16BIT name_len)
Gets the programme CRID for a given recording.
BOOLEAN STB_PVRGotoNextBookmark(U8BIT path)
Jumps playback to the position of the bookmark after the current play position.
BOOLEAN STB_PVRGetElapsedTime(U8BIT audio_decoder, U8BIT video_decoder, U8BIT *elapsed_hours, U8BIT *elapsed_mins, U8BIT *elapsed_secs)
Returns the elapsed playback time in hours, mins & secs.
BOOLEAN STB_PVRRecordingGetExtendedDescription(U32BIT handle, U8BIT *description, U16BIT desc_len)
Gets the extended description for a given recording.
BOOLEAN STB_LLSort(LINK_LIST_HEADER *ll_hdr, S16BIT(*cmp_func)(LINK_LIST_PTR_BLK **, LINK_LIST_PTR_BLK **))
Sorts the blocks of a link list object in ascending or descending order NOTE: The order in which the ...
BOOLEAN STB_PVRStartPlaying(U8BIT path, U32BIT handle, BOOLEAN resume)
Start the PVR playing.
S32BIT STB_GCDateTimeDiff(U16BIT code1, U8BIT hour1, U8BIT min1, U8BIT secs1, U16BIT code2, U8BIT hour2, U8BIT min2, U8BIT secs2)
Returns the difference in seconds between the two dates/times, as time1 - time2, so the result will b...
BOOLEAN STB_DSKIsMounted(U16BIT disk_id)
Checks if the given disk is mounted.
BOOLEAN STB_PVRRecordingGetSeries(U32BIT handle)
Returns whether the given recording is a series.
void STB_PVRPlayPause(U8BIT path)
Pauses play - has no effect when decoding from demux.
U16BIT STB_PVRGetBookmarks(U8BIT path, void ***bookmarks)
Allocates and returns an array containing the handles of the bookmarks for the recording currently be...
BOOLEAN STB_PVRToggleBookmark(U8BIT path)
Creates or deletes a bookmark at the current position during playback. If there's a bookmark within a...
S16BIT STB_PVRGetMinPlaySpeed(U8BIT path)
Reads the PVR min play speed.
void STB_DSKFormat(U16BIT disk_id)
Initiates formatting and partitioning of the hard disk. This will erase all data on the disk! ...
BOOLEAN STB_PVRIsPlaySlowest(U8BIT path)
Returns TRUE if play speed is slowest possible.