Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Test some of FFMPEG::OutputFormat

  • Loading branch information...
commit c7bd1f63deb06aed6a5488d4d6fcd83ab156a722 1 parent 58fd2b0
@drbrain authored
Showing with 60 additions and 1 deletion.
  1. +3 −1 lib/ffmpeg/output_format.rb
  2. +57 −0 test/test_ffmpeg_output_format.rb
View
4 lib/ffmpeg/output_format.rb
@@ -65,6 +65,8 @@ class FFMPEG::OutputFormat
##
# :method: guess_codec
+ #
+ # TODO CODEC_ID constants
builder.c <<-C, :method_name => :guess_codec
int of_guess_codec(VALUE _shortname, VALUE _filename, VALUE _mimetype,
@@ -94,7 +96,7 @@ class FFMPEG::OutputFormat
builder.reader :mime_type, 'char *'
builder.reader :extensions, 'char *'
- builder.reader :flags, 'int'
+ builder.reader :flags, 'int' # TODO flag constants
end
def initialize(format_context)
View
57 test/test_ffmpeg_output_format.rb
@@ -0,0 +1,57 @@
+require 'ffmpeg/test_case'
+
+class TestFFMPEGOutputFormat < FFMPEG::TestCase
+
+ def setup
+ super
+
+ @OF = FFMPEG::OutputFormat
+ @of = @OF.guess_format nil, @thumbs_up, nil
+ end
+
+ def test_class_guess_format
+ of = @OF.guess_format 'm4v', nil, nil
+ assert_equal 'm4v', of.name
+
+ of = @OF.guess_format nil, @thumbs_up, nil
+ assert_equal '3gp', of.name
+
+ of = @OF.guess_format nil, nil, 'video/mpeg'
+ assert_equal 'mpeg', of.name
+ end
+
+ def test_class_guess_codec
+ id = @of.guess_codec 'm4v', nil, nil, FFMPEG::Codec::VIDEO
+ assert_equal 5, id
+
+ id = @of.guess_codec nil, @thumbs_up, nil, FFMPEG::Codec::VIDEO
+ assert_equal 5, id
+
+ id = @of.guess_codec nil, nil, 'video/mpeg', FFMPEG::Codec::VIDEO
+ assert_equal 5, id
+ end
+
+ def test_extensions
+ assert_equal '3gp', @of.extensions
+ end
+
+ def test_flags
+ assert_equal 64, @of.flags
+ end
+
+ def test_long_name
+ assert_equal '3GP format', @of.long_name
+ end
+
+ def test_mime_type
+ assert_raises ArgumentError do
+ @of.mime_type
+ end
+ end
+
+ def test_name
+ assert_equal '3gp', @of.name
+ end
+
+end
+
Please sign in to comment.
Something went wrong with that request. Please try again.