Class: ONVIF::MediaAction::GetVideoEncoderConfiguration
- Defined in:
- lib/ruby_onvif_client/media/get_video_encoder_configuration.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(c_token, cb) ⇒ Object
c_token 的结构 // [ReferenceToken] Token of the requested video encoder configuration.
Methods inherited from Action
#attribute, #callback, #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
73 74 75 76 77 78 79 |
# File 'lib/ruby_onvif_client/media/get_video_encoder_configuration.rb', line 73 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
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/ruby_onvif_client/media/get_video_encoder_configuration.rb', line 81 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
69 70 71 |
# File 'lib/ruby_onvif_client/media/get_video_encoder_configuration.rb', line 69 def _get_node parent_node, node_name parent_node.at_xpath(node_name) end |
#_get_profiles_supported(xml_doc, parent_name) ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/ruby_onvif_client/media/get_video_encoder_configuration.rb', line 61 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
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/ruby_onvif_client/media/get_video_encoder_configuration.rb', line 92 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(c_token, cb) ⇒ Object
c_token 的结构 // [ReferenceToken] Token of the requested video encoder configuration.
7 8 9 10 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 55 56 57 58 59 60 |
# File 'lib/ruby_onvif_client/media/get_video_encoder_configuration.rb', line 7 def run c_token, cb = Message.new .body = ->(xml) do xml.wsdl(:GetVideoEncoderConfiguration) do xml.wsdl :ConfigurationToken, c_token end end do |success, result| if success xml_doc = Nokogiri::XML(result[:content]) cfr = xml_doc.at_xpath("//trt:Configuration") rcl = xml_doc.at_xpath("//tt:RateControl") configuration = { name: value(xml_doc, "//tt:Name"), use_count: value(xml_doc, "//tt:UseCount"), token: attribute(cfr,"token"), encoding: value(xml_doc, "//tt:Encoding"), resolution: { width: value(_get_node(xml_doc, "//tt:Resolution"), "//tt:Width"), height: value(_get_node(xml_doc, "//tt:Resolution"), "//tt:Height") }, quality: value(xml_doc, "//tt:Quality"), rateControl: { frame_rate_limit: value(rcl, "tt:FrameRateLimit"), encoding_interval: value(rcl, "tt:EncodingInterval"), bitrate_limit: value(rcl, "tt:BitrateLimit") }, mpeg4: { gov_length: value(_get_node(xml_doc, "//tt:MPEG4"), "//tt:GovLength"), mpeg4_profile: value(_get_node(xml_doc, "//tt:MPEG4"), "//tt:Mpeg4Profile") }, h264: { gov_length: value(_get_node(xml_doc, "//tt:H264"), "//tt:GovLength"), h264_profile: value(_get_node(xml_doc, "//tt:H264"), "//tt:H264Profile") }, multicast: { address: { type: value(_get_node(xml_doc, "//tt:Multicast//tt:Address"), '//tt:Type'), ipv4_address: value(_get_node(xml_doc, "//tt:Multicast//tt:Address"), '//tt:IPv4Address'), ipv6_address: value(_get_node(xml_doc, "//tt:Multicast//tt:Address"), '//tt:IPv6Address') }, port: value(_get_node(xml_doc, "//tt:Multicast"), "tt:Port"), ttl: value(_get_node(xml_doc, "//tt:Multicast"), "tt:TTL"), auto_start: value(_get_node(xml_doc, "//tt:Multicast"), "tt:AutoStart") }, session_timeout: value(xml_doc, "//tt:SessionTimeout") } callback cb, success, configuration else callback cb, success, result end end end |