aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: b0e77b2c5356a599148eb3fa37ab18a3a57739b5 (plain)
1
2
3
4
5
# libavirt

Application interface library for the Linux [AVIRT](https://github.com/fiberdyne/avirt) driver.

Simplifies configuring AVIRT via configfs, including adding streams, and sealing the AVIRT card.
ring.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * A standalone AM/FM Radio QML plugin (for RTL2832U and Maxim hardware)
 * Copyright © 2015-2016 Manuel Bachmann <manuel.bachmann@iot.bzh>
 * Copyright © 2016 Scott Murray <scott.murray@konsulko.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef RADIO_OUTPUT_H
#define RADIO_OUTPUT_H

#include <alsa/asoundlib.h>

#include <pulse/simple.h>
#include <pulse/error.h>

 /*
  * RadioOutputImplementation is a virtual class, with 2 implementations :
  * - RadioOutputAlsa ;
  * - RadioOutputPulse ;
  */
class RadioOutputImplementation
{
public:
	RadioOutputImplementation() {};
	virtual ~RadioOutputImplementation() {};

	virtual bool play(void*, int) = 0;

	bool works;
};


class RadioOutputAlsa : public RadioOutputImplementation
{
public:
	RadioOutputAlsa();
	~RadioOutputAlsa() override;

private:
	bool play(void *, int) override;

	snd_pcm_t *dev;
	snd_pcm_hw_params_t *hw_params;
};

class RadioOutputPulse : public RadioOutputImplementation
{
public:
	RadioOutputPulse();
	~RadioOutputPulse() override;

private:
	bool play(void *, int) override;

	pa_simple *pa;
	pa_sample_spec *pa_spec;

	unsigned int extra;
	int16_t extra_buf[1];
	unsigned char *output_buf;
};

#endif  // RTLSDR_RADIO_H