activevlc 0.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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +89 -0
- data/Rakefile +1 -0
- data/TODO.md +12 -0
- data/activevlc.gemspec +29 -0
- data/bin/activevlc +5 -0
- data/examples/design.rb +84 -0
- data/lib/activevlc/cli/vlc.rb +45 -0
- data/lib/activevlc/cli.rb +73 -0
- data/lib/activevlc/dsl/base.rb +35 -0
- data/lib/activevlc/dsl/duplicate.rb +16 -0
- data/lib/activevlc/dsl/pipeline.rb +31 -0
- data/lib/activevlc/dsl/stream.rb +75 -0
- data/lib/activevlc/dsl/transcode.rb +56 -0
- data/lib/activevlc/dsl.rb +22 -0
- data/lib/activevlc/pipeline.rb +37 -0
- data/lib/activevlc/pipeline_dump.rb +61 -0
- data/lib/activevlc/stage/base.rb +75 -0
- data/lib/activevlc/stage/chain.rb +18 -0
- data/lib/activevlc/stage/duplicate.rb +38 -0
- data/lib/activevlc/stage/gather.rb +18 -0
- data/lib/activevlc/stage/input.rb +41 -0
- data/lib/activevlc/stage/stream.rb +33 -0
- data/lib/activevlc/stage/transcode.rb +18 -0
- data/lib/activevlc/stage.rb +23 -0
- data/lib/activevlc/version.rb +3 -0
- data/lib/activevlc.rb +7 -0
- data/spec/basic_pipe_spec.rb +29 -0
- data/spec/basic_spec.rb +40 -0
- data/spec/pipeline_dump_spec.rb +38 -0
- data/spec/pipeline_spec.rb +84 -0
- data/spec/pipes/basic.rb +14 -0
- data/spec/pipes/duplicate.rb +18 -0
- data/spec/pipes/duplicate_then_transcode.rb +29 -0
- data/spec/pipes/transcode_and_display.rb +25 -0
- data/spec/pipes/transcode_and_display_with_options.rb +36 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/stage_spec.rb +48 -0
- metadata +196 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
##
|
2
|
+
## debug_print.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Fri Sep 6 17:42:31 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
require 'debugger'
|
13
|
+
|
14
|
+
module ActiveVlc
|
15
|
+
module PipelineDump
|
16
|
+
extend ActiveSupport::Concern
|
17
|
+
|
18
|
+
TAB_WIDTH = 2
|
19
|
+
|
20
|
+
def _dump(depth = 0)
|
21
|
+
name = instance_eval &_find_in_ancestors(:_dump_name)
|
22
|
+
childs = instance_eval &_find_in_ancestors(:_dump_childs)
|
23
|
+
|
24
|
+
"#{_dump_depth(depth)}+ #{name}\n" +
|
25
|
+
childs.map { |c| c._dump(depth + 1) }.join
|
26
|
+
end
|
27
|
+
|
28
|
+
def _dump_depth(depth)
|
29
|
+
' ' * depth * TAB_WIDTH
|
30
|
+
end
|
31
|
+
|
32
|
+
# FIXME Find an elegant way to do this :-/
|
33
|
+
# Here we walk the ancestor array to find the one which included us first and therefore
|
34
|
+
# has a default _dump_name and _dump_childs. It will stops to the first ancestor which has
|
35
|
+
# (re)defined it.
|
36
|
+
def _find_in_ancestors(sym)
|
37
|
+
klass = self.class
|
38
|
+
while klass.respond_to?(sym) and klass.superclass and not klass.send(sym)
|
39
|
+
klass = klass.superclass
|
40
|
+
end
|
41
|
+
klass.send(sym)
|
42
|
+
end
|
43
|
+
|
44
|
+
included do
|
45
|
+
dump_name { self.class.name }
|
46
|
+
dump_childs { [] }
|
47
|
+
end
|
48
|
+
|
49
|
+
module ClassMethods
|
50
|
+
attr_accessor :_dump_name, :_dump_childs
|
51
|
+
|
52
|
+
def dump_name(&block)
|
53
|
+
self._dump_name = block
|
54
|
+
end
|
55
|
+
|
56
|
+
def dump_childs(&block)
|
57
|
+
self._dump_childs = block
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
##
|
2
|
+
## base.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Thu Sep 5 10:08:46 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
# Represents a stage in the pipeline
|
13
|
+
module ActiveVlc::Stage
|
14
|
+
class Base
|
15
|
+
include ActiveVlc::PipelineDump
|
16
|
+
dump_name { "#{self.class.name}(#{@type}): #{options}" }
|
17
|
+
|
18
|
+
attr_reader :type
|
19
|
+
attr_reader :options
|
20
|
+
|
21
|
+
def initialize(type = :dummy)
|
22
|
+
@options = Hash.new
|
23
|
+
@type = type
|
24
|
+
end
|
25
|
+
|
26
|
+
def [](key) @options[key] end
|
27
|
+
def []=(key, value) @options[key] = value end
|
28
|
+
|
29
|
+
def fragment
|
30
|
+
_recurse_on_suboption(@type, @options)
|
31
|
+
end
|
32
|
+
|
33
|
+
protected
|
34
|
+
# Handles the rendering of the options hash to a vlc sout format
|
35
|
+
#
|
36
|
+
# key = vlc, value = {test: 42, sub: {_this_: 'this', opt1='foo'}, sub2: {opt2: 'bar'}}
|
37
|
+
# renders to "key{test=42,sub=this{opt1=foo},sub2{opt2:bar}}"
|
38
|
+
def _recurse_on_suboption(k, h)
|
39
|
+
map = h.map do |key, value|
|
40
|
+
if value.is_a?(Hash)
|
41
|
+
value_without_this = value.clone
|
42
|
+
this = value_without_this.delete :_this_
|
43
|
+
if this
|
44
|
+
"#{key}=#{_recurse_on_suboption(this, value_without_this)}"
|
45
|
+
else
|
46
|
+
_recurse_on_suboption(key, value)
|
47
|
+
end
|
48
|
+
else
|
49
|
+
if value.nil?
|
50
|
+
"#{key}"
|
51
|
+
elsif value == false
|
52
|
+
"no-#{key}"
|
53
|
+
else
|
54
|
+
"#{key}=#{format_value value}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end.join(', ')
|
58
|
+
|
59
|
+
if map == ""
|
60
|
+
"#{k}"
|
61
|
+
else
|
62
|
+
"#{k}{#{map}}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def format_value(value)
|
67
|
+
if value.is_a? String
|
68
|
+
"'#{value}'"
|
69
|
+
else
|
70
|
+
"#{value}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
##
|
2
|
+
## chain.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Tue Sep 10 19:43:11 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
module ActiveVlc::Stage
|
13
|
+
class Chain < Stream
|
14
|
+
def fragment
|
15
|
+
@chain.map{|s| s.fragment}.join ':'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
##
|
2
|
+
## duplicate.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Thu Sep 5 10:15:03 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
require 'activevlc/stage/base'
|
13
|
+
|
14
|
+
module ActiveVlc::Stage
|
15
|
+
class Duplicate < Base
|
16
|
+
attr_reader :stages
|
17
|
+
|
18
|
+
dump_childs { @stages }
|
19
|
+
|
20
|
+
def initialize()
|
21
|
+
super(:duplicate)
|
22
|
+
@stages = []
|
23
|
+
end
|
24
|
+
|
25
|
+
def <<(stage)
|
26
|
+
@stages.push stage
|
27
|
+
@stages.flatten!
|
28
|
+
self
|
29
|
+
end
|
30
|
+
|
31
|
+
def fragment
|
32
|
+
f = @stages.map do |s|
|
33
|
+
"dst=#{s.fragment}"
|
34
|
+
end.join ', '
|
35
|
+
"duplicate{#{f}}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
##
|
2
|
+
## gather.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Mon Sep 9 10:49:03 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
module ActiveVlc::Stage
|
13
|
+
class Gather < Base
|
14
|
+
def initialize
|
15
|
+
super :gather
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
##
|
2
|
+
## input_stage.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Wed Sep 4 19:13:47 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
require 'activevlc/stage'
|
13
|
+
|
14
|
+
module ActiveVlc::Stage
|
15
|
+
class Input < Base
|
16
|
+
include ActiveVlc::PipelineDump
|
17
|
+
|
18
|
+
attr_reader :inputs
|
19
|
+
|
20
|
+
def initialize(array_or_string)
|
21
|
+
super(:input)
|
22
|
+
|
23
|
+
@inputs = [array_or_string] if array_or_string.is_a? String
|
24
|
+
@inputs ||= array_or_string
|
25
|
+
end
|
26
|
+
|
27
|
+
def <<(new_inputs)
|
28
|
+
@inputs.push new_inputs
|
29
|
+
@inputs.flatten!
|
30
|
+
self
|
31
|
+
end
|
32
|
+
|
33
|
+
def fragment
|
34
|
+
@inputs.join ' '
|
35
|
+
end
|
36
|
+
|
37
|
+
dump_name { "Input : " + @inputs.join(', ') }
|
38
|
+
dump_childs { [] }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
##
|
2
|
+
## stream_stage.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Wed Sep 4 19:35:50 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
module ActiveVlc::Stage
|
13
|
+
class Stream < Base
|
14
|
+
dump_childs { @chain }
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
super :sout
|
18
|
+
@chain = []
|
19
|
+
end
|
20
|
+
|
21
|
+
def <<(stage)
|
22
|
+
@chain.push stage
|
23
|
+
@chain.flatten!
|
24
|
+
self
|
25
|
+
end
|
26
|
+
|
27
|
+
def fragment
|
28
|
+
return "" if @chain.empty?
|
29
|
+
sout_string = @chain.map{|s| s.fragment}.join ':'
|
30
|
+
":sout=\"##{sout_string}\""
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
##
|
2
|
+
## transcode.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Fri Sep 6 16:09:02 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
module ActiveVlc::Stage
|
13
|
+
class Transcode < Base
|
14
|
+
def initialize
|
15
|
+
super :transcode
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
##
|
2
|
+
## stage.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Wed Jul 3 16:08:37 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
module ActiveVlc
|
13
|
+
module Stage
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'activevlc/stage/base'
|
18
|
+
require 'activevlc/stage/input'
|
19
|
+
require 'activevlc/stage/stream'
|
20
|
+
require 'activevlc/stage/duplicate'
|
21
|
+
require 'activevlc/stage/transcode'
|
22
|
+
require 'activevlc/stage/gather'
|
23
|
+
require 'activevlc/stage/chain'
|
data/lib/activevlc.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
##
|
2
|
+
## basic_pipe_spec.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Wed Jun 12 20:46:26 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
|
14
|
+
describe ActiveVlc do
|
15
|
+
describe '::pipe_for' do
|
16
|
+
it 'creates a new Pipeline' do
|
17
|
+
ActiveVlc::Pipeline.for('test.mp4'){}.should be_a(ActiveVlc::Pipeline)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'has input file in the fragment string' do
|
21
|
+
ActiveVlc::Pipeline.for('test.mp4'){}.fragment.should match('test.mp4')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'handles an array of input' do
|
25
|
+
ActiveVlc::Pipeline.for(['test.mp4', 'test.flv']){}.fragment.should match(/test\.mp4.+test\.flv/)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
data/spec/basic_spec.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
##
|
2
|
+
## basic.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Wed Jun 12 14:08:35 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
|
14
|
+
describe ActiveVlc do
|
15
|
+
it 'has a version' do
|
16
|
+
ActiveVlc::VERSION.is_a?(String).should be_true
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'cmd' do
|
20
|
+
it 'return version number on \'version\' command' do
|
21
|
+
expect(`bundle exec activevlc version`).to match(/version \d+\.\d+\.\d+/)
|
22
|
+
expect(`bundle exec activevlc version`).to match(ActiveVlc::VERSION)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'VLC detection' do
|
27
|
+
it 'detects and returns VLV version number on \'vlc version\'' do
|
28
|
+
expect(`bundle exec activevlc vlc version`).to match(/VLC version \d+\.\d+\.\d+/)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'tells if detected VLC version is supported on \'vlc version\'' do
|
32
|
+
expect(`bundle exec activevlc vlc version`).to match(/supported = (true|false)/)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'tells if detected VLC version is supported on \'vlc supported\'' do
|
36
|
+
expect(`bundle exec activevlc vlc supported`).to match(/(true|false)/)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
##
|
2
|
+
## pipeline_dump_spec.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Mon Sep 9 12:31:23 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
|
14
|
+
describe 'ActiveVlc::PipelineDump' do
|
15
|
+
describe 'CLI' do
|
16
|
+
it 'needs a pipeline file as paremeter' do
|
17
|
+
`bundle exec activevlc dump 2>&1`.should match(/ERROR/)
|
18
|
+
end
|
19
|
+
it 'needs an existent pipeline file' do
|
20
|
+
`bundle exec activevlc dump inexistent.rb`
|
21
|
+
$?.exitstatus.should_not eq(0)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'return a readable representation of the pipeline' do
|
26
|
+
dump = <<-DUMP
|
27
|
+
ActiveVlc: Dumping pipeline internal representation
|
28
|
+
+ ActiveVlc::Pipeline
|
29
|
+
+ Input : input.mp4
|
30
|
+
+ ActiveVlc::Stage::Stream(sout): {}
|
31
|
+
+ ActiveVlc::Stage::Transcode(transcode): {:acodec=>:aac, :vcodec=>:h264, :scodec=>:svcd}
|
32
|
+
+ ActiveVlc::Stage::Duplicate(duplicate): {}
|
33
|
+
+ ActiveVlc::Stage::Base(standard): {"mux"=>:mp4, "dst"=>"output.mp4"}
|
34
|
+
+ ActiveVlc::Stage::Base(display): {}
|
35
|
+
DUMP
|
36
|
+
ActiveVlc::Pipeline.parse('spec/pipes/transcode_and_display.rb').dump.should eq(dump)
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
##
|
2
|
+
## pipeline_spec.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Wed Jul 3 15:57:47 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
require 'spec_helper'
|
13
|
+
|
14
|
+
describe ActiveVlc::Pipeline do
|
15
|
+
describe '\'basic\' pipeline' do
|
16
|
+
it 'returns nil if the file doesn\'t exists' do
|
17
|
+
ActiveVlc::Pipeline.parse('dontexist.rb').should be_nil
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'is loaded' do
|
21
|
+
pipe = ActiveVlc::Pipeline.parse 'spec/pipes/basic.rb'
|
22
|
+
pipe.class.should be(ActiveVlc::Pipeline)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'can produces a basic fragment' do
|
26
|
+
pipe = ActiveVlc::Pipeline.parse 'spec/pipes/basic.rb'
|
27
|
+
pipe.fragment.should match(/input.mp4/)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'allows adding new inputs' do
|
31
|
+
pipe = ActiveVlc::Pipeline.parse 'spec/pipes/basic.rb'
|
32
|
+
pipe.input << 'test.mp3'
|
33
|
+
pipe.fragment.should match(/input.mp4/)
|
34
|
+
pipe.fragment.should match(/test.mp3/)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '\'duplicate\' pipeline' do
|
39
|
+
it 'is loaded' do
|
40
|
+
ActiveVlc::Pipeline.parse('spec/pipes/duplicate.rb').class.should be(ActiveVlc::Pipeline)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'produce the correct fragment' do
|
44
|
+
expect(ActiveVlc::Pipeline.parse('spec/pipes/duplicate.rb').fragment)
|
45
|
+
.to eq("input.mp3 :sout=\"#duplicate{dst=display, dst=standard{dst='output.mp3'}}\"")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '\'transcode_and_display\' pipeline' do
|
50
|
+
it 'is loaded' do
|
51
|
+
ActiveVlc::Pipeline.parse('spec/pipes/transcode_and_display.rb').class.should be(ActiveVlc::Pipeline)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'produce the correct fragment' do
|
55
|
+
expect(ActiveVlc::Pipeline.parse('spec/pipes/transcode_and_display.rb').fragment)
|
56
|
+
.to eq("input.mp4 :sout=\"#transcode{acodec=aac, vcodec=h264, scodec=svcd}:duplicate{dst=standard{mux=mp4, dst='output.mp4'}, dst=display}\"")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '\'transcode_and_display_with_options\' pipeline' do
|
61
|
+
it 'is loaded' do
|
62
|
+
ActiveVlc::Pipeline.parse('spec/pipes/transcode_and_display_with_options.rb').class
|
63
|
+
.should be(ActiveVlc::Pipeline)
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'produce the correct fragment' do
|
67
|
+
expect(ActiveVlc::Pipeline.parse('spec/pipes/transcode_and_display_with_options.rb').fragment)
|
68
|
+
.to eq("input.mp4 :sout=\"#gather:transcode{deinterlace, acodec=aac, ab=128, channels=2, vcodec=h264, venc=x264{bpyramid=strict, bframes=4, no-cabac}, vb=512}:duplicate{dst=standard{mux=mp4, dst='output.mp4'}, dst=display}\"")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '\'duplicate_then_transcode\' pipeline' do
|
73
|
+
it 'is loaded' do
|
74
|
+
ActiveVlc::Pipeline.parse('spec/pipes/duplicate_then_transcode.rb').class
|
75
|
+
.should be(ActiveVlc::Pipeline)
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'produce the correct fragment' do
|
79
|
+
expect(ActiveVlc::Pipeline.parse('spec/pipes/duplicate_then_transcode.rb').fragment)
|
80
|
+
.to eq("input.mp4 :sout=\"#duplicate{dst=transcode{acodec=aac, vcodec=h264, scodec=svcd}:standard{mux=mp4, dst='output.mp4'}, dst=display}\"")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
data/spec/pipes/basic.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
##
|
2
|
+
## basic.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Wed Jun 12 14:41:04 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
# Basic pipe for rspec testing
|
13
|
+
|
14
|
+
ActiveVlc::Pipeline.for 'input.mp4'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
##
|
2
|
+
## duplicate.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Wed Sep 4 17:29:45 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
# input.mp3 :sout="#duplicate{dst=display, dst=std{dst='output.mp3'}}"
|
13
|
+
ActiveVlc::Pipeline.for 'input.mp3' do
|
14
|
+
duplicate do
|
15
|
+
to :display
|
16
|
+
to file: 'output.mp3'
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
##
|
2
|
+
## duplicate_then_transcode.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Tue Sep 10 18:30:41 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
ActiveVlc::Pipeline.for 'input.mp4' do
|
13
|
+
duplicate do
|
14
|
+
to :chain do
|
15
|
+
#debugger
|
16
|
+
transcode do
|
17
|
+
audio :aac
|
18
|
+
video :h264
|
19
|
+
subtitle :svcd
|
20
|
+
end
|
21
|
+
to :file do
|
22
|
+
mux :mp4
|
23
|
+
dst 'output.mp4'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
to :display
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
##
|
2
|
+
## transcode_and_display.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Wed Jun 12 14:45:36 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
ActiveVlc::Pipeline.for 'input.mp4' do
|
13
|
+
transcode do
|
14
|
+
audio :aac
|
15
|
+
video :h264
|
16
|
+
subtitle :svcd
|
17
|
+
end
|
18
|
+
duplicate do
|
19
|
+
to :file do
|
20
|
+
mux :mp4
|
21
|
+
dst 'output.mp4'
|
22
|
+
end
|
23
|
+
to :display
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
##
|
2
|
+
## transcode_and_display.rb
|
3
|
+
## Login : <lta@still>
|
4
|
+
## Started on Wed Jun 12 14:45:36 2013 Lta Akr
|
5
|
+
## $Id$
|
6
|
+
##
|
7
|
+
## Author(s):
|
8
|
+
## - Lta Akr <>
|
9
|
+
##
|
10
|
+
## Copyright (C) 2013 Lta Akr
|
11
|
+
|
12
|
+
ActiveVlc::Pipeline.for 'input.mp4' do
|
13
|
+
gather
|
14
|
+
transcode do
|
15
|
+
deinterlace
|
16
|
+
audio :aac do
|
17
|
+
bitrate 128 # 128 kpbs
|
18
|
+
channels 2
|
19
|
+
end
|
20
|
+
video :h264 do
|
21
|
+
encoder :x264 do
|
22
|
+
bpyramid :strict
|
23
|
+
bframes 4
|
24
|
+
cabac false
|
25
|
+
end
|
26
|
+
bitrate 512 # 512 kbps
|
27
|
+
end
|
28
|
+
end
|
29
|
+
duplicate do
|
30
|
+
to :file do
|
31
|
+
mux :mp4
|
32
|
+
dst 'output.mp4'
|
33
|
+
end
|
34
|
+
to :display
|
35
|
+
end
|
36
|
+
end
|