ariblib 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +13 -13
- data/.rspec +2 -2
- data/.travis.yml +4 -4
- data/Gemfile +6 -6
- data/LICENSE +21 -21
- data/README.md +45 -45
- data/Rakefile +6 -6
- data/ariblib.gemspec +33 -33
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/lib/ariblib.rb +14 -14
- data/lib/ariblib/BitStream.rb +67 -67
- data/lib/ariblib/Descriptor.rb +303 -303
- data/lib/ariblib/EventInformationTable.rb +184 -184
- data/lib/ariblib/ProgramSpecificInformation.rb +318 -318
- data/lib/ariblib/String.rb +325 -325
- data/lib/ariblib/TransportStreamFile.rb +283 -283
- data/lib/ariblib/version.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9665ef260f1a2f57cdb031966b6f7e357541bcd7
|
4
|
+
data.tar.gz: 259c61c7f8f2b5c4483ce6125140c6b2c53d1e33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f370941b46d37686f800c1c97d6390cf2d6638a19f163ba43141797506e309c0d84a892b2faca5f0ae1bcd980f59eb997ba7ed7c34e08c3f463cdaf78f54b178
|
7
|
+
data.tar.gz: 4dcb2e60742e79c79efbbbd869be1cfba78df152358a6732d4fb6c80f9d0ece51acc922d9978349bd3bdc62402e475db98aa8c2593a205eaa2df6afadd26925a
|
data/.gitignore
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
/.bundle/
|
2
|
-
/.yardoc
|
3
|
-
/Gemfile.lock
|
4
|
-
/_yardoc/
|
5
|
-
/coverage/
|
6
|
-
/doc/
|
7
|
-
/pkg/
|
8
|
-
/spec/reports/
|
9
|
-
/tmp/
|
10
|
-
/vendor/
|
11
|
-
|
12
|
-
*.txt
|
13
|
-
debug_*
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
/vendor/
|
11
|
+
|
12
|
+
*.txt
|
13
|
+
debug_*
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--format documentation
|
2
|
-
--color
|
1
|
+
--format documentation
|
2
|
+
--color
|
data/.travis.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.1.7
|
4
|
-
before_install: gem install bundler -v 1.11.2
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.1.7
|
4
|
+
before_install: gem install bundler -v 1.11.2
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in ariblib.gemspec
|
4
|
-
gemspec
|
5
|
-
gem 'rspec'
|
6
|
-
gem 'rake'
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in ariblib.gemspec
|
4
|
+
gemspec
|
5
|
+
gem 'rspec'
|
6
|
+
gem 'rake'
|
data/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 nak
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 nak
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,45 +1,45 @@
|
|
1
|
-
# Ariblib
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ariblib`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
## Usage
|
6
|
-
|
7
|
-
TODO: Write usage instructions here
|
8
|
-
|
9
|
-
<!---
|
10
|
-
## Installation
|
11
|
-
|
12
|
-
Add this line to your application's Gemfile:
|
13
|
-
|
14
|
-
```ruby
|
15
|
-
gem 'ariblib'
|
16
|
-
```
|
17
|
-
|
18
|
-
And then execute:
|
19
|
-
|
20
|
-
$ bundle
|
21
|
-
|
22
|
-
Or install it yourself as:
|
23
|
-
|
24
|
-
$ gem install ariblib
|
25
|
-
|
26
|
-
## Usage
|
27
|
-
|
28
|
-
TODO: Write usage instructions here
|
29
|
-
|
30
|
-
## Development
|
31
|
-
|
32
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
33
|
-
|
34
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
35
|
-
|
36
|
-
## Contributing
|
37
|
-
|
38
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/nak1114/ariblib. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
39
|
-
-->
|
40
|
-
|
41
|
-
|
42
|
-
## License
|
43
|
-
|
44
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
45
|
-
|
1
|
+
# Ariblib
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ariblib`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
TODO: Write usage instructions here
|
8
|
+
|
9
|
+
<!---
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'ariblib'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install ariblib
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
TODO: Write usage instructions here
|
29
|
+
|
30
|
+
## Development
|
31
|
+
|
32
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
33
|
+
|
34
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/nak1114/ariblib. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
39
|
+
-->
|
40
|
+
|
41
|
+
|
42
|
+
## License
|
43
|
+
|
44
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
45
|
+
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rspec/core/rake_task"
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new(:spec)
|
5
|
-
|
6
|
-
task :default => :spec
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
task :default => :spec
|
data/ariblib.gemspec
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'ariblib/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "ariblib"
|
8
|
-
spec.version = Ariblib::VERSION
|
9
|
-
spec.authors = ["nak1114"]
|
10
|
-
spec.email = ["naktak1114@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{Implementation of ARIB STD B10}
|
13
|
-
spec.description = %q{It reads the TS format file , and outputs such as a program information .}
|
14
|
-
spec.homepage = "https://github.com/nak1114/ariblib"
|
15
|
-
spec.license = "MIT"
|
16
|
-
|
17
|
-
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
-
# delete this section to allow pushing this gem to any host.
|
19
|
-
#if spec.respond_to?(:metadata)
|
20
|
-
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
-
#else
|
22
|
-
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
-
#end
|
24
|
-
|
25
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
-
spec.bindir = "exe"
|
27
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
-
spec.require_paths = ["lib"]
|
29
|
-
|
30
|
-
spec.add_development_dependency "bundler", "~> 1.11"
|
31
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ariblib/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ariblib"
|
8
|
+
spec.version = Ariblib::VERSION
|
9
|
+
spec.authors = ["nak1114"]
|
10
|
+
spec.email = ["naktak1114@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Implementation of ARIB STD B10}
|
13
|
+
spec.description = %q{It reads the TS format file , and outputs such as a program information .}
|
14
|
+
spec.homepage = "https://github.com/nak1114/ariblib"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
#if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
#else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
#end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
33
|
+
end
|
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "ariblib"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ariblib"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -euo pipefail
|
3
|
-
IFS=$'\n\t'
|
4
|
-
set -vx
|
5
|
-
|
6
|
-
bundle install
|
7
|
-
|
8
|
-
# Do any other automated setup that you need to do here
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
set -vx
|
5
|
+
|
6
|
+
bundle install
|
7
|
+
|
8
|
+
# Do any other automated setup that you need to do here
|
data/lib/ariblib.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#! ruby
|
2
|
-
# -*- encoding: utf-8 -*-
|
3
|
-
|
4
|
-
require "ariblib/version"
|
5
|
-
require "ariblib/BitStream"
|
6
|
-
require "ariblib/String"
|
7
|
-
require "ariblib/Descriptor"
|
8
|
-
require "ariblib/ProgramSpecificInformation"
|
9
|
-
require "ariblib/EventInformationTable"
|
10
|
-
require "ariblib/TransportStreamFile"
|
11
|
-
|
12
|
-
module Ariblib
|
13
|
-
# Your code goes here...
|
14
|
-
end
|
1
|
+
#! ruby
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
|
4
|
+
require "ariblib/version"
|
5
|
+
require "ariblib/BitStream"
|
6
|
+
require "ariblib/String"
|
7
|
+
require "ariblib/Descriptor"
|
8
|
+
require "ariblib/ProgramSpecificInformation"
|
9
|
+
require "ariblib/EventInformationTable"
|
10
|
+
require "ariblib/TransportStreamFile"
|
11
|
+
|
12
|
+
module Ariblib
|
13
|
+
# Your code goes here...
|
14
|
+
end
|
data/lib/ariblib/BitStream.rb
CHANGED
@@ -1,68 +1,68 @@
|
|
1
|
-
#! ruby
|
2
|
-
# -*- encoding: utf-8 -*-
|
3
|
-
|
4
|
-
module Ariblib
|
5
|
-
|
6
|
-
#ビットストリーム
|
7
|
-
class BitStream
|
8
|
-
def initialize(buf)
|
9
|
-
@bitstream_buffer=buf
|
10
|
-
@bitstream_postion=0
|
11
|
-
end
|
12
|
-
def str(byte)
|
13
|
-
ret=@bitstream_buffer.byteslice(@bitstream_postion/8,byte)
|
14
|
-
@bitstream_postion+=byte*8
|
15
|
-
ret
|
16
|
-
end
|
17
|
-
def getc
|
18
|
-
len=@bitstream_postion/8
|
19
|
-
@bitstream_postion+=8
|
20
|
-
ret =@bitstream_buffer.getbyte(len )
|
21
|
-
ret
|
22
|
-
end
|
23
|
-
def gets
|
24
|
-
len=@bitstream_postion/8
|
25
|
-
@bitstream_postion+=8*2
|
26
|
-
ret =@bitstream_buffer.getbyte(len ) << 8
|
27
|
-
ret|=@bitstream_buffer.getbyte(len+1)
|
28
|
-
ret
|
29
|
-
end
|
30
|
-
def get3
|
31
|
-
len=@bitstream_postion/8
|
32
|
-
@bitstream_postion+=8*3
|
33
|
-
ret =@bitstream_buffer.getbyte(len ) << 16
|
34
|
-
ret|=@bitstream_buffer.getbyte(len+1) << 8
|
35
|
-
ret|=@bitstream_buffer.getbyte(len+2)
|
36
|
-
ret
|
37
|
-
end
|
38
|
-
def read(size)
|
39
|
-
pos =@bitstream_postion>>3
|
40
|
-
modd=@bitstream_postion&0x07
|
41
|
-
@bitstream_postion+=size
|
42
|
-
mod =((~(@bitstream_postion)).succ)&0x07
|
43
|
-
poss=((size+modd+7)>>3)
|
44
|
-
tmp=0
|
45
|
-
poss.times do |i|
|
46
|
-
tmp<<=8
|
47
|
-
tmp|=@bitstream_buffer.getbyte(pos+i)
|
48
|
-
end
|
49
|
-
tmpd = (tmp>>mod) & ((1<<size)-1)
|
50
|
-
return tmpd
|
51
|
-
end
|
52
|
-
def lest
|
53
|
-
@bitstream_buffer.size*8-@bitstream_postion
|
54
|
-
end
|
55
|
-
def buf
|
56
|
-
@bitstream_buffer
|
57
|
-
end
|
58
|
-
def buf=(a)
|
59
|
-
@bitstream_buffer=a
|
60
|
-
end
|
61
|
-
def pos
|
62
|
-
@bitstream_postion
|
63
|
-
end
|
64
|
-
def pos=(a)
|
65
|
-
@bitstream_postion=a
|
66
|
-
end
|
67
|
-
end
|
1
|
+
#! ruby
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
|
4
|
+
module Ariblib
|
5
|
+
|
6
|
+
#ビットストリーム
|
7
|
+
class BitStream
|
8
|
+
def initialize(buf)
|
9
|
+
@bitstream_buffer=buf||("".encode("BINARY"))
|
10
|
+
@bitstream_postion=0
|
11
|
+
end
|
12
|
+
def str(byte)
|
13
|
+
ret=@bitstream_buffer.byteslice(@bitstream_postion/8,byte)
|
14
|
+
@bitstream_postion+=byte*8
|
15
|
+
ret
|
16
|
+
end
|
17
|
+
def getc
|
18
|
+
len=@bitstream_postion/8
|
19
|
+
@bitstream_postion+=8
|
20
|
+
ret =@bitstream_buffer.getbyte(len )
|
21
|
+
ret
|
22
|
+
end
|
23
|
+
def gets
|
24
|
+
len=@bitstream_postion/8
|
25
|
+
@bitstream_postion+=8*2
|
26
|
+
ret =@bitstream_buffer.getbyte(len ) << 8
|
27
|
+
ret|=@bitstream_buffer.getbyte(len+1)
|
28
|
+
ret
|
29
|
+
end
|
30
|
+
def get3
|
31
|
+
len=@bitstream_postion/8
|
32
|
+
@bitstream_postion+=8*3
|
33
|
+
ret =@bitstream_buffer.getbyte(len ) << 16
|
34
|
+
ret|=@bitstream_buffer.getbyte(len+1) << 8
|
35
|
+
ret|=@bitstream_buffer.getbyte(len+2)
|
36
|
+
ret
|
37
|
+
end
|
38
|
+
def read(size)
|
39
|
+
pos =@bitstream_postion>>3
|
40
|
+
modd=@bitstream_postion&0x07
|
41
|
+
@bitstream_postion+=size
|
42
|
+
mod =((~(@bitstream_postion)).succ)&0x07
|
43
|
+
poss=((size+modd+7)>>3)
|
44
|
+
tmp=0
|
45
|
+
poss.times do |i|
|
46
|
+
tmp<<=8
|
47
|
+
tmp|=@bitstream_buffer.getbyte(pos+i)
|
48
|
+
end
|
49
|
+
tmpd = (tmp>>mod) & ((1<<size)-1)
|
50
|
+
return tmpd
|
51
|
+
end
|
52
|
+
def lest
|
53
|
+
@bitstream_buffer.size*8-@bitstream_postion
|
54
|
+
end
|
55
|
+
def buf
|
56
|
+
@bitstream_buffer
|
57
|
+
end
|
58
|
+
def buf=(a)
|
59
|
+
@bitstream_buffer=a
|
60
|
+
end
|
61
|
+
def pos
|
62
|
+
@bitstream_postion
|
63
|
+
end
|
64
|
+
def pos=(a)
|
65
|
+
@bitstream_postion=a
|
66
|
+
end
|
67
|
+
end
|
68
68
|
end
|