wiretap 0.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/README +2 -1
  2. data/ext/Makefile +27 -24
  3. data/ext/audio_format.cpp +10 -8
  4. data/ext/charstream.h +41 -0
  5. data/ext/extconf.rb +8 -10
  6. data/ext/frame_io.cpp +120 -0
  7. data/ext/frame_io.h +45 -0
  8. data/ext/image_format.cpp +49 -169
  9. data/ext/image_io.cpp +466 -0
  10. data/ext/image_io.h +73 -0
  11. data/ext/node.cpp +71 -48
  12. data/ext/nodeframes.cpp +36 -34
  13. data/ext/nodemetadata.cpp +21 -3
  14. data/ext/server.cpp +2 -2
  15. data/ext/serverlist.cpp +20 -8
  16. data/ext/wiretap.cpp +11 -8
  17. data/ext/wiretap.h +17 -13
  18. data/lib/wiretap.rb +65 -5
  19. data/test_new/common.rb +8 -0
  20. data/{test/wiretap-images → test_new/fixtures/img/ppm-8bit}/01.ppm +0 -0
  21. data/test_new/fixtures/raw/cube_2k_12bitP_1f/0.stoneimage +0 -0
  22. data/test_new/fixtures/raw/cube_2k_8bit_1f/0.stoneimage +0 -0
  23. data/test_new/fixtures/raw/cube_SD_10bit_5f/0.stoneimage +0 -0
  24. data/test_new/fixtures/raw/cube_SD_10bit_5f/1.stoneimage +0 -0
  25. data/test_new/fixtures/raw/cube_SD_10bit_5f/2.stoneimage +0 -0
  26. data/test_new/fixtures/raw/cube_SD_10bit_5f/3.stoneimage +0 -0
  27. data/test_new/fixtures/raw/cube_SD_10bit_5f/4.stoneimage +0 -0
  28. data/test_new/fixtures/raw/cube_SD_12bitP_5f/0.stoneimage +0 -0
  29. data/test_new/fixtures/raw/cube_SD_12bitP_5f/1.stoneimage +0 -0
  30. data/test_new/fixtures/raw/cube_SD_12bitP_5f/2.stoneimage +0 -0
  31. data/test_new/fixtures/raw/cube_SD_12bitP_5f/3.stoneimage +0 -0
  32. data/test_new/fixtures/raw/cube_SD_12bitP_5f/4.stoneimage +0 -0
  33. data/test_new/fixtures/raw/cube_SD_12bitU_5f/0.stoneimage +0 -0
  34. data/test_new/fixtures/raw/cube_SD_12bitU_5f/1.stoneimage +0 -0
  35. data/test_new/fixtures/raw/cube_SD_12bitU_5f/2.stoneimage +0 -0
  36. data/test_new/fixtures/raw/cube_SD_12bitU_5f/3.stoneimage +0 -0
  37. data/test_new/fixtures/raw/cube_SD_12bitU_5f/4.stoneimage +0 -0
  38. data/test_new/fixtures/raw/cube_SD_8bit_8f/0.stoneimage +0 -0
  39. data/test_new/fixtures/raw/cube_SD_8bit_8f/1.stoneimage +0 -0
  40. data/test_new/fixtures/raw/cube_SD_8bit_8f/2.stoneimage +0 -0
  41. data/test_new/fixtures/raw/cube_SD_8bit_8f/3.stoneimage +0 -0
  42. data/test_new/fixtures/raw/cube_SD_8bit_8f/4.stoneimage +0 -0
  43. data/test_new/fixtures/raw/cube_SD_8bit_8f/5.stoneimage +0 -0
  44. data/test_new/fixtures/raw/cube_SD_8bit_8f/6.stoneimage +0 -0
  45. data/test_new/fixtures/raw/cube_SD_8bit_8f/7.stoneimage +0 -0
  46. data/{test/wiretap-images/b1.stonesound → test_new/fixtures/raw-snd/simple.stonesound} +0 -0
  47. data/{test/wiretap-images/output.wav → test_new/fixtures/snd/simple-wave.wav} +0 -0
  48. data/test_new/test_audio_conversions.rb +28 -0
  49. data/test_new/test_image_conversions.rb +132 -0
  50. data/test_new/test_parts/connect_to_test_host.rb +27 -0
  51. data/test_new/test_parts/constants.rb +7 -0
  52. data/test_new/test_parts/create_test_project.rb +37 -0
  53. data/test_new/test_parts/raw_formats_and_uploads.rb +170 -0
  54. data/test_new/test_parts/server_list.rb +20 -0
  55. data/test_new/test_parts/simple_node_lookup_and_browsing.rb +76 -0
  56. data/test_new/test_suite.rb +70 -0
  57. data/{test/convert.rb → test_new/test_thread_worker.rb} +2 -3
  58. metadata +71 -61
  59. data/ext/bmp.cpp +0 -65
  60. data/ext/image.h +0 -27
  61. data/ext/ppm.cpp +0 -132
  62. data/ext/sgi.cpp +0 -69
  63. data/test/audio.rb +0 -27
  64. data/test/image.rb +0 -101
  65. data/test/read_frames.rb +0 -142
  66. data/test/wiretap-images/32bit.stoneimage +0 -621
  67. data/test/wiretap-images/36bit.stoneimage +0 -1036
  68. data/test/wiretap-images/48bit.stoneimage +1 -800
  69. data/test/wiretap-images/a.stoneimage +0 -0
  70. data/test/wiretap-images/a0.stoneimage +0 -0
  71. data/test/wiretap-images/a1.stoneimage +0 -0
  72. data/test/wiretap-images/a2.stoneimage +0 -0
  73. data/test/wiretap-images/a3.stoneimage +0 -0
  74. data/test/wiretap-images/a4.stoneimage +0 -0
  75. data/test/wiretap-images/importable-seq/00000001.ppm +0 -0
  76. data/test/wiretap-images/importable-seq/00000002.ppm +0 -0
  77. data/test/wiretap-images/importable-seq/00000003.ppm +0 -0
  78. data/test/wiretap-images/importable-seq/00000004.ppm +0 -0
  79. data/test/wiretap-images/importable-seq/00000005.ppm +0 -0
  80. data/test/wiretap-images/importable-seq/00000006.ppm +0 -0
  81. data/test/wiretap-images/importable-seq/00000007.ppm +0 -0
  82. data/test/wiretap-images/importable-seq/00000008.ppm +0 -0
  83. data/test/wiretap-images/importable-seq/00000009.ppm +0 -0
  84. data/test/wiretap-images/importable-seq/00000010.ppm +0 -0
  85. data/test/wiretap-images/importable-seq/00000011.ppm +0 -0
  86. data/test/wiretap-images/importable-seq/00000012.ppm +0 -0
  87. data/test/wiretap-images/monsters_001.tif +0 -0
  88. data/test/wiretap-images/monsters_002.tif +0 -0
  89. data/test/wiretap-images/monsters_003.tif +0 -0
  90. data/test/wiretap-images/output.mov +0 -0
  91. data/test/write_frames.rb +0 -82
data/test/image.rb DELETED
@@ -1,101 +0,0 @@
1
- require 'test/unit'
2
- require File.dirname(__FILE__) + '/../lib/wiretap'
3
-
4
- class ImageTest < Test::Unit::TestCase
5
-
6
- def setup
7
- @width = 720
8
- @height = 576
9
- @temp_outdir = "/tmp/wiretap_tests"
10
- `mkdir #{@temp_outdir} 2>/dev/null`
11
- end
12
-
13
- def test_dump_bmp_24
14
- Wiretap.dump_image_format = :bmp
15
- 0.upto(3) do |i|
16
- File.open(File.dirname(__FILE__) + "/wiretap-images/a#{i}.stoneimage") do |f|
17
- `rm -f #{@temp_outdir}/a#{i}.bmp`
18
- Wiretap.dump_image_data(@width, @height, 24, f.read(@width*@height*3), "#{@temp_outdir}/a#{i}.bmp")
19
- end
20
- end
21
- end
22
-
23
- def test_dump_sgi_24
24
- Wiretap.dump_image_format = :sgi
25
- 0.upto(3) do |i|
26
- File.open(File.dirname(__FILE__) + "/wiretap-images/a#{i}.stoneimage") do |f|
27
- `rm -f #{@temp_outdir}/a#{i}.sgi`
28
- Wiretap.dump_image_data(@width, @height, 24, f.read(@width*@height*3), "#{@temp_outdir}/a#{i}.sgi")
29
- end
30
- end
31
- end
32
-
33
- def test_dump_bmp36
34
- Wiretap.dump_image_format = :bmp
35
- `rm -f #{@temp_outdir}/a4.bmp`
36
- File.open(File.dirname(__FILE__) + "/wiretap-images/a4.stoneimage") do |f|
37
- Wiretap.dump_image_data(@width, @height, 36, f.read(@width*@height*9/2), "#{@temp_outdir}/a4.bmp")
38
- end
39
- `rm -f #{@temp_outdir}/36bit.bmp`
40
- File.open(File.dirname(__FILE__) + "/wiretap-images/36bit.stoneimage") do |f|
41
- Wiretap.dump_image_data(@width, @height, 36, f.read(@width*@height*9/2), "#{@temp_outdir}/36bit.bmp")
42
- # `open /tmp/36bit.sgi`
43
- end
44
- end
45
-
46
- def test_dump_sgi36
47
- Wiretap.dump_image_format = :sgi
48
- `rm -f #{@temp_outdir}/a4.sgi`
49
- File.open(File.dirname(__FILE__) + "/wiretap-images/a4.stoneimage") do |f|
50
- Wiretap.dump_image_data(@width, @height, 36, f.read(@width*@height*9/2), "#{@temp_outdir}/a4.sgi")
51
- end
52
- `rm -f #{@temp_outdir}/36bit.sgi`
53
- File.open(File.dirname(__FILE__) + "/wiretap-images/36bit.stoneimage") do |f|
54
- Wiretap.dump_image_data(@width, @height, 36, f.read(@width*@height*9/2), "#{@temp_outdir}/36bit.sgi")
55
- # `open /tmp/36bit.sgi`
56
- end
57
- end
58
-
59
- def test_dump_bmp32
60
- Wiretap.dump_image_format = :bmp
61
- `rm -f #{@temp_outdir}/32bit.bmp`
62
- File.open(File.dirname(__FILE__) + "/wiretap-images/32bit.stoneimage") do |f|
63
- Wiretap.dump_image_data(@width, @height, 32, f.read(@width*@height*9/2), "#{@temp_outdir}/32bit.bmp")
64
- # `open /tmp/32bit.sgi`
65
- end
66
- end
67
- def test_dump_sgi32
68
- Wiretap.dump_image_format = :sgi
69
- `rm -f #{@temp_outdir}/32bit.sgi`
70
- File.open(File.dirname(__FILE__) + "/wiretap-images/32bit.stoneimage") do |f|
71
- Wiretap.dump_image_data(@width, @height, 32, f.read(@width*@height*9/2), "#{@temp_outdir}/32bit.sgi")
72
- # `open /tmp/32bit.sgi`
73
- end
74
- end
75
-
76
- def test_dump_sgi48
77
- Wiretap.dump_image_format = :sgi
78
- `rm -f #{@temp_outdir}/48bit.sgi`
79
- File.open(File.dirname(__FILE__) + "/wiretap-images/48bit.stoneimage") do |f|
80
- Wiretap.dump_image_data(@width, @height, 48, f.read(@width*@height*6), "#{@temp_outdir}/48bit.sgi")
81
- # `open #{@temp_outdir}/48bit.sgi`
82
- end
83
-
84
- end
85
-
86
- def test_ppm_format
87
- assert @format = Wiretap::PPM::format(File.dirname(__FILE__) + "/wiretap-images/01.ppm"), "Should retrieve format from ppm file"
88
- assert_equal 720, @format.width
89
- assert_equal 576, @format.height
90
- assert_equal 24, @format.bpp
91
- assert_equal 3, @format.channels
92
- assert_equal 720*576*3, @format.buffer_size
93
- assert_equal 25, @format.rate
94
- assert_equal :progressive, @format.scan
95
- end
96
-
97
- def test_ppm_to_sgi
98
- assert Wiretap::PPM.to_sgi(File.dirname(__FILE__) + "/wiretap-images/01.ppm","#{@temp_outdir}/ppm1.sgi")
99
- assert_equal "#{@temp_outdir}/ppm1.sgi: SGI image data, 3-D, 720 x 576, 3 channels\n", `file #{@temp_outdir}/ppm1.sgi`
100
- end
101
- end
data/test/read_frames.rb DELETED
@@ -1,142 +0,0 @@
1
- require 'test/unit'
2
- require 'benchmark'
3
- require 'fileutils'
4
- require File.dirname(__FILE__) + '/../lib/wiretap'
5
-
6
- class ReadFramesTest < Test::Unit::TestCase
7
- def setup
8
- @tezro = ENV['RUBY_WIRETAP_TEST_HOST']
9
- @toyota_dir = "/tmp/wiretap_tests/toyota_clip_wiretap"
10
- @guitar_dir = "/tmp/wiretap_tests/guitar"
11
- @temp_outdir = "/tmp/wiretap_tests"
12
- FileUtils.mkdir(@temp_outdir) rescue nil
13
- FileUtils.mkdir(@toyota_dir) rescue nil
14
- FileUtils.mkdir(@guitar_dir) rescue nil
15
- end
16
-
17
- def test_connect_to_flame
18
- @server = Wiretap::Server.new @tezro
19
- assert @server.alive?
20
- assert_equal @tezro, @server.hostname
21
- assert_equal "1.7", @server.version
22
- assert_equal "Discreet", @server.vendor
23
- assert_match /IFFFS/, @server.product
24
-
25
- assert @root = @server.root
26
- assert_equal "/", @root.id
27
- assert_equal "#{@tezro}//", @root.uri
28
- assert_kind_of Wiretap::Node, @root
29
- assert_equal @server, @root.server
30
- assert_equal nil, @root.parent
31
-
32
- #assert @root = @root.reload
33
- assert_equal "/", @root.id
34
- assert_equal "#{@tezro}//", @root.uri
35
-
36
-
37
- assert_equal 1, @root.children.count
38
- assert_equal 1, @root.children.length
39
- assert_equal 1, @root.children.size
40
-
41
- assert @volume = @root.children[0]
42
- assert_equal @root, @volume.parent
43
- assert_equal "stonefs", @volume.name
44
- assert_equal "#{@tezro}//stonefs", @volume.uri
45
- assert_kind_of Wiretap::Volume, @volume
46
-
47
- assert_equal @server, @volume.server
48
- assert @volume.server.alive?
49
-
50
- assert @j = @volume.find("Julik"), "Should open Julik's project"
51
- assert_equal 1, @j.children.count
52
- assert @j.project?
53
- assert_kind_of Wiretap::Project, @j
54
- assert_equal "Julik", @j.name
55
- assert_equal "/stonefs/Julik", @j.id
56
- assert_equal "#{@tezro}//stonefs/Julik", @j.uri
57
- assert_equal @server, @j.server
58
-
59
-
60
- assert @lib = @j.find("Default")
61
- assert @lib.library?
62
- assert_kind_of Wiretap::Library, @lib
63
- assert_equal "Default", @lib.name
64
- assert_equal "/stonefs/Julik/Default", @lib.id
65
- assert_equal "#{@tezro}//stonefs/Julik/Default", @lib.uri
66
- assert_equal @server, @lib.server
67
-
68
- assert @subclip = @lib.find("toyota_10bit")
69
- assert_kind_of Wiretap::Clip, @subclip
70
- assert_equal @server, @subclip.server
71
- assert_equal "toyota_10bit", @subclip.name
72
-
73
- # This should be a regex /#{CAPITAL}_-(\d){10}_{CAPITAL}_(\d){10}_#{CAPITAL}_(\d){6}
74
- assert_equal Wiretap::FRAMES_PATTERN, /[A-Z]_-(\d){10}_[A-Z]_(\d){10}_[A-Z]_(\d){6}/
75
- assert_match Wiretap::FRAMES_PATTERN, @subclip.id
76
- assert_equal "#{@tezro}//stonefs/Julik/Default/toyota_10bit", @subclip.uri
77
-
78
- assert @volume.server.close!
79
- assert !@volume.server.alive?
80
- end
81
-
82
- def test_bailing_when_opening_from_dead_server
83
- assert_raise(Wiretap::ServerDead) do
84
- nonexistent_lib = Wiretap::open("10.2.2.2/Bla")
85
- end
86
- end
87
-
88
- def test_open_toyota_10bit
89
- assert @clip = Wiretap.open("#{@tezro}/stonefs/Julik/Default/toyota_10bit"), "We should parse params to open function"
90
- assert @clip.clip?, "Is a clip"
91
- assert @clip.format, "Clip should have format"
92
- assert_equal 32, @clip.format.bpp, "This is a 10 bit clip"
93
- assert_equal 720, @clip.format.width, "720 px wide"
94
- assert_equal 576, @clip.format.height, "576 px high"
95
- assert_equal 76, @clip.frames.count
96
- assert_equal 76, @clip.frames.size
97
- assert_equal 76, @clip.frames.length
98
-
99
- assert_kind_of Wiretap::NodeMetaData, @clip.metadata
100
- assert_kind_of String, @clip.metadata["DMXEDL"]
101
- #assert_kind_of String, @clip.metadata.body, "XML or EDL metadata has to be accesible as a vanilla string"
102
- #assert_kind_of :XML, @clip.metadata.tag, "Metadata format should be passed"
103
-
104
- @clip.frames.dump(56, "#{@temp_outdir}/b.sgi")
105
- assert_equal "#{@temp_outdir}/b.sgi: SGI image data, 3-D, 720 x 576, 3 channels", `file #{@temp_outdir}/b.sgi`.chomp!
106
- end
107
-
108
- def test_open_toyota_12bit_clip
109
- assert @clip = Wiretap.open("#{@tezro}/stonefs/Julik/Default/toyota_12bit"), "Clip should be located"
110
- assert @clip.frames, "Clip should have it's frames"
111
- assert @clip.frames.count, "Clip frames should be countable"
112
- assert_equal 36, @clip.format.bpp, "This is a 12 bit clip"
113
- assert @clip.dump(@toyota_dir), "Clip should be dumped as video"
114
- assert_equal "#{@toyota_dir}/output.mov: Apple QuickTime movie file (ftyp)", `file #{@toyota_dir}/output.mov`.chomp!
115
- end
116
-
117
- def test_open_audio_32
118
- assert @clip = Wiretap.open("#{@tezro}/stonefs/Julik/Default/freckles_8bit_snd/freckles_8bit_snd (audio)/freckles_8bit_snd (stream)"), "Should open audio channel for test video"
119
- assert @clip.clip?, "Is a clip"
120
- assert @clip.audio?, "Is an audio clip"
121
- assert_kind_of Wiretap::Audio, @clip
122
- assert @clip.format, "Clip should always have format"
123
- assert_equal 48000.0, @clip.format.sample_rate, "Clip should have sample rate"
124
- assert_equal 203520, @clip.format.samples
125
- assert_equal 262144, @clip.format.buffer_size
126
- assert_equal 32, @clip.format.bps
127
- assert_equal 4, @clip.frames.count
128
- assert_equal :dlaudio_float, @clip.format.tag
129
- assert_equal Wiretap::AudioFrames, @clip.frames.class
130
- assert @clip.dump("#{@temp_outdir}/audio2.aiff")
131
- assert_equal "#{@temp_outdir}/audio2.aiff: IFF data, AIFF audio\n", `file #{@temp_outdir}/audio2.aiff`
132
- end
133
-
134
- def test_dump_whole_video
135
- assert @clip = Wiretap.open("#{@tezro}/stonefs/Julik/Default/freckles_8bit_snd"), "Should open test video"
136
- assert @clip.frames, "Clip should have frames"
137
- assert @clip.frames.count, "Clip frames should be countable"
138
- assert @clip.format, "Clip should have format"
139
- assert @clip.to_video(@guitar_dir)
140
- assert_equal "#{@guitar_dir}/output.mov: Apple QuickTime movie file (ftyp)\n", `file #{@guitar_dir}/output.mov`
141
- end
142
- end