| 47 | | } p_items[] = { |
|---|
| 48 | | { "http/shout-winamp://www.shoutcast.com/sbin/newxml.phtml", |
|---|
| 49 | | N_("Shoutcast Radio"), { NULL } }, |
|---|
| 50 | | { "http/shout-winamp://www.shoutcast.com/sbin/newtvlister.phtml?alltv=1", |
|---|
| 51 | | N_("Shoutcast TV"), { NULL } }, |
|---|
| 52 | | { "http://mafreebox.freebox.fr/freeboxtv/playlist.m3u", |
|---|
| 53 | | N_("Freebox TV"), { "m3u-extvlcopt=1", NULL } }, |
|---|
| | 47 | const struct shout_item_t * p_children; |
|---|
| | 48 | }; |
|---|
| | 49 | |
|---|
| | 50 | #define endItem( ) { NULL, NULL, { NULL }, NULL } |
|---|
| | 51 | #define item( title, url ) { url, title, { NULL }, NULL } |
|---|
| | 52 | #define itemWithOption( title, url, option ) { url, title, { option, NULL }, NULL } |
|---|
| | 53 | #define itemWithChildren( title, children ) { "vlc:skip", title, { NULL }, children } |
|---|
| | 54 | |
|---|
| | 55 | /* WARN: We support only two levels */ |
|---|
| | 56 | |
|---|
| | 57 | static const struct shout_item_t p_frenchtv_canalplus[] = { |
|---|
| | 58 | item( N_("Les Guignols"), "http://www.canalplus.fr/index.php?pid=1784" ), |
|---|
| | 59 | endItem() |
|---|
| | 60 | }; |
|---|
| | 61 | |
|---|
| | 62 | static const struct shout_item_t p_frenchtv[] = { |
|---|
| | 63 | itemWithChildren( N_("Canal +"), p_frenchtv_canalplus ), |
|---|
| | 64 | endItem() |
|---|
| | 65 | }; |
|---|
| | 66 | |
|---|
| | 67 | static const struct shout_item_t p_items[] = { |
|---|
| | 68 | item( N_("Shoutcast Radio"), "http/shout-winamp://www.shoutcast.com/sbin/newxml.phtml" ), |
|---|
| | 69 | item( N_("Shoutcast TV"), "http/shout-winamp://www.shoutcast.com/sbin/newtvlister.phtml?alltv=1" ), |
|---|
| | 70 | itemWithOption ( N_("Freebox TV"), "http://mafreebox.freebox.fr/freeboxtv/playlist.m3u", "m3u-extvlcopt=1" ), |
|---|
| | 71 | itemWithChildren(N_("French TV"), p_frenchtv ), |
|---|
| | 72 | endItem() |
|---|
| | 73 | }; |
|---|
| | 74 | |
|---|
| | 75 | #undef endItem |
|---|
| | 76 | #undef item |
|---|
| | 77 | #undef itemWithOptions |
|---|
| | 78 | #undef itemWithChildren |
|---|
| | 79 | |
|---|
| | 80 | struct shout_category_t { |
|---|
| | 81 | services_discovery_t * p_sd; |
|---|
| | 82 | const char * psz_category; |
|---|
| 123 | | NULL /* no category */ ); |
|---|
| 124 | | } |
|---|
| 125 | | |
|---|
| 126 | | /***************************************************************************** |
|---|
| 127 | | * Run: |
|---|
| 128 | | *****************************************************************************/ |
|---|
| 129 | | static void Run( services_discovery_t *p_sd ) |
|---|
| 130 | | { |
|---|
| 131 | | enum type_e i_type = (enum type_e)p_sd->p_sys; |
|---|
| | 161 | params->psz_category ); |
|---|
| | 162 | } |
|---|
| | 163 | |
|---|
| | 164 | /***************************************************************************** |
|---|
| | 165 | * CreateInputItemFromShoutItem: |
|---|
| | 166 | *****************************************************************************/ |
|---|
| | 167 | static input_item_t * CreateInputItemFromShoutItem( services_discovery_t *p_sd, |
|---|
| | 168 | const struct shout_item_t * p_item ) |
|---|
| | 169 | { |
|---|
| 134 | | p_items[i_type].psz_url, _(p_items[i_type].psz_name), |
|---|
| 135 | | 0, NULL, -1 ); |
|---|
| 136 | | for( i = 0; p_items[i_type].ppsz_options[i] != NULL; i++ ) |
|---|
| 137 | | input_ItemAddOption( p_input, p_items[i_type].ppsz_options[i] ); |
|---|
| | 173 | p_item->psz_url, _(p_item->psz_name), |
|---|
| | 174 | 0, NULL, -1 ); |
|---|
| | 175 | |
|---|
| | 176 | /* Copy options */ |
|---|
| | 177 | for( i = 0; p_item->ppsz_options[i] != NULL; i++ ) |
|---|
| | 178 | input_ItemAddOption( p_input, p_item->ppsz_options[i] ); |
|---|
| | 181 | return p_input; |
|---|
| | 182 | } |
|---|
| | 183 | |
|---|
| | 184 | /***************************************************************************** |
|---|
| | 185 | * AddSubitemsOfShoutItemURL: |
|---|
| | 186 | *****************************************************************************/ |
|---|
| | 187 | static void AddSubitemsOfShoutItemURL( services_discovery_t *p_sd, |
|---|
| | 188 | const struct shout_item_t * p_item, |
|---|
| | 189 | const char * psz_category ) |
|---|
| | 190 | { |
|---|
| | 191 | struct shout_category_t category = { p_sd, psz_category }; |
|---|
| | 192 | |
|---|
| | 193 | /* Create the item */ |
|---|
| | 194 | input_item_t *p_input = CreateInputItemFromShoutItem( p_sd, p_item ); |
|---|
| | 195 | |
|---|
| | 196 | /* Read every subitems, and add them in ItemAdded */ |
|---|
| | 207 | * Run: |
|---|
| | 208 | *****************************************************************************/ |
|---|
| | 209 | static void Run( services_discovery_t *p_sd ) |
|---|
| | 210 | { |
|---|
| | 211 | enum type_e i_type = (enum type_e)p_sd->p_sys; |
|---|
| | 212 | int i, j; |
|---|
| | 213 | |
|---|
| | 214 | if( !p_items[i_type].p_children ) |
|---|
| | 215 | { |
|---|
| | 216 | AddSubitemsOfShoutItemURL( p_sd, &p_items[i_type], NULL ); |
|---|
| | 217 | return; |
|---|
| | 218 | } |
|---|
| | 219 | for( i = 0; p_items[i_type].p_children[i].psz_name; i++ ) |
|---|
| | 220 | { |
|---|
| | 221 | const struct shout_item_t * p_subitem = &p_items[i_type].p_children[i]; |
|---|
| | 222 | if( !p_subitem->p_children ) |
|---|
| | 223 | { |
|---|
| | 224 | AddSubitemsOfShoutItemURL( p_sd, p_subitem, p_subitem->psz_name ); |
|---|
| | 225 | continue; |
|---|
| | 226 | } |
|---|
| | 227 | for( j = 0; p_subitem->p_children[j].psz_name; j++ ) |
|---|
| | 228 | { |
|---|
| | 229 | input_item_t *p_input = CreateInputItemFromShoutItem( p_sd, &p_subitem->p_children[j] ); |
|---|
| | 230 | services_discovery_AddItem( p_sd, |
|---|
| | 231 | p_input, |
|---|
| | 232 | p_subitem->psz_name ); |
|---|
| | 233 | vlc_gc_decref( p_input ); |
|---|
| | 234 | } |
|---|
| | 235 | } |
|---|
| | 236 | } |
|---|
| | 237 | |
|---|
| | 238 | /***************************************************************************** |
|---|