Changeset 6682

Show
Ignore:
Timestamp:
06/21/09 14:14:14 (15 months ago)
Author:
metamorph68
Message:

* Make format parameter a global parameter for icecast-based outputs.

For the notice: icecast 2.3.1 does not seem to consider that streams
with content-type audio/ogg contain ogg data.. This patch should sets
the default to application/ogg.

* Also moved protocol parameter parsing to the main icecast. This

parameter was not honored in ogg-based shout outputs, though it
should always be http in this case.

* Expanded commit description :)

Location:
trunk/liquidsoap/src/outputs
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/liquidsoap/src/outputs/external_encoded_shout.ml

    r6613 r6682  
    2727 
    2828let proto = 
    29   (Icecast2.proto ~no_mount ~no_name) @ External_encoded.proto @ 
     29  (Icecast2.proto ~no_mount ~no_name ~format:"mp3") @ External_encoded.proto @ 
    3030  [ "start", Lang.bool_t, Some (Lang.bool true), 
    3131    Some "Start output threads on operator initialization." ; 
     
    3838    "icy_metadata", Lang.bool_t, Some (Lang.bool true), 
    3939    Some "Send new metadata using the ICY protocol."; 
    40     "format", Lang.string_t, Some (Lang.string "mp3"),  
    41     Some "Content-type (mime) for the format. \ 
    42           \"mp3\" is a short-hand for mpeg audio, \"ogg\" for ogg data."; 
    4340    "", Lang.source_t, None, None ] 
    4441 
     
    7370  let mount = s "mount" in 
    7471  let name = s "name" in 
    75   let format =  
    76     match s "format" with 
    77       | "mp3" -> Cry.mpeg 
    78       | "ogg" -> Cry.ogg_application 
    79       | s -> Cry.content_type_of_string s 
    80   in 
    8172  let name = 
    8273    if name = no_name then 
     
    9384    if mount = no_mount then name else mount 
    9485  in 
    95   let protocol = 
    96     let v = List.assoc "protocol" p in 
    97       match Lang.to_string v with 
    98         | "http" -> Cry.Http 
    99         | "icy" -> Cry.Icy 
    100         | _ -> 
    101             raise (Lang.Invalid_value 
    102                      (v, "valid values are 'http' (icecast) "^ 
    103                       "and 'icy' (shoutcast)")) 
    104   in 
    10586  let icecast_info = 
    10687    { 
     
    11596  inherit Output.encoded ~autostart ~name:mount ~kind:"output.icecast" source 
    11697  inherit 
    117     Icecast2.output ~format ~protocol 
    118       ~icecast_info ~mount ~name ~source p as icecast 
     98    Icecast2.output ~icecast_info ~mount ~name ~source p as icecast 
    11999  inherit 
    120100    External_encoded.base ~restart_on_new_track ~restart_on_crash  
  • trunk/liquidsoap/src/outputs/icecast2.ml

    r6560 r6682  
    3535let no_multicast = "no_multicast" 
    3636 
    37 let proto ~no_mount ~no_name = 
     37let proto ~no_mount ~no_name ~format = 
    3838  [ "restart", Lang.bool_t, Some (Lang.bool false), 
    3939    Some "Restart output after a failure. By default, liquidsoap will stop \ 
     
    6060    "headers", Lang.list_t (Lang.product_t Lang.string_t Lang.string_t), 
    6161    Some (Lang.list []), Some "Additional headers." ; 
     62    "format", Lang.string_t, Some (Lang.string format), 
     63    Some "Content-type (mime) for the format. \ 
     64          \"mp3\" is a short-hand for mpeg audio, \"ogg\" for ogg data."; 
    6265    "dumpfile", Lang.string_t, Some (Lang.string ""),  
    6366    Some "Dump stream to file, for debugging purpose. Disabled if empty." 
     
    7073  * value for these depends on the format of the stream (ogg/mp3). *) 
    7174class virtual output 
    72   ?(format=Cry.ogg_audio) ?(protocol=Cry.Http)  
    7375  ~name ~mount ~source ~icecast_info p = 
    7476 
     
    7678    let s v = e Lang.to_string v in 
    7779 
     80    let format = 
     81     match s "format" with 
     82       | "mp3" -> Cry.mpeg 
     83       | "ogg" -> Cry.ogg_application 
     84       | s -> Cry.content_type_of_string s 
     85    in 
     86    let protocol = 
     87      let v = List.assoc "protocol" p in 
     88        match Lang.to_string v with 
     89          | "http" -> Cry.Http 
     90          | "icy" -> Cry.Icy 
     91          | _ -> 
     92              raise (Lang.Invalid_value 
     93                       (v, "valid values are 'http' (icecast) "^ 
     94                        "and 'icy' (shoutcast)")) 
     95    in 
    7896    let restart = e Lang.to_bool "restart" in 
    7997    let restart_delay = float_of_int (e Lang.to_int "restart_delay") in 
  • trunk/liquidsoap/src/outputs/lame_encoded_shout.ml

    r6560 r6682  
    2929 
    3030let proto = 
    31   (Icecast2.proto ~no_mount ~no_name) @ 
     31  (Icecast2.proto ~no_mount ~no_name ~format:"mp3") @ 
    3232  [ "samplerate", Lang.int_t, Some (Lang.int 44100), None; 
    3333    "bitrate", Lang.int_t, Some (Lang.int 128), None; 
     
    6767    if mount = no_mount then name else mount 
    6868  in 
    69   let protocol = 
    70     let v = List.assoc "protocol" p in 
    71       match Lang.to_string v with 
    72         | "http" -> Cry.Http 
    73         | "icy" -> Cry.Icy 
    74         | _ -> 
    75             raise (Lang.Invalid_value 
    76                      (v, "valid values are 'http' (icecast) \ 
    77                           and 'icy' (shoutcast)")) 
    78   in 
    7969  let channels = 
    8070    if not stereo then 1 else Fmt.channels () 
     
    9181object (self) 
    9282  inherit Output.encoded ~autostart ~name:mount ~kind:"output.icecast" source 
    93   inherit 
    94     Icecast2.output ~format:Cry.mpeg ~protocol 
    95       ~icecast_info ~mount ~name ~source p as icecast 
     83  inherit Icecast2.output ~icecast_info ~mount ~name ~source p as icecast 
    9684  inherit base ~quality ~bitrate ~stereo ~samplerate as base 
    9785 
  • trunk/liquidsoap/src/outputs/ogg_output_shout.ml

    r6560 r6682  
    2727 
    2828let proto = 
    29   (Icecast2.proto ~no_mount ~no_name) @ 
     29  (Icecast2.proto ~no_mount ~no_name ~format:"ogg") @ 
    3030  [ "start", Lang.bool_t, Some (Lang.bool true), 
    3131    Some "Start output threads on operator initialization." ; 
     
    5858 
    5959object (self) 
    60   inherit 
    61     Output.encoded ~autostart ~name:mount ~kind:"output.icecast" source 
    62   inherit Icecast2.output  
     60  inherit Output.encoded ~autostart ~name:mount ~kind:"output.icecast" source 
     61  inherit Icecast2.output 
    6362    ~mount ~name ~icecast_info  
    6463    ~source p as icecast