Changeset 7106
- Timestamp:
- 01/25/10 21:50:04 (7 months ago)
- Location:
- trunk/liquidsoap/src
- Files:
-
- 1 added
- 5 modified
-
Makefile (modified) (1 diff)
-
encoder/aacplus_encoder.ml (added)
-
encoder/encoder.ml (modified) (4 diffs)
-
lang/lang_lexer.mll (modified) (1 diff)
-
lang/lang_parser.mly (modified) (4 diffs)
-
outputs/icecast2.ml (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/liquidsoap/src/Makefile
r7072 r7106 102 102 encoder/external_encoder.ml \ 103 103 $(if $(W_LAME),encoder/lame_encoder.ml) \ 104 # $(if $(W_AACPLUS),outputs/aacplus_encoded.ml) \105 $(if $(W_FAAC),outputs/faac_encoded.ml)104 $(if $(W_AACPLUS),encoder/aacplus_encoder.ml) \ 105 # $(if $(W_FAAC),outputs/faac_encoded.ml) 106 106 107 107 outputs = outputs/output.ml $(if $(W_AO),outputs/ao_out.ml) \ -
trunk/liquidsoap/src/encoder/encoder.ml
r7067 r7106 78 78 (string_of_stereo m.stereo) 79 79 m.quality 80 m.samplerate 81 m.bitrate 82 83 end 84 85 module AACPlus = 86 struct 87 88 type t = { 89 channels : int ; 90 samplerate : int ; 91 bitrate : int ; 92 } 93 94 let to_string m = 95 Printf.sprintf "%%aac+(channels=%d,samplerate=%d,bitrate=%d)" 96 m.channels 80 97 m.samplerate 81 98 m.bitrate … … 239 256 | Ogg of Ogg.t 240 257 | MP3 of MP3.t 258 | AACPlus of AACPlus.t 241 259 | External of External.t 242 260 … … 247 265 | MP3 m -> 248 266 { Frame.audio = if m.MP3.stereo then 2 else 1 ; 267 Frame.video = 0 ; Frame.midi = 0 } 268 | AACPlus m -> 269 { Frame.audio = m.AACPlus.channels ; 249 270 Frame.video = 0 ; Frame.midi = 0 } 250 271 | Ogg l -> … … 276 297 | Ogg w -> Ogg.to_string w 277 298 | MP3 w -> MP3.to_string w 299 | AACPlus w -> AACPlus.to_string w 278 300 | External w -> External.to_string w 279 301 -
trunk/liquidsoap/src/lang/lang_lexer.mll
r7066 r7106 138 138 | "%wav" { WAV } 139 139 | "%mp3" { MP3 } 140 | "%aac+" { AACPLUS } 141 | "%aacplus" { AACPLUS } 140 142 141 143 | '[' { LBRA } -
trunk/liquidsoap/src/lang/lang_parser.mly
r7067 r7106 145 145 in 146 146 mk (Encoder (Encoder.MP3 mp3)) 147 148 let mk_aacplus params = 149 let defaults = 150 { Encoder.AACPlus. 151 channels = 2 ; 152 samplerate = 44100 ; 153 bitrate = 64 } 154 in 155 let aacplus = 156 List.fold_left 157 (fun f -> 158 function 159 | ("channels",{ term = Int i }) -> 160 { f with Encoder.AACPlus.channels = i } 161 | ("samplerate",{ term = Int i }) -> 162 { f with Encoder.AACPlus.samplerate = i } 163 | ("bitrate",{ term = Int i }) -> 164 { f with Encoder.AACPlus.bitrate = i } 165 | ("",{ term = Var s }) when String.lowercase s = "mono" -> 166 { f with Encoder.AACPlus.channels = 1 } 167 | ("",{ term = Var s }) when String.lowercase s = "stereo" -> 168 { f with Encoder.AACPlus.channels = 2 } 169 170 | _ -> raise Parsing.Parse_error) 171 defaults params 172 in 173 mk (Encoder (Encoder.AACPlus aacplus)) 147 174 148 175 let mk_external params = … … 390 417 %token <int option list> TIME 391 418 %token <int option list * int option list> INTERVAL 392 %token OGG VORBIS VORBIS_CBR VORBIS_ABR THEORA DIRAC SPEEX WAV MP3 EXTERNAL419 %token OGG VORBIS VORBIS_CBR VORBIS_ABR THEORA DIRAC SPEEX WAV AACPLUS MP3 EXTERNAL 393 420 %token EOF 394 421 %token BEGIN END GETS TILD … … 457 484 | GET expr { mk (Get $2) } 458 485 | MP3 app_opt { mk_mp3 $2 } 486 | AACPLUS app_opt { mk_aacplus $2 } 459 487 | EXTERNAL app_opt { mk_external $2 } 460 488 | WAV app_opt { mk_wav $2 } … … 509 537 | cexpr SET expr { mk (Set ($1,$3)) } 510 538 | MP3 app_opt { mk_mp3 $2 } 539 | AACPLUS app_opt { mk_aacplus $2 } 511 540 | EXTERNAL app_opt { mk_external $2 } 512 541 | WAV app_opt { mk_wav $2 } -
trunk/liquidsoap/src/outputs/icecast2.ml
r7066 r7106 89 89 90 90 let source = Lang.assoc "" 2 p in 91 let encoder_factory, ogg,icecast_info =91 let encoder_factory,format,icecast_info = 92 92 let v = Lang.assoc "" 1 p in 93 93 let enc = Lang.to_format v in 94 let icecast_info, ogg=94 let icecast_info,format = 95 95 match enc with 96 96 | Encoder.MP3 m -> … … 99 99 samplerate = Some m.Encoder.MP3.samplerate ; 100 100 channels = Some (if m.Encoder.MP3.stereo then 2 else 1) 101 }, false 101 }, Some Cry.mpeg 102 | Encoder.AACPlus m -> 103 { quality = None ; 104 bitrate = Some m.Encoder.AACPlus.bitrate ; 105 samplerate = Some m.Encoder.AACPlus.samplerate ; 106 channels = Some m.Encoder.AACPlus.channels 107 }, Some (Cry.content_type_of_string "audio/aacp") 102 108 | Encoder.External m -> 103 109 { quality = None ; … … 105 111 samplerate = Some m.Encoder.External.samplerate ; 106 112 channels = Some m.Encoder.External.channels 107 }, false113 }, None 108 114 | Encoder.Ogg o -> 109 115 let info = … … 118 124 samplerate = Some s ; 119 125 channels = Some n } 126 120 127 | [Encoder.Ogg.Vorbis 121 128 {Encoder.Vorbis.channels=n; … … 138 145 raise (Lang.Invalid_value 139 146 (v, "icy protocol (shoutcast) does not support Ogg")) ; 140 info, true147 info, Some Cry.ogg_application 141 148 | Encoder.WAV _ -> 142 149 raise (Lang.Invalid_value (v, "WAV is not supported")) … … 148 155 (v, "No encoder found for that format")) 149 156 in 150 encoder_factory, ogg, icecast_info157 encoder_factory, format, icecast_info 151 158 in 152 159 … … 154 161 let f = s "format" in 155 162 if f <> "" then Cry.content_type_of_string f else 156 if ogg then Cry.ogg_application else Cry.mpeg 163 match format with 164 | Some x -> x 165 | None -> raise (Lang.Invalid_value (Lang.assoc "" 1 p, 166 "No content-type (mime) found, \ 167 please specify one.")) 168 in 169 170 let ogg = 171 (Cry.string_of_content_type format = Cry.string_of_content_type Cry.ogg_application) || 172 (Cry.string_of_content_type format = Cry.string_of_content_type Cry.ogg_audio) || 173 (Cry.string_of_content_type format = Cry.string_of_content_type Cry.ogg_video) 157 174 in 158 175
