librtmp 0.1.3 → 0.1.4
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.
- data/CHANGELOG.md +5 -0
- data/lib/librtmp/ffi/amf.rb +7 -7
- data/lib/librtmp/ffi/rtmp.rb +3 -1
- data/lib/librtmp/streamer.rb +8 -10
- data/lib/librtmp/version.rb +1 -1
- metadata +12 -6
data/CHANGELOG.md
CHANGED
data/lib/librtmp/ffi/amf.rb
CHANGED
@@ -86,13 +86,13 @@ module Librtmp
|
|
86
86
|
# void AMF_DecodeLongString(const char *data, AVal * str);
|
87
87
|
# int AMF_DecodeBoolean(const char *data);
|
88
88
|
# double AMF_DecodeNumber(const char *data);
|
89
|
-
attach_function :AMF_DecodeInt16, [:
|
90
|
-
attach_function :AMF_DecodeInt24, [:
|
91
|
-
attach_function :AMF_DecodeInt32, [:
|
92
|
-
attach_function :AMF_DecodeString, [:
|
93
|
-
attach_function :AMF_DecodeLongString, [:
|
94
|
-
attach_function :AMF_DecodeBoolean, [:
|
95
|
-
attach_function :AMF_DecodeNumber, [:
|
89
|
+
attach_function :AMF_DecodeInt16, [:pointer], :ushort
|
90
|
+
attach_function :AMF_DecodeInt24, [:pointer], :uint
|
91
|
+
attach_function :AMF_DecodeInt32, [:pointer], :uint
|
92
|
+
attach_function :AMF_DecodeString, [:pointer, AVal], :void
|
93
|
+
attach_function :AMF_DecodeLongString, [:pointer, AVal], :void
|
94
|
+
attach_function :AMF_DecodeBoolean, [:pointer], :int
|
95
|
+
attach_function :AMF_DecodeNumber, [:pointer], :double
|
96
96
|
|
97
97
|
# char *AMF_Encode(AMFObject * obj, char *pBuffer, char *pBufEnd);
|
98
98
|
# int AMF_Decode(AMFObject * obj, const char *pBuffer, int nSize, int bDecodeName);
|
data/lib/librtmp/ffi/rtmp.rb
CHANGED
@@ -24,7 +24,7 @@ module Librtmp
|
|
24
24
|
:m_packetType, :uint8,
|
25
25
|
:m_hasAbsTimestamp, :uint8,
|
26
26
|
:m_nChannel, :int,
|
27
|
-
:
|
27
|
+
:m_nTimeStamp, :uint32,
|
28
28
|
:m_nInfoField2, :int32,
|
29
29
|
:m_nBodySize, :uint32,
|
30
30
|
:m_nBytesRead, :uint32,
|
@@ -169,6 +169,8 @@ module Librtmp
|
|
169
169
|
:Link, RTMP_LNK
|
170
170
|
end
|
171
171
|
|
172
|
+
attach_function :RTMP_GetTime, [], :uint32
|
173
|
+
|
172
174
|
attach_function :RTMPPacket_Reset, [RTMPPacket], :void
|
173
175
|
attach_function :RTMPPacket_Dump, [RTMPPacket], :void
|
174
176
|
attach_function :RTMPPacket_Alloc, [RTMPPacket, :int], :int
|
data/lib/librtmp/streamer.rb
CHANGED
@@ -35,15 +35,9 @@ module Librtmp
|
|
35
35
|
return if data.nil? || data == ''
|
36
36
|
|
37
37
|
if data.is_a?(Hash)
|
38
|
-
|
39
|
-
|
40
|
-
FFI::
|
41
|
-
#FFI::RTMP_FreePacket(packet.pointer)
|
42
|
-
else
|
43
|
-
data_buffer = ::FFI::MemoryPointer.new(:char, data.size)
|
44
|
-
data_buffer.put_bytes(0, data)
|
45
|
-
|
46
|
-
FFI::RTMP_Write(@session_ptr, data_buffer, data.size)
|
38
|
+
send_metadata_packet(data)
|
39
|
+
elsif is_flv?(data)
|
40
|
+
FFI::RTMP_Write(@session_ptr, data, data.size)
|
47
41
|
end
|
48
42
|
end
|
49
43
|
|
@@ -65,7 +59,7 @@ module Librtmp
|
|
65
59
|
@session = FFI::RTMP.new @session_ptr
|
66
60
|
end
|
67
61
|
|
68
|
-
def
|
62
|
+
def send_metadata_packet(data)
|
69
63
|
packet = FFI::RTMPPacket.new
|
70
64
|
amf_object = FFI::AMFObject.new
|
71
65
|
amf_object_ptr = amf_object.pointer
|
@@ -99,5 +93,9 @@ module Librtmp
|
|
99
93
|
|
100
94
|
packet
|
101
95
|
end
|
96
|
+
|
97
|
+
def is_flv?(data)
|
98
|
+
data[0..2] == 'FLV'
|
99
|
+
end
|
102
100
|
end
|
103
101
|
end
|
data/lib/librtmp/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: librtmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70300117544840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70300117544840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: ffi
|
27
|
-
requirement: &
|
27
|
+
requirement: &70300117544380 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70300117544380
|
36
36
|
description: Provides a wrapper for the librtmp library in Ruby to allow use of the
|
37
37
|
RTMP streaming protocols
|
38
38
|
email:
|
@@ -67,12 +67,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
67
|
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
hash: 4153078302273606918
|
70
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
74
|
none: false
|
72
75
|
requirements:
|
73
76
|
- - ! '>='
|
74
77
|
- !ruby/object:Gem::Version
|
75
78
|
version: '0'
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
hash: 4153078302273606918
|
76
82
|
requirements: []
|
77
83
|
rubyforge_project: librtmp
|
78
84
|
rubygems_version: 1.8.12
|