00001 /* 00002 * hdhomerun_device_selector.h 00003 * 00004 * Copyright © 2009 Silicondust USA Inc. <www.silicondust.com>. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 3 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 00018 * 00019 * As a special exception to the GNU Lesser General Public License, 00020 * you may link, statically or dynamically, an application with a 00021 * publicly distributed version of the Library to produce an 00022 * executable file containing portions of the Library, and 00023 * distribute that executable file under terms of your choice, 00024 * without any of the additional requirements listed in clause 4 of 00025 * the GNU Lesser General Public License. 00026 * 00027 * By "a publicly distributed version of the Library", we mean 00028 * either the unmodified Library as distributed by Silicondust, or a 00029 * modified version of the Library that is distributed under the 00030 * conditions defined in the GNU Lesser General Public License. 00031 */ 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00037 /* 00038 * Create a device selector object for use with dynamic tuner allocation support. 00039 * All tuners registered with a specific device selector instance must have the same signal source. 00040 * The dbg parameter may be null. 00041 */ 00042 extern LIBTYPE struct hdhomerun_device_selector_t *hdhomerun_device_selector_create(struct hdhomerun_debug_t *dbg); 00043 extern LIBTYPE void hdhomerun_device_selector_destroy(struct hdhomerun_device_selector_t *hds, bool_t destroy_devices); 00044 00045 /* 00046 * Get the number of devices in the list. 00047 */ 00048 extern LIBTYPE int hdhomerun_device_selector_get_device_count(struct hdhomerun_device_selector_t *hds); 00049 00050 /* 00051 * Populate device selector with devices from given source. 00052 * Returns the number of devices populated. 00053 */ 00054 extern LIBTYPE int hdhomerun_device_selector_load_from_file(struct hdhomerun_device_selector_t *hds, char *filename); 00055 #if defined(__WINDOWS__) 00056 extern LIBTYPE int hdhomerun_device_selector_load_from_windows_registry(struct hdhomerun_device_selector_t *hds, wchar_t *wsource); 00057 #endif 00058 00059 /* 00060 * Add/remove a device from the selector list. 00061 */ 00062 extern LIBTYPE void hdhomerun_device_selector_add_device(struct hdhomerun_device_selector_t *hds, struct hdhomerun_device_t *hd); 00063 extern LIBTYPE void hdhomerun_device_selector_remove_device(struct hdhomerun_device_selector_t *hds, struct hdhomerun_device_t *hd); 00064 00065 /* 00066 * Find a device in the selector list. 00067 */ 00068 extern LIBTYPE struct hdhomerun_device_t *hdhomerun_device_selector_find_device(struct hdhomerun_device_selector_t *hds, uint32_t device_id, unsigned int tuner_index); 00069 00070 /* 00071 * Select and lock an available device. 00072 * If not null, preference will be given to the prefered device specified. 00073 * The device resource lock must be released by the application when no longer needed by 00074 * calling hdhomerun_device_tuner_lockkey_release(). 00075 * 00076 * Recommended channel change logic: 00077 * 00078 * Start (inactive -> active): 00079 * - Call hdhomerun_device_selector_choose_and_lock() to choose and lock an available tuner. 00080 * 00081 * Stop (active -> inactive): 00082 * - Call hdhomerun_device_tuner_lockkey_release() to release the resource lock and allow the tuner 00083 * to be allocated by other computers. 00084 * 00085 * Channel change (active -> active): 00086 * - If the new channel has a different signal source then call hdhomerun_device_tuner_lockkey_release() 00087 * to release the lock on the tuner playing the previous channel, then call 00088 * hdhomerun_device_selector_choose_and_lock() to choose and lock an available tuner. 00089 * - If the new channel has the same signal source then call hdhomerun_device_tuner_lockkey_request() 00090 * to refresh the lock. If this function succeeds then the same device can be used. If this fucntion fails 00091 * then call hdhomerun_device_selector_choose_and_lock() to choose and lock an available tuner. 00092 */ 00093 extern LIBTYPE struct hdhomerun_device_t *hdhomerun_device_selector_choose_and_lock(struct hdhomerun_device_selector_t *hds, struct hdhomerun_device_t *prefered); 00094 00095 #ifdef __cplusplus 00096 } 00097 #endif
1.6.3