📜 ⬆️ ⬇️

Astra: first contact

Initially, a bunch of sasc-ng (decryption of closed channels) and getstream (remultiplexing and broadcasting in is) on servers and several satellite receivers were used for IPTV broadcasting. About two years ago, he began working on getstream, the main goal was to replace expensive receivers and remove unstable sasc-ng. Over time, this project became known as getstream_a84 (a84 - it was the name of my account at bitbucket.org, from which it stuck).
The application turned out to be fully functional, in contrast to sasc-ng, no dvbloopback installation was required, it worked stably with 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 the refinement of the existing code posed many problems. The new project is called Astra.

The project was a very successful, modular architecture in combination with Lua allows you to create flexible configurations and perform various actions while the application is running.
Aster core can be used as a framework for developing various applications. The core includes:


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 the development is only within the framework of IPTV. Astra in terms of functionality can completely replace getstream_a84 and even more.
The main advantages of the Astra over the getstream:


A small demonstration of Aster's capabilities - broadcasting to the network, from 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 (connects from require “base”), it loads modules with the necessary parameters, establishes a connection between them. Instances of loaded modules are saved to 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 = "<html><head><title>Stat</title></head><body><pre>" html = html .. "<b>DVB</b> 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 .. " <b>" .. ch.config.name .. "</b>" .. " ready:" .. tostring(ch_stat.ready) .. " bitrate:" .. tostring(ch_stat.bitrate) .. " scrambled:" .. tostring(ch_stat.scrambled) .. "\n" end html = html .. "</pre></body></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 mostly Open-source.
Source code and documentation: https://bitbucket.org/cesbo/astra
Forum: http://cesbo.com/forum

Source: https://habr.com/ru/post/149479/


All Articles