From 91ed9937c9af4892cf73e44f11062066daa023fc Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Wed, 12 Jan 2011 11:52:45 -0200 Subject: [PATCH 1/2] Avoid stack level too deep exception when unknown number of audio channels --- lib/rvideo/inspector.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rvideo/inspector.rb b/lib/rvideo/inspector.rb index a0d0caa..292ec34 100644 --- a/lib/rvideo/inspector.rb +++ b/lib/rvideo/inspector.rb @@ -400,7 +400,7 @@ def audio_channels when "stereo" 2 else - raise RuntimeError, "Unknown number of channels: #{audio_channels}" + raise RuntimeError, "Unknown number of channels: #{audio_match[5]}" end end @@ -542,4 +542,4 @@ def video_match match end end -end \ No newline at end of file +end From 31c1cc7f5c2df603ef02e690a406c012c003686e Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Wed, 16 Feb 2011 15:47:27 -0200 Subject: [PATCH 2/2] Fixed audio_channels method for when stream contains 'x channels' --- lib/rvideo/inspector.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rvideo/inspector.rb b/lib/rvideo/inspector.rb index 292ec34..3a35734 100644 --- a/lib/rvideo/inspector.rb +++ b/lib/rvideo/inspector.rb @@ -393,6 +393,7 @@ def audio_channels_string def audio_channels return nil unless audio? + return audio_match[5].to_i if (audio_match[5].to_i > 0) case audio_match[5] when "mono" @@ -523,7 +524,7 @@ def bitrate_match def audio_match return nil unless valid? - /Stream\s*(.*?)[,|:|\(|\[].*?\s*Audio:\s*(.*?),\s*([0-9\.]*) (\w*),\s*([a-zA-Z:]*)/.match(audio_stream) + /Stream\s*(.*?)[,|:|\(|\[].*?\s*Audio:\s*(.*?),\s*([0-9\.]*) (\w*),\s*([(\d)*a-zA-Z:]*)/.match(audio_stream) end def video_match