lib/sdp/parser.rb in sdp-0.1.0 vs lib/sdp/parser.rb in sdp-0.2.0
- old
+ new
@@ -23,11 +23,11 @@
field_value.as(:unicast_address) >> eol
end
rule(:session_name) { str('s=') >> field_value_string.as(:name) >> eol }
- rule(:session_information) do
+ rule(:information) do
str('i=') >> field_value_string.as(:information) >> eol
end
rule(:uri) { str('u=') >> field_value.as(:uri) >> eol }
@@ -38,11 +38,13 @@
rule(:phone_number) do
str('p=') >> field_value_string.as(:phone_number) >> eol
end
rule(:connection_data) do
- str('c=') >> field_value >> space >> field_value >> space >>
+ str('c=') >>
+ field_value.as(:connection_network_type) >> space >>
+ field_value.as(:connection_address_type) >> space >>
field_value.as(:connection_address) >> eol
end
rule(:bandwidth) do
str('b=') >> match('[\w]').repeat(2).as(:bandwidth_type) >> str(':') >>
@@ -73,11 +75,11 @@
str('k=') >> match('[\w]').repeat.as(:encryption_method) >>
(str(':') >> field_value.as(:encryption_key)).maybe >> eol
end
rule(:attribute) do
- str('a=') >> match('[\w]').repeat(1).as(:attribute) >>
+ str('a=') >> match('[^:\r\n]').repeat(1).as(:attribute) >>
(str(':') >> field_value_string.as(:value)).maybe >> eol
end
rule(:attributes) { attribute.repeat(1).as(:attributes) }
@@ -95,17 +97,18 @@
rule(:field_value_string) { match('[^\r\n]').repeat }
# The SDP description
rule(:session_section) do
version.maybe >> origin.maybe >> session_name.maybe >>
- session_information.maybe >> uri.maybe >> email_address.maybe >>
+ information.maybe >> uri.maybe >> email_address.maybe >>
phone_number.maybe >> connection_data.maybe >> bandwidth.maybe >>
timing.maybe >> repeat_times.maybe >> time_zones.maybe >>
encryption_keys.maybe >> attributes.maybe
end
rule(:media_section) do
- media_description >> attributes.maybe
+ media_description >> information.maybe >> connection_data.maybe >>
+ bandwidth.maybe >> encryption_keys.maybe >> attributes.maybe
end
rule(:description) do
session_section.as(:session_section) >>
media_section.repeat.as(:media_sections)