m3u8 0.8.0 → 0.8.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 +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +6 -3
- data/lib/m3u8/error.rb +0 -3
- data/lib/m3u8/playlist_item.rb +14 -11
- data/lib/m3u8/version.rb +1 -1
- data/spec/lib/m3u8/playlist_item_spec.rb +77 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddb2f4d0d192d3240638f292df9af726bb34cc0a
|
4
|
+
data.tar.gz: b83b3ef504e0103d8dfa1295ee8b27b5860824b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f07895da5aa3a400e2020c3ac0d14e421ac99869d35573985f1589809267e1ddb2d1b25a2174eb88057ba8497f0651f12f453c8b1c765453ef0ff68e99d0689c
|
7
|
+
data.tar.gz: 053c1be2adfa5bb2593fc1ee603c21af04f0ba71e8f0fa232a379ea4d27ad8789b9ff753b5e94c1a0e5c41ee9adc65eef043ad42ed1d58ce558ad3a24cfd5437
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
**0.8.1**
|
2
|
+
Merged pull request #23 from [ryanische](https:/github.com/ryanische) which fixes issue of CODEC attribute validation not matching the HLS I-D.
|
3
|
+
|
1
4
|
**0.8.0 (4/13/2017)**
|
2
5
|
|
3
|
-
* Added several improvements for writing playlists: Allow playlist to be initalized as master, expose `write_header`/`write_footer` on `Writer` class.
|
4
|
-
* Added support for the `#EXT-X-DISCONTINUITY-SEQUENCE` tag. Added missing attributes to `MediaItem`: `INSTREAM-ID`, `CHARACTERISTICS`, `CHANNELS`, Added missing `HDCP-LEVEL` attribute to `PlaylistItem`.
|
5
|
-
* Fixed issue [#20](https://github.com/sethdeckard/m3u8/issues/20).
|
6
|
+
* Added several improvements for writing playlists: Allow playlist to be initalized as master, expose `write_header`/`write_footer` on `Writer` class.
|
7
|
+
* Added support for the `#EXT-X-DISCONTINUITY-SEQUENCE` tag. Added missing attributes to `MediaItem`: `INSTREAM-ID`, `CHARACTERISTICS`, `CHANNELS`, Added missing `HDCP-LEVEL` attribute to `PlaylistItem`.
|
8
|
+
* Fixed issue [#20](https://github.com/sethdeckard/m3u8/issues/20).
|
6
9
|
* Merged pull request #21 from [rmberg](https://github.com/rmberg), adding support for live playlists to `Writer`.
|
7
10
|
|
8
11
|
***
|
data/lib/m3u8/error.rb
CHANGED
data/lib/m3u8/playlist_item.rb
CHANGED
@@ -8,7 +8,6 @@ module M3u8
|
|
8
8
|
:audio_codec, :level, :profile, :video, :audio, :uri,
|
9
9
|
:average_bandwidth, :subtitles, :closed_captions, :iframe,
|
10
10
|
:frame_rate, :name, :hdcp_level
|
11
|
-
MISSING_CODEC_MESSAGE = 'Audio or video codec info should be provided.'
|
12
11
|
|
13
12
|
def initialize(params = {})
|
14
13
|
self.iframe = false
|
@@ -37,16 +36,23 @@ module M3u8
|
|
37
36
|
def codecs
|
38
37
|
return @codecs unless @codecs.nil?
|
39
38
|
|
40
|
-
|
41
|
-
return audio_codec_code if video_code.nil?
|
42
|
-
return video_code if audio_codec_code.nil?
|
39
|
+
video_codec_string = video_codec(profile, level)
|
43
40
|
|
44
|
-
|
41
|
+
# profile and/or level were specified but not recognized,
|
42
|
+
# do not specify any codecs
|
43
|
+
return nil if !(profile.nil? && level.nil?) && video_codec_string.nil?
|
44
|
+
|
45
|
+
audio_codec_string = audio_codec_code
|
46
|
+
|
47
|
+
# audio codec was specified but not recognized,
|
48
|
+
# do not specify any codecs
|
49
|
+
return nil if !@audio_codec.nil? && audio_codec_string.nil?
|
50
|
+
|
51
|
+
codec_strings = [video_codec_string, audio_codec_string].compact
|
52
|
+
codec_strings.empty? ? nil : codec_strings.join(',')
|
45
53
|
end
|
46
54
|
|
47
55
|
def to_s
|
48
|
-
validate
|
49
|
-
|
50
56
|
m3u8_format
|
51
57
|
end
|
52
58
|
|
@@ -88,10 +94,6 @@ module M3u8
|
|
88
94
|
value if value > 0
|
89
95
|
end
|
90
96
|
|
91
|
-
def validate
|
92
|
-
raise MissingCodecError, MISSING_CODEC_MESSAGE if codecs.nil?
|
93
|
-
end
|
94
|
-
|
95
97
|
def m3u8_format
|
96
98
|
return %(#EXT-X-I-FRAME-STREAM-INF:#{attributes},URI="#{uri}") if iframe
|
97
99
|
|
@@ -134,6 +136,7 @@ module M3u8
|
|
134
136
|
end
|
135
137
|
|
136
138
|
def codecs_format
|
139
|
+
return if codecs.nil?
|
137
140
|
%(CODECS="#{codecs}")
|
138
141
|
end
|
139
142
|
|
data/lib/m3u8/version.rb
CHANGED
@@ -75,11 +75,83 @@ describe M3u8::PlaylistItem do
|
|
75
75
|
|
76
76
|
describe '#to_s' do
|
77
77
|
context 'when codecs is missing' do
|
78
|
-
it '
|
78
|
+
it 'does not specify CODECS' do
|
79
79
|
params = { bandwidth: 540, uri: 'test.url' }
|
80
80
|
item = M3u8::PlaylistItem.new params
|
81
|
-
|
82
|
-
|
81
|
+
expect(item.to_s).not_to include('CODECS')
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'when level is not recognized' do
|
86
|
+
it 'does not specify CODECS' do
|
87
|
+
params = { bandwidth: 540, uri: 'test.url', level: 9001 }
|
88
|
+
item = M3u8::PlaylistItem.new params
|
89
|
+
expect(item.to_s).not_to include('CODECS')
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'when profile is not recognized' do
|
94
|
+
it 'does not specify CODECS' do
|
95
|
+
params = { bandwidth: 540, uri: 'test.url', profile: 'best' }
|
96
|
+
item = M3u8::PlaylistItem.new params
|
97
|
+
expect(item.to_s).not_to include('CODECS')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context 'when profile and level are not recognized' do
|
102
|
+
it 'does not specify CODECS' do
|
103
|
+
params = { bandwidth: 540, uri: 'test.url', profile: 'best',
|
104
|
+
level: 9001 }
|
105
|
+
item = M3u8::PlaylistItem.new params
|
106
|
+
expect(item.to_s).not_to include('CODECS')
|
107
|
+
end
|
108
|
+
|
109
|
+
context 'when audio codec is recognized' do
|
110
|
+
it 'does not specify CODECS' do
|
111
|
+
params = { bandwidth: 540, uri: 'test.url', profile: 'best',
|
112
|
+
level: 9001, audio_codec: 'aac-lc' }
|
113
|
+
item = M3u8::PlaylistItem.new params
|
114
|
+
expect(item.to_s).not_to include('CODECS')
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
context 'when profile and level are not set' do
|
120
|
+
context 'when audio codec is recognized' do
|
121
|
+
it 'specifies CODECS with audio codec' do
|
122
|
+
params = { bandwidth: 540, uri: 'test.url', audio_codec: 'aac-lc' }
|
123
|
+
item = M3u8::PlaylistItem.new params
|
124
|
+
expect(item.to_s).to include('CODECS="mp4a.40.2"')
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
context 'when profile and level are recognized' do
|
130
|
+
context 'when audio codec is not recognized' do
|
131
|
+
it 'does not specify CODECS' do
|
132
|
+
params = { bandwidth: 540, uri: 'test.url', profile: 'high',
|
133
|
+
level: 4.1, audio_codec: 'fuzzy' }
|
134
|
+
item = M3u8::PlaylistItem.new params
|
135
|
+
expect(item.to_s).not_to include('CODECS')
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context 'when audio codec is not set' do
|
140
|
+
it 'specifies CODECS with video codec' do
|
141
|
+
params = { bandwidth: 540, uri: 'test.url', profile: 'high',
|
142
|
+
level: 4.1 }
|
143
|
+
item = M3u8::PlaylistItem.new params
|
144
|
+
expect(item.to_s).to include('CODECS="avc1.640029"')
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context 'when audio codec is recognized' do
|
149
|
+
it 'specifies CODECS with video codec and audio_codec' do
|
150
|
+
params = { bandwidth: 540, uri: 'test.url', profile: 'high',
|
151
|
+
level: 4.1, audio_codec: 'aac-lc' }
|
152
|
+
item = M3u8::PlaylistItem.new params
|
153
|
+
expect(item.to_s).to include('CODECS="avc1.640029,mp4a.40.2"')
|
154
|
+
end
|
83
155
|
end
|
84
156
|
end
|
85
157
|
|
@@ -101,8 +173,8 @@ describe M3u8::PlaylistItem do
|
|
101
173
|
subtitles: 'subs', frame_rate: 30, closed_captions: 'caps',
|
102
174
|
name: 'SD', hdcp_level: 'TYPE-0', program_id: '1' }
|
103
175
|
item = described_class.new(options)
|
104
|
-
expected = %(#EXT-X-STREAM-INF:PROGRAM-ID=1,CODECS="avc",
|
105
|
-
|
176
|
+
expected = %(#EXT-X-STREAM-INF:PROGRAM-ID=1,CODECS="avc",) +
|
177
|
+
'BANDWIDTH=540,AVERAGE-BANDWIDTH=500,FRAME-RATE=30.000,' \
|
106
178
|
'HDCP-LEVEL=TYPE-0,' +
|
107
179
|
%(AUDIO="test",VIDEO="test2",SUBTITLES="subs",) +
|
108
180
|
%(CLOSED-CAPTIONS="caps",NAME="SD"\ntest.url)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: m3u8
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Deckard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|