wiretap 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. data/LICENSE +32 -0
  2. data/README +93 -0
  3. data/ext/Makefile +146 -0
  4. data/ext/audio_format.cpp +224 -0
  5. data/ext/bmp.cpp +65 -0
  6. data/ext/extconf.rb +85 -0
  7. data/ext/format.cpp +347 -0
  8. data/ext/image.h +27 -0
  9. data/ext/image_format.cpp +194 -0
  10. data/ext/node.cpp +401 -0
  11. data/ext/nodechildren.cpp +67 -0
  12. data/ext/nodeframes.cpp +233 -0
  13. data/ext/nodemetadata.cpp +90 -0
  14. data/ext/ppm.cpp +132 -0
  15. data/ext/server.cpp +202 -0
  16. data/ext/serverlist.cpp +183 -0
  17. data/ext/sgi.cpp +69 -0
  18. data/ext/testserver/Makefile +5 -0
  19. data/ext/testserver/cfg/wiretap_path_translation_db.xml +44 -0
  20. data/ext/testserver/cfg/wiretapd.cfg +74 -0
  21. data/ext/testserver/cfg/wiretapd.res +60 -0
  22. data/ext/testserver/db.sql +50 -0
  23. data/ext/testserver/server.cpp +206 -0
  24. data/ext/testserver/testserver.rb +146 -0
  25. data/ext/thread_worker.cpp +85 -0
  26. data/ext/wiretap.cpp +68 -0
  27. data/ext/wiretap.h +115 -0
  28. data/lib/wiretap.rb +280 -0
  29. data/test/audio.rb +27 -0
  30. data/test/convert.rb +35 -0
  31. data/test/image.rb +101 -0
  32. data/test/read_frames.rb +142 -0
  33. data/test/wiretap-images/01.ppm +0 -0
  34. data/test/wiretap-images/32bit.stoneimage +621 -0
  35. data/test/wiretap-images/36bit.stoneimage +1036 -0
  36. data/test/wiretap-images/48bit.stoneimage +800 -1
  37. data/test/wiretap-images/a.stoneimage +0 -0
  38. data/test/wiretap-images/a0.stoneimage +0 -0
  39. data/test/wiretap-images/a1.stoneimage +0 -0
  40. data/test/wiretap-images/a2.stoneimage +0 -0
  41. data/test/wiretap-images/a3.stoneimage +0 -0
  42. data/test/wiretap-images/a4.stoneimage +0 -0
  43. data/test/wiretap-images/b1.stonesound +0 -0
  44. data/test/wiretap-images/importable-seq/00000001.ppm +0 -0
  45. data/test/wiretap-images/importable-seq/00000002.ppm +0 -0
  46. data/test/wiretap-images/importable-seq/00000003.ppm +0 -0
  47. data/test/wiretap-images/importable-seq/00000004.ppm +0 -0
  48. data/test/wiretap-images/importable-seq/00000005.ppm +0 -0
  49. data/test/wiretap-images/importable-seq/00000006.ppm +0 -0
  50. data/test/wiretap-images/importable-seq/00000007.ppm +0 -0
  51. data/test/wiretap-images/importable-seq/00000008.ppm +0 -0
  52. data/test/wiretap-images/importable-seq/00000009.ppm +0 -0
  53. data/test/wiretap-images/importable-seq/00000010.ppm +0 -0
  54. data/test/wiretap-images/importable-seq/00000011.ppm +0 -0
  55. data/test/wiretap-images/importable-seq/00000012.ppm +0 -0
  56. data/test/wiretap-images/monsters_001.tif +0 -0
  57. data/test/wiretap-images/monsters_002.tif +0 -0
  58. data/test/wiretap-images/monsters_003.tif +0 -0
  59. data/test/wiretap-images/output.mov +0 -0
  60. data/test/wiretap-images/output.wav +0 -0
  61. data/test/write_frames.rb +82 -0
  62. metadata +138 -0
@@ -0,0 +1,142 @@
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
Binary file