Class: ONVIF::MediaAction::GetAudioEncoderConfigurationOptions
- Defined in:
- lib/ruby_onvif_client/media/get_audio_encoder_configuration_options.rb
Instance Method Summary collapse
-
#run(options, cb) ⇒ Object
options 的结构 { c_token: "xxxxxxx", //[ReferenceToken] Optional audio encoder configuration token that specifies an existing configuration that the options are intended for. p_token: "xxxxxxx" //[ReferenceToken] Optional ProfileToken that specifies an existing media profile that the options shall be compatible with. }.
Methods inherited from Action
#attribute, #callback, #create_event_onvif_message, #create_media_onvif_message, #create_ptz_onvif_message, #initialize, #send_message, #value
Constructor Details
This class inherits a constructor from ONVIF::Action
Instance Method Details
#run(options, cb) ⇒ Object
options 的结构 { c_token: "xxxxxxx", //[ReferenceToken] Optional audio encoder configuration token that specifies an existing configuration that the options are intended for. p_token: "xxxxxxx" //[ReferenceToken] Optional ProfileToken that specifies an existing media profile that the options shall be compatible with. }
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ruby_onvif_client/media/get_audio_encoder_configuration_options.rb', line 11 def run , cb = .body = ->(xml) do xml.wsdl(:GetAudioEncoderConfigurationOptions) do xml.wsdl :ConfigurationToken, [:c_token] xml.wsdl :ProfileToken, [:p_token] end end do |success, result| if success xml_doc = Nokogiri::XML(result[:content]) = [] xml_doc.xpath('//trt:Options//tt:Options').each do |node| = {encoding: value(node, 'tt:Encoding')} bitrate = node.at_xpath("tt:BitrateList") unless bitrate.nil? bitrate_list = [] node.xpath('tt:BitrateList//tt:Items').each do |item| bitrate_list << { items: item.content } end [:bitrate_list] = bitrate_list end sample_rate = node.at_xpath("tt:SampleRateList") unless sample_rate.nil? sample_rate_list = [] node.xpath('tt:SampleRateList//tt:Items').each do |item| sample_rate_list << { items: item.content } end [:sample_rate_list] = sample_rate_list end << end callback cb, success, else callback cb, success, result end end end |