GNU Radio's RTP Package
source.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2026 Franco Venturi.
4 *
5 * based on:
6 * - pcmcat in ka9q-radio
7 * - wavfile_source block in GNU Radio
8 *
9 * SPDX-License-Identifier: GPL-3.0-or-later
10 */
11
12#ifndef INCLUDED_RTP_SOURCE_H
13#define INCLUDED_RTP_SOURCE_H
14
15#include <gnuradio/rtp/api.h>
16#include <gnuradio/sync_block.h>
17
18namespace gr {
19namespace rtp {
20
21/*!
22 * \brief Read stream from an RTP PCM stream, output gr_complex or interleaved shorts
23 * \ingroup rtp
24 *
25 * \details
26 * Unless otherwise called, values are within [-1;1].
27 * Check gr_make_rtp_source() for extra info.
28 */
29template <class T>
30class RTP_API source : virtual public gr::sync_block
31{
32public:
33 // gr::rtp:source::sptr
34 typedef std::shared_ptr<source<T>> sptr;
35
36 static sptr make(const std::string& mcast_address,
37 unsigned int ssrc,
38 int in_channels=1,
39 int out_channels=1,
40 bool quiet=false);
41
42 /*!
43 * \brief Return the number of bits per sample.
44 * the RTP stream.
45 */
46 virtual int get_bits_per_sample() const = 0;
47
48 /*!
49 * \brief Return the number of input channels.
50 */
51 virtual int get_channels() const = 0;
52
53 /*!
54 * Set SSRC
55 *
56 * \param ssrc new SSRC
57 */
58 virtual void set_ssrc(unsigned int ssrc) = 0;
59
60 /*!
61 * Get SSRC
62 *
63 * \return current SSRC
64 */
65 virtual unsigned int get_ssrc() const = 0;
66};
67
68} // namespace rtp
69} // namespace gr
70
71#endif /* INCLUDED_RTP_SOURCE_H */
#define RTP_API
Definition api.h:19
Read stream from an RTP PCM stream, output gr_complex or interleaved shorts.
Definition source.h:31
virtual void set_ssrc(unsigned int ssrc)=0
virtual int get_channels() const =0
Return the number of input channels.
std::shared_ptr< source< T > > sptr
Definition source.h:34
virtual unsigned int get_ssrc() const =0
virtual int get_bits_per_sample() const =0
Return the number of bits per sample. the RTP stream.
static sptr make(const std::string &mcast_address, unsigned int ssrc, int in_channels=1, int out_channels=1, bool quiet=false)
Definition source.h:19
Definition source.h:18