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)
64 65 66 |
# File 'lib/depix.rb', line 64 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, …)
54 55 56 |
# File 'lib/depix.rb', line 54 def colorimetric COLORIMETRIC.invert[image.image_elements[0].colorimetric] end |
#component_type ⇒ Object
Get the name of the compnent type (RGB, YCbCr, …)
59 60 61 |
# File 'lib/depix.rb', line 59 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
69 70 71 |
# File 'lib/depix.rb', line 69 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 |
# File 'lib/depix.rb', line 43 def time_code framerate = television.frame_rate || film.frame_rate || DEFAULT_DPX_FPS Timecode.from_uint(television.time_code, framerate) end |
#time_code=(new_tc) ⇒ Object
Assign frame rate and timecode from a Timecode object
49 50 51 |
# File 'lib/depix.rb', line 49 def time_code=(new_tc) television.time_code, television.frame_rate = new_tc.to_uint, new_tc.fps end |