vlc_services_discovery.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * vlc_services_discovery.h : Services Discover functions
00003  *****************************************************************************
00004  * Copyright (C) 1999-2004 the VideoLAN team
00005  * $Id: 58ff2a77ce8a52bac304f7279c013ef8667ccb98 $
00006  *
00007  * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef VLC_SERVICES_DISCOVERY_H_
00025 #define VLC_SERVICES_DISCOVERY_H_
00026 
00027 #include <vlc_input.h>
00028 #include <vlc_events.h>
00029 #include <vlc_probe.h>
00030 
00031 /**
00032  * \file
00033  * This file functions and structures for service discovery in vlc
00034  */
00035 
00036 # ifdef __cplusplus
00037 extern "C" {
00038 # endif
00039 
00040 /*
00041  * @{
00042  */
00043 
00044 struct services_discovery_t
00045 {
00046     VLC_COMMON_MEMBERS
00047     module_t *          p_module;
00048 
00049     vlc_event_manager_t event_manager;      /* Accessed through Setters for non class function */
00050 
00051     char *psz_name;
00052     config_chain_t *p_cfg;
00053 
00054     services_discovery_sys_t *p_sys;
00055 };
00056 
00057 enum services_discovery_category_e
00058 {
00059     SD_CAT_DEVICES = 1,
00060     SD_CAT_LAN,
00061     SD_CAT_INTERNET,
00062     SD_CAT_MYCOMPUTER
00063 };
00064 
00065 /***********************************************************************
00066  * Service Discovery
00067  ***********************************************************************/
00068 
00069 /* Get the services discovery modules names to use in Create(), in a null
00070  * terminated string array. Array and string must be freed after use. */
00071 VLC_EXPORT( char **, vlc_sd_GetNames, ( vlc_object_t *, char ***, int ** ) LIBVLC_USED );
00072 #define vlc_sd_GetNames(obj, pln, pcat ) \
00073         vlc_sd_GetNames(VLC_OBJECT(obj), pln, pcat)
00074 
00075 /* Creation of a service_discovery object */
00076 VLC_EXPORT( services_discovery_t *, vlc_sd_Create, ( vlc_object_t *, const char * ) LIBVLC_USED );
00077 VLC_EXPORT( bool, vlc_sd_Start, ( services_discovery_t * ) );
00078 VLC_EXPORT( void, vlc_sd_Stop, ( services_discovery_t * ) );
00079 VLC_EXPORT( void, vlc_sd_Destroy, ( services_discovery_t * ) );
00080 
00081 static inline void vlc_sd_StopAndDestroy( services_discovery_t * p_this )
00082 {
00083     vlc_sd_Stop( p_this );
00084     vlc_sd_Destroy( p_this );
00085 }
00086 
00087 /* Read info from discovery object */
00088 VLC_EXPORT( char *,                 services_discovery_GetLocalizedName, ( services_discovery_t * p_this ) LIBVLC_USED );
00089 
00090 /* Receive event notification (preferred way to get new items) */
00091 VLC_EXPORT( vlc_event_manager_t *,  services_discovery_EventManager, ( services_discovery_t * p_this ) LIBVLC_USED );
00092 
00093 /* Used by services_discovery to post update about their items */
00094     /* About the psz_category, it is a legacy way to add info to the item,
00095      * for more options, directly set the (meta) data on the input item */
00096 VLC_EXPORT( void,                   services_discovery_AddItem, ( services_discovery_t * p_this, input_item_t * p_item, const char * psz_category ) );
00097 VLC_EXPORT( void,                   services_discovery_RemoveItem, ( services_discovery_t * p_this, input_item_t * p_item ) );
00098 
00099 
00100 /* SD probing */
00101 
00102 VLC_EXPORT(int, vlc_sd_probe_Add, (vlc_probe_t *, const char *, const char *, int category));
00103 
00104 #define VLC_SD_PROBE_SUBMODULE \
00105     add_submodule() \
00106         set_capability( "services probe", 100 ) \
00107         set_callbacks( vlc_sd_probe_Open, NULL )
00108 
00109 #define VLC_SD_PROBE_HELPER(name, longname, cat) \
00110 static int vlc_sd_probe_Open (vlc_object_t *obj) \
00111 { \
00112     return vlc_sd_probe_Add ((struct vlc_probe_t *)obj, \
00113                              name "{longname=\"" longname "\"}", \
00114                              longname, cat); \
00115 }
00116 
00117 /** @} */
00118 # ifdef __cplusplus
00119 }
00120 # endif
00121 
00122 #endif

Generated on Mon Nov 22 07:55:20 2010 for VLC by  doxygen 1.5.6