Astra: first contact
The application turned out to be quite functional, unlike sasc-ng, dvbloopback was not required to be installed, it worked stably with the DRE-Crypt and Irdeto conditional access systems.
About a year ago, there was a need to develop a replacement for getstream. The main reason is that the getstream architecture did not allow adding new functionality with ease. Even updating existing code was a lot of trouble. The new project is called Astra.
The project turned out to be very successful, the modular architecture in combination with Lua allows you to create flexible configurations and perform various actions while the application is running.
Astra's core can be used as a framework for developing various applications. The core includes:
- event handling. Currently supports epoll, kqueue and poll
- work with network sockets
- timer (works by interrupting the event handler)
- module initialization
- logging
- Lua
The functionality of the final application is determined by a set of modules and protocols (a set of functions describing the interaction between modules).
In the future, I plan to separate the Astra core into a separate project; at the moment, development is going on only within the IPTV framework. Astra in functionality can completely replace getstream_a84 and even more.
The main advantages of Asters over the hetstream:
- modularity
- less CPU load
- works stably
- great opportunities in control, configuration, management
- convenient to develop new functionality
A small demonstration of the capabilities of Astra - broadcasting on the network, with DVB, several channels:
#!/usr/bin/env astra
require "base"
cam_1 = newcamd({
name = "Reader:0.01",
host = "card-server.local", port = "40001",
username = "user", password = "****",
key = "0102030405060708091011121314",
})
dvb_1 = {
adapter = 1, type = "S2",
tp = "12149:h:27500",
lnb = "10750:10750:10750"
}
s1 = make_stream({ name = "Stream 1", dvb = dvb_1 }, {
{ name = "Channel 1", pnr = 23150, cam = cam_1, addr = "239.255.1.1", analyze = true },
{ name = "Channel 2", pnr = 23010, cam = cam_1, addr = "239.255.1.2", analyze = true },
})
All logic is described in Lua scripts. The example uses the make_stream function (connected from require “base”), it loads the modules with the necessary parameters, establishes a connection between them. The instances of loaded modules are saved in a table for later use (plus, if the module instance is not assigned a variable, the garbage collector will unload it).
For example, you can add statistics output via the web interface (http: // server: 8000 /):
function stat_cb(self, data)
if type(data) == 'table' then
local dvb_stat = s1.dvb:status()
local html = "Stat "
html = html .. "DVB adapter:" .. s1.config.dvb.adapter ..
" lock:" .. tostring(dvb_stat.lock) ..
" signal:" .. tostring(dvb_stat.signal) .. "%" ..
" snr:" .. tostring(dvb_stat.snr) .. "%\n"
for _,ch in pairs(s1.channels) do
local ch_stat = ch.analyze:status()
html = html .. " " .. ch.config.name .. "" ..
" ready:" .. tostring(ch_stat.ready) ..
" bitrate:" .. tostring(ch_stat.bitrate) ..
" scrambled:" .. tostring(ch_stat.scrambled) ..
"\n"
end
html = html .. ""
self:send({
code = 200,
message = "OK",
headers = {
"Server: Astra " .. astra.version(),
"Content-Type: text/html; charset=utf-8",
"Content-Length: " .. #html,
"Connection: close"
},
content = html
})
end
end
stat = http_server({ port = 8000, callback = stat_cb })
The project is for the most part Open-source.
Source code and documentation: https://bitbucket.org/cesbo/astra
Forum: http://cesbo.com/forum