CC-3074: Give users the choice of which hardware sound API they wish to

use (instead of hardcoded to ALSA)

- finished everything except LS part(including upgrade and UI)
This commit is contained in:
James 2011-11-30 19:01:40 -05:00 committed by Martin Konecny
parent 06cbe215a3
commit 043f0c29a1
10 changed files with 62 additions and 2 deletions

View File

@ -198,6 +198,7 @@ class PreferenceController extends Zend_Controller_Action
} }
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata'); $values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
$values['output_sound_device_type'] = $form->getValue('output_sound_device_type');
} }
if(!$error){ if(!$error){
Application_Model_StreamSetting::setStreamSetting($values); Application_Model_StreamSetting::setStreamSetting($values);

View File

@ -25,6 +25,17 @@ class Application_Form_StreamSetting extends Zend_Form
$output_sound_device->setAttrib("readonly", true); $output_sound_device->setAttrib("readonly", true);
} }
$this->addElement($output_sound_device); $this->addElement($output_sound_device);
$output_types = array("ALSA"=>"ALSA", "AO"=>"AO", "OSS"=>"OSS", "Portaudio"=>"Portaudio", "Pulseaudio"=>"Pulseaudio");
$output_type = new Zend_Form_Element_Select('output_sound_device_type');
$output_type->setLabel("Output Type")
->setMultiOptions($output_types)
->setValue($setting['output_sound_device_type'])
->setDecorators(array('ViewHelper'));
if($setting['output_sound_device'] != "true"){
$output_type->setAttrib("disabled", "disabled");
}
$this->addElement($output_type);
} }
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
@ -39,7 +50,8 @@ class Application_Form_StreamSetting extends Zend_Form
} }
public function isValid($data){ public function isValid($data){
$this->populate(array("output_sound_device"=>$data['output_sound_device'], "icecast_vorbis_metadata"=>$data['icecast_vorbis_metadata'])); $this->populate(array("output_sound_device"=>$data['output_sound_device'], "icecast_vorbis_metadata"=>$data['icecast_vorbis_metadata'],
"output_sound_device_type"=>$data['output_sound_device_type']));
return true; return true;
} }
} }

View File

@ -68,7 +68,6 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
if($disable_all){ if($disable_all){
$bitrate->setAttrib("disabled", "disabled"); $bitrate->setAttrib("disabled", "disabled");
} }
$this->addElement($type);
$this->addElement($bitrate); $this->addElement($bitrate);
$output = new Zend_Form_Element_Select('output'); $output = new Zend_Form_Element_Select('output');

View File

@ -20,6 +20,14 @@
<dd id="hardwareOut-element"> <dd id="hardwareOut-element">
<?php echo $this->form->getElement('output_sound_device') ?> <?php echo $this->form->getElement('output_sound_device') ?>
</dd> </dd>
<dt id="hardwareOutType-label">
<label class="required">
<?php echo $this->form->getElement('output_sound_device_type')->getLabel() ?> :
</label>
</dt>
<dd id="hardwareOutType-element">
<?php echo $this->form->getElement('output_sound_device_type') ?>
</dd>
<?php } ?> <?php } ?>
<dt id="vorbisMetadata-label"> <dt id="vorbisMetadata-label">
<label class="required"> <label class="required">

View File

@ -8,6 +8,7 @@ INSERT INTO cc_pref("keystr", "valstr") VALUES('max_bitrate', '320');
INSERT INTO cc_pref("keystr", "valstr") VALUES('plan_level', 'disabled'); INSERT INTO cc_pref("keystr", "valstr") VALUES('plan_level', 'disabled');
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device', 'false', 'boolean'); INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device', 'false', 'boolean');
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device_type', 'ALSA', 'string');
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('icecast_vorbis_metadata', 'false', 'boolean'); INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('icecast_vorbis_metadata', 'false', 'boolean');
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_enable', 'true', 'boolean'); INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_enable', 'true', 'boolean');

View File

@ -125,6 +125,14 @@ $(document).ready(function() {
rebuildStreamURL($(this)) rebuildStreamURL($(this))
}) })
$("#output_sound_device").change(function(){
if($(this).is(':checked')){
$("select[id=output_sound_device_type]").removeAttr('disabled')
}else{
$("select[id=output_sound_device_type]").attr('disabled', 'disabled')
}
})
$("select[id$=data-type]").change(function(){ $("select[id$=data-type]").change(function(){
if($(this).val() == 'ogg'){ if($(this).val() == 'ogg'){
restrictOggBitrate($(this), true) restrictOggBitrate($(this), true)

View File

@ -162,6 +162,7 @@ class AirtimeDatabaseUpgrade{
INSERT INTO cc_pref(keystr, valstr) VALUES('plan_level', 'disabled'); INSERT INTO cc_pref(keystr, valstr) VALUES('plan_level', 'disabled');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('output_sound_device', 'false', 'boolean'); INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('output_sound_device', 'false', 'boolean');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('output_sound_device_type', 'ALSA', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('icecast_vorbis_metadata', 'false', 'boolean'); INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('icecast_vorbis_metadata', 'false', 'boolean');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_enable', 'true', 'boolean'); INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_enable', 'true', 'boolean');

View File

@ -6,6 +6,7 @@
# Output settings # # Output settings #
########################################### ###########################################
output_sound_device = false output_sound_device = false
output_sound_device_type = "ALSA"
s1_output = "icecast" s1_output = "icecast"
s2_output = "icecast" s2_output = "icecast"
s3_output = "icecast" s3_output = "icecast"

View File

@ -6,6 +6,7 @@
# Output settings # # Output settings #
########################################### ###########################################
output_sound_device = false output_sound_device = false
output_sound_device_type = "ALSA"
s1_output = "icecast" s1_output = "icecast"
s2_output = "icecast" s2_output = "icecast"
s3_output = "icecast" s3_output = "icecast"

View File

@ -53,6 +53,34 @@ add_skip_command(s)
s = map_metadata(append_title, s) s = map_metadata(append_title, s)
if output_sound_device then if output_sound_device then
output.prefered=output.dummy
%ifdef output.alsa
if output_sound_device_type == "ALSA" then
output.prefered=output.alsa
end
%endif
%ifdef output.ao
if output_sound_device_type == "AO" then
output.prefered=output.ao
output.prefered(mksafe(s))
end
%endif
%ifdef output.oss
if output_sound_device_type == "OSS" then
output.prefered=output.oss
end
%endif
%ifdef output.portaudio
if output_sound_device_type == "Portaudio" then
output.prefered=output.portaudio
end
%endif
%ifdef output.pulseaudio
if output_sound_device_type == "Pulseaudio" then
output.prefered=output.pulseaudio
end
%endif
ignore(out(s)) ignore(out(s))
end end