Allow specifying options specific to each url in the shout service discovery.
authorAntoine Cellerier <dionoea@videolan.org>
Sun, 23 Dec 2007 22:23:25 +0000 (22:23 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sun, 23 Dec 2007 22:23:25 +0000 (22:23 +0000)
Make it possible to inherit the m3u-extvlcopt option in the m3u parser.

modules/demux/playlist/m3u.c
modules/services_discovery/shout.c

index 8a9e696..109600d 100644 (file)
@@ -109,7 +109,8 @@ static int Demux( demux_t *p_demux )
     const char**ppsz_options = NULL;
     int        i_options = 0;
     vlc_bool_t b_cleanup = VLC_FALSE;
-    vlc_bool_t b_enable_extvlcopt = config_GetInt( p_demux, "m3u-extvlcopt" );
+    vlc_bool_t b_enable_extvlcopt = var_CreateGetInteger( p_demux,
+                                                          "m3u-extvlcopt" );
     input_item_t *p_input;
 
     INIT_PLAYLIST_STUFF;
@@ -220,6 +221,7 @@ static int Demux( demux_t *p_demux )
         }
     }
     HANDLE_PLAY_AND_RELEASE;
+    var_Destroy( p_demux, "m3u-extvlcopt" );
     return 0; /* Needed for correct operation of go back */
 }
 
index 670f094..221ac5c 100644 (file)
@@ -43,13 +43,14 @@ static const struct
 {
     const char *psz_url;
     const char *psz_name;
+    const char *ppsz_options[2];
 } p_items[] = {
     { "http/shout-winamp://www.shoutcast.com/sbin/newxml.phtml",
-      N_("Shoutcast Radio") },
+      N_("Shoutcast Radio"), { NULL } },
     { "http/shout-winamp://www.shoutcast.com/sbin/newtvlister.phtml?alltv=1",
-      N_("Shoutcast TV") },
+      N_("Shoutcast TV"), { NULL } },
     { "http://mafreebox.freebox.fr/freeboxtv/playlist.m3u",
-      N_("Freebox TV") },
+      N_("Freebox TV"), { "m3u-extvlcopt=1", NULL } },
 };
 
 /* Main functions */
@@ -128,11 +129,15 @@ static void ItemAdded( const vlc_event_t * p_event, void * user_data )
 static void Run( services_discovery_t *p_sd )
 {
     enum type_e i_type = (enum type_e)p_sd->p_sys;
+    int i;
     input_item_t *p_input = input_ItemNewExt( p_sd,
                         p_items[i_type].psz_url, _(p_items[i_type].psz_name),
                         0, NULL, -1 );
+    for( i = 0; p_items[i_type].ppsz_options[i] != NULL; i++ )
+        input_ItemAddOption( p_input, p_items[i_type].ppsz_options[i] );
     input_ItemAddOption( p_input, "no-playlist-autostart" );
 
+
     vlc_gc_incref( p_input );
     vlc_event_attach( &p_input->event_manager, vlc_InputItemSubItemAdded,
                       ItemAdded, p_sd );