Class: Bitmovin::Encoding::Encodings::Stream

Inherits:
Resource
  • Object
show all
Defined in:
lib/bitmovin/encoding/encodings/stream.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#delete!, find, init, #init_instance, #inspect, list, #persisted?

Methods included from Helpers

#camelize_hash, #hash_to_struct, result, #result, #underscore_hash

Constructor Details

#initialize(encoding_id, hash = {}) ⇒ Stream

Returns a new instance of Stream.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 8

def initialize(encoding_id, hash = {})
  set_defaults
  hsh = ActiveSupport::HashWithIndifferentAccess.new(underscore_hash(hash))
  @encoding_id = encoding_id
  init_instance(File.join("/v1/encoding/encodings/", encoding_id, "streams"))
  super(hash)
  @outputs = (hsh[:outputs] || []).map { |output| Bitmovin::Encoding::StreamOutput.new(output) }
  @input_streams = (hsh[:input_streams] || []).map { |input| StreamInput.new(@encoding_id, @id, input) }

  @errors = []
  @conditions = nil
  @mode = "STANDARD"
end

Instance Attribute Details

#conditionsObject

Returns the value of attribute conditions.



5
6
7
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 5

def conditions
  @conditions
end

#create_quality_meta_dataObject

Returns the value of attribute create_quality_meta_data.



22
23
24
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 22

def 
  @create_quality_meta_data
end

#created_atObject

Returns the value of attribute created_at.



22
23
24
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 22

def created_at
  @created_at
end

#descriptionObject

Returns the value of attribute description.



22
23
24
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 22

def description
  @description
end

#encoding_idObject

Returns the value of attribute encoding_id.



3
4
5
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 3

def encoding_id
  @encoding_id
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 4

def id
  @id
end

#modeObject

Returns the value of attribute mode.



6
7
8
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 6

def mode
  @mode
end

#modified_atObject

Returns the value of attribute modified_at.



22
23
24
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 22

def modified_at
  @modified_at
end

#nameObject

Returns the value of attribute name.



22
23
24
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 22

def name
  @name
end

Instance Method Details

#build_input_stream(opts = {}) ⇒ Object



28
29
30
31
32
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 28

def build_input_stream(opts = {})
  input = StreamInput.new(@encoding_id, @id, opts)
  @input_streams << input
  input
end

#build_output(opts = {}) ⇒ Object



38
39
40
41
42
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 38

def build_output(opts = {})
  output = Bitmovin::Encoding::StreamOutput.new(opts)
  @outputs << output
  output
end

#codec_configurationObject



51
52
53
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 51

def codec_configuration
  @codec_config_id
end

#codec_configuration=(configuration) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 44

def codec_configuration=(configuration)
  if configuration.instance_of?(String)
    @codec_config_id = configuration
  else
    @codec_config_id = configuration.id
  end
end

#errorsObject



70
71
72
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 70

def errors
  @errors
end

#input_analysisObject



80
81
82
83
84
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 80

def input_analysis
  path = File.join("/v1/encoding/encodings/", @encoding_id, "streams", @id, "inputs")
  response = Bitmovin.client.get(path)
  hash_to_struct(result(response))
end

#input_detailsObject



74
75
76
77
78
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 74

def input_details
  path = File.join("/v1/encoding/encodings/", @encoding_id, "streams", @id, "input")
  response = Bitmovin.client.get(path)
  hash_to_struct(result(response))
end

#input_streamsObject



24
25
26
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 24

def input_streams
  @input_streams
end

#invalid?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 66

def invalid?
  !valid?
end

#outputsObject



34
35
36
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 34

def outputs
  @outputs
end

#save!Object



55
56
57
58
59
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 55

def save!
  if valid?
    super
  end
end

#valid?Boolean

Returns:

  • (Boolean)


61
62
63
64
# File 'lib/bitmovin/encoding/encodings/stream.rb', line 61

def valid?
  validate!
  @errors.empty?
end