Module: Depix::Synthetics
- Included in:
- DPX
- Defined in:
- lib/depix.rb
Overview
Offers convenience access to a few common attributes bypassing the piecemeal structs
Constant Summary collapse
- DEFAULT_DPX_FPS =
25
Instance Method Summary collapse
-
#aspect ⇒ Object
Aspect in it’s traditional representation (1.77 for 16x9 and so on).
-
#colorimetric ⇒ Object
Get the name of the transfer function (Linear, Logarithmic, …).
-
#component_type ⇒ Object
Get the name of the compnent type (RGB, YCbCr, …).
-
#flame_reel ⇒ Object
Return the flame reel name.
-
#flame_reel=(new_reel) ⇒ Object
Assign reel name.
-
#keycode ⇒ Object
Get formatted keycode as string, empty elements are omitted.
-
#le? ⇒ Boolean
Is this DPX file little-endian? This would be an exception, but still useful.
-
#time_code ⇒ Object
Get television.time_code as a Timecode object with a framerate.
-
#time_code=(new_tc) ⇒ Object
Assign frame rate and timecode from a Timecode object.
Instance Method Details
#aspect ⇒ Object
Aspect in it’s traditional representation (1.77 for 16x9 and so on)
70 71 72 |
# File 'lib/depix.rb', line 70 def aspect "%.2f" % (orientation.aspect_ratio[0].to_f / orientation.aspect_ratio[1].to_f) end |
#colorimetric ⇒ Object
Get the name of the transfer function (Linear, Logarithmic, …)
60 61 62 |
# File 'lib/depix.rb', line 60 def colorimetric COLORIMETRIC.invert[image.image_elements[0].colorimetric] end |
#component_type ⇒ Object
Get the name of the compnent type (RGB, YCbCr, …)
65 66 67 |
# File 'lib/depix.rb', line 65 def component_type COMPONENT_TYPE.invert[image.image_elements[0].descriptor] end |
#flame_reel ⇒ Object
Return the flame reel name. The data after the first null byte is not meant to be seen and is used by Flame internally as it seems
30 31 32 33 |
# File 'lib/depix.rb', line 30 def flame_reel return nil unless orientation.device orientation.device.split(0x00.chr).shift end |
#flame_reel=(new_reel) ⇒ Object
Assign reel name
36 37 38 |
# File 'lib/depix.rb', line 36 def flame_reel=(new_reel) orientation.device = new_reel end |
#keycode ⇒ Object
Get formatted keycode as string, empty elements are omitted
23 24 25 |
# File 'lib/depix.rb', line 23 def keycode [film.id, film.type, film.offset, film.prefix, film.count].compact.join(' ') end |
#le? ⇒ Boolean
Is this DPX file little-endian? This would be an exception, but still useful
75 76 77 |
# File 'lib/depix.rb', line 75 def le? file.magic == 'XPDS' end |
#time_code ⇒ Object
Get television.time_code as a Timecode object with a framerate. We explicitly use the television frame rate since Northlight writes different rates for television and film time code
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/depix.rb', line 43 def time_code framerates = [television.frame_rate, film.frame_rate, DEFAULT_DPX_FPS] framerate = framerates.find{|e| !e.nil? && !e.zero? } if television.time_code Timecode.from_uint(television.time_code, framerate) else # Assume frame position Timecode.new(film.frame_position, framerate) end end |
#time_code=(new_tc) ⇒ Object
Assign frame rate and timecode from a Timecode object
55 56 57 |
# File 'lib/depix.rb', line 55 def time_code=(new_tc) television.time_code, television.frame_rate = new_tc.to_uint, new_tc.fps end |