Skip to content
Browse files

Add CODEC_ID constants

  • Loading branch information...
1 parent 5edb7f7 commit 6e71b156229d06a9069abfabc506ec27bb3bfc07 @drbrain committed Sep 2, 2009
Showing with 273 additions and 5 deletions.
  1. +1 −0 lib/ffmpeg.rb
  2. +269 −0 lib/ffmpeg/codec/id.rb
  3. +0 −2 lib/ffmpeg/output_format.rb
  4. +3 −3 test/test_ffmpeg_output_format.rb
View
1 lib/ffmpeg.rb
@@ -151,6 +151,7 @@ def self.builder_defaults(builder)
require 'ffmpeg/codec'
require 'ffmpeg/codec/flag'
require 'ffmpeg/codec/flag2'
+require 'ffmpeg/codec/id'
require 'ffmpeg/image_scaler'
require 'ffmpeg/stream_map'
require 'ffmpeg/pixel_format'
View
269 lib/ffmpeg/codec/id.rb
@@ -0,0 +1,269 @@
+class FFMPEG::Codec::ID
+ inline :C do |builder|
+ FFMPEG.builder_defaults builder
+
+ ID_CONSTANTS = [
+ 'CODEC_ID_AAC',
+ 'CODEC_ID_AASC',
+ 'CODEC_ID_AC3',
+ 'CODEC_ID_ADPCM_4XM',
+ 'CODEC_ID_ADPCM_ADX',
+ 'CODEC_ID_ADPCM_CT',
+ 'CODEC_ID_ADPCM_EA',
+ 'CODEC_ID_ADPCM_EA_MAXIS_XA',
+ 'CODEC_ID_ADPCM_EA_R1',
+ 'CODEC_ID_ADPCM_EA_R2',
+ 'CODEC_ID_ADPCM_EA_R3',
+ 'CODEC_ID_ADPCM_EA_XAS',
+ 'CODEC_ID_ADPCM_G726',
+ 'CODEC_ID_ADPCM_IMA_AMV',
+ 'CODEC_ID_ADPCM_IMA_DK3',
+ 'CODEC_ID_ADPCM_IMA_DK4',
+ 'CODEC_ID_ADPCM_IMA_EA_EACS',
+ 'CODEC_ID_ADPCM_IMA_EA_SEAD',
+ 'CODEC_ID_ADPCM_IMA_ISS',
+ 'CODEC_ID_ADPCM_IMA_QT',
+ 'CODEC_ID_ADPCM_IMA_SMJPEG',
+ 'CODEC_ID_ADPCM_IMA_WAV',
+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ID_VP6',
+ 'CODEC_ID_VP6A',
+ 'CODEC_ID_VP6F',
+ 'CODEC_ID_WAVPACK',
+ 'CODEC_ID_WESTWOOD_SND1',
+ 'CODEC_ID_WMALOSSLESS',
+ 'CODEC_ID_WMAPRO',
+ 'CODEC_ID_WMAV1',
+ 'CODEC_ID_WMAV2',
+ 'CODEC_ID_WMAVOICE',
+ 'CODEC_ID_WMV1',
+ 'CODEC_ID_WMV2',
+ 'CODEC_ID_WMV3',
+ 'CODEC_ID_WNV1',
+ 'CODEC_ID_WS_VQA',
+ 'CODEC_ID_XAN_DPCM',
+ 'CODEC_ID_XAN_WC3',
+ 'CODEC_ID_XAN_WC4',
+ 'CODEC_ID_XSUB',
+ 'CODEC_ID_XVID',
+ 'CODEC_ID_ZLIB',
+ 'CODEC_ID_ZMBV',
+ ]
+
+ ID_CONSTANTS.each do |const|
+ builder.map_c_const const => ['int', const.sub('CODEC_ID_', '')]
+ end
+
+ builder.map_c_const 'CODEC_ID_4XM' => ['int', 'FOURXM']
+ builder.map_c_const 'CODEC_ID_8BPS' => ['int', 'EIGHTBPS']
+ builder.map_c_const 'CODEC_ID_8SVX_EXP' => ['int', 'EIGHTSVX_EXP']
+ builder.map_c_const 'CODEC_ID_8SVX_FIB' => ['int', 'EIGHTSVX_FIB']
+ end
+end
+
View
2 lib/ffmpeg/output_format.rb
@@ -65,8 +65,6 @@ 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,
View
6 test/test_ffmpeg_output_format.rb
@@ -22,13 +22,13 @@ def test_class_guess_format
def test_class_guess_codec
id = @of.guess_codec 'm4v', nil, nil, FFMPEG::Codec::VIDEO
- assert_equal 5, id
+ assert_equal FFMPEG::Codec::ID::H263, id
id = @of.guess_codec nil, @thumbs_up, nil, FFMPEG::Codec::VIDEO
- assert_equal 5, id
+ assert_equal FFMPEG::Codec::ID::H263, id
id = @of.guess_codec nil, nil, 'video/mpeg', FFMPEG::Codec::VIDEO
- assert_equal 5, id
+ assert_equal FFMPEG::Codec::ID::H263, id
end
def test_extensions

0 comments on commit 6e71b15

Please sign in to comment.
Something went wrong with that request. Please try again.