Warning: This is a development version. The latest stable version is Version 4.0.0.

Code Example: Hello World

This simple example can be used for checking whether your build system has been successfully setup to use the otacast library.

 1#!/usr/bin/env python
 2# encoding: utf-8
 3
 4"""A simple hello world example."""
 5
 6# License for Commercial Usage
 7# Distributed under the "OTACAST EVALUATION LICENSE 1.3"
 8# Licensees holding a valid commercial license may use this project in
 9# accordance with the standard license agreement terms provided with the
10# Software (see accompanying file LICENSE.rst or
11# https://www.steinwurf.com/license), unless otherwise different terms and
12# conditions are agreed in writing between Licensee and Steinwurf ApS in which
13# case the license will be regulated by that separate written agreement.
14# License for Non-Commercial Usage
15# Distributed under the "OTACAST RESEARCH LICENSE 1.2"
16# Licensees holding a valid research license may use this project in accordance
17# with the license agreement terms provided with the Software
18# See accompanying file LICENSE.rst or https://www.steinwurf.com/license
19
20import otacast
21
22
23def main():
24    # Print the version of the library used
25    print(otacast.__version__)
26
27    # Create the encoder object with a specific finite field
28    encoder = otacast.Encoder()
29
30    block_bytes = 1024 * 1000  # 1 MB
31    symbol_bytes = 1500
32    width = otacast.CodecWidth._32
33
34    encoder.configure(width, block_bytes, symbol_bytes)
35
36    print("block_bytes:  {}".format(encoder.block_bytes))
37    print("symbol_bytes: {}".format(encoder.symbol_bytes))
38    print("width:        {}".format(encoder.width))
39    print("symbols       {}".format(encoder.symbols))
40
41
42if __name__ == "__main__":
43    main()
Versions
4.0.0
3.2.0
3.1.0
3.0.0
2.0.0
1.0.1
Development
latest