Class: ONVIF::MediaAction::GetVideoEncoderConfigurationOptions
- Defined in:
- lib/ruby_onvif_client/media/get_video_encoder_configuration_options.rb
Instance Method Summary collapse
- #_get_each_val(xml_doc, parent_name) ⇒ Object
- #_get_min_max(xml_doc, parent_name) ⇒ Object
- #_get_node(parent_node, node_name) ⇒ Object
- #_get_profiles_supported(xml_doc, parent_name) ⇒ Object
- #_get_width_height(xml_doc, parent_name) ⇒ Object
-
#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
#_get_each_val(xml_doc, parent_name) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/ruby_onvif_client/media/get_video_encoder_configuration_options.rb', line 67 def _get_each_val xml_doc, parent_name result_val = [] xml_doc.each do |node| result_val << _get_width_height(node, parent_name) end return result_val end |
#_get_min_max(xml_doc, parent_name) ⇒ Object
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/ruby_onvif_client/media/get_video_encoder_configuration_options.rb', line 75 def _get_min_max xml_doc, parent_name this_node = xml_doc unless parent_name.nil? this_node = xml_doc.at_xpath(parent_name) end return { min: value(this_node, "tt:Min"), max: value(this_node, "tt:Max") } end |
#_get_node(parent_node, node_name) ⇒ Object
63 64 65 |
# File 'lib/ruby_onvif_client/media/get_video_encoder_configuration_options.rb', line 63 def _get_node parent_node, node_name parent_node.at_xpath(node_name) end |
#_get_profiles_supported(xml_doc, parent_name) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/ruby_onvif_client/media/get_video_encoder_configuration_options.rb', line 55 def _get_profiles_supported xml_doc, parent_name this_node = xml_doc.at_xpath(parent_name) result_val = [] this_node.each do |node| result_val << node.content end return result_val end |
#_get_width_height(xml_doc, parent_name) ⇒ Object
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/ruby_onvif_client/media/get_video_encoder_configuration_options.rb', line 86 def _get_width_height xml_doc, parent_name this_node = xml_doc unless parent_name.nil? this_node = xml_doc.at_xpath(parent_name) end return { width: value(this_node, "tt:Width"), height: value(this_node, "tt:Height") } end |
#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_video_encoder_configuration_options.rb', line 11 def run , cb = .body = ->(xml) do xml.wsdl(:GetVideoEncoderConfigurationOptions) do xml.wsdl :ConfigurationToken, [:c_token] xml.wsdl :ProfileToken, [:p_token] end end do |success, result| if success xml_doc = Nokogiri::XML(result[:content]) = { quality_range: _get_min_max(_get_node(xml_doc, "//tt:QualityRange")), jpeg: { resolutions_available: _get_each_val(_get_node(xml_doc, "//tt:JPEG"), "//tt:ResolutionsAvailable"), frame_rate_range: _get_min_max(_get_node(xml_doc, "//tt:JPEG"), "//tt:FrameRateRange"), rncoding_interval_range: _get_min_max(_get_node(xml_doc, "//tt:JPEG"), "//tt:FrameRateRange") }, extension: "" } unless xml_doc.at_xpath('//tt:MPEG4').nil? [:mpeg4] = { resolutions_available: _get_each_val(_get_node(xml_doc, "//tt:MPEG4"), "//tt:ResolutionsAvailable"), gov_length_range: _get_min_max(_get_node(xml_doc, "//tt:MPEG4"), "//tt:GovLengthRange"), frame_rate_range: _get_min_max(_get_node(xml_doc, "//tt:MPEG4"), "//tt:FrameRateRange"), rncoding_interval_range: _get_min_max(_get_node(xml_doc, "//tt:MPEG4"), "//tt:EncodingIntervalRange"), mpeg4_profiles_supported: _get_profiles_supported(_get_node(xml_doc, "//tt:MPEG4"), "//tt:Mpeg4ProfilesSupported") } end unless xml_doc.at_xpath('//tt:H264').nil? [:h264] = { resolutions_available: _get_each_val(_get_node(xml_doc, "//tt:H264"), "//tt:ResolutionsAvailable"), gov_length_range: _get_min_max(_get_node(xml_doc, "//tt:H264"), "//tt:GovLengthRange"), frame_rate_range: _get_min_max(_get_node(xml_doc, "//tt:H264"), "//tt:FrameRateRange"), rncoding_interval_range: _get_min_max(_get_node(xml_doc, "//tt:H264"), "//tt:EncodingIntervalRange"), h264_profiles_supported: _get_profiles_supported(_get_node(xml_doc, "//tt:H264"), "//tt:H264ProfilesSupported") } end callback cb, success, else callback cb, success, result end end end |